diff --git a/kitchenowl/lib/cubits/auth_cubit.dart b/kitchenowl/lib/cubits/auth_cubit.dart index 751f73e1..5a4f342a 100644 --- a/kitchenowl/lib/cubits/auth_cubit.dart +++ b/kitchenowl/lib/cubits/auth_cubit.dart @@ -25,6 +25,7 @@ class AuthCubit extends Cubit { .then((value) => value ?? token); }); } + _loadForcedOfflineMode(); setup(); } @@ -277,8 +278,13 @@ class AuthCubit extends Cubit { } } + Future _loadForcedOfflineMode() async { + _forcedOfflineMode = await PreferenceStorage.getInstance().readBool(key: 'forcedOfflineMode') ?? false; + } + void setForcedOfflineMode(bool forcedOfflineMode) async { _forcedOfflineMode = forcedOfflineMode; + await PreferenceStorage.getInstance().writeBool(key: 'forcedOfflineMode', value: forcedOfflineMode); updateState(); // force refresh if state stays the same refresh(); }