v1.0.1 warning fixes

This commit is contained in:
Tibor Bossanyi
2023-02-10 19:48:58 +01:00
parent ee205bf4b8
commit 9782a1ca46
19 changed files with 165 additions and 178 deletions
+13 -1
View File
@@ -119,6 +119,7 @@ class Cache with Logging {
static String baseUrlLive = 'https://api.workouttest.org/api/';
static String baseUrlTest = 'https://apitest.workouttest.org/api/';
static String baseUrlLocal = 'http://localhost:8443/api/';
late String baseUrl;
static const String mediaUrl = 'https://admin.workouttest.org/media/';
static const String username = 'bosi';
@@ -199,6 +200,9 @@ class Cache with Logging {
if (testEnv == "1") {
baseUrl = baseUrlTest;
liveServer = false;
} else if ( testEnv == "2") {
baseUrl = baseUrlLocal;
liveServer = false;
}
for (var element in ActivityDone.values) {
@@ -210,6 +214,10 @@ class Cache with Logging {
baseUrl = baseUrlTest;
}
void setLocalBaseUrl() {
baseUrl = baseUrlLocal;
}
String getAuthToken() {
return authToken;
}
@@ -362,10 +370,14 @@ class Cache with Logging {
}
void setServerAddress(SharedPreferences prefs) {
if (this.testEnvironment == "1") {
if (testEnvironment == "1") {
baseUrl = baseUrlTest;
print("TestEnv $baseUrl");
return;
} else if ( testEnvironment == "2") {
baseUrl = baseUrlLocal;
print("TestEnv $baseUrl");
return;
}
final bool? live = prefs.getBool(Cache.serverKey);
if (live == null) {
+8 -7
View File
@@ -1,3 +1,4 @@
// ignore: depend_on_referenced_packages
import 'package:intl/intl.dart';
class CustomerActivity {
@@ -12,19 +13,19 @@ class CustomerActivity {
customerId = json['custoemrId'];
type = json['type'];
skipped = json['skipped'];
this.dateAdd = DateTime.parse(json['dateAdd']);
dateAdd = DateTime.parse(json['dateAdd']);
}
Map<String, dynamic> toJson() => {
'activityId': this.activityId,
'customerId': this.customerId,
'type': this.type,
'skipped': this.skipped,
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
'activityId': activityId,
'customerId': customerId,
'type': type,
'skipped': skipped,
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd!),
};
@override
String toString() {
return this.toJson().toString();
return toJson().toString();
}
}
+8 -7
View File
@@ -1,3 +1,4 @@
// ignore: depend_on_referenced_packages
import 'package:intl/intl.dart';
class CustomerExerciseDevice {
@@ -14,11 +15,11 @@ class CustomerExerciseDevice {
}
CustomerExerciseDevice.fromJson(Map json) {
this.customerExerciseDeviceId = json['customerExerciseDeviceId'];
this.exerciseDeviceId = json['exerciseDeviceId'];
this.customerId = json['customerId'];
this.favourite = json['favourite'] == 1 ? true : false;
this.dateAdd = DateTime.parse(json['dateAdd']);
customerExerciseDeviceId = json['customerExerciseDeviceId'];
exerciseDeviceId = json['exerciseDeviceId'];
customerId = json['customerId'];
favourite = json['favourite'] == 1 ? true : false;
dateAdd = DateTime.parse(json['dateAdd']);
}
Map<String, dynamic> toJson() {
@@ -27,7 +28,7 @@ class CustomerExerciseDevice {
"exerciseDeviceId": exerciseDeviceId,
"customerId": customerId,
"favourite": favourite == true ? 1 : 0,
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd),
};
} else {
return {
@@ -35,7 +36,7 @@ class CustomerExerciseDevice {
"exerciseDeviceId": exerciseDeviceId,
"customerId": customerId,
"favourite": favourite == true ? 1 : 0,
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(dateAdd),
};
}
}
+13 -11
View File
@@ -1,6 +1,8 @@
// ignore: depend_on_referenced_packages
import 'package:intl/intl.dart';
import '../util/logging.dart';
class CustomerProperty {
class CustomerProperty with Logging {
int? customerPropertyId;
late int propertyId;
late int customerId;
@@ -18,20 +20,20 @@ class CustomerProperty {
required this.propertyValue});
CustomerProperty.fromJson(Map json) {
this.customerPropertyId = json['customerPropertyId'];
this.propertyId = json['propertyId'];
this.customerId = json['customerId'];
this.dateAdd = DateTime.parse(json['dateAdd']);
customerPropertyId = json['customerPropertyId'];
propertyId = json['propertyId'];
customerId = json['customerId'];
dateAdd = DateTime.parse(json['dateAdd']);
if (this.dateAdd != null) {
dateYmd = DateFormat('yyyy-MM-dd').format(this.dateAdd!);
dateYm = DateFormat('yyyy-MM').format(this.dateAdd!);
dateY = DateFormat('yyyy').format(this.dateAdd!);
if (dateAdd != null) {
dateYmd = DateFormat('yyyy-MM-dd').format(dateAdd!);
dateYm = DateFormat('yyyy-MM').format(dateAdd!);
dateY = DateFormat('yyyy').format(dateAdd!);
}
this.propertyValue = json['propertyValue'];
propertyValue = json['propertyValue'];
print("Json $json, ${this.toString()}");
print("Json $json, ${toString()}");
}
Map<String, dynamic> toJson() {