From a8728edae2c72bd0c283259b0f1d38dd8d58ba23 Mon Sep 17 00:00:00 2001 From: bossanyit Date: Mon, 7 Jun 2021 17:28:25 +0200 Subject: [PATCH] WT1.1.18+8 repeats MAX --- i18n/en.json | 11 +++++++-- i18n/hu.json | 11 +++++++-- ios/Runner.xcodeproj/project.pbxproj | 6 ++--- lib/model/training_plan.dart | 3 +++ lib/repository/training_plan_repository.dart | 10 +++++--- lib/service/package_service.dart | 10 +++++++- lib/view/training_plan_activate_page.dart | 17 +++++++++++++- lib/view/training_plan_execute_page.dart | 24 ++++++-------------- lib/view/training_plan_exercise.dart | 23 ++++++++----------- pubspec.yaml | 2 +- 10 files changed, 73 insertions(+), 44 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 67d6789..0cf60d7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -352,7 +352,7 @@ "Start training": "Start training", "Enjoy the exercises, good luck with the testing!": "Enjoy the exercises, good luck with the testing!", "Please continue with the next exercise in the queue:": "Please continue with the next exercise in the queue:", - "Or, you can redifine this exercise queue in the Compact Test menu": "Or, you can redifine this exercise queue in the Compact Test menu", + "Or, you can redefine this exercise queue in the Compact Test menu": "Or, you can redifine this exercise queue in the Compact Test menu", "you are able to do 12-20 repeats with": "you are able to do 12-20 repeats with", "You have an active Test Set!": "You have an active Test Set!", "Do you want to override it?": "Do you want to override it?", @@ -462,5 +462,12 @@ "This is a premium function": "This is a premium function", "because only that way can we show you your exercises, results and evaluations.": "because only that way can we show you your exercises, results and evaluations.", "because only that way can we show you the personalized development diagrams and analysises": "because only that way can we show you the personalized development diagrams and analysises", - "because only in that way can you begin to execute a training plan": "because only in that way can you begin to execute a training plan" + "because only in that way can you begin to execute a training plan": "because only in that way can you begin to execute a training plan", + "Please try to execute this exercise with exact weight and repeats what is suggested": "Please try to execute this exercise with exact weight and repeats what is suggested", + "Please try to execute this exercise with exact repeats what is suggested": "Please try to execute this exercise with exact repeats what is suggested", + "Please take a relative bigger weight and at least 12 times and do your best! MAXIMIZE it!": "Please take a relative bigger weight and at least 12 times and do your best! MAXIMIZE it!", + "During the exercise you should try your best:": "During the exercise you should try your best:", + "do it with the possible maximum repeats.": "do it with the possible maximum repeats.", + "Maximum repeats": "Maximum repeats", + "TEST": "TEST" } \ No newline at end of file diff --git a/i18n/hu.json b/i18n/hu.json index f476ed1..cc62fb7 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -355,7 +355,7 @@ "Start training": "Edzés kezdése", "Enjoy the exercises, good luck with the testing!": "Élvezd a gyakorlatokat, sok sikert a teszteléshez!", "Please continue with the next exercise in the queue:": "Kérlek folytasd a következő gyakorlattal:", - "Or, you can redifine this exercise queue in the Compact Test menu": "Vagy változtatsd meg a gyakorlatokat a Tesztközpontban", + "Or, you can redefine this exercise queue in the Compact Test menu": "Vagy változtatsd meg a gyakorlatokat a Tesztközpontban", "you are able to do 12-20 repeats with": "amivel képes vagy 12-20 ismétlésre", "You have an active Test Set!": "Van egy aktiv tesztköröd!", "Do you want to override it?": "Felülírod?", @@ -460,5 +460,12 @@ "This is a premium function": "Ez egy prémium funkció", "because only that way can we show you your exercises, results and evaluations.": "mert csak így tudjuk neked megmutatni a korábbi gyakorlataidat, eredményeket és kiértékeléseket.", "because only that way can we show you the personalized development diagrams and analysises": "mert csak így tudjuk neked megmutatni a személyre szabott diagramokat és analíziseket.", - "because only in that way can you begin to execute a training plan": "mert csak így tudod elkezdeni az edzésterved végrehajtását" + "because only in that way can you begin to execute a training plan": "mert csak így tudod elkezdeni az edzésterved végrehajtását", + "Please try to execute this exercise with exact weight and repeats what is suggested": "Kérlek, próbáld végrehajtani a gyakorlatot pontosan annyi súllyal és ismétléssel, amennyit javaslunk", + "Please try to execute this exercise with exact repeats what is suggested": "Kérlek, próbáld végrehajtani a gyakorlatot pontosan annyi ismétléssel, amennyit javaslunk", + "Please take a relative bigger weight and at least 12 times and do your best! MAXIMIZE it!": "Kérlek válassz egy relatív nagyobb súlyt, és hajtsd végre a gyakorlatot minimum 12-szer! MAXOLD KI!", + "During the exercise you should try your best:": "A gyakorlat végrehajtása alatt a hozd a legjobbadat:", + "do it with the possible maximum repeats.": "A lehetséges maximum ismétlésszámot hajtsd végre.", + "Maximum repeats": "Maximum ismétlésszám", + "TEST": "TESZT" } \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 29bcd5c..5e40a53 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 = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/model/training_plan.dart b/lib/model/training_plan.dart index ed7619f..223cc1b 100644 --- a/lib/model/training_plan.dart +++ b/lib/model/training_plan.dart @@ -9,6 +9,7 @@ class TrainingPlan { late String internalName; late String description; late bool free; + late bool active; int? treeId; HashMap nameTranslations = HashMap(); @@ -23,6 +24,7 @@ class TrainingPlan { this.internalName = json['internalName']; this.description = json['description']; this.free = json['free']; + this.active = json['active']; this.treeId = json['treeId']; nameTranslations['en'] = name; @@ -62,6 +64,7 @@ class TrainingPlan { "type": this.type, "internalName": this.internalName, "free": this.free, + "active": this.active, "description": this.description, "nameTranslation": this.nameTranslations.toString(), }; diff --git a/lib/repository/training_plan_repository.dart b/lib/repository/training_plan_repository.dart index 311fa16..819674c 100644 --- a/lib/repository/training_plan_repository.dart +++ b/lib/repository/training_plan_repository.dart @@ -77,10 +77,14 @@ class TrainingPlanRepository { detail.parallel = elem.parallel; detail.restingTime = elem.restingTime; detail.exerciseType = Cache().getExerciseTypeById(detail.exerciseTypeId!); - if (detail.exerciseType!.unitQuantityUnit != null) { - detail = getCalculatedWeightRepeats(elem.exerciseTypeId, detail); + if (elem.weight == -1) { + if (detail.exerciseType!.unitQuantityUnit != null) { + detail = getCalculatedWeightRepeats(elem.exerciseTypeId, detail); + } else { + detail.weight = 0; + } } else { - detail.weight = 0; + detail.weight = elem.weight; } //print("Detail $detail exerciseType: ${detail.exerciseType}"); diff --git a/lib/service/package_service.dart b/lib/service/package_service.dart index 89e2c71..73d8a2f 100644 --- a/lib/service/package_service.dart +++ b/lib/service/package_service.dart @@ -91,7 +91,15 @@ class PackageApi { final Iterable json = jsonDecode(headRecord[1]); final List? plans = json.map((plan) => TrainingPlan.fromJson(plan)).toList(); - Cache().setTrainingPlans(plans); + List activePlans = []; + if (plans != null) { + plans.forEach((element) { + if (element.active) { + activePlans.add(element); + } + }); + } + Cache().setTrainingPlans(activePlans); } else if (headRecord[0] == "SplitTests") { final Iterable json = jsonDecode(headRecord[1]); final List? tests = json.map((test) => SplitTest.fromJson(test)).toList(); diff --git a/lib/view/training_plan_activate_page.dart b/lib/view/training_plan_activate_page.dart index 3b4215e..4f48735 100644 --- a/lib/view/training_plan_activate_page.dart +++ b/lib/view/training_plan_activate_page.dart @@ -373,7 +373,22 @@ class TrainingPlanActivatePage extends StatelessWidget with Trans { }) }, onRepeatTap: () => { - print("Reps"), + showDialog( + context: context, + builder: (BuildContext context) { + return DialogCommon( + title: t("Maximum repeats"), + descriptions: t("During the exercise you should try your best:"), + description2: t("do it with the possible maximum repeats."), + text: "OK", + onTap: () => { + Navigator.of(context).pop(), + }, + onCancel: () => { + Navigator.of(context).pop(), + }, + ); + }) }), headerGridLinesVisibility: GridLinesVisibility.both, gridLinesVisibility: GridLinesVisibility.both, diff --git a/lib/view/training_plan_execute_page.dart b/lib/view/training_plan_execute_page.dart index e9102ce..398d32f 100644 --- a/lib/view/training_plan_execute_page.dart +++ b/lib/view/training_plan_execute_page.dart @@ -454,7 +454,6 @@ class _ExerciseListState extends State with Trans { title = AppLocalizations.of(context)!.translate("Stop!"); description = AppLocalizations.of(context)!.translate("Please continue with the next exercise in the queue:") + next.exerciseType!.nameTranslation; - description2 = AppLocalizations.of(context)!.translate("Or, you can redifine this exercise queue in the Compact Test menu"); } else { final HashMap args = HashMap(); args['exerciseType'] = next.exerciseType; @@ -564,13 +563,17 @@ class _ExerciseTileState extends State with Trans { final bool done = state.equalsTo(ExercisePlanDetailState.finished) || state.equalsTo(ExercisePlanDetailState.skipped); final String countSerie = widget.detail.set.toString(); final String step = (widget.detail.exercises.length).toString(); - String weight = widget.detail.weight!.toStringAsFixed(1); + String weight = widget.detail.weight != null ? widget.detail.weight!.toStringAsFixed(1) : "-"; String restingTime = widget.detail.restingTime == null ? "" : widget.detail.restingTime!.toStringAsFixed(0); bool isTest = false; - if (widget.detail.weight! == -1) { + if (widget.detail.weight != null && widget.detail.weight! == -1) { weight = t("TEST"); isTest = true; } + String repeats = widget.detail.repeats!.toString(); + if (widget.detail.repeats! == -1) { + repeats = t("MAX"); + } setContext(context); return Container( color: Colors.transparent, @@ -679,7 +682,7 @@ class _ExerciseTileState extends State with Trans { style: GoogleFonts.inter( fontSize: 12, color: done ? Colors.grey[100] : Colors.yellow[400], fontWeight: FontWeight.bold)), TextSpan( - text: widget.detail.repeats!.toString(), + text: repeats, style: GoogleFonts.inter( fontSize: 12, )), @@ -707,19 +710,6 @@ class _ExerciseTileState extends State with Trans { style: GoogleFonts.inter(fontSize: 12, color: done ? Colors.grey[100] : Colors.white, fontWeight: FontWeight.bold)), ]), )), - /* done - ? AnimatedBuilder( - animation: animation, - builder: (context, snapshot) { - return Column(mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset( - "asset/image/kupa.png", - width: animation.value, - ), - Text("Result", style: GoogleFonts.inter(fontSize: 10, color: Colors.white)), - ]); - }) - : Offstage(), */ isTest ? AnimatedBuilder( animation: animation, diff --git a/lib/view/training_plan_exercise.dart b/lib/view/training_plan_exercise.dart index 94bf58b..dad8353 100644 --- a/lib/view/training_plan_exercise.dart +++ b/lib/view/training_plan_exercise.dart @@ -1,15 +1,8 @@ import 'dart:collection'; -import 'package:aitrainer_app/bloc/test_set_control/test_set_control_bloc.dart'; -import 'package:aitrainer_app/bloc/test_set_execute/test_set_execute_bloc.dart'; -import 'package:aitrainer_app/bloc/test_set_new/test_set_new_bloc.dart'; import 'package:aitrainer_app/bloc/training_plan/training_plan_bloc.dart'; import 'package:aitrainer_app/library/custom_icon_icons.dart'; -import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/model/customer_training_plan_details.dart'; -import 'package:aitrainer_app/model/exercise_plan_detail.dart'; -import 'package:aitrainer_app/model/exercise_type.dart'; - import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/exercise_save.dart'; @@ -37,9 +30,7 @@ class TrainingPlanExercise extends StatelessWidget with Trans { padding: EdgeInsets.all(20), decoration: BoxDecoration( image: DecorationImage( - image: Cache().userLoggedIn!.sex == "m" - ? AssetImage("asset/image/WT_black_background.jpg") - : AssetImage("asset/image/WT_Results_for_female.jpg"), + image: AssetImage("asset/image/WT_black_background.jpg"), fit: BoxFit.cover, alignment: Alignment.center, ), @@ -77,21 +68,25 @@ class TrainingPlanExercise extends StatelessWidget with Trans { Widget getExercises(TrainingPlanBloc bloc, CustomerTrainingPlanDetails detail) { final String noTestTextWithWeight = "Please try to execute this exercise with exact weight and repeats what is suggested"; final String noTestTextNoWeight = "Please try to execute this exercise with exact repeats what is suggested"; + final String testMaxRepeats = "Please repeat as much times as you can! MAXIMIZE it!"; + final String testWeight = "Please take a relative bigger weight and at least 12 times and do your best! MAXIMIZE it!"; return ExerciseSave( exerciseName: detail.exerciseType!.nameTranslation, exerciseDescription: detail.exerciseType!.descriptionTranslation, exerciseTask: detail.exerciseType!.unitQuantityUnit != null ? detail.weight == -1 - ? t("Please take a relative bigger weight and repeat 12-20 times and do your best! MAXIMIZE it!") - : noTestTextWithWeight + ? t(testWeight) + : detail.repeats == -1 + ? t(testMaxRepeats) + : t(noTestTextWithWeight) : detail.repeats == -1 - ? t("Please repeat as much times as you can! MAXIMIZE it!") + ? t(testMaxRepeats) : noTestTextNoWeight, unit: detail.exerciseType!.unit, unitQuantityUnit: detail.exerciseType!.unitQuantityUnit, hasUnitQuantity: detail.exerciseType!.unitQuantityUnit != null, weight: detail.weight == -1 ? 30 : detail.weight, - repeats: detail.repeats == -1 ? 12 : detail.repeats, + repeats: detail.repeats == -1 ? 99 : detail.repeats, set: detail.set, exerciseNr: detail.exercises.length + 1, onUnitQuantityChanged: (value) => bloc.add(TrainingPlanWeightChange(weight: value, detail: detail)), diff --git a/pubspec.yaml b/pubspec.yaml index e96719d..3031f8a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.18+85 +version: 1.1.18+86 environment: sdk: ">=2.12.0 <3.0.0"