From 14b5b4434733ca66233cd054b1b9af503fa80a90 Mon Sep 17 00:00:00 2001 From: bossanyit Date: Wed, 30 Dec 2020 21:50:11 +0100 Subject: [PATCH] WT1.1.0+42 error fixes --- android/app/build.gradle | 5 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- i18n/en.json | 6 +-- ios/Runner.xcodeproj/project.pbxproj | 6 +-- lib/model/cache.dart | 6 ++- lib/repository/exercise_repository.dart | 4 ++ lib/view/exercise_log_page.dart | 20 +++---- lib/view/mydevelopment_body_page.dart | 38 ++++++------- lib/view/mydevelopment_muscle_page.dart | 41 ++++++++------ lib/view/mydevelopment_page.dart | 11 ++-- lib/view/myexcercise_plan_page.dart | 12 ++--- lib/widgets/dialog_common.dart | 31 +++++++++-- lib/widgets/image_button.dart | 54 ++++++++++--------- lib/widgets/menu_page_widget.dart | 5 +- 14 files changed, 142 insertions(+), 99 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5516a96..fa45132 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -52,14 +52,14 @@ android { multiDexEnabled true } - /*signingConfigs { + signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } - }*/ + } buildTypes { release { @@ -79,3 +79,4 @@ dependencies { implementation 'com.facebook.android:facebook-login:5.15.3' implementation 'com.android.support:multidex:1.0.3' } +sourceCompatibility = '1.8' \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index add9132..de2ccd6 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/i18n/en.json b/i18n/en.json index 3916e3c..92392b3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -128,8 +128,8 @@ "2nd Control": "2nd Control", "3rd Control": "3rd Control", - "My Development":"My Development", - "My Training Plan":"My Training Plan", + "My Development":"Development", + "My Training Plan":"Training Plan", "Please add an exercise plan": "Please add an exercise plan", "Serie": "Serie", @@ -183,7 +183,7 @@ "Persistence!": "Persistence!", "Greetings!": "Greetings!", - "The purpose is to measure you physical condition": "The purpose is to measure you physical condition.", + "The purpose is to measure you physical condition": "The purpose is to measure your physical condition.", "The suggested order of the exercises: chest - biceps - triceps - back - shoulders - core - tigh - calf.": "The suggested order of the exercises: chest - biceps - triceps - back - shoulders - core - tigh - calf.", "Go to the menu Strength - One Rep Max - Chest, and select your favourite exercise.": "Go to the menu Strength - One Rep Max - Chest, and select your favourite exercise.", "Please continue your tests with a": "Please continue your tests with a", diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 59208eb..b8425b9 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -366,7 +366,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 41; + CURRENT_PROJECT_VERSION = 42; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -509,7 +509,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 41; + CURRENT_PROJECT_VERSION = 42; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -544,7 +544,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 41; + CURRENT_PROJECT_VERSION = 42; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/model/cache.dart b/lib/model/cache.dart index 310bdef..b66fb70 100644 --- a/lib/model/cache.dart +++ b/lib/model/cache.dart @@ -70,7 +70,7 @@ class Cache with Logging { String authToken = ""; Customer userLoggedIn; String firebaseUid; - Purchase purchased; + bool hasPurchased = false; bool firstLoad = true; @@ -81,7 +81,7 @@ class Cache with Logging { ExercisePlan _myExercisePlan; List _properties; List _products; - List _purchases; + List _purchases = List(); List _productTests; List _devices; @@ -436,5 +436,7 @@ class Cache with Logging { CustomerRepository customerRepository = CustomerRepository(customer: this.userLoggedIn); await customerRepository.getPurchase(); await customerRepository.getProductTests(); + + this.hasPurchased = this._purchases.isNotEmpty; } } diff --git a/lib/repository/exercise_repository.dart b/lib/repository/exercise_repository.dart index 8246493..d524c19 100644 --- a/lib/repository/exercise_repository.dart +++ b/lib/repository/exercise_repository.dart @@ -245,6 +245,10 @@ class ExerciseRepository { } void sortByDate() { + if (exerciseList.isEmpty) { + return; + } + exerciseList.sort((a, b) => b.dateAdd.compareTo(a.dateAdd)); this.exerciseLogList = List(); diff --git a/lib/view/exercise_log_page.dart b/lib/view/exercise_log_page.dart index faa91c4..589e8ed 100644 --- a/lib/view/exercise_log_page.dart +++ b/lib/view/exercise_log_page.dart @@ -209,15 +209,17 @@ class _ExerciseLogPage extends State with Trans, Common { evaluation(); }, ), - GestureDetector( - child: Image.asset( - 'asset/image/lock.png', - height: 25, - width: 25, - ), - onTap: () { - evaluation(); - }), + Cache().hasPurchased + ? Offstage() + : GestureDetector( + child: Image.asset( + 'asset/image/lock.png', + height: 25, + width: 25, + ), + onTap: () { + evaluation(); + }), ], ), IconButton( diff --git a/lib/view/mydevelopment_body_page.dart b/lib/view/mydevelopment_body_page.dart index 8786295..4b9e7ab 100644 --- a/lib/view/mydevelopment_body_page.dart +++ b/lib/view/mydevelopment_body_page.dart @@ -26,24 +26,26 @@ class _MyDevelopmentBodyPage extends State with Trans, Co @override void initState() { super.initState(); - Timer( - Duration(milliseconds: 2000), - () => { - showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - setContext(context); - return DialogPremium( - unlocked: false, - unlockRound: 2, - function: "My Whole Body Development", - unlockedText: "", - onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, - onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, - ); - }) - }); + if (!Cache().hasPurchased) { + Timer( + Duration(milliseconds: 2000), + () => { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + setContext(context); + return DialogPremium( + unlocked: false, + unlockRound: 2, + function: "My Whole Body Development", + unlockedText: "", + onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, + onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, + ); + }) + }); + } /// We require the initializers to run after the loading screen is rendered SchedulerBinding.instance.addPostFrameCallback((_) { diff --git a/lib/view/mydevelopment_muscle_page.dart b/lib/view/mydevelopment_muscle_page.dart index 03668ee..7a99219 100644 --- a/lib/view/mydevelopment_muscle_page.dart +++ b/lib/view/mydevelopment_muscle_page.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:collection'; +import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/dialog_premium.dart'; @@ -30,23 +31,25 @@ class _MyDevelopmentMuscleState extends State with Comm @override void initState() { super.initState(); - Timer( - Duration(milliseconds: 2000), - () => { - showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return DialogPremium( - unlocked: false, - unlockRound: 1, - function: "Development Of Muscles", - unlockedText: "", - onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, - onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, - ); - }) - }); + if (!Cache().hasPurchased) { + Timer( + Duration(milliseconds: 2000), + () => { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return DialogPremium( + unlocked: false, + unlockRound: 1, + function: "Development Of Muscles", + unlockedText: "", + onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, + onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()}, + ); + }) + }); + } /// We require the initializers to run after the loading screen is rendered SchedulerBinding.instance.addPostFrameCallback((_) { @@ -166,6 +169,7 @@ class _MyDevelopmentMuscleState extends State with Comm mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ChoiceChip( + labelPadding: EdgeInsets.only(right: 5), avatar: Icon(Icons.timer), label: Text(t('Detailed')), labelStyle: TextStyle(fontSize: 9, color: Colors.black), @@ -175,6 +179,7 @@ class _MyDevelopmentMuscleState extends State with Comm onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))}, ), ChoiceChip( + labelPadding: EdgeInsets.only(right: 5), avatar: Icon(Icons.timer), label: Text(t('Weekly')), labelStyle: TextStyle(fontSize: 9, color: Colors.black), @@ -185,6 +190,7 @@ class _MyDevelopmentMuscleState extends State with Comm onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))}, ), ChoiceChip( + labelPadding: EdgeInsets.only(right: 5), avatar: Icon(Icons.timer), label: Text(t('Monthly')), labelStyle: TextStyle(fontSize: 9, color: Colors.black), @@ -194,6 +200,7 @@ class _MyDevelopmentMuscleState extends State with Comm onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))}, ), ChoiceChip( + labelPadding: EdgeInsets.only(right: 5), avatar: Icon(Icons.timer), label: Text(t('Yearly')), labelStyle: TextStyle(fontSize: 9, color: Colors.black), diff --git a/lib/view/mydevelopment_page.dart b/lib/view/mydevelopment_page.dart index 5db7fbd..fb78b56 100644 --- a/lib/view/mydevelopment_page.dart +++ b/lib/view/mydevelopment_page.dart @@ -48,7 +48,7 @@ class _MyDevelopmentPage extends State with Trans { style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/edzesnaplom400400.jpg", @@ -62,10 +62,7 @@ class _MyDevelopmentPage extends State with Trans { text: t("My Whole Body Development"), style: GoogleFonts.robotoMono( textStyle: TextStyle( - fontSize: 14, - color: Colors.orange, - fontWeight: FontWeight.bold, - backgroundColor: Colors.black54.withOpacity(0.4)), + fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4)), ), image: "asset/image/testemfejl400x400.jpg", left: 5, @@ -82,7 +79,7 @@ class _MyDevelopmentPage extends State with Trans { style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/izomcsop400400.jpg", @@ -98,7 +95,7 @@ class _MyDevelopmentPage extends State with Trans { style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/predictions.jpg", diff --git a/lib/view/myexcercise_plan_page.dart b/lib/view/myexcercise_plan_page.dart index 7f1982d..e3cd832 100644 --- a/lib/view/myexcercise_plan_page.dart +++ b/lib/view/myexcercise_plan_page.dart @@ -47,7 +47,7 @@ class _MyExercisePlanPage extends State with Trans, Logging style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/exercise_plan_execute.jpg", @@ -66,7 +66,7 @@ class _MyExercisePlanPage extends State with Trans, Logging style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/exercise_plan_custom.jpg", @@ -85,11 +85,11 @@ class _MyExercisePlanPage extends State with Trans, Logging style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/exercise_plan_suggested.jpg", - left: 5, + left: 2, onTap: () => { showDialog( context: context, @@ -113,7 +113,7 @@ class _MyExercisePlanPage extends State with Trans, Logging style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/exercise_plan_special.jpg", @@ -141,7 +141,7 @@ class _MyExercisePlanPage extends State with Trans, Logging style: GoogleFonts.robotoMono( textStyle: TextStyle( fontSize: 14, - color: Colors.orange, + color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))), image: "asset/image/exercise_plan_stars.jpg", diff --git a/lib/widgets/dialog_common.dart b/lib/widgets/dialog_common.dart index 45dc8cd..f5a6537 100644 --- a/lib/widgets/dialog_common.dart +++ b/lib/widgets/dialog_common.dart @@ -7,12 +7,14 @@ class DialogCommon extends StatefulWidget { final String title, descriptions, text; final VoidCallback onTap; final VoidCallback onCancel; - String description2; + String description2, description3; final Image img; - DialogCommon({Key key, this.title, this.descriptions, this.description2, this.text, this.img, this.onTap, this.onCancel}) + DialogCommon( + {Key key, this.title, this.descriptions, this.description2, this.description3, this.text, this.img, this.onTap, this.onCancel}) : super(key: key) { description2 = description2 ?? ""; + description3 = description3 ?? ""; } @override @@ -129,7 +131,30 @@ class _DialogPremiumState extends State with Trans { textAlign: TextAlign.center, ), SizedBox( - height: 62, + height: 15, + ), + Text( + widget.description3, + style: GoogleFonts.inter( + fontSize: 14, + color: Colors.white, + shadows: [ + Shadow( + offset: Offset(5.0, 5.0), + blurRadius: 12.0, + color: Colors.black54, + ), + Shadow( + offset: Offset(-3.0, 3.0), + blurRadius: 12.0, + color: Colors.black54, + ), + ], + ), + textAlign: TextAlign.center, + ), + SizedBox( + height: 52, ), Align( alignment: Alignment.center, diff --git a/lib/widgets/image_button.dart b/lib/widgets/image_button.dart index cd7ad82..0c73ce7 100644 --- a/lib/widgets/image_button.dart +++ b/lib/widgets/image_button.dart @@ -50,7 +50,7 @@ class ImageButton extends StatelessWidget { @override Widget build(BuildContext context) { if (top == null) { - top = height - (style.fontSize - 5) * text.length - 2 * left < 0 ? height - 2 * style.fontSize - 22 : height - style.fontSize - 17; + top = height - (style.fontSize - 5) * text.length - 2 * left < 0 ? height - 2 * style.fontSize - 22 : height - style.fontSize - 37; //print("Top: " + top.toStringAsFixed(0) + " length: " + ((style.fontSize - 5) * text.length).toString()); } return Stack( @@ -99,31 +99,33 @@ class ImageButton extends StatelessWidget { color: Colors.transparent, ), ), - Stack(alignment: Alignment.topLeft, children: [ - Positioned( - top: height / 2 - 30, - left: width / 2 - 30, - child: this.isLocked - ? GestureDetector( - child: Image.asset( - 'asset/image/lock.png', - height: 60, - width: 60, - ), - onTap: onTap ?? onTap, - ) - : isMarked - ? GestureDetector( - child: Image.asset( - 'asset/image/haken.png', - height: 70, - width: 70, - ), - onTap: onTap ?? onTap, - ) - : Container(), - ) - ]), + Cache().hasPurchased + ? Offstage() + : Stack(alignment: Alignment.topLeft, children: [ + Positioned( + top: height / 2 - 30, + left: width / 2 - 30, + child: this.isLocked + ? GestureDetector( + child: Image.asset( + 'asset/image/lock.png', + height: 60, + width: 60, + ), + onTap: onTap ?? onTap, + ) + : isMarked + ? GestureDetector( + child: Image.asset( + 'asset/image/haken.png', + height: 70, + width: 70, + ), + onTap: onTap ?? onTap, + ) + : Container(), + ) + ]), ] //) // ) diff --git a/lib/widgets/menu_page_widget.dart b/lib/widgets/menu_page_widget.dart index 69d98f9..ccbbcf2 100644 --- a/lib/widgets/menu_page_widget.dart +++ b/lib/widgets/menu_page_widget.dart @@ -221,8 +221,9 @@ class _MenuPageWidgetState extends State with Trans, Logging { builder: (BuildContext context) { return DialogCommon( title: menuBloc.infoTitle, - descriptions: menuBloc.infoText2, - description2: menuBloc.infoText3, + descriptions: menuBloc.infoText, + description2: menuBloc.infoText2, + description3: menuBloc.infoText3, text: "OK", onTap: () => {Navigator.of(context).pop()}, onCancel: () => {Navigator.of(context).pop()},