fixed state
This commit is contained in:
@ -9,6 +9,21 @@ import 'package:rogapp/utils/string_values.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
// import 'package:is_lock_screen/is_lock_screen.dart';
|
||||
|
||||
void saveGameState() async {
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||
pref.setBool("is_in_rog", destinationController.is_in_rog.value);
|
||||
pref.setBool("rogaining_counted", destinationController.rogaining_counted.value);
|
||||
}
|
||||
|
||||
void restoreGame() async{
|
||||
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_in_rog.value = pref.getBool("is_in_rog") ?? false;
|
||||
destinationController.rogaining_counted.value = pref.getBool("rogaining_counted") ?? false;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@ -27,7 +42,6 @@ void main() async {
|
||||
key: 'behaviour',
|
||||
value: 'cacheFirst',
|
||||
);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@ -55,20 +69,13 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void saveGameState() async {
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||
pref.setBool("is_in_rog", destinationController.is_in_rog.value);
|
||||
pref.setBool("rogaining_counted", destinationController.rogaining_counted.value);
|
||||
}
|
||||
// void saveGameState() async {
|
||||
// DestinationController destinationController = Get.find<DestinationController>();
|
||||
// SharedPreferences pref = await SharedPreferences.getInstance();
|
||||
// pref.setBool("is_in_rog", destinationController.is_in_rog.value);
|
||||
// pref.setBool("rogaining_counted", destinationController.rogaining_counted.value);
|
||||
// }
|
||||
|
||||
void restoreGame() async{
|
||||
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_in_rog.value = pref.getBool("is_in_rog") ?? false;
|
||||
destinationController.rogaining_counted.value = pref.getBool("rogaining_counted") ?? false;
|
||||
}
|
||||
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
Reference in New Issue
Block a user