WT1.1.6+3 bodyType animation, bug fixes
This commit is contained in:
@@ -4,3 +4,61 @@ extension LoginTypeExt on LoginType {
|
||||
bool equalsTo(LoginType type) => this.toString() == type.toString();
|
||||
bool equalsStringTo(String type) => this.toString() == type;
|
||||
}
|
||||
|
||||
enum TrackingEvent {
|
||||
enter,
|
||||
login,
|
||||
logout,
|
||||
registration,
|
||||
home,
|
||||
sizes,
|
||||
sizes_save,
|
||||
my_development,
|
||||
my_exerciseplan,
|
||||
account,
|
||||
settings,
|
||||
sales_page,
|
||||
purchase_request,
|
||||
purchase_successful,
|
||||
exercise_new,
|
||||
result,
|
||||
exercise_log,
|
||||
exercise_log_open,
|
||||
exercise_log_delete,
|
||||
exercise_log_result,
|
||||
my_body_development,
|
||||
my_muscle_development,
|
||||
my_size_development,
|
||||
my_custom_exercise_plan,
|
||||
my_custom_exercise_plan_save,
|
||||
my_exercise_plan_execute_open,
|
||||
my_exercise_plan_execute_save,
|
||||
my_special_plan,
|
||||
my_suggested_plan,
|
||||
prediction,
|
||||
|
||||
exercise_device,
|
||||
customer_change,
|
||||
settings_lang,
|
||||
settings_server
|
||||
}
|
||||
|
||||
T enumFromString<T>(Iterable<T> values, String value) {
|
||||
return values.firstWhere((type) => type.toString().split(".").last == value, orElse: () => null);
|
||||
}
|
||||
|
||||
extension TrackingEventExt on TrackingEvent {
|
||||
String enumToString() => this.toString().split(".").last;
|
||||
|
||||
bool equalsTo(TrackingEvent event) => this.toString() == event.toString();
|
||||
bool equalsStringTo(String event) => this.toString() == event;
|
||||
}
|
||||
|
||||
enum PropertyEnum { Ectomorph, Mesomorph, Endomorph }
|
||||
|
||||
extension PropertyExt on PropertyEnum {
|
||||
String toStr() => this.toString().split(".").last;
|
||||
|
||||
bool equalsTo(PropertyEnum event) => this.toString() == event.toString();
|
||||
bool equalsStringTo(String event) => this.toString() == event;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class RevenueCatPurchases with Logging {
|
||||
await Purchases.setup("yLxGFWaeRtThLImqznvBnUEKjgArSsZE", appUserId: Cache().userLoggedIn.customerId.toString());
|
||||
appUserId = await Purchases.appUserID;
|
||||
log("AppUserId: " + appUserId);
|
||||
await Purchases.setAllowSharingStoreAccount(true);
|
||||
await this.restore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,17 @@ import 'dart:io';
|
||||
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/main.dart';
|
||||
import 'package:aitrainer_app/service/api.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/service/package_service.dart';
|
||||
import 'package:aitrainer_app/service/product_service.dart';
|
||||
import 'package:aitrainer_app/service/property_service.dart';
|
||||
import 'package:aitrainer_app/util/purchases.dart';
|
||||
import 'package:aitrainer_app/util/track.dart';
|
||||
import 'package:devicelocale/devicelocale.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
|
||||
@@ -21,6 +25,7 @@ class Session with Logging {
|
||||
log(" -- Session: await prefs..");
|
||||
_sharedPreferences = await _prefs;
|
||||
print("Platform: " + Platform.localeName);
|
||||
Cache().packageInfo = await PackageInfo.fromPlatform();
|
||||
if (Cache().firstLoad) {
|
||||
log(" -- Session: fetch locale..");
|
||||
await AppLanguage().getLocale(_sharedPreferences);
|
||||
@@ -30,10 +35,6 @@ class Session with Logging {
|
||||
Cache().getHardware(_sharedPreferences);
|
||||
await _fetchToken(_sharedPreferences);
|
||||
await RevenueCatPurchases().initPlatform();
|
||||
//initDeviceLocale();
|
||||
|
||||
// Create the initialization Future outside of `build`:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +71,8 @@ class Session with Logging {
|
||||
prefs.setString(Cache.authTokenKey, responseJson['token']);
|
||||
Cache().authToken = responseJson['token'];
|
||||
Cache().firebaseUid = prefs.get(Cache.firebaseUidKey);
|
||||
await PropertyApi().getProperties();
|
||||
await ProductApi().getProducts();
|
||||
await PackageApi().getPackage();
|
||||
|
||||
if (prefs.get(Cache.customerIdKey) == null) {
|
||||
log("************** Registration");
|
||||
// registration
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:aitrainer_app/main.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/service/tracking_service.dart';
|
||||
import 'package:aitrainer_app/util/enums.dart';
|
||||
import 'package:flurry/flurry.dart';
|
||||
import 'package:aitrainer_app/model/tracking.dart' as model;
|
||||
|
||||
class Track with Logging {
|
||||
static final Track _singleton = Track._internal();
|
||||
|
||||
factory Track() {
|
||||
return _singleton;
|
||||
}
|
||||
|
||||
Track._internal();
|
||||
|
||||
void track(TrackingEvent event, {String eventValue = ""}) {
|
||||
if (!isInDebugMode) {
|
||||
Flurry.logEvent(event.toString());
|
||||
model.Tracking tracking = model.Tracking();
|
||||
tracking.customerId = Cache().userLoggedIn.customerId;
|
||||
tracking.event = event.enumToString();
|
||||
if (eventValue.isNotEmpty) {
|
||||
tracking.eventValue = eventValue;
|
||||
}
|
||||
tracking.dateAdd = DateTime.now();
|
||||
TrackingApi().saveTracking(tracking);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user