v1.0.3 webapi client
This commit is contained in:
+88
-93
@@ -139,7 +139,7 @@ class Cache with Logging {
|
||||
|
||||
List<ExerciseType>? _exerciseTypes;
|
||||
List<ExerciseTree>? _exerciseTree;
|
||||
List<Evaluation>? _evaluations;
|
||||
List<Evaluation>? evaluations;
|
||||
|
||||
List<Exercise>? _exercises;
|
||||
ExercisePlan? _myExercisePlan;
|
||||
@@ -196,7 +196,7 @@ class Cache with Logging {
|
||||
Cache._internal() {
|
||||
String testEnv = EnvironmentConfig.test_env;
|
||||
testEnvironment = testEnv;
|
||||
print("testEnv $testEnv");
|
||||
log("testEnv $testEnv");
|
||||
if (testEnv == "1") {
|
||||
baseUrl = baseUrlTest;
|
||||
liveServer = false;
|
||||
@@ -280,11 +280,11 @@ class Cache with Logging {
|
||||
//String jsonPlan = savedTrainingPlanJson.replaceAllMapped(RegExp(r'[a-zA-Z]+\:'), (Match m) => "\"${m[0]}\"");
|
||||
Map<String, dynamic> map;
|
||||
try {
|
||||
map = JsonDecoder().convert(savedTrainingPlanJson);
|
||||
//print("Training plan: $savedTrainingPlanJson");
|
||||
this.myTrainingPlan = CustomerTrainingPlan.fromJsonWithDetails(map);
|
||||
map = const JsonDecoder().convert(savedTrainingPlanJson);
|
||||
//log("Training plan: $savedTrainingPlanJson");
|
||||
myTrainingPlan = CustomerTrainingPlan.fromJsonWithDetails(map);
|
||||
} on Exception catch (e) {
|
||||
print(e.toString());
|
||||
log(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,8 +294,8 @@ class Cache with Logging {
|
||||
sharedPreferences = await prefs;
|
||||
|
||||
sharedPreferences.remove(Cache.activeExercisePlanDateKey);
|
||||
this.activeExercisePlan = null;
|
||||
this.activeExercisePlanDetails = null;
|
||||
activeExercisePlan = null;
|
||||
activeExercisePlanDetails = null;
|
||||
}
|
||||
|
||||
Future<void> getActiveExercisePlan() async {
|
||||
@@ -312,29 +312,29 @@ class Cache with Logging {
|
||||
DateTime savedPlanDate;
|
||||
|
||||
savedPlanDate = format.parse(savedPlanDateString);
|
||||
print("Saved plan: $savedPlanDate");
|
||||
log("Saved plan: $savedPlanDate");
|
||||
|
||||
final DateTime now = DateTime.now();
|
||||
final DateTime added = savedPlanDate.add(Duration(days: 1));
|
||||
final DateTime added = savedPlanDate.add(const Duration(days: 1));
|
||||
if (added.isBefore(now)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String? exercisePlanJson = sharedPreferences.getString(Cache.activeExercisePlanKey);
|
||||
if (exercisePlanJson != null) {
|
||||
final Map<String, dynamic> map = JsonDecoder().convert(exercisePlanJson);
|
||||
this.activeExercisePlan = ExercisePlan.fromJson(map);
|
||||
final Map<String, dynamic> map = const JsonDecoder().convert(exercisePlanJson);
|
||||
activeExercisePlan = ExercisePlan.fromJson(map);
|
||||
}
|
||||
|
||||
String? detailsJson = sharedPreferences.getString(Cache.activeExercisePlanDetailsKey);
|
||||
if (detailsJson != null) {
|
||||
Iterable json = jsonDecode(detailsJson);
|
||||
this.activeExercisePlanDetails = json.map((details) => ExercisePlanDetail.fromJsonWithExerciseList(details)).toList();
|
||||
activeExercisePlanDetails = json.map((details) => ExercisePlanDetail.fromJsonWithExerciseList(details)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setServer(bool live) async {
|
||||
if (this.testEnvironment == "1") {
|
||||
if (testEnvironment == "1") {
|
||||
liveServer = false;
|
||||
live = false;
|
||||
}
|
||||
@@ -366,23 +366,23 @@ class Cache with Logging {
|
||||
SharedPreferences sharedPreferences;
|
||||
sharedPreferences = await prefs;
|
||||
sharedPreferences.setBool(Cache.hardwareKey, hasHardware);
|
||||
this.hasHardware = hasHardware;
|
||||
hasHardware = hasHardware;
|
||||
}
|
||||
|
||||
void setServerAddress(SharedPreferences prefs) {
|
||||
if (testEnvironment == "1") {
|
||||
baseUrl = baseUrlTest;
|
||||
print("TestEnv $baseUrl");
|
||||
log("TestEnv $baseUrl");
|
||||
return;
|
||||
} else if ( testEnvironment == "2") {
|
||||
baseUrl = baseUrlLocal;
|
||||
print("TestEnv $baseUrl");
|
||||
log("TestEnv $baseUrl");
|
||||
return;
|
||||
}
|
||||
final bool? live = prefs.getBool(Cache.serverKey);
|
||||
if (live == null) {
|
||||
baseUrl = baseUrlLive;
|
||||
print("Live Env $baseUrl");
|
||||
log("Live Env $baseUrl");
|
||||
liveServer = true;
|
||||
return;
|
||||
}
|
||||
@@ -393,7 +393,7 @@ class Cache with Logging {
|
||||
baseUrl = baseUrlTest;
|
||||
}
|
||||
|
||||
print("Env $baseUrl");
|
||||
log("Env $baseUrl");
|
||||
}
|
||||
|
||||
Future<void> setLoginTypeFromPrefs() async {
|
||||
@@ -410,7 +410,7 @@ class Cache with Logging {
|
||||
} else if (loginType == LoginType.email.toString()) {
|
||||
type = LoginType.email;
|
||||
}
|
||||
//print("LoginType: " + loginType == null ? "NULL" : loginType);
|
||||
//log("LoginType: " + loginType == null ? "NULL" : loginType);
|
||||
Cache().setLoginType(type);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ class Cache with Logging {
|
||||
}
|
||||
|
||||
logout() async {
|
||||
if (this.accessTokenFacebook != null) {
|
||||
if (accessTokenFacebook != null) {
|
||||
await FirebaseApi().logOutFacebook();
|
||||
}
|
||||
userLoggedIn = null;
|
||||
@@ -472,7 +472,7 @@ class Cache with Logging {
|
||||
_traineeExercisePlan = null;
|
||||
_exercises = [];
|
||||
_myExercisesPlanDetails = LinkedHashMap();
|
||||
log("Trainees is null? " + (_trainee == null).toString());
|
||||
log("Trainees is null? ${_trainee == null}");
|
||||
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
await setPreferences(prefs, SharePrefsChange.logout, 0, "");
|
||||
}
|
||||
@@ -504,60 +504,60 @@ class Cache with Logging {
|
||||
}
|
||||
|
||||
void setExerciseTypes(List<ExerciseType> exerciseTypes) {
|
||||
this._exerciseTypes = exerciseTypes;
|
||||
_exerciseTypes = exerciseTypes;
|
||||
}
|
||||
|
||||
void setExerciseTree(List<ExerciseTree> exerciseTree) {
|
||||
this._exerciseTree = exerciseTree;
|
||||
_exerciseTree = exerciseTree;
|
||||
}
|
||||
|
||||
void setExercises(List<Exercise> exercises) => this._exercises = exercises;
|
||||
void setExercises(List<Exercise> exercises) => _exercises = exercises;
|
||||
|
||||
void setExercisesTrainee(List<Exercise> exercises) {
|
||||
this._exercisesTrainee = exercises;
|
||||
_exercisesTrainee = exercises;
|
||||
}
|
||||
|
||||
void setWorkoutMenuTree(LinkedHashMap<String, WorkoutMenuTree> tree) {
|
||||
this._tree = tree;
|
||||
_tree = tree;
|
||||
}
|
||||
|
||||
List<ExerciseType>? getExerciseTypes() => this._exerciseTypes;
|
||||
List<ExerciseType>? getExerciseTypes() => _exerciseTypes;
|
||||
|
||||
ExerciseType? getExerciseTypeById(int exerciseTypeId) {
|
||||
ExerciseType? exerciseType;
|
||||
if (_exerciseTypes != null) {
|
||||
this._exerciseTypes!.forEach((element) {
|
||||
for (var element in _exerciseTypes!) {
|
||||
if (element.exerciseTypeId == exerciseTypeId) {
|
||||
exerciseType = element;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return exerciseType;
|
||||
}
|
||||
|
||||
List<ExerciseTree>? getExerciseTree() => this._exerciseTree;
|
||||
List<ExerciseTree>? getExerciseTree() => _exerciseTree;
|
||||
|
||||
List<Exercise>? getExercises() => this._exercises;
|
||||
List<Exercise>? getExercises() => _exercises;
|
||||
|
||||
List<Exercise>? getExercisesTrainee() => this._exercisesTrainee;
|
||||
List<Exercise>? getExercisesTrainee() => _exercisesTrainee;
|
||||
|
||||
LinkedHashMap<String, WorkoutMenuTree> getWorkoutMenuTree() => this._tree;
|
||||
LinkedHashMap<String, WorkoutMenuTree> getWorkoutMenuTree() => _tree;
|
||||
|
||||
void setPercentExercises(double percent) => this._percentExercises = percent;
|
||||
void setPercentExercises(double percent) => _percentExercises = percent;
|
||||
|
||||
double getPercentExercises() => this._percentExercises;
|
||||
double getPercentExercises() => _percentExercises;
|
||||
|
||||
void addExercise(Exercise exercise) => _exercises!.add(exercise);
|
||||
|
||||
void addExerciseTrainee(Exercise exercise) => _exercisesTrainee!.add(exercise);
|
||||
|
||||
Customer? getTrainee() => this._trainee;
|
||||
Customer? getTrainee() => _trainee;
|
||||
|
||||
void setTrainee(Customer trainee) => _trainee = trainee;
|
||||
|
||||
void setTraineeExercisePlan(ExercisePlan exercisePlan) => this._traineeExercisePlan = exercisePlan;
|
||||
void setTraineeExercisePlan(ExercisePlan exercisePlan) => _traineeExercisePlan = exercisePlan;
|
||||
|
||||
ExercisePlan? getTraineesExercisePlan() => this._traineeExercisePlan;
|
||||
ExercisePlan? getTraineesExercisePlan() => _traineeExercisePlan;
|
||||
|
||||
void setMyExercisePlan(ExercisePlan exercisePlan) => _myExercisePlan = exercisePlan;
|
||||
|
||||
@@ -573,31 +573,31 @@ class Cache with Logging {
|
||||
void resetMyExercisePlanDetails() => _myExercisesPlanDetails = LinkedHashMap<int, ExercisePlanDetail>();
|
||||
|
||||
void updateMyExercisePlanDetail(ExercisePlanDetail detail) {
|
||||
this.addToMyExercisePlanDetails(detail);
|
||||
addToMyExercisePlanDetails(detail);
|
||||
}
|
||||
|
||||
void deleteMyExercisePlanDetail(ExercisePlanDetail detail) => this.deleteMyExercisePlanDetailByExerciseTypeId(detail.exerciseTypeId);
|
||||
void deleteMyExercisePlanDetail(ExercisePlanDetail detail) => deleteMyExercisePlanDetailByExerciseTypeId(detail.exerciseTypeId);
|
||||
|
||||
void deletedMyExercisePlanDetail(ExercisePlanDetail detail) =>
|
||||
this._myExercisesPlanDetails[detail.exerciseTypeId]!.change = ModelChange.deleted;
|
||||
_myExercisesPlanDetails[detail.exerciseTypeId]!.change = ModelChange.deleted;
|
||||
|
||||
void deleteMyExercisePlanDetailByExerciseTypeId(int exerciseTypeId) {
|
||||
this._myExercisesPlanDetails[exerciseTypeId]!.change = ModelChange.delete;
|
||||
_myExercisesPlanDetails[exerciseTypeId]!.change = ModelChange.delete;
|
||||
}
|
||||
|
||||
void setProperties(List<Property> properties) => this._properties = properties;
|
||||
void setProperties(List<Property> properties) => _properties = properties;
|
||||
List<Property>? getProperties() => _properties;
|
||||
|
||||
List<Sport>? getSports() => _sports;
|
||||
void setSports(List<Sport> sports) => this._sports = sports;
|
||||
void setSports(List<Sport> sports) => _sports = sports;
|
||||
|
||||
void setDevices(List<ExerciseDevice> devices) => this._devices = devices;
|
||||
void setDevices(List<ExerciseDevice> devices) => _devices = devices;
|
||||
|
||||
List<ExerciseDevice>? getDevices() => this._devices;
|
||||
List<ExerciseDevice>? getDevices() => _devices;
|
||||
|
||||
void setCustomerDevices(List<CustomerExerciseDevice> devices) => this._customerDevices = devices;
|
||||
void setCustomerDevices(List<CustomerExerciseDevice> devices) => _customerDevices = devices;
|
||||
|
||||
List<CustomerExerciseDevice>? getCustomerDevices() => this._customerDevices;
|
||||
List<CustomerExerciseDevice>? getCustomerDevices() => _customerDevices;
|
||||
|
||||
LinkedHashMap getBadges() => _badges;
|
||||
|
||||
@@ -634,17 +634,17 @@ class Cache with Logging {
|
||||
return;
|
||||
}
|
||||
customerRepository.setCustomer(userLoggedIn!);
|
||||
int _ecto = customerRepository.getCustomerPropertyValue(PropertyEnum.Ectomorph.toStr()).toInt();
|
||||
int _mezo = customerRepository.getCustomerPropertyValue(PropertyEnum.Mesomorph.toStr()).toInt();
|
||||
int _endo = customerRepository.getCustomerPropertyValue(PropertyEnum.Endomorph.toStr()).toInt();
|
||||
int ecto = customerRepository.getCustomerPropertyValue(PropertyEnum.Ectomorph.toStr()).toInt();
|
||||
int mezo = customerRepository.getCustomerPropertyValue(PropertyEnum.Mesomorph.toStr()).toInt();
|
||||
int endo = customerRepository.getCustomerPropertyValue(PropertyEnum.Endomorph.toStr()).toInt();
|
||||
|
||||
//print("endo " + _endo.toString() + " mezo " + _mezo.toString());
|
||||
if (this.userLoggedIn != null) {
|
||||
if (this.userLoggedIn!.birthYear == null || this.userLoggedIn!.birthYear == 0) {
|
||||
//log("endo " + _endo.toString() + " mezo " + _mezo.toString());
|
||||
if (userLoggedIn != null) {
|
||||
if (userLoggedIn!.birthYear == null || userLoggedIn!.birthYear == 0) {
|
||||
setBadge("personalData", true);
|
||||
setBadge("account", true);
|
||||
}
|
||||
if (this._customerDevices == null || this._customerDevices!.isEmpty) {
|
||||
if (_customerDevices == null || _customerDevices!.isEmpty) {
|
||||
setBadge("customerDevice", true);
|
||||
setBadge("account", true);
|
||||
}
|
||||
@@ -662,11 +662,11 @@ class Cache with Logging {
|
||||
setBadge("My Body", true);
|
||||
setBadgeNr("home", 1);
|
||||
}
|
||||
if (_ecto == 0 && _mezo == 0 && _endo == 0) {
|
||||
if (ecto == 0 && mezo == 0 && endo == 0) {
|
||||
setBadge("account", true);
|
||||
setBadge("bodyType", true);
|
||||
}
|
||||
if (this._exercises == null || this._exercises!.isEmpty) {
|
||||
if (_exercises == null || _exercises!.isEmpty) {
|
||||
setBadge("home", true);
|
||||
setBadge("Custom Tests", true);
|
||||
setBadge("Start Training", true);
|
||||
@@ -685,7 +685,7 @@ class Cache with Logging {
|
||||
setBadge("FitnessLevel", true);
|
||||
setBadge("account", true);
|
||||
}
|
||||
if (this._exercises != null && this._exercises!.isNotEmpty) {
|
||||
if (_exercises != null && _exercises!.isNotEmpty) {
|
||||
if (!activitiesDone[ActivityDone.isExerciseLogSeen.toStr()]!) {
|
||||
setBadge("exerciseLog", true);
|
||||
setBadge("development", true);
|
||||
@@ -696,7 +696,7 @@ class Cache with Logging {
|
||||
}
|
||||
}
|
||||
}
|
||||
log("Badges: " + _badges.toString());
|
||||
log("Badges: $_badges");
|
||||
}
|
||||
|
||||
List<Product>? get products => _products;
|
||||
@@ -727,11 +727,11 @@ class Cache with Logging {
|
||||
}
|
||||
|
||||
await Future.forEach(ActivityDone.values, (element) async {
|
||||
ActivityDone activity = element as ActivityDone;
|
||||
ActivityDone activity = element;
|
||||
await isActivityDonePrefs(activity);
|
||||
});
|
||||
|
||||
print("Firebase token save: $firebaseMessageToken");
|
||||
log("Firebase token save: $firebaseMessageToken");
|
||||
if (firebaseMessageToken != null) {
|
||||
userLoggedIn!.firebaseRegToken = firebaseMessageToken;
|
||||
CustomerRepository customerRepository = CustomerRepository();
|
||||
@@ -745,13 +745,13 @@ class Cache with Logging {
|
||||
}
|
||||
|
||||
AccessToken? get getAccessTokenFacebook => accessTokenFacebook;
|
||||
set setAccessTokenFacebook(AccessToken accessTokenFacebook) => this.accessTokenFacebook = accessTokenFacebook;
|
||||
set setAccessTokenFacebook(AccessToken accessTokenFacebook) => accessTokenFacebook = accessTokenFacebook;
|
||||
|
||||
LoginType? getLoginType() => loginType;
|
||||
void setLoginType(LoginType type) => this.loginType = type;
|
||||
void setLoginType(LoginType type) => loginType = type;
|
||||
|
||||
List get exercisePlanTemplates => this._exercisePlanTemplates;
|
||||
setExercisePlanTemplates(value) => this._exercisePlanTemplates = value;
|
||||
List get exercisePlanTemplates => _exercisePlanTemplates;
|
||||
setExercisePlanTemplates(value) => _exercisePlanTemplates = value;
|
||||
|
||||
isActivityDonePrefs(ActivityDone activity) async {
|
||||
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
@@ -772,42 +772,37 @@ class Cache with Logging {
|
||||
|
||||
bool isActivityDone(ActivityDone activity) => activitiesDone[activity.toStr()] == true;
|
||||
|
||||
List<Evaluation>? get evaluations => this._evaluations;
|
||||
set evaluations(List<Evaluation>? value) => this._evaluations = value;
|
||||
List<CustomerActivity>? get customerActivities => _customerActivities;
|
||||
setCustomerActivities(List<CustomerActivity>? value) => _customerActivities = value;
|
||||
|
||||
List<CustomerActivity>? get customerActivities => this._customerActivities;
|
||||
setCustomerActivities(List<CustomerActivity>? value) => this._customerActivities = value;
|
||||
List<Tutorial>? get tutorials => _tutorials;
|
||||
setTutorials(List<Tutorial>? value) => _tutorials = value;
|
||||
|
||||
List<Tutorial>? get tutorials => this._tutorials;
|
||||
setTutorials(List<Tutorial>? value) => this._tutorials = value;
|
||||
FirebaseRemoteConfig? getRemoteConfig() => remoteConfig;
|
||||
setRemoteConfig(FirebaseRemoteConfig? remoteConfig) => remoteConfig = remoteConfig;
|
||||
|
||||
FirebaseRemoteConfig? getRemoteConfig() => this.remoteConfig;
|
||||
setRemoteConfig(FirebaseRemoteConfig? remoteConfig) => this.remoteConfig = remoteConfig;
|
||||
List<Description>? getDescriptions() => _descriptions;
|
||||
setDescriptions(List<Description>? value) => _descriptions = value;
|
||||
|
||||
List<Description>? getDescriptions() => this._descriptions;
|
||||
setDescriptions(List<Description>? value) => this._descriptions = value;
|
||||
List<Faq>? getFaqs() => _faqs;
|
||||
setFaqs(List<Faq>? value) => _faqs = value;
|
||||
|
||||
List<Faq>? getFaqs() => this._faqs;
|
||||
setFaqs(List<Faq>? value) => this._faqs = value;
|
||||
List<TrainingPlan>? getTrainingPlans() => _trainingPlans;
|
||||
setTrainingPlans(List<TrainingPlan>? value) => _trainingPlans = value;
|
||||
|
||||
List<TrainingPlan>? getTrainingPlans() => this._trainingPlans;
|
||||
setTrainingPlans(List<TrainingPlan>? value) => this._trainingPlans = value;
|
||||
List<CustomerTrainingPlan>? getCustomerTrainingPlans() => _customerTrainingPlans;
|
||||
setCustomerTrainingPlans(value) => _customerTrainingPlans = value;
|
||||
|
||||
List<CustomerTrainingPlan>? getCustomerTrainingPlans() => this._customerTrainingPlans;
|
||||
setCustomerTrainingPlans(value) => this._customerTrainingPlans = value;
|
||||
List<SplitTest> getSplitTests() => _splitTests;
|
||||
setSplitTests(value) => _splitTests = value;
|
||||
|
||||
List<SplitTest> getSplitTests() => this._splitTests;
|
||||
setSplitTests(value) => this._splitTests = value;
|
||||
List<TrainingPlanDay> getTrainingPlanDays() => _trainingPlanDays;
|
||||
setTrainingPlanDays(value) => _trainingPlanDays = value;
|
||||
|
||||
List<TrainingPlanDay> getTrainingPlanDays() => this._trainingPlanDays;
|
||||
setTrainingPlanDays(value) => this._trainingPlanDays = value;
|
||||
|
||||
List<CustomerProperty>? getCustomerPropertyAll() => this._customerPropertyAll;
|
||||
setCustomerPropertyAll(value) => this._customerPropertyAll = value;
|
||||
List<CustomerProperty>? getCustomerPropertyAll() => _customerPropertyAll;
|
||||
setCustomerPropertyAll(value) => _customerPropertyAll = value;
|
||||
addCustomerProperty(CustomerProperty property) {
|
||||
if (this._customerPropertyAll == null) {
|
||||
this._customerPropertyAll = [];
|
||||
}
|
||||
this._customerPropertyAll!.add(property);
|
||||
_customerPropertyAll ??= [];
|
||||
_customerPropertyAll!.add(property);
|
||||
}
|
||||
}
|
||||
|
||||
+55
-55
@@ -33,56 +33,56 @@ class Customer {
|
||||
LinkedHashMap<String, CustomerProperty> properties = LinkedHashMap();
|
||||
|
||||
Customer(
|
||||
{this.customerId,
|
||||
this.name,
|
||||
this.firstname,
|
||||
this.email,
|
||||
this.sex,
|
||||
this.age,
|
||||
this.active,
|
||||
this.password,
|
||||
this.birthYear,
|
||||
this.bodyType,
|
||||
this.fitnessLevel,
|
||||
this.goal,
|
||||
this.admin,
|
||||
this.trainer,
|
||||
this.dataPolicyAllowed,
|
||||
this.firebaseUid,
|
||||
this.dateAdd,
|
||||
this.dateChange}) {
|
||||
{customerId,
|
||||
name,
|
||||
firstname,
|
||||
email,
|
||||
sex,
|
||||
age,
|
||||
active,
|
||||
password,
|
||||
birthYear,
|
||||
bodyType,
|
||||
fitnessLevel,
|
||||
goal,
|
||||
admin,
|
||||
trainer,
|
||||
dataPolicyAllowed,
|
||||
firebaseUid,
|
||||
dateAdd,
|
||||
dateChange}) {
|
||||
dateAdd = DateTime.now();
|
||||
dateChange = DateTime.now();
|
||||
}
|
||||
|
||||
Customer.fromJson(Map json) {
|
||||
this.customerId = json['customerId'];
|
||||
this.name = json['name'];
|
||||
this.firstname = json['firstname'];
|
||||
this.email = json['email'];
|
||||
this.sex = json['sex'];
|
||||
this.age = json['age'];
|
||||
this.active = json['active'];
|
||||
this.birthYear = json['birthYear'];
|
||||
this.bodyType = json['bodyType'];
|
||||
this.fitnessLevel = json['fitnessLevel'];
|
||||
this.goal = json['goal'];
|
||||
this.admin = json['admin'];
|
||||
this.lifeLong = json['lifeLong'];
|
||||
customerId = json['customerId'];
|
||||
name = json['name'];
|
||||
firstname = json['firstname'];
|
||||
email = json['email'];
|
||||
sex = json['sex'];
|
||||
age = json['age'];
|
||||
active = json['active'];
|
||||
birthYear = json['birthYear'];
|
||||
bodyType = json['bodyType'];
|
||||
fitnessLevel = json['fitnessLevel'];
|
||||
goal = json['goal'];
|
||||
admin = json['admin'];
|
||||
lifeLong = json['lifeLong'];
|
||||
|
||||
this.trainer = json['trainer'];
|
||||
this.firebaseUid = json['firebaseUid'];
|
||||
this.firebaseRegToken = json['firebaseRegToken'];
|
||||
this.lang = json['lang'];
|
||||
trainer = json['trainer'];
|
||||
firebaseUid = json['firebaseUid'];
|
||||
firebaseRegToken = json['firebaseRegToken'];
|
||||
lang = json['lang'];
|
||||
|
||||
this.dataPolicyAllowed = json['dataPolicyAllowed'];
|
||||
this.emailSubscription = json['emailSubscription'];
|
||||
this.sportId = json['sportId'];
|
||||
this.syncedDate = json['syncedDate'] == null ? null : DateTime.parse(json['syncedDate']);
|
||||
this.trialDate = json['trialDate'] == null ? null : DateTime.parse(json['trialDate']);
|
||||
dataPolicyAllowed = json['dataPolicyAllowed'];
|
||||
emailSubscription = json['emailSubscription'];
|
||||
sportId = json['sportId'];
|
||||
syncedDate = json['syncedDate'] == null ? null : DateTime.parse(json['syncedDate']);
|
||||
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']);
|
||||
dateAdd = json['dateAdd'] == null ? DateTime.parse("0000-00-00") : DateTime.parse(json['dateAdd']);
|
||||
dateChange = json['dateChange'] == null ? DateTime.parse("0000-00-00") : DateTime.parse(json['dateChange']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -100,29 +100,29 @@ class Customer {
|
||||
"admin": admin,
|
||||
"trainer": trainer,
|
||||
"dataPolicyAllowed": dataPolicyAllowed,
|
||||
"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,
|
||||
"syncedDate": this.syncedDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(this.syncedDate!),
|
||||
"trialDate": this.trialDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(this.trialDate!),
|
||||
"firebaseRegToken": this.firebaseRegToken,
|
||||
"lang": this.lang,
|
||||
"lifeLong": this.lifeLong,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
|
||||
"dateChange": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateChange!),
|
||||
"emailSubscription": emailSubscription,
|
||||
"sportId": sportId,
|
||||
"syncedDate": syncedDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(syncedDate!),
|
||||
"trialDate": trialDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(trialDate!),
|
||||
"firebaseRegToken": firebaseRegToken,
|
||||
"lang": lang,
|
||||
"lifeLong": lifeLong,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
|
||||
double getProperty(String propertyName) {
|
||||
if (this.properties[propertyName] == null) {
|
||||
if (properties[propertyName] == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return this.properties[propertyName]!.propertyValue;
|
||||
return properties[propertyName]!.propertyValue;
|
||||
}
|
||||
}
|
||||
|
||||
setProperty(String propertyName, double value) {
|
||||
this.properties[propertyName]!.propertyValue = value;
|
||||
properties[propertyName]!.propertyValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CustomerActivity {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CustomerExerciseDevice {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:intl/intl.dart';
|
||||
import '../util/logging.dart';
|
||||
|
||||
@@ -14,10 +13,10 @@ class CustomerProperty with Logging {
|
||||
bool newData = false;
|
||||
|
||||
CustomerProperty(
|
||||
{required this.propertyId,
|
||||
required this.customerId,
|
||||
required this.dateAdd,
|
||||
required this.propertyValue});
|
||||
{required propertyId,
|
||||
required customerId,
|
||||
required dateAdd,
|
||||
required propertyValue});
|
||||
|
||||
CustomerProperty.fromJson(Map json) {
|
||||
customerPropertyId = json['customerPropertyId'];
|
||||
@@ -33,38 +32,39 @@ class CustomerProperty with Logging {
|
||||
|
||||
propertyValue = json['propertyValue'];
|
||||
|
||||
print("Json $json, ${toString()}");
|
||||
log("Json $json, ${toString()}");
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
if (customerPropertyId != null) {
|
||||
return {
|
||||
"customerPropertyId": this.customerPropertyId,
|
||||
"propertyId": this.propertyId,
|
||||
"customerId": this.customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
||||
"propertyValue": this.propertyValue
|
||||
"customerPropertyId": customerPropertyId,
|
||||
"propertyId": propertyId,
|
||||
"customerId": customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
|
||||
"propertyValue": propertyValue
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
"propertyId": this.propertyId,
|
||||
"customerId": this.customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
||||
"propertyValue": this.propertyValue
|
||||
"propertyId": propertyId,
|
||||
"customerId": customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
|
||||
"propertyValue": propertyValue
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
"customerPropertyId": this.customerPropertyId,
|
||||
"propertyId": this.propertyId,
|
||||
"customerId": this.customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
||||
"propertyValue": this.propertyValue,
|
||||
"dateYmd": this.dateYmd,
|
||||
"dateYm": this.dateYm,
|
||||
"dateY": this.dateY,
|
||||
"customerPropertyId": customerPropertyId,
|
||||
"propertyId": propertyId,
|
||||
"customerId": customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
|
||||
"propertyValue": propertyValue,
|
||||
"dateYmd": dateYmd,
|
||||
"dateYm": dateYm,
|
||||
"dateY": dateY,
|
||||
};
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:convert';
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:workouttest_util/repository/exercise_type_repository.dart';
|
||||
|
||||
import 'package:workouttest_util/model/customer_training_plan_details.dart';
|
||||
import 'package:workouttest_util/util/logging.dart';
|
||||
|
||||
enum CustomerTrainingPlanType { custom, template, none }
|
||||
|
||||
@@ -14,7 +14,7 @@ extension CustomerTrainingPlanTypeExt on CustomerTrainingPlanType {
|
||||
bool equalsStringTo(String type) => toStr() == type;
|
||||
}
|
||||
|
||||
class CustomerTrainingPlan {
|
||||
class CustomerTrainingPlan with Logging {
|
||||
int? customerTrainingPlanId;
|
||||
int? customerId;
|
||||
int? trainingPlanId;
|
||||
@@ -59,15 +59,15 @@ class CustomerTrainingPlan {
|
||||
jsonDetails =
|
||||
jsonDetails.replaceAllMapped(RegExp(r'([0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})'), (Match m) => "\"${m[0]}\"");
|
||||
|
||||
print("detail: $jsonDetails");
|
||||
log("detail: $jsonDetails");
|
||||
|
||||
Iterable iterable = jsonDecode(jsonDetails);
|
||||
this.details = iterable.map((detail) => CustomerTrainingPlanDetails.fromJsonWithExerciseList(detail)).toList();
|
||||
this.details.forEach((detail) {
|
||||
for (var detail in this.details) {
|
||||
detail.alternatives = ExerciseTypeRepository.getExerciseTypeAlternatives(detail.exerciseTypeId);
|
||||
});
|
||||
}
|
||||
} on Exception catch (e) {
|
||||
print("JsonDecode error " + e.toString());
|
||||
log("JsonDecode error $e");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ import 'package:workouttest_util/model/exercise.dart';
|
||||
import 'package:workouttest_util/model/exercise_plan_detail.dart';
|
||||
import 'package:workouttest_util/model/exercise_type.dart';
|
||||
import 'package:workouttest_util/repository/training_plan_day_repository.dart';
|
||||
import 'package:workouttest_util/util/logging.dart';
|
||||
|
||||
class CustomerTrainingPlanDetails {
|
||||
class CustomerTrainingPlanDetails with Logging {
|
||||
/// customerTrainingPlanDetails
|
||||
int? customerTrainingPlanDetailsId;
|
||||
|
||||
@@ -45,86 +46,86 @@ class CustomerTrainingPlanDetails {
|
||||
CustomerTrainingPlanDetails();
|
||||
|
||||
CustomerTrainingPlanDetails.fromJson(Map json) {
|
||||
this.customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.set = json['set'];
|
||||
this.repeats = json['repeats'];
|
||||
this.weight = json['weight'];
|
||||
this.restingTime = json['restingTime'];
|
||||
this.parallel = json['parallel'];
|
||||
this.day = json['day'];
|
||||
customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
set = json['set'];
|
||||
repeats = json['repeats'];
|
||||
weight = json['weight'];
|
||||
restingTime = json['restingTime'];
|
||||
parallel = json['parallel'];
|
||||
day = json['day'];
|
||||
}
|
||||
|
||||
CustomerTrainingPlanDetails.fromJsonWithExerciseList(Map json) {
|
||||
this.customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'] == "null" || json['customerTrainingPlanDetailsId'] == null
|
||||
customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'] == "null" || json['customerTrainingPlanDetailsId'] == null
|
||||
? 0
|
||||
: json['customerTrainingPlanDetailsId'];
|
||||
this.trainingPlanDetailsId = json['trainingPlanDetailsId'] == "null" ? 0 : json['trainingPlanDetailsId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.set = json['set'];
|
||||
this.repeats = json['repeats'] == "null" ? -1 : json['repeats'];
|
||||
this.weight = json['weight'] == "null" ? 0 : json['weight'];
|
||||
this.restingTime = json['restingTime'];
|
||||
this.parallel = json['parallel'] == "false"
|
||||
trainingPlanDetailsId = json['trainingPlanDetailsId'] == "null" ? 0 : json['trainingPlanDetailsId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
set = json['set'];
|
||||
repeats = json['repeats'] == "null" ? -1 : json['repeats'];
|
||||
weight = json['weight'] == "null" ? 0 : json['weight'];
|
||||
restingTime = json['restingTime'];
|
||||
parallel = json['parallel'] == "false"
|
||||
? false
|
||||
: json['parallel'] == "true"
|
||||
? true
|
||||
: null;
|
||||
this.dayId = json['dayId'] == "null" ? null : json['dayId'];
|
||||
TrainingPlanDayRepository trainingPlanDayRepository = TrainingPlanDayRepository();
|
||||
this.day = trainingPlanDayRepository.getNameById(this.dayId);
|
||||
dayId = json['dayId'] == "null" ? null : json['dayId'];
|
||||
TrainingPlanDayRepository trainingPlanDayRepository = const TrainingPlanDayRepository();
|
||||
day = trainingPlanDayRepository.getNameById(dayId);
|
||||
|
||||
try {
|
||||
Iterable iterable = json['exercises'];
|
||||
this.exercises = iterable.map((exercise) => Exercise.fromJson(exercise)).toList();
|
||||
exercises = iterable.map((exercise) => Exercise.fromJson(exercise)).toList();
|
||||
} on Exception catch (e) {
|
||||
print("JsonDecode error " + e.toString());
|
||||
log("JsonDecode error $e");
|
||||
}
|
||||
|
||||
if (json['state'] == ExercisePlanDetailState.finished.toStr()) {
|
||||
this.state = ExercisePlanDetailState.finished;
|
||||
state = ExercisePlanDetailState.finished;
|
||||
} else if (json['state'] == ExercisePlanDetailState.inProgress.toStr()) {
|
||||
this.state = ExercisePlanDetailState.inProgress;
|
||||
state = ExercisePlanDetailState.inProgress;
|
||||
} else if (json['state'] == ExercisePlanDetailState.skipped.toStr()) {
|
||||
this.state = ExercisePlanDetailState.skipped;
|
||||
state = ExercisePlanDetailState.skipped;
|
||||
} else {
|
||||
this.state = ExercisePlanDetailState.start;
|
||||
state = ExercisePlanDetailState.start;
|
||||
}
|
||||
this.isTest = json['isTest'] == "true" ? true : false;
|
||||
isTest = json['isTest'] == "true" ? true : false;
|
||||
|
||||
this.exerciseType = Cache().getExerciseTypeById(exerciseTypeId!);
|
||||
exerciseType = Cache().getExerciseTypeById(exerciseTypeId!);
|
||||
|
||||
this.baseOneRepMax = json['baseOneRepMax'] == null ? 0 : json['baseOneRepMax'];
|
||||
baseOneRepMax = json['baseOneRepMax'] ?? 0;
|
||||
}
|
||||
|
||||
ExerciseType? getExerciseType() => exerciseType;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"customerTrainingPlanDetailsId": this.customerTrainingPlanDetailsId,
|
||||
"exerciseTypeId": this.exerciseTypeId,
|
||||
"set": this.set,
|
||||
"repeats": this.repeats,
|
||||
"weight": this.weight,
|
||||
"restingTime": this.restingTime,
|
||||
"parallel": this.parallel,
|
||||
"day": this.day == null ? '1.' : this.day,
|
||||
"customerTrainingPlanDetailsId": customerTrainingPlanDetailsId,
|
||||
"exerciseTypeId": exerciseTypeId,
|
||||
"set": set,
|
||||
"repeats": repeats,
|
||||
"weight": weight,
|
||||
"restingTime": restingTime,
|
||||
"parallel": parallel,
|
||||
"day": day ?? '1.',
|
||||
};
|
||||
|
||||
Map<String, dynamic> toJsonWithExercises() {
|
||||
final Map<String, dynamic> jsonMap = {
|
||||
"customerTrainingPlanDetailsId": this.customerTrainingPlanDetailsId,
|
||||
"trainingPlanDetailsId": this.trainingPlanDetailsId,
|
||||
"exerciseTypeId": this.exerciseTypeId,
|
||||
"set": this.set,
|
||||
"repeats": this.repeats,
|
||||
"weight": this.weight,
|
||||
"restingTime": this.restingTime,
|
||||
"parallel": this.parallel,
|
||||
"customerTrainingPlanDetailsId": customerTrainingPlanDetailsId,
|
||||
"trainingPlanDetailsId": trainingPlanDetailsId,
|
||||
"exerciseTypeId": exerciseTypeId,
|
||||
"set": set,
|
||||
"repeats": repeats,
|
||||
"weight": weight,
|
||||
"restingTime": restingTime,
|
||||
"parallel": parallel,
|
||||
'exercises': exercises.isEmpty ? [].toString() : exercises.map((exercise) => exercise.toJson()).toList().toString(),
|
||||
'state': this.state.toStr(),
|
||||
"isTest": this.isTest,
|
||||
"dayId": this.dayId,
|
||||
"baseOneRepMax": this.baseOneRepMax,
|
||||
'state': state.toStr(),
|
||||
"isTest": isTest,
|
||||
"dayId": dayId,
|
||||
"baseOneRepMax": baseOneRepMax,
|
||||
};
|
||||
|
||||
//print("Detail toJson $jsonMap");
|
||||
@@ -132,31 +133,31 @@ class CustomerTrainingPlanDetails {
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => this.toJsonWithExercises().toString();
|
||||
String toString() => toJsonWithExercises().toString();
|
||||
|
||||
void copy(CustomerTrainingPlanDetails from) {
|
||||
this.customerTrainingPlanDetailsId = from.customerTrainingPlanDetailsId;
|
||||
this.trainingPlanDetailsId = from.trainingPlanDetailsId;
|
||||
this.exerciseTypeId = from.exerciseTypeId;
|
||||
this.exerciseType = from.exerciseType;
|
||||
this.set = from.set;
|
||||
this.repeats = from.repeats;
|
||||
this.weight = from.weight;
|
||||
this.restingTime = from.restingTime;
|
||||
this.parallel = from.parallel;
|
||||
this.exercises = from.exercises;
|
||||
this.state = from.state;
|
||||
this.isTest = from.isTest;
|
||||
this.day = from.day;
|
||||
this.dayId = from.dayId;
|
||||
this.baseOneRepMax = from.baseOneRepMax;
|
||||
if (from.exercises.length == 0) {
|
||||
this.exercises = [];
|
||||
customerTrainingPlanDetailsId = from.customerTrainingPlanDetailsId;
|
||||
trainingPlanDetailsId = from.trainingPlanDetailsId;
|
||||
exerciseTypeId = from.exerciseTypeId;
|
||||
exerciseType = from.exerciseType;
|
||||
set = from.set;
|
||||
repeats = from.repeats;
|
||||
weight = from.weight;
|
||||
restingTime = from.restingTime;
|
||||
parallel = from.parallel;
|
||||
exercises = from.exercises;
|
||||
state = from.state;
|
||||
isTest = from.isTest;
|
||||
day = from.day;
|
||||
dayId = from.dayId;
|
||||
baseOneRepMax = from.baseOneRepMax;
|
||||
if (from.exercises.isEmpty) {
|
||||
exercises = [];
|
||||
}
|
||||
if (from.alternatives.length > 0) {
|
||||
from.alternatives.forEach((alternative) {
|
||||
this.alternatives.add(alternative);
|
||||
});
|
||||
if (from.alternatives.isNotEmpty) {
|
||||
for (var alternative in from.alternatives) {
|
||||
alternatives.add(alternative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,22 +9,22 @@ class CustomerTrainingPlanExercise {
|
||||
CustomerTrainingPlanExercise();
|
||||
|
||||
CustomerTrainingPlanExercise.fromJson(Map json) {
|
||||
this.customerTrainingPlanExerciseId = json['customerTrainingPlanExerciseId'];
|
||||
this.customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.exerciseId = json['exerciseId'];
|
||||
this.repeats = json['repeats'];
|
||||
this.weight = json['weight'];
|
||||
customerTrainingPlanExerciseId = json['customerTrainingPlanExerciseId'];
|
||||
customerTrainingPlanDetailsId = json['customerTrainingPlanDetailsId'];
|
||||
customerId = json['customerId'];
|
||||
exerciseId = json['exerciseId'];
|
||||
repeats = json['repeats'];
|
||||
weight = json['weight'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"customerTrainingPlanDetailsId": this.customerTrainingPlanDetailsId,
|
||||
"customerId": this.customerId,
|
||||
"exerciseId": this.exerciseId,
|
||||
"weight": this.weight,
|
||||
"repeats": this.repeats
|
||||
"customerTrainingPlanDetailsId": customerTrainingPlanDetailsId,
|
||||
"customerId": customerId,
|
||||
"exerciseId": exerciseId,
|
||||
"weight": weight,
|
||||
"repeats": repeats
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
+16
-16
@@ -12,29 +12,29 @@ class Description {
|
||||
String? descriptionTranslation;
|
||||
|
||||
Description.fromJson(Map json) {
|
||||
this.descriptionId = json['descriptionId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.version = json['version'];
|
||||
this.validFrom = json['validFrom'];
|
||||
this.validTo = json['validTo'];
|
||||
descriptionId = json['descriptionId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
version = json['version'];
|
||||
validFrom = json['validFrom'];
|
||||
validTo = json['validTo'];
|
||||
|
||||
if (json['translations'] != null && json['translations'].length > 0) {
|
||||
this.descriptionTranslation =
|
||||
AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['descriptionTranslation'] : json['description'];
|
||||
descriptionTranslation =
|
||||
AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['descriptionTranslation'] : json['description'];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"descriptionId": this.descriptionId,
|
||||
"name": this.name,
|
||||
"description": this.description,
|
||||
"version": this.version,
|
||||
"validFrom": this.validFrom,
|
||||
"validTo": this.validTo,
|
||||
"descriptionTranslation": this.descriptionTranslation
|
||||
"descriptionId": descriptionId,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"version": version,
|
||||
"validFrom": validFrom,
|
||||
"validTo": validTo,
|
||||
"descriptionTranslation": descriptionTranslation
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@ class Evaluation {
|
||||
name = json['name'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
unit = json['unit'];
|
||||
this.attributes = json['attributes'].map((attr) => EvaluationAttribute.fromJson(attr)).toList();
|
||||
attributes = json['attributes'].map((attr) => EvaluationAttribute.fromJson(attr)).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
'evaluationId': this.evaluationId,
|
||||
'name': this.name,
|
||||
'exerciseTypeId': this.exerciseTypeId,
|
||||
'unit': this.unit
|
||||
'evaluationId': evaluationId,
|
||||
'name': name,
|
||||
'exerciseTypeId': exerciseTypeId,
|
||||
'unit': unit
|
||||
};
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ class EvaluationAttribute {
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
'evaluationAttrId': this.evaluationAttrId,
|
||||
'evaluationId': this.evaluationId,
|
||||
'name': this.name,
|
||||
'sex': this.sex,
|
||||
'ageMin': this.ageMin,
|
||||
'ageMax': this.ageMax,
|
||||
'valueMin': this.valueMin,
|
||||
'valueMax': this.valueMax,
|
||||
'evaluation_text': this.evaluationText,
|
||||
'evaluationAttrId': evaluationAttrId,
|
||||
'evaluationId': evaluationId,
|
||||
'name': name,
|
||||
'sex': sex,
|
||||
'ageMin': ageMin,
|
||||
'ageMax': ageMax,
|
||||
'valueMin': valueMin,
|
||||
'valueMax': valueMax,
|
||||
'evaluation_text': evaluationText,
|
||||
};
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
+19
-19
@@ -15,20 +15,20 @@ class Exercise {
|
||||
double? calculated;
|
||||
String? summary;
|
||||
|
||||
Exercise({this.exerciseTypeId, this.customerId, this.quantity, this.dateAdd});
|
||||
Exercise({exerciseTypeId, customerId, quantity, dateAdd});
|
||||
|
||||
Exercise.fromJson(Map json) {
|
||||
this.exerciseId = json['exerciseId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.quantity = json['quantity'];
|
||||
this.unit = json['unit'];
|
||||
this.unitQuantity = json['unitQuantity'];
|
||||
this.dateAdd = DateTime.parse(json['dateAdd']);
|
||||
this.datePart = DateFormat('yyyy-MM-dd').format(this.dateAdd!);
|
||||
this.calculated = quantity;
|
||||
this.exercisePlanDetailId = json['exercisePlanDetailId'] == "null" ? null : json['exercisePlanDetailId'];
|
||||
this.trainingPlanDetailsId = json['trainingPlanDetailsId'] == "null" ? null : json['trainingPlanDetailsId'];
|
||||
exerciseId = json['exerciseId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
customerId = json['customerId'];
|
||||
quantity = json['quantity'];
|
||||
unit = json['unit'];
|
||||
unitQuantity = json['unitQuantity'];
|
||||
dateAdd = DateTime.parse(json['dateAdd']);
|
||||
datePart = DateFormat('yyyy-MM-dd').format(dateAdd!);
|
||||
calculated = quantity;
|
||||
exercisePlanDetailId = json['exercisePlanDetailId'] == "null" ? null : json['exercisePlanDetailId'];
|
||||
trainingPlanDetailsId = json['trainingPlanDetailsId'] == "null" ? null : json['trainingPlanDetailsId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -37,7 +37,7 @@ class Exercise {
|
||||
"quantity": quantity,
|
||||
"unit": unit,
|
||||
"unitQuantity": unitQuantity,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
|
||||
"exercisePlanDetailId": exercisePlanDetailId,
|
||||
"trainingPlanDetailsId": trainingPlanDetailsId,
|
||||
};
|
||||
@@ -49,20 +49,20 @@ class Exercise {
|
||||
'calculated': calculated,
|
||||
"unit": unit,
|
||||
"unitQuantity": unitQuantity,
|
||||
"datePart": this.datePart,
|
||||
"datePart": datePart,
|
||||
};
|
||||
|
||||
Exercise copy() {
|
||||
Exercise newExercise =
|
||||
Exercise(exerciseTypeId: this.exerciseTypeId, customerId: this.customerId, quantity: this.quantity, dateAdd: this.dateAdd);
|
||||
newExercise.unit = this.unit;
|
||||
newExercise.unitQuantity = this.unitQuantity;
|
||||
newExercise.exercisePlanDetailId = this.exercisePlanDetailId;
|
||||
Exercise(exerciseTypeId: exerciseTypeId, customerId: customerId, quantity: quantity, dateAdd: dateAdd);
|
||||
newExercise.unit = unit;
|
||||
newExercise.unitQuantity = unitQuantity;
|
||||
newExercise.exercisePlanDetailId = exercisePlanDetailId;
|
||||
return newExercise;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return this.toJson().toString();
|
||||
return toJson().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
enum ExerciseAbility { oneRepMax, endurance, running, mini_test_set, paralell_test, training, training_execute, none }
|
||||
|
||||
extension ExerciseAbilityExt on ExerciseAbility {
|
||||
String enumToString() => this.toString().split(".").last;
|
||||
bool equalsTo(ExerciseAbility ability) => this.toString() == ability.toString();
|
||||
bool equalsStringTo(String ability) => this.enumToString() == ability;
|
||||
String enumToString() => toString().split(".").last;
|
||||
bool equalsTo(ExerciseAbility ability) => toString() == ability.toString();
|
||||
bool equalsStringTo(String ability) => enumToString() == ability;
|
||||
String get description {
|
||||
switch (this) {
|
||||
case ExerciseAbility.endurance:
|
||||
|
||||
@@ -10,12 +10,12 @@ class ExerciseDevice {
|
||||
bool? isGym;
|
||||
|
||||
ExerciseDevice.fromJson(Map json) {
|
||||
this.exerciseDeviceId = json['exerciseDeviceId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.imageUrl = json['imageUrl'];
|
||||
this.nameTranslation = json['translations'][0]['name'];
|
||||
this.sort = json['sort'];
|
||||
this.place = json['place'] == 1 ? true : false;
|
||||
exerciseDeviceId = json['exerciseDeviceId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
imageUrl = json['imageUrl'];
|
||||
nameTranslation = json['translations'][0]['name'];
|
||||
sort = json['sort'];
|
||||
place = json['place'] == 1 ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,21 @@ class ExercisePlan {
|
||||
int? exercisePlanTemplateId;
|
||||
|
||||
ExercisePlan(String name, int customerId) {
|
||||
this.customerId = customerId;
|
||||
this.name = name;
|
||||
this.dateUpd = DateTime.now();
|
||||
customerId = customerId;
|
||||
name = name;
|
||||
dateUpd = DateTime.now();
|
||||
}
|
||||
|
||||
ExercisePlan.fromJson(Map json) {
|
||||
this.exercisePlanId = json['exercisePlanId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.name = json['name'];
|
||||
this.private = json['private'];
|
||||
this.description = json['description'];
|
||||
this.dateAdd = (json['dateAdd'] == null ? null : DateTime.parse(json['dateAdd']))!;
|
||||
this.dateUpd = (json['dateUpd'] == null ? null : DateTime.parse(json['dateUpd']))!;
|
||||
this.type = json['type'];
|
||||
this.exercisePlanTemplateId = json['exercisePlanTemplateId'];
|
||||
exercisePlanId = json['exercisePlanId'];
|
||||
customerId = json['customerId'];
|
||||
name = json['name'];
|
||||
private = json['private'];
|
||||
description = json['description'];
|
||||
dateAdd = (json['dateAdd'] == null ? null : DateTime.parse(json['dateAdd']))!;
|
||||
dateUpd = (json['dateUpd'] == null ? null : DateTime.parse(json['dateUpd']))!;
|
||||
type = json['type'];
|
||||
exercisePlanTemplateId = json['exercisePlanTemplateId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
||||
@@ -2,16 +2,17 @@ import 'dart:convert';
|
||||
|
||||
import 'package:workouttest_util/model/exercise.dart';
|
||||
import 'package:workouttest_util/model/exercise_type.dart';
|
||||
import 'package:workouttest_util/util/logging.dart';
|
||||
|
||||
enum ExercisePlanDetailState { start, inProgress, skipped, finished, extra }
|
||||
|
||||
extension ExericisePlanDetailStateExt on ExercisePlanDetailState {
|
||||
bool equalsTo(ExercisePlanDetailState state) => this.toString() == state.toString();
|
||||
bool equalsStringTo(String state) => this.toString() == state;
|
||||
String toStr() => this.toString().split(".").last;
|
||||
bool equalsTo(ExercisePlanDetailState state) => toString() == state.toString();
|
||||
bool equalsStringTo(String state) => toString() == state;
|
||||
String toStr() => toString().split(".").last;
|
||||
}
|
||||
|
||||
class ExercisePlanDetail {
|
||||
class ExercisePlanDetail with Logging {
|
||||
int? exercisePlanDetailId;
|
||||
int? exercisePlanId;
|
||||
late int exerciseTypeId;
|
||||
@@ -31,25 +32,25 @@ class ExercisePlanDetail {
|
||||
String? change; // 1: update -1:delete 0: new
|
||||
|
||||
ExercisePlanDetail(int exerciseTypeId) {
|
||||
this.exerciseTypeId = exerciseTypeId;
|
||||
exerciseTypeId = exerciseTypeId;
|
||||
}
|
||||
|
||||
ExercisePlanDetail.fromJson(Map json) {
|
||||
this.exercisePlanDetailId = json['exercisePlanDetailId'];
|
||||
this.exercisePlanId = json['exercisePlanId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.serie = json['serie'];
|
||||
this.repeats = json['repeats'];
|
||||
this.weightEquation = json['weightEquation'];
|
||||
exercisePlanDetailId = json['exercisePlanDetailId'];
|
||||
exercisePlanId = json['exercisePlanId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
serie = json['serie'];
|
||||
repeats = json['repeats'];
|
||||
weightEquation = json['weightEquation'];
|
||||
}
|
||||
|
||||
ExercisePlanDetail.fromJsonWithExerciseList(Map json) {
|
||||
this.exercisePlanDetailId = json['exercisePlanDetailId'];
|
||||
this.exercisePlanId = json['exercisePlanId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.serie = json['serie'];
|
||||
this.repeats = json['repeats'];
|
||||
this.weightEquation = json['weightEquation'];
|
||||
exercisePlanDetailId = json['exercisePlanDetailId'];
|
||||
exercisePlanId = json['exercisePlanId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
serie = json['serie'];
|
||||
repeats = json['repeats'];
|
||||
weightEquation = json['weightEquation'];
|
||||
try {
|
||||
final String exercises = json['exercises'];
|
||||
String jsonExercises = exercises.replaceAllMapped(
|
||||
@@ -61,12 +62,12 @@ class ExercisePlanDetail {
|
||||
Iterable iterable = jsonDecode(jsonExercises);
|
||||
this.exercises = iterable.map((exercise) => Exercise.fromJson(exercise)).toList();
|
||||
} on Exception catch (e) {
|
||||
print("JsonDecode error " + e.toString());
|
||||
log("JsonDecode error $e");
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"exercisePlanId": exercisePlanId == null ? 0 : exercisePlanId,
|
||||
"exercisePlanId": exercisePlanId ?? 0,
|
||||
"exerciseTypeId": exerciseTypeId,
|
||||
"serie": serie,
|
||||
"repeats": repeats,
|
||||
|
||||
@@ -12,13 +12,13 @@ class ExercisePlanTemplate {
|
||||
List<int> exerciseTypes = [];
|
||||
|
||||
ExercisePlanTemplate.fromJson(Map json) {
|
||||
this.exercisePlanTemplateId = json['exercisePlanId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.templateType = json['templateType'];
|
||||
exercisePlanTemplateId = json['exercisePlanId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
templateType = json['templateType'];
|
||||
if (json['translations'].length > 0) {
|
||||
this.nameTranslation = AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['name'] : json['name'];
|
||||
this.descriptionTranslation = AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['description'] : json['description'];
|
||||
nameTranslation = AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['name'] : json['name'];
|
||||
descriptionTranslation = AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['description'] : json['description'];
|
||||
}
|
||||
|
||||
if (json['details'] != null && (json['details']).length > 0) {
|
||||
@@ -30,9 +30,9 @@ class ExercisePlanTemplate {
|
||||
return a['sort'] < b['sort'] ? -1 : 1;
|
||||
}
|
||||
});
|
||||
details.forEach((element) {
|
||||
for (var element in details) {
|
||||
exerciseTypes.add(element['exerciseTypeId']);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ class ExerciseResult {
|
||||
"exercisePlanId": exercisePlanId,
|
||||
"resultType": resultType,
|
||||
"value": value,
|
||||
"dateFrom": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateFrom),
|
||||
"dateFrom": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateFrom),
|
||||
"dateTo": formattedDateTo,
|
||||
};
|
||||
}
|
||||
|
||||
ExerciseResult.fromJson(Map json) {
|
||||
this.exerciseResultId = json['exerciseResultId'];
|
||||
this.exerciseId = json['exerciseId'];
|
||||
this.exercisePlanId = json['exercisePlanId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.resultType = json['resultType'];
|
||||
this.value = json["value"];
|
||||
this.dateFrom = DateTime.parse(json['dateFrom']);
|
||||
this.dateTo = DateTime.parse(json['dateTo']);
|
||||
this.resultExtension = ResultExt(itemString: this.resultType);
|
||||
exerciseResultId = json['exerciseResultId'];
|
||||
exerciseId = json['exerciseId'];
|
||||
exercisePlanId = json['exercisePlanId'];
|
||||
customerId = json['customerId'];
|
||||
resultType = json['resultType'];
|
||||
value = json["value"];
|
||||
dateFrom = DateTime.parse(json['dateFrom']);
|
||||
dateTo = DateTime.parse(json['dateTo']);
|
||||
resultExtension = ResultExt(itemString: resultType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@ class ExerciseTree {
|
||||
ExerciseTree();
|
||||
|
||||
ExerciseTree.fromJson(Map json) {
|
||||
this.treeId = json['treeId'];
|
||||
this.name = json['name'];
|
||||
this.parentId = 0;
|
||||
this.imageUrl = json['imageUrl'];
|
||||
this.active = json['active'];
|
||||
this.nameTranslation = json['translations'] != null && (json['translations']).length > 0 ? json['translations'][0]['name'] : this.name;
|
||||
this.descriptionTranslation =
|
||||
treeId = json['treeId'];
|
||||
name = json['name'];
|
||||
parentId = 0;
|
||||
imageUrl = json['imageUrl'];
|
||||
active = json['active'];
|
||||
nameTranslation = json['translations'] != null && (json['translations']).length > 0 ? json['translations'][0]['name'] : name;
|
||||
descriptionTranslation =
|
||||
json['translations'] != null && (json['translations']).length > 0 && json['translations'][0]['description'] != null
|
||||
? json['translations'][0]['description']
|
||||
: this.description;
|
||||
this.sort = 99;
|
||||
this.internalName = json['internalName'];
|
||||
: description;
|
||||
sort = 99;
|
||||
internalName = json['internalName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -57,19 +57,19 @@ class ExerciseTree {
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
|
||||
ExerciseTree copy(int parentId) {
|
||||
ExerciseTree newTree = ExerciseTree();
|
||||
newTree.treeId = this.treeId;
|
||||
newTree.name = this.name;
|
||||
newTree.imageUrl = this.imageUrl;
|
||||
newTree.nameTranslation = this.nameTranslation;
|
||||
newTree.treeId = treeId;
|
||||
newTree.name = name;
|
||||
newTree.imageUrl = imageUrl;
|
||||
newTree.nameTranslation = nameTranslation;
|
||||
if (parentId != -1) {
|
||||
newTree.parentId = parentId;
|
||||
}
|
||||
newTree.active = this.active;
|
||||
newTree.sort = this.sort == null ? 99 : this.sort;
|
||||
newTree.active = active;
|
||||
newTree.sort = sort ?? 99;
|
||||
|
||||
return newTree;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ class ExerciseTreeParents {
|
||||
late int sort;
|
||||
|
||||
ExerciseTreeParents.fromJson(Map json) {
|
||||
this.exerciseTreeParentsId = json['exerciseTreeParentsId'];
|
||||
this.exerciseTreeParentId = json['exerciseTreeParentId'];
|
||||
this.exerciseTreeChildId = json['exerciseTreeChildId'];
|
||||
this.sort = json['sort'];
|
||||
exerciseTreeParentsId = json['exerciseTreeParentsId'];
|
||||
exerciseTreeParentId = json['exerciseTreeParentId'];
|
||||
exerciseTreeChildId = json['exerciseTreeChildId'];
|
||||
sort = json['sort'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,49 +55,49 @@ class ExerciseType {
|
||||
/// custom training plan
|
||||
ExerciseTypeTrainingPlanState trainingPlanState = ExerciseTypeTrainingPlanState.none;
|
||||
|
||||
ExerciseType({required this.name, required this.description});
|
||||
ExerciseType({required name, required description});
|
||||
|
||||
ExerciseType.fromJson(Map json) {
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
//this.treeId = json['treeId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.unit = json['unit'];
|
||||
this.unitQuantity = json['unitQuantity'];
|
||||
this.unitQuantityUnit = json['unitQuantityUnit'];
|
||||
this.active = json['active'];
|
||||
this.base = json['base'];
|
||||
this.buddyWarning = json['buddyWarning'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
//treeId = json['treeId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
unit = json['unit'];
|
||||
unitQuantity = json['unitQuantity'];
|
||||
unitQuantityUnit = json['unitQuantityUnit'];
|
||||
active = json['active'];
|
||||
base = json['base'];
|
||||
buddyWarning = json['buddyWarning'];
|
||||
if (json['images'].length > 0) {
|
||||
this.imageUrl = json['images'][0]['url'];
|
||||
imageUrl = json['images'][0]['url'];
|
||||
}
|
||||
if (json['translations'].length > 0) {
|
||||
this.nameTranslation = AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['name'] : json['name'];
|
||||
this.descriptionTranslation = AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['description'] : json['description'];
|
||||
nameTranslation = AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['name'] : json['name'];
|
||||
descriptionTranslation = AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['description'] : json['description'];
|
||||
}
|
||||
|
||||
if (json['devices'].length > 0) {
|
||||
final List jsonDevices = json['devices'];
|
||||
|
||||
jsonDevices.forEach((device) {
|
||||
this.devices.add(device['exerciseDeviceId']);
|
||||
});
|
||||
for (var device in jsonDevices) {
|
||||
devices.add(device['exerciseDeviceId']);
|
||||
}
|
||||
}
|
||||
|
||||
if (json['parents'].length > 0) {
|
||||
final List jsonParents = json['parents'];
|
||||
|
||||
jsonParents.forEach((parent) {
|
||||
this.parents.add(parent['exerciseTreeId']);
|
||||
});
|
||||
for (var parent in jsonParents) {
|
||||
parents.add(parent['exerciseTreeId']);
|
||||
}
|
||||
}
|
||||
|
||||
if (json['alternatives'].length > 0) {
|
||||
final List jsonAlternatives = json['alternatives'];
|
||||
|
||||
jsonAlternatives.forEach((alternative) {
|
||||
this.alternatives.add(alternative['exerciseTypeChildId']);
|
||||
});
|
||||
for (var alternative in jsonAlternatives) {
|
||||
alternatives.add(alternative['exerciseTypeChildId']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,25 +110,25 @@ class ExerciseType {
|
||||
"active": active,
|
||||
"base": base,
|
||||
"buddyWarning": buddyWarning,
|
||||
"devices": this.devices.toString(),
|
||||
"nameTranslation": this.nameTranslation,
|
||||
"parents": this.parents.toString()
|
||||
"devices": devices.toString(),
|
||||
"nameTranslation": nameTranslation,
|
||||
"parents": parents.toString()
|
||||
};
|
||||
|
||||
void setAbility(ExerciseAbility ability) {
|
||||
this.ability = ability;
|
||||
ability = ability;
|
||||
}
|
||||
|
||||
ExerciseAbility getAbility() {
|
||||
return this.ability!;
|
||||
return ability!;
|
||||
}
|
||||
|
||||
bool is1RM() {
|
||||
return this.ability!.equalsTo(ExerciseAbility.oneRepMax);
|
||||
return ability!.equalsTo(ExerciseAbility.oneRepMax);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return this.toJson().toString();
|
||||
return toJson().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ class ExerciseTypeDevice {
|
||||
ExerciseTypeDevice();
|
||||
|
||||
ExerciseTypeDevice.fromJson(Map json) {
|
||||
this.exerciseTypeDeviceId = json['exerciseTypeDeviceId'];
|
||||
this.exerciseDeviceId = json['exerciseDeviceId'];
|
||||
exerciseTypeDeviceId = json['exerciseTypeDeviceId'];
|
||||
exerciseDeviceId = json['exerciseDeviceId'];
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -10,10 +10,10 @@ class Faq {
|
||||
HashMap<String, String> descriptionTranslations = HashMap();
|
||||
|
||||
Faq.fromJson(Map json) {
|
||||
this.faqId = json['faqId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.sort = json['sort'];
|
||||
faqId = json['faqId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
sort = json['sort'];
|
||||
|
||||
nameTranslations['en'] = name;
|
||||
descriptionTranslations['en'] = description;
|
||||
@@ -26,12 +26,12 @@ class Faq {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"faqId": this.faqId,
|
||||
"name": this.name,
|
||||
"description": this.description,
|
||||
"nameTranslation": this.nameTranslations.toString(),
|
||||
"faqId": faqId,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"nameTranslation": nameTranslations.toString(),
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ class FitnessState {
|
||||
static String advanced = "advanced";
|
||||
static String professional = "professional";
|
||||
|
||||
FitnessState({required this.value, required this.stateText, required this.explanation});
|
||||
FitnessState({required value, required stateText, required explanation});
|
||||
|
||||
bool isEqual(FitnessState? state) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
return state.value == this.value;
|
||||
return state.value == value;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -33,17 +33,17 @@ class FitnessItem {
|
||||
|
||||
FitnessItem._internal() {
|
||||
elements.add(FitnessState(
|
||||
value: FitnessState.beginner, stateText: _capitalize(FitnessState.beginner), explanation: "I am " + FitnessState.beginner));
|
||||
value: FitnessState.beginner, stateText: _capitalize(FitnessState.beginner), explanation: "I am ${FitnessState.beginner}"));
|
||||
elements.add(FitnessState(
|
||||
value: FitnessState.intermediate,
|
||||
stateText: _capitalize(FitnessState.intermediate),
|
||||
explanation: "I am " + FitnessState.intermediate));
|
||||
explanation: "I am ${FitnessState.intermediate}"));
|
||||
elements.add(FitnessState(
|
||||
value: FitnessState.advanced, stateText: _capitalize(FitnessState.advanced), explanation: "I am " + FitnessState.advanced));
|
||||
value: FitnessState.advanced, stateText: _capitalize(FitnessState.advanced), explanation: "I am ${FitnessState.advanced}"));
|
||||
elements.add(FitnessState(
|
||||
value: FitnessState.professional,
|
||||
stateText: _capitalize(FitnessState.professional),
|
||||
explanation: "I am " + FitnessState.professional));
|
||||
explanation: "I am ${FitnessState.professional}"));
|
||||
}
|
||||
|
||||
String _capitalize(String value) {
|
||||
@@ -53,15 +53,15 @@ class FitnessItem {
|
||||
List<FitnessState> toList() => elements;
|
||||
|
||||
FitnessState? getItem(String? value) {
|
||||
if (value == null || value.length == 0) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return elements[0];
|
||||
}
|
||||
FitnessState? selected;
|
||||
elements.forEach((element) {
|
||||
for (var element in elements) {
|
||||
if (element.value == value) {
|
||||
selected = element;
|
||||
}
|
||||
});
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ class Mautic {
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
+26
-26
@@ -15,38 +15,38 @@ class Product {
|
||||
String? localizedPrice;
|
||||
|
||||
Product.fromJson(Map json) {
|
||||
this.productId = json['productId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.type = json['type'];
|
||||
this.appVersion = json['appVersion'];
|
||||
this.sort = json['sort'];
|
||||
this.productSet = json['productSet'];
|
||||
this.validFrom = (json['validFrom'] == null ? null : DateTime.parse(json['validFrom']))!;
|
||||
this.validTo = json['validTo'] == null ? null : DateTime.parse(json['validTo']);
|
||||
this.productIdIos = json['productIdIos'];
|
||||
this.productIdAndroid = json['productIdAndroid'];
|
||||
this.priceIos = json['priceIos'];
|
||||
this.priceAndroid = json['priceAndroid'];
|
||||
productId = json['productId'];
|
||||
name = json['name'];
|
||||
description = json['description'];
|
||||
type = json['type'];
|
||||
appVersion = json['appVersion'];
|
||||
sort = json['sort'];
|
||||
productSet = json['productSet'];
|
||||
validFrom = (json['validFrom'] == null ? null : DateTime.parse(json['validFrom']))!;
|
||||
validTo = json['validTo'] == null ? null : DateTime.parse(json['validTo']);
|
||||
productIdIos = json['productIdIos'];
|
||||
productIdAndroid = json['productIdAndroid'];
|
||||
priceIos = json['priceIos'];
|
||||
priceAndroid = json['priceAndroid'];
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
'productId': this.productId,
|
||||
'name': this.name,
|
||||
'description': this.description,
|
||||
'type': this.type,
|
||||
'appVersion': this.appVersion,
|
||||
'sort': this.sort,
|
||||
'productSet': this.productSet,
|
||||
'validFrom': this.validFrom,
|
||||
'productId': productId,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'type': type,
|
||||
'appVersion': appVersion,
|
||||
'sort': sort,
|
||||
'productSet': productSet,
|
||||
'validFrom': validFrom,
|
||||
'validTo': validTo,
|
||||
'productIdIos': this.productIdIos,
|
||||
'productIdAndroid': this.productIdAndroid,
|
||||
'priceIos': this.priceIos,
|
||||
'priceAndroid': this.priceAndroid,
|
||||
'localizedPrice': this.localizedPrice
|
||||
'productIdIos': productIdIos,
|
||||
'productIdAndroid': productIdAndroid,
|
||||
'priceIos': priceIos,
|
||||
'priceAndroid': priceAndroid,
|
||||
'localizedPrice': localizedPrice
|
||||
};
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
@@ -8,15 +8,16 @@ class Property {
|
||||
double? value;
|
||||
|
||||
Property.fromJson(Map json) {
|
||||
this.propertyId = json['propertyId'];
|
||||
this.propertyName = json['propertyName'];
|
||||
this.propertyUnit = json['propertyUnit'];
|
||||
this.propertyNameTranslation =
|
||||
propertyId = json['propertyId'];
|
||||
propertyName = json['propertyName'];
|
||||
propertyUnit = json['propertyUnit'];
|
||||
propertyNameTranslation =
|
||||
json['translations'] != null && (json['translations']).length > 0
|
||||
? json['translations'][0]['propertyName']
|
||||
: this.propertyName;
|
||||
: propertyName;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
"propertyId": propertyId,
|
||||
|
||||
@@ -9,15 +9,15 @@ class Purchase {
|
||||
late double purchaseSum;
|
||||
late String currency;
|
||||
|
||||
Purchase({required this.customerId, required this.productId});
|
||||
Purchase({required customerId, required productId});
|
||||
|
||||
Purchase.fromJson(Map json) {
|
||||
this.purchaseId = json['purchaseId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.productId = json['productId'];
|
||||
this.dateAdd = DateTime.parse(json['dateAdd']);
|
||||
this.purchaseSum = json['purchaseSum'];
|
||||
this.currency = json['currency'];
|
||||
purchaseId = json['purchaseId'];
|
||||
customerId = json['customerId'];
|
||||
productId = json['productId'];
|
||||
dateAdd = DateTime.parse(json['dateAdd']);
|
||||
purchaseSum = json['purchaseSum'];
|
||||
currency = json['currency'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -25,7 +25,7 @@ class Purchase {
|
||||
"customerId": customerId,
|
||||
"productId": productId,
|
||||
"purchaseSum": purchaseSum,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd),
|
||||
"currency": currency,
|
||||
};
|
||||
}
|
||||
|
||||
+10
-10
@@ -59,8 +59,8 @@ extension ResultItemExt on ResultItem {
|
||||
ResultItem.fatburn_percent: true,
|
||||
};
|
||||
|
||||
bool equals(ResultItem item) => this.toString() == item.toString();
|
||||
bool equalsString(String item) => this.description == item;
|
||||
bool equals(ResultItem item) => toString() == item.toString();
|
||||
bool equalsString(String item) => description == item;
|
||||
|
||||
String? get description => ResultItemDesc[this];
|
||||
String? get image => ResultItemImg[this];
|
||||
@@ -78,24 +78,24 @@ class ResultExt {
|
||||
|
||||
DateTime? dateTo;
|
||||
|
||||
ResultExt({required this.itemString}) {
|
||||
ResultItem.values.forEach((element) {
|
||||
ResultExt({required itemString}) {
|
||||
for (var element in ResultItem.values) {
|
||||
if (element.equalsString(itemString)) {
|
||||
item = element;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
String? getDescription() => item.description;
|
||||
String getImage() => "asset/image/" + item.image!;
|
||||
String getImage() => "asset/image/${item.image!}";
|
||||
bool? isHardware() => item.isHardware;
|
||||
int? get getExerciseId => exerciseId;
|
||||
set setExerciseId(int exerciseId) => this.exerciseId = exerciseId;
|
||||
set setDateFrom(DateTime dateFrom) => this.dateFrom = dateFrom;
|
||||
set setExerciseId(int exerciseId) => exerciseId = exerciseId;
|
||||
set setDateFrom(DateTime dateFrom) => dateFrom = dateFrom;
|
||||
DateTime? get getDateFrom => dateFrom;
|
||||
set setDateTo(DateTime dateTo) => this.dateTo = dateTo;
|
||||
set setDateTo(DateTime dateTo) => dateTo = dateTo;
|
||||
DateTime? get getDateTo => dateTo;
|
||||
|
||||
bool equals(ResultItem item) => this.item.equals(item);
|
||||
bool equals(ResultItem item) => item.equals(item);
|
||||
bool equalsString(String item) => this.item.equalsString(item);
|
||||
}
|
||||
|
||||
+15
-15
@@ -9,26 +9,26 @@ class SplitTest {
|
||||
DateTime? validTo;
|
||||
|
||||
SplitTest.fromJson(Map json) {
|
||||
this.testId = json['testId'];
|
||||
this.name = json['name'];
|
||||
this.remoteConfigKey = json['remoteConfigKey'];
|
||||
this.remoteConfigValue = json['remoteConfigValue'];
|
||||
this.testValue = json['testValue'];
|
||||
this.source = json['source'];
|
||||
this.active = json['active'];
|
||||
this.validTo = json['validTo'] == null ? null : DateTime.parse(json['validTo']);
|
||||
testId = json['testId'];
|
||||
name = json['name'];
|
||||
remoteConfigKey = json['remoteConfigKey'];
|
||||
remoteConfigValue = json['remoteConfigValue'];
|
||||
testValue = json['testValue'];
|
||||
source = json['source'];
|
||||
active = json['active'];
|
||||
validTo = json['validTo'] == null ? null : DateTime.parse(json['validTo']);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
Map<String, dynamic> json = {
|
||||
'productId': this.testId,
|
||||
'name': this.name,
|
||||
'remoteConfigKey': this.remoteConfigKey,
|
||||
'remoteConfigValue': this.remoteConfigValue,
|
||||
'testValue': this.testValue,
|
||||
'source': this.source,
|
||||
'active': this.active,
|
||||
'productId': testId,
|
||||
'name': name,
|
||||
'remoteConfigKey': remoteConfigKey,
|
||||
'remoteConfigValue': remoteConfigValue,
|
||||
'testValue': testValue,
|
||||
'source': source,
|
||||
'active': active,
|
||||
'validTo': validTo,
|
||||
};
|
||||
return json.toString();
|
||||
|
||||
@@ -7,8 +7,8 @@ class Sport {
|
||||
HashMap<String, String> nameTranslations = HashMap();
|
||||
|
||||
Sport.fromJson(Map json) {
|
||||
this.sportId = json['sportId'];
|
||||
this.name = json['name'];
|
||||
sportId = json['sportId'];
|
||||
name = json['name'];
|
||||
|
||||
nameTranslations['en'] = name;
|
||||
if (json['translations'] != null && json['translations'].length > 0) {
|
||||
@@ -25,6 +25,6 @@ class Sport {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return this.toJson().toString();
|
||||
return toJson().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ class Tracking {
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"customerId": customerId,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd),
|
||||
"event": event,
|
||||
"eventValue": eventValue,
|
||||
"area": Platform.localeName,
|
||||
"platform": Platform.isAndroid ? "Android" : "iOS",
|
||||
"version": Cache().packageInfo != null ? Cache().packageInfo!.version + "+" + Cache().packageInfo!.buildNumber : ""
|
||||
"version": Cache().packageInfo != null ? "${Cache().packageInfo!.version}+${Cache().packageInfo!.buildNumber}" : ""
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
|
||||
enum TrainingEvaluationExerciseType { weightBased, repeatBased, secondBased }
|
||||
|
||||
extension TrainingEvaluationExerciseTypeExt on TrainingEvaluationExerciseType {
|
||||
String toStr() => this.toString().split(".").last;
|
||||
bool equalsTo(TrainingEvaluationExerciseType value) => this.toString() == value.toString();
|
||||
bool equalsStringTo(String value) => this.toString() == value;
|
||||
String toStr() => toString().split(".").last;
|
||||
bool equalsTo(TrainingEvaluationExerciseType value) => toString() == value.toString();
|
||||
bool equalsStringTo(String value) => toString() == value;
|
||||
}
|
||||
|
||||
class TrainingEvaluationExercise {
|
||||
|
||||
@@ -18,14 +18,14 @@ class TrainingPlan {
|
||||
List<TrainingPlanDetail>? details;
|
||||
|
||||
TrainingPlan.fromJson(Map<String, dynamic> json) {
|
||||
this.trainingPlanId = json['trainingPlanId'];
|
||||
this.name = json['name'];
|
||||
this.type = json['type'];
|
||||
this.internalName = json['internalName'];
|
||||
this.description = json['description'];
|
||||
this.free = json['free'];
|
||||
this.active = json['active'];
|
||||
this.treeId = json['treeId'];
|
||||
trainingPlanId = json['trainingPlanId'];
|
||||
name = json['name'];
|
||||
type = json['type'];
|
||||
internalName = json['internalName'];
|
||||
description = json['description'];
|
||||
free = json['free'];
|
||||
active = json['active'];
|
||||
treeId = json['treeId'];
|
||||
|
||||
nameTranslations['en'] = name;
|
||||
descriptionTranslations['en'] = description ?? "";
|
||||
@@ -58,17 +58,17 @@ class TrainingPlan {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"trainingPlanId": this.trainingPlanId,
|
||||
"treeId": this.treeId,
|
||||
"name": this.name,
|
||||
"type": this.type,
|
||||
"internalName": this.internalName,
|
||||
"free": this.free,
|
||||
"active": this.active,
|
||||
"description": this.description,
|
||||
"nameTranslation": this.nameTranslations.toString(),
|
||||
"trainingPlanId": trainingPlanId,
|
||||
"treeId": treeId,
|
||||
"name": name,
|
||||
"type": type,
|
||||
"internalName": internalName,
|
||||
"free": free,
|
||||
"active": active,
|
||||
"description": description,
|
||||
"nameTranslation": nameTranslations.toString(),
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ class TrainingPlanDay {
|
||||
HashMap<String, String> nameTranslations = HashMap();
|
||||
|
||||
TrainingPlanDay.fromJson(Map json) {
|
||||
this.dayId = json['dayId'];
|
||||
this.name = json['name'];
|
||||
dayId = json['dayId'];
|
||||
name = json['name'];
|
||||
|
||||
nameTranslations['en'] = name;
|
||||
if (json['translations'] != null && json['translations'].length > 0) {
|
||||
@@ -19,11 +19,11 @@ class TrainingPlanDay {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"dayId": this.dayId,
|
||||
"name": this.name,
|
||||
"nameTranslation": this.nameTranslations.toString(),
|
||||
"dayId": dayId,
|
||||
"name": name,
|
||||
"nameTranslation": nameTranslations.toString(),
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -13,32 +13,32 @@ class TrainingPlanDetail {
|
||||
String? summary;
|
||||
|
||||
TrainingPlanDetail.fromJson(Map<String, dynamic> json) {
|
||||
this.trainingPlanDetailId = json['trainingPlanDetailId'];
|
||||
this.trainingPlanId = json['trainingPlanId'];
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.sort = json['sort'];
|
||||
this.set = json['set'];
|
||||
this.repeats = json['repeats'];
|
||||
this.weight = json['weight'];
|
||||
this.restingTime = json['restingTime'];
|
||||
this.parallel = json['parallel'];
|
||||
this.dayId = json['dayId'];
|
||||
trainingPlanDetailId = json['trainingPlanDetailId'];
|
||||
trainingPlanId = json['trainingPlanId'];
|
||||
exerciseTypeId = json['exerciseTypeId'];
|
||||
sort = json['sort'];
|
||||
set = json['set'];
|
||||
repeats = json['repeats'];
|
||||
weight = json['weight'];
|
||||
restingTime = json['restingTime'];
|
||||
parallel = json['parallel'];
|
||||
dayId = json['dayId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"trainingPlanDetailId": this.trainingPlanDetailId,
|
||||
"trainingPlanId": this.trainingPlanId,
|
||||
"exerciseType": this.exerciseTypeId,
|
||||
"sort": this.sort,
|
||||
"repeats": this.repeats,
|
||||
"weight": this.weight,
|
||||
"restingTime": this.restingTime,
|
||||
"parallel": this.parallel,
|
||||
"dayId": this.dayId,
|
||||
"day": this.day,
|
||||
"summary": this.summary,
|
||||
"trainingPlanDetailId": trainingPlanDetailId,
|
||||
"trainingPlanId": trainingPlanId,
|
||||
"exerciseType": exerciseTypeId,
|
||||
"sort": sort,
|
||||
"repeats": repeats,
|
||||
"weight": weight,
|
||||
"restingTime": restingTime,
|
||||
"parallel": parallel,
|
||||
"dayId": dayId,
|
||||
"day": day,
|
||||
"summary": summary,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ class Tutorial {
|
||||
List<TutorialStep>? steps;
|
||||
|
||||
Tutorial.fromJson(Map<String, dynamic> json) {
|
||||
this.tutorialId = json['tutorialId'];
|
||||
this.name = json['name'];
|
||||
tutorialId = json['tutorialId'];
|
||||
name = json['name'];
|
||||
|
||||
if (json['steps'] != null && json['steps'].length > 0) {
|
||||
steps = json['steps'].map<TutorialStep>((step) => TutorialStep.fromJson(step)).toList();
|
||||
@@ -30,8 +30,8 @@ class Tutorial {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {'tutorialId': this.tutorialId, 'name': this.name, 'steps': steps.toString()};
|
||||
Map<String, dynamic> toJson() => {'tutorialId': tutorialId, 'name': name, 'steps': steps.toString()};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -18,33 +18,33 @@ class TutorialStepAction {
|
||||
late int parent;
|
||||
|
||||
TutorialStepAction.fromJson(Map json) {
|
||||
this.direction = json['direction'];
|
||||
this.top = json['top'];
|
||||
this.left = json['left'];
|
||||
this.showBubble = json['show_bubble'];
|
||||
this.bubbleX = json['bubble_x'];
|
||||
this.bubbleY = json['bubble_y'];
|
||||
this.bubbleWidth = json['bubble_width'];
|
||||
this.bubbleHeight = json['bubble_height'];
|
||||
this.showCheckText = json['show_check_text'];
|
||||
this.parent = json['parent'];
|
||||
direction = json['direction'];
|
||||
top = json['top'];
|
||||
left = json['left'];
|
||||
showBubble = json['show_bubble'];
|
||||
bubbleX = json['bubble_x'];
|
||||
bubbleY = json['bubble_y'];
|
||||
bubbleWidth = json['bubble_width'];
|
||||
bubbleHeight = json['bubble_height'];
|
||||
showCheckText = json['show_check_text'];
|
||||
parent = json['parent'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"direction": this.direction,
|
||||
"top": this.top,
|
||||
"left": this.left,
|
||||
"showBubble": this.showBubble,
|
||||
"bubbleX": this.bubbleX,
|
||||
"bubbleY": this.bubbleY,
|
||||
"bubbleWidth": this.bubbleWidth,
|
||||
"bubbleHeight": this.bubbleHeight,
|
||||
"showCheckText": this.showCheckText,
|
||||
"parent": this.parent,
|
||||
"direction": direction,
|
||||
"top": top,
|
||||
"left": left,
|
||||
"showBubble": showBubble,
|
||||
"bubbleX": bubbleX,
|
||||
"bubbleY": bubbleY,
|
||||
"bubbleWidth": bubbleWidth,
|
||||
"bubbleHeight": bubbleHeight,
|
||||
"showCheckText": showCheckText,
|
||||
"parent": parent,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
class TutorialStep {
|
||||
@@ -63,36 +63,36 @@ class TutorialStep {
|
||||
String? errorTextTranslation;
|
||||
|
||||
TutorialStep.fromJson(Map json) {
|
||||
this.tutorialStepId = json['tutorialStepId'];
|
||||
this.tutorialId = json['tutorialId'];
|
||||
this.step = json['step'];
|
||||
this.tutorialText = json['tutorialText'];
|
||||
this.checkText = json['checkText'];
|
||||
this.condition = json['condition'];
|
||||
if (this.condition != null) {
|
||||
this.condition = condition!.replaceAll(r'\\', "replace");
|
||||
this.action = TutorialStepAction.fromJson(jsonDecode(condition!));
|
||||
tutorialStepId = json['tutorialStepId'];
|
||||
tutorialId = json['tutorialId'];
|
||||
step = json['step'];
|
||||
tutorialText = json['tutorialText'];
|
||||
checkText = json['checkText'];
|
||||
condition = json['condition'];
|
||||
if (condition != null) {
|
||||
condition = condition!.replaceAll(r'\\', "replace");
|
||||
action = TutorialStepAction.fromJson(jsonDecode(condition!));
|
||||
}
|
||||
|
||||
if (json['translations'] != null && json['translations'].length > 0) {
|
||||
this.tutorialTextTranslation =
|
||||
AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['tutorialText'] : json['tutorialText'];
|
||||
this.errorTextTranslation = AppLanguage().appLocal == Locale('hu') ? json['translations'][0]['errorText'] : json['errorText'];
|
||||
tutorialTextTranslation =
|
||||
AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['tutorialText'] : json['tutorialText'];
|
||||
errorTextTranslation = AppLanguage().appLocal == const Locale('hu') ? json['translations'][0]['errorText'] : json['errorText'];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"tutorialStepId": this.tutorialStepId,
|
||||
"tutorialId": this.tutorialId,
|
||||
"step": this.step,
|
||||
"tutorialText": this.tutorialText,
|
||||
"checkText": this.checkText,
|
||||
"tutorialTextTranslation": this.tutorialTextTranslation,
|
||||
"errorTextTranslation": this.errorTextTranslation,
|
||||
"condition": this.condition,
|
||||
"action": this.action != null ? this.action!.toJson() : ""
|
||||
"tutorialStepId": tutorialStepId,
|
||||
"tutorialId": tutorialId,
|
||||
"step": step,
|
||||
"tutorialText": tutorialText,
|
||||
"checkText": checkText,
|
||||
"tutorialTextTranslation": tutorialTextTranslation,
|
||||
"errorTextTranslation": errorTextTranslation,
|
||||
"condition": condition,
|
||||
"action": action != null ? action!.toJson() : ""
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() => this.toJson().toString();
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ extension WorkoutTypeExt on WorkoutType {
|
||||
WorkoutType.staticExercise: "Static"
|
||||
};
|
||||
|
||||
bool equals(WorkoutType type) => this.toString() == type.toString();
|
||||
bool equalsString(String type) => this.toString() == type;
|
||||
bool equals(WorkoutType type) => toString() == type.toString();
|
||||
bool equalsString(String type) => toString() == type;
|
||||
|
||||
String? get menu => WorkoutTypeMenu[this];
|
||||
}
|
||||
@@ -43,23 +43,23 @@ class WorkoutMenuTree {
|
||||
late String internalName;
|
||||
|
||||
WorkoutMenuTree(
|
||||
this.id,
|
||||
this.parent,
|
||||
this.name,
|
||||
this.imageName,
|
||||
this.color,
|
||||
this.fontSize,
|
||||
this.child,
|
||||
this.exerciseTypeId,
|
||||
this.exerciseType,
|
||||
this.base,
|
||||
this.is1RM,
|
||||
this.isRunning,
|
||||
this.nameEnglish,
|
||||
this.parentName,
|
||||
this.parentNameEnglish,
|
||||
this.sort,
|
||||
this.internalName);
|
||||
id,
|
||||
parent,
|
||||
name,
|
||||
imageName,
|
||||
color,
|
||||
fontSize,
|
||||
child,
|
||||
exerciseTypeId,
|
||||
exerciseType,
|
||||
base,
|
||||
is1RM,
|
||||
isRunning,
|
||||
nameEnglish,
|
||||
parentName,
|
||||
parentNameEnglish,
|
||||
sort,
|
||||
internalName);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
@@ -81,6 +81,6 @@ class WorkoutMenuTree {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return this.toJson().toString();
|
||||
return toJson().toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user