WT1.1.5 In-app-purchase
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user