WT1.1.3 logo change, error fixes

This commit is contained in:
bossanyit
2021-01-07 22:40:59 +01:00
parent 234a2f10e9
commit e6d0543021
119 changed files with 3580 additions and 1178 deletions
+25 -4
View File
@@ -17,9 +17,11 @@ import 'package:aitrainer_app/service/customer_service.dart';
import 'package:aitrainer_app/service/exercise_device_service.dart';
import 'package:aitrainer_app/service/exercise_tree_service.dart';
import 'package:aitrainer_app/service/exercisetype_service.dart';
import 'package:aitrainer_app/service/firebase_api.dart';
import 'package:aitrainer_app/service/logging.dart';
import 'package:aitrainer_app/util/env.dart';
import 'package:flurry/flurry.dart';
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:aitrainer_app/model/exercise_type.dart';
@@ -68,8 +70,11 @@ class Cache with Logging {
static final String password = 'andio2009';
String authToken = "";
AccessToken accessTokenFacebook;
Customer userLoggedIn;
String firebaseUid;
String facebookUid;
bool hasPurchased = false;
bool firstLoad = true;
@@ -196,7 +201,8 @@ class Cache with Logging {
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
userLoggedIn = customer;
await setPreferences(prefs, SharePrefsChange.registration, customer.customerId, Cache().firebaseUid);
final String uid = Cache().firebaseUid == null ? Cache().facebookUid : Cache().firebaseUid;
await setPreferences(prefs, SharePrefsChange.registration, customer.customerId, uid);
}
afterLogin(Customer customer) async {
@@ -211,7 +217,15 @@ class Cache with Logging {
await setPreferences(prefs, SharePrefsChange.login, userLoggedIn.customerId, Cache().firebaseUid);
}
afterFacebookLogin() async {
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
await setPreferences(prefs, SharePrefsChange.login, userLoggedIn.customerId, Cache().facebookUid);
}
logout() async {
if (this.accessTokenFacebook != null) {
await FirebaseApi().logOutFacebook();
}
userLoggedIn = null;
firebaseUid = null;
authToken = "";
@@ -249,7 +263,7 @@ class Cache with Logging {
sharedPreferences.setString(Cache.firebaseUidKey, null);
sharedPreferences.setString(authTokenKey, "");
}
initBadges();
await initBadges();
}
void setExerciseTypes(List<ExerciseType> exerciseTypes) {
@@ -374,7 +388,7 @@ class Cache with Logging {
}
}
void initBadges() {
Future<void> initBadges() async {
CustomerRepository customerRepository = CustomerRepository();
_badges = LinkedHashMap();
customerRepository.setCustomer(userLoggedIn);
@@ -422,7 +436,7 @@ class Cache with Logging {
Future<void> initCustomer(int customerId) async {
log(" *** initCustomer");
await CustomerApi().getCustomer(customerId);
Cache().startPage = "home";
Flurry.setUserId(customerId.toString());
final customerDevices = await CustomerExerciseDeviceApi().getDevices(customerId);
Cache().setCustomerDevices(customerDevices);
@@ -438,5 +452,12 @@ class Cache with Logging {
await customerRepository.getProductTests();
this.hasPurchased = this._purchases.isNotEmpty;
Cache().startPage = "home";
}
AccessToken get getAccessTokenFacebook => accessTokenFacebook;
set setAccessTokenFacebook(AccessToken accessTokenFacebook) => this.accessTokenFacebook = accessTokenFacebook;
String get getFacebookUid => facebookUid;
set setFacebookUid(String facebookUid) => this.facebookUid = facebookUid;
}