diff --git a/i18n/hu.json b/i18n/hu.json
index 7b0f319..db6faad 100644
--- a/i18n/hu.json
+++ b/i18n/hu.json
@@ -215,8 +215,8 @@
"More »": "Részletek »",
"Done": "Kész",
"Height":"Magasság",
- "Actual Height":"Akt. magasság",
- "Actual Weight":"Aktuális tömeg",
+ "Actual Height":"Magasság",
+ "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:",
"Body Mass Index":"Testtömegindex",
"Basal Metabolic Rate":"Alapanyagcsere érték",
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index ec7eeb7..12a98eb 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -16,6 +16,9 @@ PODS:
- FirebaseAuth (~> 6.5.3)
- Firebase/CoreOnly (6.26.0):
- FirebaseCore (= 6.7.2)
+ - Firebase/Messaging (6.26.0):
+ - Firebase/CoreOnly
+ - FirebaseMessaging (~> 4.4.1)
- firebase_auth (0.18.1-2):
- Firebase/Auth (~> 6.26.0)
- Firebase/CoreOnly (~> 6.26.0)
@@ -24,6 +27,12 @@ PODS:
- firebase_core (0.5.0-1):
- Firebase/CoreOnly (~> 6.26.0)
- 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):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 6.6)
@@ -42,6 +51,25 @@ PODS:
- GoogleUtilities/Logger (~> 6.5)
- nanopb (~> 1.30905.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_facebook_auth (0.3.1):
- FBSDKCoreKit (~> 7.1.0)
@@ -68,6 +96,8 @@ PODS:
- "GoogleUtilities/NSData+zlib (6.6.0)"
- GoogleUtilities/Reachability (6.6.0):
- GoogleUtilities/Logger
+ - GoogleUtilities/UserDefaults (6.6.0):
+ - GoogleUtilities/Logger
- GTMSessionFetcher/Core (1.4.0)
- nanopb (1.30905.0):
- nanopb/decode (= 1.30905.0)
@@ -77,6 +107,7 @@ PODS:
- path_provider (0.0.1):
- Flutter
- PromisesObjC (1.2.11)
+ - Protobuf (3.13.0)
- shared_preferences (0.0.1):
- Flutter
@@ -84,6 +115,7 @@ DEPENDENCIES:
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
+ - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
@@ -95,17 +127,22 @@ SPEC REPOS:
- FBSDKCoreKit
- FBSDKLoginKit
- Firebase
+ - FirebaseAnalyticsInterop
- FirebaseAuth
- FirebaseAuthInterop
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop
+ - FirebaseInstallations
+ - FirebaseInstanceID
+ - FirebaseMessaging
- GoogleDataTransport
- GoogleDataTransportCCTSupport
- GoogleUtilities
- GTMSessionFetcher
- nanopb
- PromisesObjC
+ - Protobuf
EXTERNAL SOURCES:
devicelocale:
@@ -114,6 +151,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
+ firebase_messaging:
+ :path: ".symlinks/plugins/firebase_messaging/ios"
Flutter:
:path: Flutter
flutter_facebook_auth:
@@ -132,11 +171,16 @@ SPEC CHECKSUMS:
Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6
firebase_auth: 8ae6798925da84bf8745668a73c936b148c1b04d
firebase_core: 00e54a4744164a6b5a250b96dd1ad5afaba7a342
+ firebase_messaging: 666d9994651b1ecf8c582b52dd913f3fa58c17ef
+ FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae
FirebaseAuth: 7047aec89c0b17ecd924a550c853f0c27ac6015e
FirebaseAuthInterop: a0f37ae05833af156e72028f648d313f7e7592e9
FirebaseCore: f42e5e5f382cdcf6b617ed737bf6c871a6947b17
FirebaseCoreDiagnostics: 4505e4d4009b1d93f605088ee7d7764d5f0d1c84
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
+ FirebaseInstallations: 6f5f680e65dc374397a483c32d1799ba822a395b
+ FirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b
+ FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_facebook_auth: 85c86b1f574faa5eaacd6de0db6b416fa94b326c
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
@@ -147,6 +191,7 @@ SPEC CHECKSUMS:
nanopb: c43f40fadfe79e8b8db116583945847910cbabc9
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
+ Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index e4ac9f4..93b447e 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -177,7 +177,7 @@
};
};
};
- buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
@@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 30;
+ CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 30;
+ CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 30;
+ CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -570,7 +570,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata
index 21a3cc1..af6bf0f 100644
--- a/ios/Runner.xcworkspace/contents.xcworkspacedata
+++ b/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -2,9 +2,12 @@
+ location = "group:/Users/tiborbossanyi/Development/projects/workouttest/aitrainer_app/ios/ .xcodeproj">
+
+
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index 3e982cf..b0bb7f3 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -1,6 +1,6 @@
import UIKit
import Flutter
-//import Firebase
+import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@@ -8,7 +8,7 @@ import Flutter
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
- //FirebaseApp.configure()
+ FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 9476437..beb9209 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -66,5 +66,7 @@
UIViewControllerBasedStatusBarAppearance
+ FirebaseAppDelegateProxyEnabled
+ NO
diff --git a/lib/bloc/login_form_bloc.dart b/lib/bloc/login_form_bloc.dart
index 8f7f357..78254ec 100644
--- a/lib/bloc/login_form_bloc.dart
+++ b/lib/bloc/login_form_bloc.dart
@@ -4,6 +4,7 @@ import 'package:aitrainer_app/repository/exercise_repository.dart';
import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/service/exercise_tree_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:flutter_form_bloc/flutter_form_bloc.dart';
@@ -16,19 +17,13 @@ class LoginFormBloc extends FormBloc with Common {
FieldBlocValidators.required,
],
);
- final passwordField = TextFieldBloc(
- validators: [
- FieldBlocValidators.required,
- ]
- );
-
+ final passwordField = TextFieldBloc(validators: [
+ FieldBlocValidators.required,
+ ]);
LoginFormBloc({this.userRepository, this.accountBloc}) {
- addFieldBlocs(fieldBlocs: [
- emailField,
- passwordField
- ]);
-
+ addFieldBlocs(fieldBlocs: [emailField, passwordField]);
+
emailField.onValueChanges(onData: (previous, current) async* {
userRepository.setEmail(current.value);
});
@@ -36,26 +31,26 @@ class LoginFormBloc extends FormBloc with Common {
passwordField.onValueChanges(onData: (previous, current) async* {
userRepository.setPassword(current.value);
});
-
}
@override
void onSubmitting() async {
try {
emitLoading(progress: 30);
- if ( ! validateEmail(userRepository)) {
+ if (!validateEmail(userRepository)) {
emailField.addFieldError(EMAIL_ERROR, isPermanent: true);
emitFailure(failureResponse: EMAIL_ERROR);
- } else if ( ! validatePassword(userRepository)) {
- passwordField.addFieldError( PASSWORD_ERROR, isPermanent: true);
+ } else if (!validatePassword(userRepository)) {
+ passwordField.addFieldError(PASSWORD_ERROR, isPermanent: true);
emitFailure(failureResponse: PASSWORD_ERROR);
} else {
// Emit either Loaded or Error
+ await PropertyApi().getProperties();
await userRepository.getUser();
await ExerciseTypeApi().getExerciseTypes();
await ExerciseTreeApi().getExerciseTree();
- if ( Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
+ if (Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
ExerciseRepository exerciseRepository = ExerciseRepository();
await exerciseRepository.getExercisesByCustomer(Cache().userLoggedIn.customerId);
}
@@ -64,7 +59,6 @@ class LoginFormBloc extends FormBloc with Common {
}
} on Exception catch (ex) {
emitFailure(failureResponse: ex.toString());
-
}
}
}
diff --git a/lib/main.dart b/lib/main.dart
index d5d9677..079c703 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'package:aitrainer_app/push_notifications.dart';
import 'package:aitrainer_app/repository/customer_repository.dart';
import 'package:aitrainer_app/repository/workout_tree_repository.dart';
import 'package:aitrainer_app/util/session.dart';
@@ -113,53 +114,46 @@ Future main() async {
// - https://www.dartlang.org/articles/libraries/zones
runZonedGuarded>(() async {
final WorkoutTreeRepository menuTreeRepository = WorkoutTreeRepository();
- runApp(
- MultiBlocProvider(
- providers: [
- BlocProvider(
- create: (BuildContext context) => SessionBloc(session: Session()),
- ),
- BlocProvider(
- create: (BuildContext context) => MenuBloc( menuTreeRepository: menuTreeRepository),
- ),
- BlocProvider(
- create: (BuildContext context) => SettingsBloc(),
- ),
- BlocProvider(
- create: (BuildContext context) => AccountBloc(customerRepository: CustomerRepository()),
- ),
- BlocProvider(
- create: (BuildContext context) => ExercisePlanBloc(menuTreeRepository: menuTreeRepository),
- ),
- BlocProvider(
- create: (BuildContext context) => ExerciseExecutePlanBloc(
- menuTreeRepository: menuTreeRepository),
- ),
- BlocProvider(
- create: (BuildContext context) => DevelopmentByMuscleBloc(
- workoutTreeRepository: menuTreeRepository),
- ),
- BlocProvider(
- create: (BuildContext context) => BodyDevelopmentBloc(
- workoutTreeRepository: menuTreeRepository),
- ),
- ],
-
- child: AitrainerApp(),
- )
- );
+ runApp(MultiBlocProvider(
+ providers: [
+ BlocProvider(
+ create: (BuildContext context) => SessionBloc(session: Session()),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => MenuBloc(menuTreeRepository: menuTreeRepository),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => SettingsBloc(),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => AccountBloc(customerRepository: CustomerRepository()),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => ExercisePlanBloc(menuTreeRepository: menuTreeRepository),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => ExerciseExecutePlanBloc(menuTreeRepository: menuTreeRepository),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => DevelopmentByMuscleBloc(workoutTreeRepository: menuTreeRepository),
+ ),
+ BlocProvider(
+ create: (BuildContext context) => BodyDevelopmentBloc(workoutTreeRepository: menuTreeRepository),
+ ),
+ ],
+ child: AitrainerApp(),
+ ));
}, (error, stackTrace) async {
await _reportError(error, stackTrace);
});
}
-
class AitrainerApp extends StatelessWidget {
-
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
//final FirebaseAnalytics analytics = FirebaseAnalytics();
+ PushNotificationsManager().init();
return MaterialApp(
localizationsDelegates: [
// ... 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
Locale realSupportedLocale = Locale('en', "US");
supportedLocales.forEach((supportedLocale) {
- if ( locale != null && supportedLocale != null &&
- supportedLocale.countryCode == locale.countryCode ) {
+ if (locale != null && supportedLocale != null && supportedLocale.countryCode == locale.countryCode) {
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 :(");
}
return realSupportedLocale;
@@ -219,21 +212,16 @@ class AitrainerApp extends StatelessWidget {
initialRoute: 'home',
title: 'WorkoutTest',
theme: ThemeData(
- brightness: Brightness.light,
- //primarySwatch: Colors.transparent,
- //fontFamily: 'Arial',
- textTheme: TextTheme(
- bodyText1: GoogleFonts.openSans(textStyle: TextStyle(fontSize: 14.0)),
- )
- ),
+ brightness: Brightness.light,
+ //primarySwatch: Colors.transparent,
+ //fontFamily: 'Arial',
+ textTheme: TextTheme(
+ bodyText1: GoogleFonts.openSans(textStyle: TextStyle(fontSize: 14.0)),
+ )),
navigatorObservers: [
//FirebaseAnalyticsObserver(analytics: analytics),
],
home: AitrainerHome(),
-
);
}
}
-
-
-
diff --git a/lib/push_notifications.dart b/lib/push_notifications.dart
index b25d135..6ef1fb6 100644
--- a/lib/push_notifications.dart
+++ b/lib/push_notifications.dart
@@ -1,7 +1,6 @@
-/*import 'package:firebase_messaging/firebase_messaging.dart';
+import 'package:firebase_messaging/firebase_messaging.dart';
class PushNotificationsManager {
-
PushNotificationsManager._();
factory PushNotificationsManager() => _instance;
@@ -25,5 +24,3 @@ class PushNotificationsManager {
}
}
}
-
-*/
diff --git a/lib/repository/workout_tree_repository.dart b/lib/repository/workout_tree_repository.dart
index 5d76220..4b67040 100644
--- a/lib/repository/workout_tree_repository.dart
+++ b/lib/repository/workout_tree_repository.dart
@@ -15,7 +15,7 @@ class Antagonist {
static String biceps = "Biceps";
static int bicepsNr = 2;
static String triceps = "Triceps";
- static int tricepsNr =3;
+ static int tricepsNr = 3;
static String back = "Back";
static int backNr = 4;
static String shoulder = "Shoulders";
@@ -44,30 +44,29 @@ class WorkoutTreeRepository {
Antagonist.calf: Antagonist.calfNr
};
-
Future createTree() async {
-
isEnglish = AppLanguage().appLocal == Locale('en');
print("** Start creating tree on lang: " + AppLanguage().appLocal.languageCode);
List exerciseTree = Cache().getExerciseTree();
- if ( exerciseTree == null || exerciseTree.length == 0) {
+ if (exerciseTree == null || exerciseTree.length == 0) {
await ExerciseTreeApi().getExerciseTree();
}
- exerciseTree.forEach( (treeItem) async {
+ exerciseTree.forEach((treeItem) async {
String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation;
String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7);
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);
}
this.tree[treeItem.name] = WorkoutMenuTree(
treeItem.treeId,
treeItem.parentId,
treeName,
- assetImage, Colors.white,
- 24,
+ assetImage,
+ Colors.white,
+ 20,
false,
0,
null,
@@ -78,30 +77,17 @@ class WorkoutTreeRepository {
});
List exerciseTypes = Cache().getExerciseTypes();
- if ( exerciseTypes == null || exerciseTypes.length == 0) {
+ if (exerciseTypes == null || exerciseTypes.length == 0) {
await ExerciseTypeApi().getExerciseTypes();
}
- exerciseTypes.forEach( (exerciseType) {
- String exerciseTypeName = isEnglish ?
- exerciseType.name : exerciseType.nameTranslation;
+ exerciseTypes.forEach((exerciseType) {
+ String exerciseTypeName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7);
bool is1RM = this.isParent1RM(exerciseType.treeId);
exerciseType.is1RM = is1RM;
- this.tree[exerciseType.name] = WorkoutMenuTree(
- exerciseType.exerciseTypeId,
- exerciseType.treeId,
- exerciseTypeName,
- assetImage,
- Colors.white,
- 16,
- true,
- exerciseType.exerciseTypeId,
- exerciseType,
- exerciseType.base,
- is1RM,
- exerciseType.name
- );
+ this.tree[exerciseType.name] = WorkoutMenuTree(exerciseType.exerciseTypeId, exerciseType.treeId, exerciseTypeName, assetImage,
+ Colors.white, 16, true, exerciseType.exerciseTypeId, exerciseType, exerciseType.base, is1RM, exerciseType.name);
});
Cache().setWorkoutMenuTree(tree);
@@ -114,11 +100,10 @@ class WorkoutTreeRepository {
this.tree.forEach((key, value) {
WorkoutMenuTree treeItem = value as WorkoutMenuTree;
- if ( treeItem.id == treeId ) {
+ if (treeItem.id == treeId) {
isTreeItem1RM = treeItem.is1RM;
//print (treeItem.name + " 1RM " + treeItem.is1RM.toString() );
}
-
});
return isTreeItem1RM;
@@ -128,7 +113,7 @@ class WorkoutTreeRepository {
LinkedHashMap branch = LinkedHashMap();
tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
- if ( parent == workoutTree.parent) {
+ if (parent == workoutTree.parent) {
branch[key] = value;
}
});
@@ -139,7 +124,7 @@ class WorkoutTreeRepository {
List branch = List();
tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
- if ( parent == workoutTree.parent) {
+ if (parent == workoutTree.parent) {
branch.add(workoutTree);
}
});
@@ -150,7 +135,7 @@ class WorkoutTreeRepository {
WorkoutMenuTree parentItem;
tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
- if ( parent == workoutTree.id) {
+ if (parent == workoutTree.id) {
parentItem = workoutTree;
}
});
@@ -161,7 +146,7 @@ class WorkoutTreeRepository {
sortedTree = SplayTreeMap>();
tree.forEach((key, value) {
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;
sortedTree[treeName] = this.getBranchList(workoutTree.id);
}
@@ -174,11 +159,10 @@ class WorkoutTreeRepository {
int missingId = 0;
tree.forEach((key, value) {
WorkoutMenuTree item = value as WorkoutMenuTree;
- if ( item.name == name || name == item.nameEnglish ) {
+ if (item.name == name || name == item.nameEnglish) {
missingId = item.id;
}
});
return missingId;
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/service/customer_service.dart b/lib/service/customer_service.dart
index 453fd3b..11a1caf 100644
--- a/lib/service/customer_service.dart
+++ b/lib/service/customer_service.dart
@@ -72,10 +72,12 @@ class CustomerApi {
Customer customer;
try {
customer = Customer.fromJson(jsonDecode(responseBody));
- if (customer.firebaseUid == null) {
+ /* if (customer.firebaseUid == null) {
await this.updateFirebaseUid(customer.customerId, Cache().firebaseUid);
- }
+ } */
Cache().userLoggedIn = customer;
+ final List properties = await this.getActualProperties(customer.customerId);
+ this._initProperties(properties);
} on FormatException {
throw new Exception(responseBody);
}
@@ -164,6 +166,9 @@ class CustomerApi {
final Iterable json = jsonDecode(body);
final List properties = json.map((property) => CustomerProperty.fromJson(property)).toList();
+ properties.forEach((element) {
+ print("Property " + element.toString());
+ });
return properties;
}
diff --git a/lib/util/session.dart b/lib/util/session.dart
index f35fc5f..30de85c 100644
--- a/lib/util/session.dart
+++ b/lib/util/session.dart
@@ -73,6 +73,7 @@ class Session {
prefs.setString(Cache.authTokenKey, responseJson['token']);
Cache().authToken = responseJson['token'];
Cache().firebaseUid = prefs.get(Cache.firebaseUidKey);
+ await PropertyApi().getProperties();
if (prefs.get(Cache.customerIdKey) == null) {
print("************** Registration");
// registration
@@ -97,7 +98,6 @@ class Session {
} else {
// get API customer
customerId = prefs.getInt(Cache.customerIdKey);
- await PropertyApi().getProperties();
await CustomerApi().getCustomer(customerId);
Cache().startPage = "home";
}
diff --git a/lib/view/account.dart b/lib/view/account.dart
index 07529fc..c62bf18 100644
--- a/lib/view/account.dart
+++ b/lib/view/account.dart
@@ -1,5 +1,6 @@
import 'package:aitrainer_app/bloc/account/account_bloc.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/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart';
@@ -66,7 +67,7 @@ class AccountPage extends StatelessWidget with Trans {
textColor: Colors.grey,
color: Colors.white,
onPressed: () => {
- if (accountBloc.customerRepository.customer != null)
+ if (accountBloc.customerRepository.customer != null && Cache().userLoggedIn != null)
{
Navigator.of(context).pushNamed('customerModifyPage'),
}
diff --git a/lib/view/customer_modify_page.dart b/lib/view/customer_modify_page.dart
index 6a38d4f..f4b5e8c 100644
--- a/lib/view/customer_modify_page.dart
+++ b/lib/view/customer_modify_page.dart
@@ -250,7 +250,7 @@ class CustomerModifyPage extends StatelessWidget with Trans {
),
Divider(),
ToggleSwitch(
- minWidth: 50.0,
+ minWidth: 80.0,
minHeight: 50.0,
fontSize: 14.0,
initialLabelIndex: customerBloc.customerRepository.customer.sex == "m" ? 0 : 1,
diff --git a/pubspec.lock b/pubspec.lock
index 7ac4f7b..e60be0f 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -295,6 +295,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index a7e3df3..ae2cf60 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -44,6 +44,7 @@ dependencies:
firebase_core: 0.5.0+1
#firebase_analytics: ^6.0.2
+ firebase_messaging: ^7.0.3
firebase_auth: ^0.18.1+2
flutter_facebook_auth: ^0.3.3
animated_widgets: ^1.0.6