WT1.1.5 In-app-purchase

This commit is contained in:
bossanyit
2021-01-24 14:34:13 +01:00
parent d44fefe9af
commit 71efd3f349
52 changed files with 847 additions and 367 deletions
+1 -1
View File
@@ -270,7 +270,7 @@ class CustomerRepository with Logging {
try {
int customerId = Cache().userLoggedIn.customerId;
tests = await ProductTestApi().getProductTestByCustomer(customerId);
} on NotFoundException catch (ex) {
} on NotFoundException catch (_) {
log("Product Tests not found");
Cache().productTests = tests;
} on Exception catch (ex) {
+11
View File
@@ -259,6 +259,17 @@ class ExerciseRepository {
return actualExerciseType;
}
void getSameExercise(int exerciseTypeId, String day) {
this.actualExerciseList = List();
for (int i = 0; i < this.exerciseList.length; i++) {
Exercise exercise = exerciseList[i];
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
if (exerciseTypeId == exercise.exerciseTypeId && exerciseDate == day) {
this.actualExerciseList.add(exercise);
}
}
}
void sortByDate() {
if (exerciseList.isEmpty) {
return;
@@ -1,7 +1,6 @@
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/exercise_result.dart';
import 'package:aitrainer_app/model/result.dart';
import 'package:aitrainer_app/service/exercise_result_service.dart';
enum ResultType { running, man, woman, none }
+16 -8
View File
@@ -59,6 +59,11 @@ class UserRepository with Logging {
if (e.code == 'email-already-in-use') {
log('The account already exists for that email.');
throw Exception("The email address has been registered already");
} else if (e.code == 'weak-password') {
log('The password provided is too weak.');
throw Exception("Password too short");
} else {
throw Exception(e);
}
} on WorkoutTestException catch (ex) {
if (ex.code == WorkoutTestException.CUSTOMER_EXISTS) {
@@ -66,8 +71,8 @@ class UserRepository with Logging {
throw Exception("The email address has been registered already");
}
} on Exception catch (ex) {
log("Google exception: " + ex.toString());
throw Exception("Google Sign In failed");
log("FB exception: " + ex.toString());
throw Exception("Facebook Sign In failed");
}
}
@@ -90,6 +95,8 @@ class UserRepository with Logging {
if (e.code == 'email-already-in-use') {
log('The account already exists for that email.');
throw Exception("The email address has been registered already");
} else {
throw Exception(e);
}
} on WorkoutTestException catch (ex) {
if (ex.code == WorkoutTestException.CUSTOMER_EXISTS) {
@@ -167,17 +174,18 @@ class UserRepository with Logging {
Future<void> getUserByGoogle() async {
final User modelUser = this.user;
Map<String, dynamic> userData = await FirebaseApi().signInWithGoogle();
if (userData == null || userData['email'] == null) {
throw new Exception("Google login was not successful");
}
modelUser.email = userData['email'];
try {
Map<String, dynamic> userData = await FirebaseApi().signInWithGoogle();
if (userData == null || userData['email'] == null) {
throw new Exception("Google login was not successful");
}
modelUser.email = userData['email'];
await CustomerApi().getUserByEmail(modelUser.email);
await Cache().afterFirebaseLogin();
} on Exception catch (ex) {
log("Google exception: " + ex.toString());
throw Exception("Customer does not exist or the password is wrong");
throw Exception(ex);
}
}
+2 -3
View File
@@ -10,7 +10,6 @@ import 'package:aitrainer_app/service/exercise_tree_service.dart';
import 'package:aitrainer_app/service/exercisetype_service.dart';
import 'package:aitrainer_app/service/logging.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class Antagonist {
static String chest = "Chest";
@@ -48,7 +47,7 @@ class WorkoutTreeRepository with Logging {
Antagonist.calf: Antagonist.calfNr
};
Future<String> _buildImage(String imageUrl) async {
/* Future<String> _buildImage(String imageUrl) async {
String assetImage = 'asset/menu/' + imageUrl.substring(7);
//print("Loading image " + assetImage);
return rootBundle.load(assetImage).then((value) {
@@ -59,7 +58,7 @@ class WorkoutTreeRepository with Logging {
//print("Exception: " + assetImage + " will be loaded from the network " + url);
return url;
});
}
} */
Future<void> createTree() async {
isEnglish = AppLanguage().appLocal == Locale('en');