WT1.1.2h getProperty fix

This commit is contained in:
bossanyit 2020-11-20 13:31:26 +01:00
parent d984588567
commit 3ce32434bf
16 changed files with 149 additions and 122 deletions

View File

@ -215,8 +215,8 @@
"More »": "Részletek »", "More »": "Részletek »",
"Done": "Kész", "Done": "Kész",
"Height":"Magasság", "Height":"Magasság",
"Actual Height":"Akt. magasság", "Actual Height":"Magasság",
"Actual Weight":"Aktuális tömeg", "Actual Weight":"Tömeg",
"Based on your weight and height your goal for BMI and weight:":"A jelenlegi tömeged és magasságod alapján kiszámoltuk, hogy mennyi legyen a célod a BMI (testtömegindex) és tömeg elérésben:", "Based on your weight and height your goal for BMI and weight:":"A jelenlegi tömeged és magasságod alapján kiszámoltuk, hogy mennyi legyen a célod a BMI (testtömegindex) és tömeg elérésben:",
"Body Mass Index":"Testtömegindex", "Body Mass Index":"Testtömegindex",
"Basal Metabolic Rate":"Alapanyagcsere érték", "Basal Metabolic Rate":"Alapanyagcsere érték",

View File

@ -16,6 +16,9 @@ PODS:
- FirebaseAuth (~> 6.5.3) - FirebaseAuth (~> 6.5.3)
- Firebase/CoreOnly (6.26.0): - Firebase/CoreOnly (6.26.0):
- FirebaseCore (= 6.7.2) - FirebaseCore (= 6.7.2)
- Firebase/Messaging (6.26.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.4.1)
- firebase_auth (0.18.1-2): - firebase_auth (0.18.1-2):
- Firebase/Auth (~> 6.26.0) - Firebase/Auth (~> 6.26.0)
- Firebase/CoreOnly (~> 6.26.0) - Firebase/CoreOnly (~> 6.26.0)
@ -24,6 +27,12 @@ PODS:
- firebase_core (0.5.0-1): - firebase_core (0.5.0-1):
- Firebase/CoreOnly (~> 6.26.0) - Firebase/CoreOnly (~> 6.26.0)
- Flutter - Flutter
- firebase_messaging (7.0.3):
- Firebase/CoreOnly (~> 6.26.0)
- Firebase/Messaging (~> 6.26.0)
- firebase_core
- Flutter
- FirebaseAnalyticsInterop (1.5.0)
- FirebaseAuth (6.5.3): - FirebaseAuth (6.5.3):
- FirebaseAuthInterop (~> 1.0) - FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 6.6) - FirebaseCore (~> 6.6)
@ -42,6 +51,25 @@ PODS:
- GoogleUtilities/Logger (~> 6.5) - GoogleUtilities/Logger (~> 6.5)
- nanopb (~> 1.30905.0) - nanopb (~> 1.30905.0)
- FirebaseCoreDiagnosticsInterop (1.2.0) - FirebaseCoreDiagnosticsInterop (1.2.0)
- FirebaseInstallations (1.3.0):
- FirebaseCore (~> 6.6)
- GoogleUtilities/Environment (~> 6.6)
- GoogleUtilities/UserDefaults (~> 6.6)
- PromisesObjC (~> 1.2)
- FirebaseInstanceID (4.3.4):
- FirebaseCore (~> 6.6)
- FirebaseInstallations (~> 1.0)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/UserDefaults (~> 6.5)
- FirebaseMessaging (4.4.1):
- FirebaseAnalyticsInterop (~> 1.5)
- FirebaseCore (~> 6.6)
- FirebaseInstanceID (~> 4.3)
- GoogleUtilities/AppDelegateSwizzler (~> 6.5)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Reachability (~> 6.5)
- GoogleUtilities/UserDefaults (~> 6.5)
- Protobuf (>= 3.9.2, ~> 3.9)
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_facebook_auth (0.3.1): - flutter_facebook_auth (0.3.1):
- FBSDKCoreKit (~> 7.1.0) - FBSDKCoreKit (~> 7.1.0)
@ -68,6 +96,8 @@ PODS:
- "GoogleUtilities/NSData+zlib (6.6.0)" - "GoogleUtilities/NSData+zlib (6.6.0)"
- GoogleUtilities/Reachability (6.6.0): - GoogleUtilities/Reachability (6.6.0):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.6.0):
- GoogleUtilities/Logger
- GTMSessionFetcher/Core (1.4.0) - GTMSessionFetcher/Core (1.4.0)
- nanopb (1.30905.0): - nanopb (1.30905.0):
- nanopb/decode (= 1.30905.0) - nanopb/decode (= 1.30905.0)
@ -77,6 +107,7 @@ PODS:
- path_provider (0.0.1): - path_provider (0.0.1):
- Flutter - Flutter
- PromisesObjC (1.2.11) - PromisesObjC (1.2.11)
- Protobuf (3.13.0)
- shared_preferences (0.0.1): - shared_preferences (0.0.1):
- Flutter - Flutter
@ -84,6 +115,7 @@ DEPENDENCIES:
- devicelocale (from `.symlinks/plugins/devicelocale/ios`) - devicelocale (from `.symlinks/plugins/devicelocale/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`) - flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
@ -95,17 +127,22 @@ SPEC REPOS:
- FBSDKCoreKit - FBSDKCoreKit
- FBSDKLoginKit - FBSDKLoginKit
- Firebase - Firebase
- FirebaseAnalyticsInterop
- FirebaseAuth - FirebaseAuth
- FirebaseAuthInterop - FirebaseAuthInterop
- FirebaseCore - FirebaseCore
- FirebaseCoreDiagnostics - FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop - FirebaseCoreDiagnosticsInterop
- FirebaseInstallations
- FirebaseInstanceID
- FirebaseMessaging
- GoogleDataTransport - GoogleDataTransport
- GoogleDataTransportCCTSupport - GoogleDataTransportCCTSupport
- GoogleUtilities - GoogleUtilities
- GTMSessionFetcher - GTMSessionFetcher
- nanopb - nanopb
- PromisesObjC - PromisesObjC
- Protobuf
EXTERNAL SOURCES: EXTERNAL SOURCES:
devicelocale: devicelocale:
@ -114,6 +151,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_auth/ios" :path: ".symlinks/plugins/firebase_auth/ios"
firebase_core: firebase_core:
:path: ".symlinks/plugins/firebase_core/ios" :path: ".symlinks/plugins/firebase_core/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_facebook_auth: flutter_facebook_auth:
@ -132,11 +171,16 @@ SPEC CHECKSUMS:
Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6 Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6
firebase_auth: 8ae6798925da84bf8745668a73c936b148c1b04d firebase_auth: 8ae6798925da84bf8745668a73c936b148c1b04d
firebase_core: 00e54a4744164a6b5a250b96dd1ad5afaba7a342 firebase_core: 00e54a4744164a6b5a250b96dd1ad5afaba7a342
firebase_messaging: 666d9994651b1ecf8c582b52dd913f3fa58c17ef
FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae
FirebaseAuth: 7047aec89c0b17ecd924a550c853f0c27ac6015e FirebaseAuth: 7047aec89c0b17ecd924a550c853f0c27ac6015e
FirebaseAuthInterop: a0f37ae05833af156e72028f648d313f7e7592e9 FirebaseAuthInterop: a0f37ae05833af156e72028f648d313f7e7592e9
FirebaseCore: f42e5e5f382cdcf6b617ed737bf6c871a6947b17 FirebaseCore: f42e5e5f382cdcf6b617ed737bf6c871a6947b17
FirebaseCoreDiagnostics: 4505e4d4009b1d93f605088ee7d7764d5f0d1c84 FirebaseCoreDiagnostics: 4505e4d4009b1d93f605088ee7d7764d5f0d1c84
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850 FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
FirebaseInstallations: 6f5f680e65dc374397a483c32d1799ba822a395b
FirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b
FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_facebook_auth: 85c86b1f574faa5eaacd6de0db6b416fa94b326c flutter_facebook_auth: 85c86b1f574faa5eaacd6de0db6b416fa94b326c
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
@ -147,6 +191,7 @@ SPEC CHECKSUMS:
nanopb: c43f40fadfe79e8b8db116583945847910cbabc9 nanopb: c43f40fadfe79e8b8db116583945847910cbabc9
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

View File

@ -177,7 +177,7 @@
}; };
}; };
}; };
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */;
compatibilityVersion = "Xcode 10.0"; compatibilityVersion = "Xcode 10.0";
developmentRegion = en; developmentRegion = en;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 30; CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 30; CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 30; CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -570,7 +570,7 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
97C147031CF9000F007C117D /* Debug */, 97C147031CF9000F007C117D /* Debug */,

View File

@ -2,9 +2,12 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:/Users/tiborbossanyi/Development/projects/workouttest/aitrainer_app/ios/ .xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
location = "group:Pods/Pods.xcodeproj"> location = "group:Pods/Pods.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace> </Workspace>

View File

@ -1,6 +1,6 @@
import UIKit import UIKit
import Flutter import Flutter
//import Firebase import Firebase
@UIApplicationMain @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
@ -8,7 +8,7 @@ import Flutter
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
//FirebaseApp.configure() FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }

View File

@ -66,5 +66,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
</dict> </dict>
</plist> </plist>

View File

@ -4,6 +4,7 @@ import 'package:aitrainer_app/repository/exercise_repository.dart';
import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/service/exercise_tree_service.dart'; import 'package:aitrainer_app/service/exercise_tree_service.dart';
import 'package:aitrainer_app/service/exercisetype_service.dart'; import 'package:aitrainer_app/service/exercisetype_service.dart';
import 'package:aitrainer_app/service/property_service.dart';
import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/common.dart';
import 'package:flutter_form_bloc/flutter_form_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart';
@ -16,18 +17,12 @@ class LoginFormBloc extends FormBloc<String, String> with Common {
FieldBlocValidators.required, FieldBlocValidators.required,
], ],
); );
final passwordField = TextFieldBloc( final passwordField = TextFieldBloc(validators: [
validators: [
FieldBlocValidators.required, FieldBlocValidators.required,
] ]);
);
LoginFormBloc({this.userRepository, this.accountBloc}) { LoginFormBloc({this.userRepository, this.accountBloc}) {
addFieldBlocs(fieldBlocs: [ addFieldBlocs(fieldBlocs: [emailField, passwordField]);
emailField,
passwordField
]);
emailField.onValueChanges(onData: (previous, current) async* { emailField.onValueChanges(onData: (previous, current) async* {
userRepository.setEmail(current.value); userRepository.setEmail(current.value);
@ -36,26 +31,26 @@ class LoginFormBloc extends FormBloc<String, String> with Common {
passwordField.onValueChanges(onData: (previous, current) async* { passwordField.onValueChanges(onData: (previous, current) async* {
userRepository.setPassword(current.value); userRepository.setPassword(current.value);
}); });
} }
@override @override
void onSubmitting() async { void onSubmitting() async {
try { try {
emitLoading(progress: 30); emitLoading(progress: 30);
if ( ! validateEmail(userRepository)) { if (!validateEmail(userRepository)) {
emailField.addFieldError(EMAIL_ERROR, isPermanent: true); emailField.addFieldError(EMAIL_ERROR, isPermanent: true);
emitFailure(failureResponse: EMAIL_ERROR); emitFailure(failureResponse: EMAIL_ERROR);
} else if ( ! validatePassword(userRepository)) { } else if (!validatePassword(userRepository)) {
passwordField.addFieldError( PASSWORD_ERROR, isPermanent: true); passwordField.addFieldError(PASSWORD_ERROR, isPermanent: true);
emitFailure(failureResponse: PASSWORD_ERROR); emitFailure(failureResponse: PASSWORD_ERROR);
} else { } else {
// Emit either Loaded or Error // Emit either Loaded or Error
await PropertyApi().getProperties();
await userRepository.getUser(); await userRepository.getUser();
await ExerciseTypeApi().getExerciseTypes(); await ExerciseTypeApi().getExerciseTypes();
await ExerciseTreeApi().getExerciseTree(); await ExerciseTreeApi().getExerciseTree();
if ( Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) { if (Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
ExerciseRepository exerciseRepository = ExerciseRepository(); ExerciseRepository exerciseRepository = ExerciseRepository();
await exerciseRepository.getExercisesByCustomer(Cache().userLoggedIn.customerId); await exerciseRepository.getExercisesByCustomer(Cache().userLoggedIn.customerId);
} }
@ -64,7 +59,6 @@ class LoginFormBloc extends FormBloc<String, String> with Common {
} }
} on Exception catch (ex) { } on Exception catch (ex) {
emitFailure(failureResponse: ex.toString()); emitFailure(failureResponse: ex.toString());
} }
} }
} }

View File

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:aitrainer_app/push_notifications.dart';
import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/repository/customer_repository.dart';
import 'package:aitrainer_app/repository/workout_tree_repository.dart'; import 'package:aitrainer_app/repository/workout_tree_repository.dart';
import 'package:aitrainer_app/util/session.dart'; import 'package:aitrainer_app/util/session.dart';
@ -113,14 +114,13 @@ Future<Null> main() async {
// - https://www.dartlang.org/articles/libraries/zones // - https://www.dartlang.org/articles/libraries/zones
runZonedGuarded<Future<Null>>(() async { runZonedGuarded<Future<Null>>(() async {
final WorkoutTreeRepository menuTreeRepository = WorkoutTreeRepository(); final WorkoutTreeRepository menuTreeRepository = WorkoutTreeRepository();
runApp( runApp(MultiBlocProvider(
MultiBlocProvider(
providers: [ providers: [
BlocProvider<SessionBloc>( BlocProvider<SessionBloc>(
create: (BuildContext context) => SessionBloc(session: Session()), create: (BuildContext context) => SessionBloc(session: Session()),
), ),
BlocProvider<MenuBloc>( BlocProvider<MenuBloc>(
create: (BuildContext context) => MenuBloc( menuTreeRepository: menuTreeRepository), create: (BuildContext context) => MenuBloc(menuTreeRepository: menuTreeRepository),
), ),
BlocProvider<SettingsBloc>( BlocProvider<SettingsBloc>(
create: (BuildContext context) => SettingsBloc(), create: (BuildContext context) => SettingsBloc(),
@ -132,34 +132,28 @@ Future<Null> main() async {
create: (BuildContext context) => ExercisePlanBloc(menuTreeRepository: menuTreeRepository), create: (BuildContext context) => ExercisePlanBloc(menuTreeRepository: menuTreeRepository),
), ),
BlocProvider<ExerciseExecutePlanBloc>( BlocProvider<ExerciseExecutePlanBloc>(
create: (BuildContext context) => ExerciseExecutePlanBloc( create: (BuildContext context) => ExerciseExecutePlanBloc(menuTreeRepository: menuTreeRepository),
menuTreeRepository: menuTreeRepository),
), ),
BlocProvider<DevelopmentByMuscleBloc>( BlocProvider<DevelopmentByMuscleBloc>(
create: (BuildContext context) => DevelopmentByMuscleBloc( create: (BuildContext context) => DevelopmentByMuscleBloc(workoutTreeRepository: menuTreeRepository),
workoutTreeRepository: menuTreeRepository),
), ),
BlocProvider<BodyDevelopmentBloc>( BlocProvider<BodyDevelopmentBloc>(
create: (BuildContext context) => BodyDevelopmentBloc( create: (BuildContext context) => BodyDevelopmentBloc(workoutTreeRepository: menuTreeRepository),
workoutTreeRepository: menuTreeRepository),
), ),
], ],
child: AitrainerApp(), child: AitrainerApp(),
) ));
);
}, (error, stackTrace) async { }, (error, stackTrace) async {
await _reportError(error, stackTrace); await _reportError(error, stackTrace);
}); });
} }
class AitrainerApp extends StatelessWidget { class AitrainerApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
//final FirebaseAnalytics analytics = FirebaseAnalytics(); //final FirebaseAnalytics analytics = FirebaseAnalytics();
PushNotificationsManager().init();
return MaterialApp( return MaterialApp(
localizationsDelegates: [ localizationsDelegates: [
// ... app-specific localization delegate[s] here // ... app-specific localization delegate[s] here
@ -178,12 +172,11 @@ class AitrainerApp extends StatelessWidget {
// but you should check whether the localization is supported by your app // but you should check whether the localization is supported by your app
Locale realSupportedLocale = Locale('en', "US"); Locale realSupportedLocale = Locale('en', "US");
supportedLocales.forEach((supportedLocale) { supportedLocales.forEach((supportedLocale) {
if ( locale != null && supportedLocale != null && if (locale != null && supportedLocale != null && supportedLocale.countryCode == locale.countryCode) {
supportedLocale.countryCode == locale.countryCode ) {
realSupportedLocale = supportedLocale; realSupportedLocale = supportedLocale;
} }
}); });
if ( locale != null && realSupportedLocale.countryCode != locale.countryCode ) { if (locale != null && realSupportedLocale.countryCode != locale.countryCode) {
//print ("Locale " + locale.countryCode + " not supported on this device :("); //print ("Locale " + locale.countryCode + " not supported on this device :(");
} }
return realSupportedLocale; return realSupportedLocale;
@ -224,16 +217,11 @@ class AitrainerApp extends StatelessWidget {
//fontFamily: 'Arial', //fontFamily: 'Arial',
textTheme: TextTheme( textTheme: TextTheme(
bodyText1: GoogleFonts.openSans(textStyle: TextStyle(fontSize: 14.0)), bodyText1: GoogleFonts.openSans(textStyle: TextStyle(fontSize: 14.0)),
) )),
),
navigatorObservers: [ navigatorObservers: [
//FirebaseAnalyticsObserver(analytics: analytics), //FirebaseAnalyticsObserver(analytics: analytics),
], ],
home: AitrainerHome(), home: AitrainerHome(),
); );
} }
} }

View File

@ -1,7 +1,6 @@
/*import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
class PushNotificationsManager { class PushNotificationsManager {
PushNotificationsManager._(); PushNotificationsManager._();
factory PushNotificationsManager() => _instance; factory PushNotificationsManager() => _instance;
@ -25,5 +24,3 @@ class PushNotificationsManager {
} }
} }
} }
*/

View File

@ -15,7 +15,7 @@ class Antagonist {
static String biceps = "Biceps"; static String biceps = "Biceps";
static int bicepsNr = 2; static int bicepsNr = 2;
static String triceps = "Triceps"; static String triceps = "Triceps";
static int tricepsNr =3; static int tricepsNr = 3;
static String back = "Back"; static String back = "Back";
static int backNr = 4; static int backNr = 4;
static String shoulder = "Shoulders"; static String shoulder = "Shoulders";
@ -44,30 +44,29 @@ class WorkoutTreeRepository {
Antagonist.calf: Antagonist.calfNr Antagonist.calf: Antagonist.calfNr
}; };
Future<void> createTree() async { Future<void> createTree() async {
isEnglish = AppLanguage().appLocal == Locale('en'); isEnglish = AppLanguage().appLocal == Locale('en');
print("** Start creating tree on lang: " + AppLanguage().appLocal.languageCode); print("** Start creating tree on lang: " + AppLanguage().appLocal.languageCode);
List<ExerciseTree> exerciseTree = Cache().getExerciseTree(); List<ExerciseTree> exerciseTree = Cache().getExerciseTree();
if ( exerciseTree == null || exerciseTree.length == 0) { if (exerciseTree == null || exerciseTree.length == 0) {
await ExerciseTreeApi().getExerciseTree(); await ExerciseTreeApi().getExerciseTree();
} }
exerciseTree.forEach( (treeItem) async { exerciseTree.forEach((treeItem) async {
String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation; String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation;
String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7); String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7);
bool is1RM = treeItem.name == 'One Rep Max' ? true : false; bool is1RM = treeItem.name == 'One Rep Max' ? true : false;
if ( is1RM == false && treeItem.parentId != 0) { if (is1RM == false && treeItem.parentId != 0) {
is1RM = isParent1RM(treeItem.parentId); is1RM = isParent1RM(treeItem.parentId);
} }
this.tree[treeItem.name] = WorkoutMenuTree( this.tree[treeItem.name] = WorkoutMenuTree(
treeItem.treeId, treeItem.treeId,
treeItem.parentId, treeItem.parentId,
treeName, treeName,
assetImage, Colors.white, assetImage,
24, Colors.white,
20,
false, false,
0, 0,
null, null,
@ -78,30 +77,17 @@ class WorkoutTreeRepository {
}); });
List<ExerciseType> exerciseTypes = Cache().getExerciseTypes(); List<ExerciseType> exerciseTypes = Cache().getExerciseTypes();
if ( exerciseTypes == null || exerciseTypes.length == 0) { if (exerciseTypes == null || exerciseTypes.length == 0) {
await ExerciseTypeApi().getExerciseTypes(); await ExerciseTypeApi().getExerciseTypes();
} }
exerciseTypes.forEach( (exerciseType) { exerciseTypes.forEach((exerciseType) {
String exerciseTypeName = isEnglish ? String exerciseTypeName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
exerciseType.name : exerciseType.nameTranslation;
String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7); String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7);
bool is1RM = this.isParent1RM(exerciseType.treeId); bool is1RM = this.isParent1RM(exerciseType.treeId);
exerciseType.is1RM = is1RM; exerciseType.is1RM = is1RM;
this.tree[exerciseType.name] = WorkoutMenuTree( this.tree[exerciseType.name] = WorkoutMenuTree(exerciseType.exerciseTypeId, exerciseType.treeId, exerciseTypeName, assetImage,
exerciseType.exerciseTypeId, Colors.white, 16, true, exerciseType.exerciseTypeId, exerciseType, exerciseType.base, is1RM, exerciseType.name);
exerciseType.treeId,
exerciseTypeName,
assetImage,
Colors.white,
16,
true,
exerciseType.exerciseTypeId,
exerciseType,
exerciseType.base,
is1RM,
exerciseType.name
);
}); });
Cache().setWorkoutMenuTree(tree); Cache().setWorkoutMenuTree(tree);
@ -114,11 +100,10 @@ class WorkoutTreeRepository {
this.tree.forEach((key, value) { this.tree.forEach((key, value) {
WorkoutMenuTree treeItem = value as WorkoutMenuTree; WorkoutMenuTree treeItem = value as WorkoutMenuTree;
if ( treeItem.id == treeId ) { if (treeItem.id == treeId) {
isTreeItem1RM = treeItem.is1RM; isTreeItem1RM = treeItem.is1RM;
//print (treeItem.name + " 1RM " + treeItem.is1RM.toString() ); //print (treeItem.name + " 1RM " + treeItem.is1RM.toString() );
} }
}); });
return isTreeItem1RM; return isTreeItem1RM;
@ -128,7 +113,7 @@ class WorkoutTreeRepository {
LinkedHashMap branch = LinkedHashMap<String, WorkoutMenuTree>(); LinkedHashMap branch = LinkedHashMap<String, WorkoutMenuTree>();
tree.forEach((key, value) { tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree; WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
if ( parent == workoutTree.parent) { if (parent == workoutTree.parent) {
branch[key] = value; branch[key] = value;
} }
}); });
@ -139,7 +124,7 @@ class WorkoutTreeRepository {
List branch = List<WorkoutMenuTree>(); List branch = List<WorkoutMenuTree>();
tree.forEach((key, value) { tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree; WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
if ( parent == workoutTree.parent) { if (parent == workoutTree.parent) {
branch.add(workoutTree); branch.add(workoutTree);
} }
}); });
@ -150,7 +135,7 @@ class WorkoutTreeRepository {
WorkoutMenuTree parentItem; WorkoutMenuTree parentItem;
tree.forEach((key, value) { tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree; WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
if ( parent == workoutTree.id) { if (parent == workoutTree.id) {
parentItem = workoutTree; parentItem = workoutTree;
} }
}); });
@ -161,7 +146,7 @@ class WorkoutTreeRepository {
sortedTree = SplayTreeMap<String, List<WorkoutMenuTree>>(); sortedTree = SplayTreeMap<String, List<WorkoutMenuTree>>();
tree.forEach((key, value) { tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree; WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
if ( workoutTree.nameEnglish != 'One Rep Max' && workoutTree.is1RM && workoutTree.exerciseTypeId == 0) { if (workoutTree.nameEnglish != 'One Rep Max' && workoutTree.is1RM && workoutTree.exerciseTypeId == 0) {
String treeName = _antagonist[workoutTree.nameEnglish].toString() + ". " + workoutTree.name; String treeName = _antagonist[workoutTree.nameEnglish].toString() + ". " + workoutTree.name;
sortedTree[treeName] = this.getBranchList(workoutTree.id); sortedTree[treeName] = this.getBranchList(workoutTree.id);
} }
@ -174,11 +159,10 @@ class WorkoutTreeRepository {
int missingId = 0; int missingId = 0;
tree.forEach((key, value) { tree.forEach((key, value) {
WorkoutMenuTree item = value as WorkoutMenuTree; WorkoutMenuTree item = value as WorkoutMenuTree;
if ( item.name == name || name == item.nameEnglish ) { if (item.name == name || name == item.nameEnglish) {
missingId = item.id; missingId = item.id;
} }
}); });
return missingId; return missingId;
} }
} }

View File

@ -72,10 +72,12 @@ class CustomerApi {
Customer customer; Customer customer;
try { try {
customer = Customer.fromJson(jsonDecode(responseBody)); customer = Customer.fromJson(jsonDecode(responseBody));
if (customer.firebaseUid == null) { /* if (customer.firebaseUid == null) {
await this.updateFirebaseUid(customer.customerId, Cache().firebaseUid); await this.updateFirebaseUid(customer.customerId, Cache().firebaseUid);
} } */
Cache().userLoggedIn = customer; Cache().userLoggedIn = customer;
final List properties = await this.getActualProperties(customer.customerId);
this._initProperties(properties);
} on FormatException { } on FormatException {
throw new Exception(responseBody); throw new Exception(responseBody);
} }
@ -164,6 +166,9 @@ class CustomerApi {
final Iterable json = jsonDecode(body); final Iterable json = jsonDecode(body);
final List<CustomerProperty> properties = json.map((property) => CustomerProperty.fromJson(property)).toList(); final List<CustomerProperty> properties = json.map((property) => CustomerProperty.fromJson(property)).toList();
properties.forEach((element) {
print("Property " + element.toString());
});
return properties; return properties;
} }

View File

@ -73,6 +73,7 @@ class Session {
prefs.setString(Cache.authTokenKey, responseJson['token']); prefs.setString(Cache.authTokenKey, responseJson['token']);
Cache().authToken = responseJson['token']; Cache().authToken = responseJson['token'];
Cache().firebaseUid = prefs.get(Cache.firebaseUidKey); Cache().firebaseUid = prefs.get(Cache.firebaseUidKey);
await PropertyApi().getProperties();
if (prefs.get(Cache.customerIdKey) == null) { if (prefs.get(Cache.customerIdKey) == null) {
print("************** Registration"); print("************** Registration");
// registration // registration
@ -97,7 +98,6 @@ class Session {
} else { } else {
// get API customer // get API customer
customerId = prefs.getInt(Cache.customerIdKey); customerId = prefs.getInt(Cache.customerIdKey);
await PropertyApi().getProperties();
await CustomerApi().getCustomer(customerId); await CustomerApi().getCustomer(customerId);
Cache().startPage = "home"; Cache().startPage = "home";
} }

View File

@ -1,5 +1,6 @@
import 'package:aitrainer_app/bloc/account/account_bloc.dart'; import 'package:aitrainer_app/bloc/account/account_bloc.dart';
import 'package:aitrainer_app/localization/app_language.dart'; import 'package:aitrainer_app/localization/app_language.dart';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/customer.dart'; import 'package:aitrainer_app/model/customer.dart';
import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart';
@ -66,7 +67,7 @@ class AccountPage extends StatelessWidget with Trans {
textColor: Colors.grey, textColor: Colors.grey,
color: Colors.white, color: Colors.white,
onPressed: () => { onPressed: () => {
if (accountBloc.customerRepository.customer != null) if (accountBloc.customerRepository.customer != null && Cache().userLoggedIn != null)
{ {
Navigator.of(context).pushNamed('customerModifyPage'), Navigator.of(context).pushNamed('customerModifyPage'),
} }

View File

@ -250,7 +250,7 @@ class CustomerModifyPage extends StatelessWidget with Trans {
), ),
Divider(), Divider(),
ToggleSwitch( ToggleSwitch(
minWidth: 50.0, minWidth: 80.0,
minHeight: 50.0, minHeight: 50.0,
fontSize: 14.0, fontSize: 14.0,
initialLabelIndex: customerBloc.customerRepository.customer.sex == "m" ? 0 : 1, initialLabelIndex: customerBloc.customerRepository.customer.sex == "m" ? 0 : 1,

View File

@ -295,6 +295,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.1" version: "0.2.1"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.3"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:

View File

@ -44,6 +44,7 @@ dependencies:
firebase_core: 0.5.0+1 firebase_core: 0.5.0+1
#firebase_analytics: ^6.0.2 #firebase_analytics: ^6.0.2
firebase_messaging: ^7.0.3
firebase_auth: ^0.18.1+2 firebase_auth: ^0.18.1+2
flutter_facebook_auth: ^0.3.3 flutter_facebook_auth: ^0.3.3
animated_widgets: ^1.0.6 animated_widgets: ^1.0.6