diff --git a/README.md b/README.md index d6b1352..4ca1901 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,5 @@ The WorkoutTest Mobile Application -live 1.1.5 +live 1.1.22 diff --git a/asset/menu/standing_calf_machine.jpg b/asset/menu/standing_calf_machine.jpg new file mode 100644 index 0000000..919c1a9 Binary files /dev/null and b/asset/menu/standing_calf_machine.jpg differ diff --git a/asset/menu/strength_endurance.jpg b/asset/menu/strength_endurance.jpg new file mode 100644 index 0000000..e070e41 Binary files /dev/null and b/asset/menu/strength_endurance.jpg differ diff --git a/i18n/en.json b/i18n/en.json index 305716b..29d0203 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -540,5 +540,6 @@ "If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free.": "If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free.", "Based on your initial data, we will generate the personalized training plan for you.": "Based on your initial data, we will generate the personalized training plan for you.", "No selected Training Plan": "No selected Training Plan", - "Min. 10 minutes": "Min. 10 minutes" + "Min. 10 minutes": "Min. 10 minutes", + "You want to skip really the entire exercise?": "You want to skip really the entire exercise?" } \ No newline at end of file diff --git a/i18n/hu.json b/i18n/hu.json index 3db4518..c2c6777 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -540,5 +540,6 @@ "If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free.": "Ha a 'Nem'-re kattintasz, használhatod az összes alapfunkciót, de elveszted a lehetőséget, hogy a prémium funkciókat ingyen kipróbáld.", "Based on your initial data, we will generate the personalized training plan for you.": "A megadott adataid alapján most személyre szabott edzéstervet generálunk neked.", "No selected Training Plan": "Nincs kiválasztott edzésterved", - "Min. 10 minutes": "Minimum 10 perc" + "Min. 10 minutes": "Minimum 10 perc", + "You want to skip really the entire exercise?": "Átugrod az egész gyakorlatot?" } \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index aff1598..317d6f1 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -405,7 +405,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.22; + MARKETING_VERSION = 1.1.23; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -548,7 +548,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.22; + MARKETING_VERSION = 1.1.23; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -583,7 +583,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.22; + MARKETING_VERSION = 1.1.23; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/bloc/exercise_new/exercise_new_bloc.dart b/lib/bloc/exercise_new/exercise_new_bloc.dart index 65a877b..64f433c 100644 --- a/lib/bloc/exercise_new/exercise_new_bloc.dart +++ b/lib/bloc/exercise_new/exercise_new_bloc.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:aitrainer_app/repository/mautic_repository.dart'; import 'package:intl/intl.dart'; +import 'package:aitrainer_app/main.dart'; import 'package:aitrainer_app/bloc/menu/menu_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; @@ -153,10 +154,13 @@ class ExerciseNewBloc extends Bloc with Logg yield ExerciseNewReady(); throw Exception("Please type in a real number"); } + exerciseRepository.end = DateTime.now(); await exerciseRepository.addExercise(); - MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); - await mauticRepository.sendMauticExercise(); + if (!isInDebugMode) { + MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); + await mauticRepository.sendMauticExercise(); + } // exerciseRepository.initExercise(); menuBloc.add(MenuTreeDown(parent: 0)); Cache().initBadges(); diff --git a/lib/bloc/menu/menu_bloc.dart b/lib/bloc/menu/menu_bloc.dart index 9c8ed10..0743d6d 100644 --- a/lib/bloc/menu/menu_bloc.dart +++ b/lib/bloc/menu/menu_bloc.dart @@ -1,7 +1,9 @@ import 'dart:async'; import 'dart:collection'; +import 'package:aitrainer_app/repository/mautic_repository.dart'; import 'package:intl/intl.dart'; +import 'package:aitrainer_app/main.dart'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/model/exercise_ability.dart'; import 'package:aitrainer_app/model/workout_menu_tree.dart'; @@ -129,6 +131,11 @@ class MenuBloc extends Bloc with Trans, Logging { Cache().hasPurchased = true; log("Trial mode on!"); Track().track(TrackingEvent.trial, eventValue: DateFormat('yyyy-MM-dd HH:mm:ss').format(start)); + + if (!isInDebugMode) { + MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); + await mauticRepository.sendMauticTrial(); + } } yield MenuReady(); } diff --git a/lib/bloc/test_set_new/test_set_new_bloc.dart b/lib/bloc/test_set_new/test_set_new_bloc.dart index d8a6f2d..545a264 100644 --- a/lib/bloc/test_set_new/test_set_new_bloc.dart +++ b/lib/bloc/test_set_new/test_set_new_bloc.dart @@ -1,5 +1,5 @@ import 'dart:async'; - +import 'package:aitrainer_app/main.dart'; import 'package:aitrainer_app/bloc/test_set_execute/test_set_execute_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/model/exercise_type.dart'; @@ -54,10 +54,12 @@ class TestSetNewBloc extends Bloc { await exerciseRepository.addExercise(); executeBloc.add( TestSetExecuteExerciseFinished(exerciseTypeId: exerciseType.exerciseTypeId, quantity: quantity, unitQuantity: unitQuantity)); - CustomerRepository customerRepository = CustomerRepository(); - customerRepository.customer = Cache().userLoggedIn; - MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); - await mauticRepository.sendMauticExercise(); + if (!isInDebugMode) { + CustomerRepository customerRepository = CustomerRepository(); + customerRepository.customer = Cache().userLoggedIn; + MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); + await mauticRepository.sendMauticExercise(); + } Track().track(TrackingEvent.test_set_new, eventValue: exerciseType.name); } diff --git a/lib/bloc/training_plan/training_plan_bloc.dart b/lib/bloc/training_plan/training_plan_bloc.dart index 2a5902f..3b98ef1 100644 --- a/lib/bloc/training_plan/training_plan_bloc.dart +++ b/lib/bloc/training_plan/training_plan_bloc.dart @@ -1,5 +1,5 @@ import 'dart:async'; - +import 'package:aitrainer_app/main.dart'; import 'package:aitrainer_app/bloc/menu/menu_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/model/customer_training_plan.dart'; @@ -123,6 +123,7 @@ class TrainingPlanBloc extends Bloc { // recalculate the weight to the original planned repeats for the next details if (exercise.unitQuantity != null && exercise.unitQuantity! > 0) { for (var nextDetail in _myPlan!.details) { + print("NextDetail detail: $nextDetail"); double weightFromPlan = trainingPlanRepository.getOriginalWeight(this.getMyPlan()!.trainingPlanId!, nextDetail); if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && nextDetail.weight == -2 && @@ -132,6 +133,9 @@ class TrainingPlanBloc extends Bloc { } else if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && weightFromPlan == -1 && nextDetail.set! > 1) { print("recalculating -1 ${event.detail.customerTrainingPlanDetailsId}"); nextDetail = trainingPlanRepository.recalculateDetailFixRepeats(_myPlan!.trainingPlanId!, nextDetail); + } else if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && nextDetail.weight == -1 && nextDetail.set! == 1) { + print("recalculating -1, set 1 ${event.detail.customerTrainingPlanDetailsId}"); + nextDetail = trainingPlanRepository.recalculateDetailFixRepeatsSet1(_myPlan!.trainingPlanId!, nextDetail, event.detail); } } } @@ -145,10 +149,12 @@ class TrainingPlanBloc extends Bloc { Cache().myTrainingPlan = _myPlan; await Cache().saveMyTrainingPlan(); } - CustomerRepository customerRepository = CustomerRepository(); - customerRepository.customer = Cache().userLoggedIn; - MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); - await mauticRepository.sendMauticExercise(); + if (!isInDebugMode) { + CustomerRepository customerRepository = CustomerRepository(); + customerRepository.customer = Cache().userLoggedIn; + MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); + await mauticRepository.sendMauticExercise(); + } Track().track(TrackingEvent.training_plan_execute, eventValue: event.detail.exerciseType!.name); if (isDayDone()) { @@ -166,6 +172,21 @@ class TrainingPlanBloc extends Bloc { } else { yield TrainingPlanReady(); } + } else if (event is TrainingPlanSkipEntireExercise) { + yield TrainingPlanLoading(); + List list = getAllDetailsSameExercise(event.detail); + list.forEach((element) { + if (!element.state.equalsTo(ExercisePlanDetailState.finished)) { + element.state = ExercisePlanDetailState.skipped; + } + Cache().myTrainingPlan = _myPlan; + }); + await Cache().saveMyTrainingPlan(); + if (isDayDone()) { + this.add(TrainingPlanFinishDay()); + } else { + yield TrainingPlanReady(); + } } else if (event is TrainingPlanFinishDay) { yield TrainingPlanLoading(); celebrating = true; @@ -545,7 +566,7 @@ class TrainingPlanBloc extends Bloc { break; } - if (prev != null && prev.exerciseTypeId != detail.exerciseTypeId && detail.state != ExercisePlanDetailState.extra) { + if (prev != null && prev.exerciseTypeId != detail.exerciseTypeId || detail.state == ExercisePlanDetailState.extra) { //print(" --- offset + 1"); indexInStart++; indexInProgress++; @@ -553,7 +574,7 @@ class TrainingPlanBloc extends Bloc { prev = detail; } int index = indexInStart > indexInProgress ? indexInStart : indexInProgress; - offset = (index) * 270; + offset = (index) * 300; print("Offset: $offset day: $day ($indexInStart, $indexInProgress)"); return offset; } @@ -707,7 +728,8 @@ class TrainingPlanBloc extends Bloc { bool allFinished = true; List list = getAllDetailsSameExercise(detail); for (var listDetail in list) { - allFinished = allFinished && listDetail.exercises.length >= listDetail.set!; + allFinished = + allFinished && (listDetail.exercises.length >= listDetail.set! || listDetail.state.equalsTo(ExercisePlanDetailState.skipped)); } return allFinished; } diff --git a/lib/bloc/training_plan/training_plan_event.dart b/lib/bloc/training_plan/training_plan_event.dart index 9d34c99..6d17338 100644 --- a/lib/bloc/training_plan/training_plan_event.dart +++ b/lib/bloc/training_plan/training_plan_event.dart @@ -83,6 +83,14 @@ class TrainingPlanSkipExercise extends TrainingPlanEvent { List get props => [detail]; } +class TrainingPlanSkipEntireExercise extends TrainingPlanEvent { + final CustomerTrainingPlanDetails detail; + const TrainingPlanSkipEntireExercise({required this.detail}); + + @override + List get props => [detail]; +} + class TrainingPlanAddExerciseType extends TrainingPlanEvent { const TrainingPlanAddExerciseType(); } diff --git a/lib/model/cache.dart b/lib/model/cache.dart index c936751..d314483 100644 --- a/lib/model/cache.dart +++ b/lib/model/cache.dart @@ -125,6 +125,7 @@ class Cache with Logging { AccessToken? accessTokenFacebook; Customer? userLoggedIn; String? firebaseUid; + String? firebaseMessageToken; LoginType? loginType; PackageInfo? packageInfo; @@ -699,6 +700,14 @@ class Cache with Logging { await isActivityDonePrefs(activity); }); + print("Firebase token save: $firebaseMessageToken"); + if (userLoggedIn!.firebaseRegToken == null && firebaseMessageToken != null) { + userLoggedIn!.firebaseRegToken = firebaseMessageToken; + CustomerRepository customerRepository = CustomerRepository(); + customerRepository.customer = userLoggedIn; + customerRepository.saveCustomer(); + } + await getMyTrainingPlan(); Cache().startPage = "home"; diff --git a/lib/model/customer.dart b/lib/model/customer.dart index df20a9c..ce30d85 100644 --- a/lib/model/customer.dart +++ b/lib/model/customer.dart @@ -26,6 +26,7 @@ class Customer { int? sportId; DateTime? syncedDate; DateTime? trialDate; + String? firebaseRegToken; LinkedHashMap properties = LinkedHashMap(); @@ -68,6 +69,7 @@ class Customer { this.trainer = json['trainer']; this.firebaseUid = json['firebaseUid']; + this.firebaseRegToken = json['firebaseRegToken']; this.dataPolicyAllowed = json['dataPolicyAllowed']; this.emailSubscription = json['emailSubscription']; @@ -100,6 +102,7 @@ class Customer { "sportId": this.sportId, "syncedDate": this.syncedDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(this.syncedDate!), "trialDate": this.trialDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(this.trialDate!), + "firebaseRegToken": this.firebaseRegToken, }; @override diff --git a/lib/model/mautic.dart b/lib/model/mautic.dart index a94180b..9ddc338 100644 --- a/lib/model/mautic.dart +++ b/lib/model/mautic.dart @@ -10,6 +10,7 @@ class Mautic { String? language; String? purchaseDate; String? exerciseDate; + String? trialDate; Map toJson() => { "formId": this.formId, @@ -31,10 +32,11 @@ class Mautic { form += this.fitnessLevel == null ? "" : "&mauticform[fitness_level]=${this.fitnessLevel}"; form += this.goal == null ? "" : "&mauticform[goal]=${this.goal}"; form += this.subscriptionDate == null ? "" : "&mauticform[subscribed]=${this.subscriptionDate}"; - form += this.databaseId == null ? "" : "&mauticform[database_id]=${this.databaseId}"; + form += this.databaseId == null ? "" : "&mauticform[databaseid]=${this.databaseId}"; form += this.language == null ? "" : "&mauticform[language]=${this.language}"; form += this.purchaseDate == null ? "" : "&mauticform[purchase_date]=${this.purchaseDate}"; form += this.exerciseDate == null ? "" : "&mauticform[last_exercise]=${this.exerciseDate}"; + form += this.trialDate == null ? "" : "&mauticform[trialdate]=${this.trialDate}"; return form; } diff --git a/lib/repository/mautic_repository.dart b/lib/repository/mautic_repository.dart index 9b20b8b..4a683db 100644 --- a/lib/repository/mautic_repository.dart +++ b/lib/repository/mautic_repository.dart @@ -71,6 +71,20 @@ class MauticRepository { return; } mautic.exerciseDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()); + mautic.databaseId = Cache().userLoggedIn!.customerId!; + + await MauticApi().sendMauticForm(mautic); + } + + Future sendMauticTrial() async { + Mautic mautic = Mautic(); + mautic.formId = 6; + mautic.email = customerRepository.customer!.email == null ? "" : customerRepository.customer!.email!; + if (mautic.email == null || mautic.email!.contains("privaterelay.appleid.com")) { + return; + } + mautic.trialDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()); + mautic.databaseId = Cache().userLoggedIn!.customerId!; await MauticApi().sendMauticForm(mautic); } diff --git a/lib/repository/training_plan_repository.dart b/lib/repository/training_plan_repository.dart index 0072069..33212e5 100644 --- a/lib/repository/training_plan_repository.dart +++ b/lib/repository/training_plan_repository.dart @@ -237,6 +237,22 @@ class TrainingPlanRepository { return detail; } + CustomerTrainingPlanDetails recalculateDetailFixRepeatsSet1( + int trainingPlanId, CustomerTrainingPlanDetails detail, CustomerTrainingPlanDetails detailWithData) { + TrainingPlan? plan = getTrainingPlanById(trainingPlanId); + if (plan == null) { + return detail; + } + int originalRepeats = getOriginalRepeats(trainingPlanId, detail); + + detail.weight = + Common.calculateWeigthByChangedQuantity(detailWithData.weight!, detailWithData.repeats!.toDouble(), originalRepeats.toDouble()); + detail.weight = Common.roundWeight(detail.weight!); + print("Recalculated weight: ${detail.weight}"); + detail.repeats = originalRepeats; + return detail; + } + CustomerTrainingPlanDetails recalculateDetail( int trainingPlanId, CustomerTrainingPlanDetails detail, CustomerTrainingPlanDetails nextDetail) { CustomerTrainingPlanDetails recalculatedDetail = nextDetail; @@ -277,15 +293,35 @@ class TrainingPlanRepository { if (Cache().userLoggedIn!.goal == "shape_forming") { if (Cache().userLoggedIn!.fitnessLevel == FitnessState.beginner) { - trainingPlanId = isWoman ? getTrainingPlanByInternalName("woman_beginner") : getTrainingPlanByInternalName("man_routine1"); + trainingPlanId = isWoman ? getTrainingPlanByInternalName("women_shape_L1") : getTrainingPlanByInternalName("man_routine1"); } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.intermediate) { - trainingPlanId = isWoman ? getTrainingPlanByInternalName("woman_beginner_split") : getTrainingPlanByInternalName("man_routine3"); + trainingPlanId = isWoman ? getTrainingPlanByInternalName("women_shape_L2") : getTrainingPlanByInternalName("man_routine3"); } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.advanced) { - trainingPlanId = isWoman ? getTrainingPlanByInternalName("woman_advanced") : getTrainingPlanByInternalName("man_routine4"); + trainingPlanId = isWoman ? getTrainingPlanByInternalName("women_shape_L3") : getTrainingPlanByInternalName("man_routine4"); } else { - trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_routine2") : getTrainingPlanByInternalName("man_routine2"); + trainingPlanId = isWoman ? getTrainingPlanByInternalName("women_shape_L4") : getTrainingPlanByInternalName("man_routine2"); } - } else { + } else if (Cache().userLoggedIn!.goal == "muscle_endurance") { + if (Cache().userLoggedIn!.fitnessLevel == FitnessState.beginner) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_se_l1") : getTrainingPlanByInternalName("man_se_l1"); + } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.intermediate) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_se_l2") : getTrainingPlanByInternalName("man_se_l2"); + } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.advanced) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_se_l3") : getTrainingPlanByInternalName("man_se_l3"); + } else { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_se_l4") : getTrainingPlanByInternalName("man_se_l4"); + } + } else if (Cache().userLoggedIn!.goal == "gain_strength") { + if (Cache().userLoggedIn!.fitnessLevel == FitnessState.beginner) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_power_l1") : getTrainingPlanByInternalName("man_power_l1"); + } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.intermediate) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_power_l2") : getTrainingPlanByInternalName("man_power_l2"); + } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.advanced) { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_power_l3") : getTrainingPlanByInternalName("man_power_l3"); + } else { + trainingPlanId = isWoman ? getTrainingPlanByInternalName("man_power_l4") : getTrainingPlanByInternalName("man_power_l4"); + } + } else if (Cache().userLoggedIn!.goal == "gain_muscle") { if (Cache().userLoggedIn!.fitnessLevel == FitnessState.beginner) { trainingPlanId = isWoman ? getTrainingPlanByInternalName("woman_beginner") : getTrainingPlanByInternalName("beginner_man"); } else if (Cache().userLoggedIn!.fitnessLevel == FitnessState.intermediate) { diff --git a/lib/service/firebase_api.dart b/lib/service/firebase_api.dart index e8cef5e..92eabeb 100644 --- a/lib/service/firebase_api.dart +++ b/lib/service/firebase_api.dart @@ -23,6 +23,7 @@ class FirebaseApi with logging.Logging { static const String REGISTER_EMAIL_IN_USE = "email-already-in-use"; late UserCredential userCredential; + String? firebaseRegToken; factory FirebaseApi() => FirebaseApi._internal(); @@ -61,9 +62,10 @@ class FirebaseApi with logging.Logging { badge: true, sound: true, ); - String? token = await FirebaseMessaging.instance.getToken(); + this.firebaseRegToken = await FirebaseMessaging.instance.getToken(); + Cache().firebaseMessageToken = firebaseRegToken; FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); - log("FirebaseMessaging token $token"); + log("FirebaseMessaging token $firebaseRegToken"); } catch (e) { // Set `_error` state to true if Firebase initialization fails log("Error initializing Firebase"); diff --git a/lib/service/mautic.dart b/lib/service/mautic.dart index 3abab2e..cd075d0 100644 --- a/lib/service/mautic.dart +++ b/lib/service/mautic.dart @@ -23,7 +23,7 @@ class MauticApi with Logging { client.close(); if (!(result.statusCode == 200 || result.statusCode == 302)) { trace("mautic response: ${result.statusCode}"); - throw Exception("Network error, try again later!"); + //throw Exception("Network error, try again later!"); } } } diff --git a/lib/service/tracking_service.dart b/lib/service/tracking_service.dart index 76dab05..57b652d 100644 --- a/lib/service/tracking_service.dart +++ b/lib/service/tracking_service.dart @@ -7,8 +7,12 @@ class TrackingApi with Logging { final APIClient _client = new APIClient(); Future saveTracking(Tracking tracking) async { - String body = JsonEncoder().convert(tracking.toJson()); - log(" ===== saving tracking:" + body); - await _client.post("tracking/", body); + try { + String body = JsonEncoder().convert(tracking.toJson()); + log(" ===== saving tracking:" + body); + await _client.post("tracking/", body); + } catch (exception) { + log("exception in tracking: ${exception.toString()}"); + } } } diff --git a/lib/util/track.dart b/lib/util/track.dart index 46115b9..a0166dd 100644 --- a/lib/util/track.dart +++ b/lib/util/track.dart @@ -20,7 +20,6 @@ class Track with Logging { Track._internal(); void track(TrackingEvent event, {String eventValue = ""}) { - analytics.logEvent(name: event.enumToString(), parameters: {"value": eventValue}); if (!isInDebugMode) { FlurryData.logEvent(event.enumToString()); // Smartlook.setGlobalEventProperty(event.toString(), eventValue, false); @@ -33,8 +32,11 @@ class Track with Logging { tracking.eventValue = eventValue; } tracking.dateAdd = DateTime.now(); - FirebaseMessaging.instance.subscribeToTopic(event.enumToString()); + TrackingApi().saveTracking(tracking); + + FirebaseMessaging.instance.subscribeToTopic(event.enumToString()); + analytics.logEvent(name: event.enumToString(), parameters: {"value": eventValue}); } } } diff --git a/lib/view/customer_goal_page.dart b/lib/view/customer_goal_page.dart index 06c0fce..a80ca20 100644 --- a/lib/view/customer_goal_page.dart +++ b/lib/view/customer_goal_page.dart @@ -12,7 +12,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; -enum Goals { gain_muscle, weight_loss, endurance, muscle_endurance, flexibility, gain_strength, explosiveness, shape_forming } +enum Goals { gain_muscle, muscle_endurance, gain_strength, shape_forming } //weight_loss, endurance, explosiveness,flexibility, extension GoalsExt on Goals { String toStr() => this.toString().split(".").last; @@ -21,20 +21,13 @@ extension GoalsExt on Goals { String description(Goals goal) { switch (goal) { - case Goals.endurance: - return "Endurance"; - case Goals.weight_loss: - return "Loss Weight"; case Goals.gain_muscle: return "Gain Muscle"; case Goals.gain_strength: return "Gain Strength"; case Goals.muscle_endurance: return "Muscle Endurance"; - case Goals.flexibility: - return "Flexibility"; - case Goals.explosiveness: - return "Explosiveness"; + case Goals.shape_forming: return "Shape Forming"; default: @@ -42,6 +35,18 @@ extension GoalsExt on Goals { } } + /* + case Goals.endurance: + return "Endurance"; + case Goals.weight_loss: + return "Loss Weight"; + case Goals.explosiveness: + return "Explosiveness"; + case Goals.flexibility: + return "Flexibility"; + + */ + Goals getGoal(Goals goal) { Goals selected = Goals.gain_muscle; Goals.values.forEach((element) { @@ -186,18 +191,18 @@ class _CustomerGoalPage extends State with Trans { SizedBox( height: h, ), - getItem(changeBloc, Goals.weight_loss), + /* getItem(changeBloc, Goals.weight_loss), SizedBox( height: h, - ), + ), */ getItem(changeBloc, Goals.shape_forming), SizedBox( height: h, ), - getItem(changeBloc, Goals.endurance), + /* getItem(changeBloc, Goals.endurance), SizedBox( height: h, - ), + ), */ getItem(changeBloc, Goals.gain_strength), SizedBox( height: h, @@ -206,14 +211,14 @@ class _CustomerGoalPage extends State with Trans { SizedBox( height: h, ), - getItem(changeBloc, Goals.flexibility), + /* getItem(changeBloc, Goals.flexibility), SizedBox( height: h, ), getItem(changeBloc, Goals.explosiveness), SizedBox( height: h, - ), + ), */ ], ), )); diff --git a/lib/view/customer_welcome_page.dart b/lib/view/customer_welcome_page.dart index cf9b164..183b61d 100644 --- a/lib/view/customer_welcome_page.dart +++ b/lib/view/customer_welcome_page.dart @@ -37,7 +37,29 @@ class _CustomerWelcomePageState extends State with Trans { child: Column( children: [ SizedBox( - height: 200, + height: 5, + ), + FadeIn( + child: Container( + width: 160, + height: 80, + child: GestureDetector( + onTap: () => Navigator.of(context).popAndPushNamed("home"), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset('asset/icon/gomb_orange_c.png', width: 140, height: 80), + Text( + t("Next"), + style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white), + ), + ], + ), + )), + duration: Duration(seconds: 6), + ), + SizedBox( + height: 110, ), CircularPercentIndicator( radius: 250.0, @@ -75,25 +97,6 @@ class _CustomerWelcomePageState extends State with Trans { SizedBox( height: 90, ), - FadeIn( - child: Container( - width: 160, - height: 80, - child: GestureDetector( - onTap: () => Navigator.of(context).popAndPushNamed("home"), - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset('asset/icon/gomb_orange_a.png', width: 140, height: 80), - Text( - t("Next"), - style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white), - ), - ], - ), - )), - duration: Duration(seconds: 6), - ), ], ), ))), diff --git a/lib/view/settings.dart b/lib/view/settings.dart index 566f2d6..e67760d 100644 --- a/lib/view/settings.dart +++ b/lib/view/settings.dart @@ -87,6 +87,7 @@ class SettingsPage extends StatelessWidget with Trans { getPrivacy(), mailTo(), getVersion(), + //welcome(), //getDevice(settingsBloc), ]); } @@ -264,6 +265,16 @@ class SettingsPage extends StatelessWidget with Trans { ); } + ListTile welcome() { + return ListTile( + title: TextButton( + child: Text("Welcome"), + onPressed: () => { + Navigator.of(context).pushNamed("customerWelcomePage"), + }), + ); + } + ListTile mailTo() { return ListTile( leading: Icon(CustomIcon.mail_1), diff --git a/lib/view/training_plan_execute.dart b/lib/view/training_plan_execute.dart index be0b6b3..b349b2f 100644 --- a/lib/view/training_plan_execute.dart +++ b/lib/view/training_plan_execute.dart @@ -308,6 +308,7 @@ class _ExerciseListState extends State with Trans { void animate() { offset = widget.bloc.getOffset(); + print("Offset: $offset"); if (scrollController.hasClients) { scrollController.animateTo(offset, duration: Duration(milliseconds: 300), curve: Curves.easeIn); } @@ -531,8 +532,8 @@ class ExerciseTile extends StatelessWidget with Trans { elevation: 0, padding: EdgeInsets.all(0), position: BadgePosition.topStart(top: 5, start: 5), - animationDuration: Duration(milliseconds: 500), - animationType: BadgeAnimationType.slide, + animationDuration: Duration(milliseconds: 1000), + animationType: BadgeAnimationType.scale, badgeColor: Colors.transparent, showBadge: true, badgeContent: IconButton( @@ -638,7 +639,7 @@ class ExerciseTile extends StatelessWidget with Trans { useRootNavigator: true, context: context, builder: (_) => CupertinoAlertDialog( - title: Text(t("You want to skip really this exercise?")), + title: Text(t("You want to skip really the entire exercise?")), content: Column(children: [ Divider(), ]), @@ -652,7 +653,7 @@ class ExerciseTile extends StatelessWidget with Trans { child: Text(t("Yes")), onPressed: () { Navigator.pop(context); - bloc.add(TrainingPlanSkipExercise(detail: detail)); + bloc.add(TrainingPlanSkipEntireExercise(detail: detail)); }, ) ], diff --git a/lib/view/training_plans_page.dart b/lib/view/training_plans_page.dart index 60b1272..0d328d3 100644 --- a/lib/view/training_plans_page.dart +++ b/lib/view/training_plans_page.dart @@ -86,6 +86,7 @@ class MyTrainingPlans extends StatelessWidget with Trans, Logging { getTrainingPlan(t("Training Plans for Women"), "asset/menu/training_plans_q_woman.jpg", "for_woman"), getTrainingPlan(t("Training Plans of Celebrities"), "asset/menu/training_plans_q_celebrities.jpg", "celebrities"), getTrainingPlan(t("Training Plans for Gain Strength"), "asset/menu/training_plans_q_gain_strength.jpg", "gain_strength"), + getTrainingPlan(t("Training Plans for Muscle Endurance"), "asset/menu/strenght_endurance.jpg", "muscle_endurance"), getTrainingPlan(t("Physical Prepare Program for Footgolfers"), "asset/menu/FG_2_edz.jpg", "footgolf"), ]), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( diff --git a/lib/widgets/exercise_save.dart b/lib/widgets/exercise_save.dart index 893d2a8..d45310d 100644 --- a/lib/widgets/exercise_save.dart +++ b/lib/widgets/exercise_save.dart @@ -696,6 +696,22 @@ class _ExplanationWidgetState extends State with Trans { color: Colors.transparent, child: Column( children: [ + Theme( + data: ThemeData(unselectedWidgetColor: Colors.white38), + child: CheckboxListTile( + value: _selected, + onChanged: (bool? checked) { + setState(() { + _selected = checked!; + }); + }, + checkColor: Colors.white, + activeColor: Colors.orange[600], + controlAffinity: ListTileControlAffinity.leading, + title: Text( + t("Show this tip no more"), + style: GoogleFonts.inter(color: Colors.grey), + ))), Padding( padding: const EdgeInsets.only(top: 10, left: 10, right: 10), child: Text(t(expl.getExplanation(Explanations.intro)), @@ -805,22 +821,6 @@ class _ExplanationWidgetState extends State with Trans { ), ], )), - Theme( - data: ThemeData(unselectedWidgetColor: Colors.white38), - child: CheckboxListTile( - value: _selected, - onChanged: (bool? checked) { - setState(() { - _selected = checked!; - }); - }, - checkColor: Colors.white, - activeColor: Colors.orange[600], - controlAffinity: ListTileControlAffinity.leading, - title: Text( - t("Show this tip no more"), - style: GoogleFonts.inter(color: Colors.grey), - ))) ], )); } diff --git a/lib/widgets/menu_page_widget.dart b/lib/widgets/menu_page_widget.dart index 6e0a43d..ee0f166 100644 --- a/lib/widgets/menu_page_widget.dart +++ b/lib/widgets/menu_page_widget.dart @@ -74,7 +74,7 @@ class _MenuPageWidgetState extends State with Trans, Logging { } Future runDelayedEvent() async { - await Future.delayed(Duration(milliseconds: 3000), () async { + await Future.delayed(Duration(milliseconds: 500), () async { if (Cache().userLoggedIn != null) { await initDynamicLinks(); } diff --git a/pubspec.yaml b/pubspec.yaml index b459be3..52bb49e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: aitrainer_app -description: Aitrainer Mobile Application in Flutter/Dart +description: Workout Test Mobile Application in Flutter/Dart # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.22+94 +version: 1.1.23+95 environment: sdk: ">=2.12.0 <3.0.0" @@ -386,6 +386,7 @@ flutter: - asset/menu/standing_barbell_curl.jpg - asset/menu/standing_biceps_cable_curl.jpg - asset/menu/standing_cable_triceps_extension.jpg + - asset/menu/standing_calf_machine.jpg - asset/menu/standing_face_pull.jpg - asset/menu/standing_leg_curls.jpg - asset/menu/standing_military_presses.jpg @@ -396,6 +397,7 @@ flutter: - asset/menu/stiff_legged_deadlift.jpg - asset/menu/straight_arm_pulldown.jpg - asset/menu/straight-arm_rope_pull-down.jpg + - asset/menu/strength_endurance.jpg - asset/menu/stretching.jpg - asset/menu/t_bar_rows.jpg - asset/menu/test_center.jpg