Fix load app from cache
This commit is contained in:
parent
b1063f5057
commit
7b05ed2a4a
5 changed files with 19 additions and 13 deletions
|
@ -9,7 +9,7 @@ class TTConsts {
|
||||||
static get SESSION_SERVER =>
|
static get SESSION_SERVER =>
|
||||||
"https://api.zontreck.com/timetrack/$UPDATE_CHANNEL/timetrack.php";
|
"https://api.zontreck.com/timetrack/$UPDATE_CHANNEL/timetrack.php";
|
||||||
|
|
||||||
static const VERSION = "1.0.0-beta.18";
|
static const VERSION = "1.0.0-beta.19";
|
||||||
|
|
||||||
static bool UPDATE_AVAILABLE = false;
|
static bool UPDATE_AVAILABLE = false;
|
||||||
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.beta;
|
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.beta;
|
||||||
|
|
|
@ -327,6 +327,10 @@ class SessionData {
|
||||||
|
|
||||||
await _deserialize(ct);
|
await _deserialize(ct);
|
||||||
|
|
||||||
|
if (IsOnTheClock) ContainsTripTimes = true;
|
||||||
|
|
||||||
|
Calls.dispatch();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,13 +342,20 @@ class SessionData {
|
||||||
|
|
||||||
static Future<void> _deserialize(CompoundTag ct) async {
|
static Future<void> _deserialize(CompoundTag ct) async {
|
||||||
IsOnTheClock = NbtUtils.readBoolean(ct, "inprog");
|
IsOnTheClock = NbtUtils.readBoolean(ct, "inprog");
|
||||||
|
|
||||||
|
if (IsOnTheClock) {
|
||||||
|
await Login();
|
||||||
|
}
|
||||||
|
|
||||||
StartTime = DateTime.parse(ct.get("start")!.asString());
|
StartTime = DateTime.parse(ct.get("start")!.asString());
|
||||||
if (ct.containsKey("end")) {
|
if (ct.containsKey("end")) {
|
||||||
EndTime = DateTime.parse(ct.get("end")!.asString());
|
EndTime = DateTime.parse(ct.get("end")!.asString());
|
||||||
} else {
|
} else {
|
||||||
EndTime = DateTime(0);
|
EndTime = DateTime(0);
|
||||||
}
|
}
|
||||||
TotalPay = ct.get("totalPay")!.asDouble();
|
if (ct.containsKey("totalPay")) {
|
||||||
|
TotalPay = ct.get("totalPay")!.asDouble();
|
||||||
|
}
|
||||||
|
|
||||||
ListTag poses = ct.get("pos")! as ListTag;
|
ListTag poses = ct.get("pos")! as ListTag;
|
||||||
for (var pos in poses.value) {
|
for (var pos in poses.value) {
|
||||||
|
|
|
@ -17,6 +17,8 @@ void serviceEntry() {
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
SessionData.LoadSavedCacheState();
|
||||||
|
|
||||||
SessionData.isWeb = true;
|
SessionData.isWeb = true;
|
||||||
try {
|
try {
|
||||||
SessionData.isWeb = !Platform.isAndroid;
|
SessionData.isWeb = !Platform.isAndroid;
|
||||||
|
|
|
@ -117,22 +117,15 @@ class _HomePageState extends State<HomePage> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
/*
|
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("RESET APP SESSION"),
|
title: Text("RESET APP SESSION"),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
SessionData.IsOnTheClock = false;
|
SessionData.ResetAppSession();
|
||||||
SessionData.StartTime = DateTime.fromMillisecondsSinceEpoch(
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
SessionData.Trips = [];
|
|
||||||
SessionData.currentDelivery = null;
|
|
||||||
SessionData.currentTrip = null;
|
|
||||||
SessionData.positions = [];
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),*/
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.0-beta.18
|
version: 1.0.0-beta.19
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.7.2
|
sdk: ^3.7.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue