fixed issues for release

This commit is contained in:
2023-11-21 22:43:28 +05:30
parent acc03f8e2b
commit 8a1e5b1ca8
5 changed files with 324 additions and 276 deletions

View File

@ -25,6 +25,8 @@ void restoreGame() async {
destinationController.isInRog.value = pref.getBool("is_in_rog") ?? false;
destinationController.rogainingCounted.value =
pref.getBool("rogaining_counted") ?? false;
print(
"--restored -- destinationController.isInRog.value ${pref.getBool("is_in_rog")} -- ${pref.getBool("rogaining_counted")}");
}
void main() async {
@ -61,6 +63,9 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
if (context.mounted) {
restoreGame();
}
WidgetsBinding.instance.addObserver(this);
}
@ -83,22 +88,22 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
Get.find<DestinationController>();
switch (state) {
case AppLifecycleState.resumed:
//print("RESUMED");
print("RESUMED");
restoreGame();
break;
case AppLifecycleState.inactive:
//print("INACTIVE");
print("INACTIVE");
break;
case AppLifecycleState.paused:
//print("PAUSED");
print("PAUSED");
saveGameState();
break;
case AppLifecycleState.detached:
//print("DETACHED");
print("DETACHED");
saveGameState();
break;
case AppLifecycleState.hidden:
//print("DETACHED");
print("DETACHED");
saveGameState();
break;
}