WT 1.1.22 reengineering: Training Plan execution, registration
This commit is contained in:
+29
-1
@@ -186,8 +186,8 @@ class Cache with Logging {
|
||||
Cache._internal() {
|
||||
String testEnv = EnvironmentConfig.test_env;
|
||||
this.testEnvironment = testEnv;
|
||||
print("testEnv $testEnv");
|
||||
if (testEnv == "1") {
|
||||
print("testEnv $testEnv");
|
||||
baseUrl = baseUrlTest;
|
||||
liveServer = false;
|
||||
}
|
||||
@@ -234,6 +234,17 @@ class Cache with Logging {
|
||||
sharedPreferences.setString(Cache.myTrainingPlanKey, myTrainingPlanJson);
|
||||
}
|
||||
|
||||
Future<void> deleteMyTrainingPlan() async {
|
||||
if (myTrainingPlan == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
SharedPreferences sharedPreferences;
|
||||
sharedPreferences = await prefs;
|
||||
sharedPreferences.remove(Cache.myTrainingPlanKey);
|
||||
}
|
||||
|
||||
Future<void> getMyTrainingPlan() async {
|
||||
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
SharedPreferences sharedPreferences;
|
||||
@@ -744,4 +755,21 @@ class Cache with Logging {
|
||||
|
||||
List<TrainingPlanDay> getTrainingPlanDays() => this._trainingPlanDays;
|
||||
setTrainingPlanDays(value) => this._trainingPlanDays = value;
|
||||
|
||||
bool canTrial() {
|
||||
if (Cache().userLoggedIn == null) {
|
||||
return false;
|
||||
}
|
||||
for (var element in _purchases) {
|
||||
if (element.customerId == Cache().userLoggedIn!.customerId) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (userLoggedIn!.trialDate != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class Customer {
|
||||
DateTime? dateChange;
|
||||
int? emailSubscription;
|
||||
int? sportId;
|
||||
DateTime? trialDate;
|
||||
|
||||
LinkedHashMap<String, CustomerProperty> properties = LinkedHashMap();
|
||||
|
||||
@@ -70,6 +71,7 @@ class Customer {
|
||||
this.dataPolicyAllowed = json['dataPolicyAllowed'];
|
||||
this.emailSubscription = json['emailSubscription'];
|
||||
this.sportId = json['sportId'];
|
||||
this.trialDate = json['trialDate'] == null ? null : DateTime.parse(json['trialDate']);
|
||||
|
||||
this.dateAdd = json['dateAdd'] == null ? DateTime.parse("0000-00-00") : DateTime.parse(json['dateAdd']);
|
||||
this.dateChange = json['dateChange'] == null ? DateTime.parse("0000-00-00") : DateTime.parse(json['dateChange']);
|
||||
@@ -93,7 +95,8 @@ class Customer {
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
||||
"dateChange": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateChange!),
|
||||
"emailSubscription": this.emailSubscription,
|
||||
"sportId": this.sportId
|
||||
"sportId": this.sportId,
|
||||
"trialDate": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.trialDate!),
|
||||
};
|
||||
|
||||
double getProperty(String propertyName) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
enum ExerciseAbility { oneRepMax, endurance, running, mini_test_set, paralell_test, training, none }
|
||||
enum ExerciseAbility { oneRepMax, endurance, running, mini_test_set, paralell_test, training, training_execute, none }
|
||||
|
||||
extension ExerciseAbilityExt on ExerciseAbility {
|
||||
String enumToString() => this.toString().split(".").last;
|
||||
|
||||
@@ -75,6 +75,7 @@ class WorkoutMenuTree {
|
||||
"is1RM": is1RM.toString(),
|
||||
"isRunning": isRunning.toString(),
|
||||
"sort": sort,
|
||||
"internalName": internalName,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user