mirror of
https://github.com/koloideal/Casha.git
synced 2026-08-08 17:51:14 +03:00
step
This commit is contained in:
@@ -4,18 +4,27 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
class OnboardingService {
|
||||
static const _key = 'onboarding_completed';
|
||||
static bool _shownInSession = false;
|
||||
static SharedPreferences? _staticPrefs;
|
||||
|
||||
final SharedPreferences _prefs;
|
||||
|
||||
OnboardingService(this._prefs);
|
||||
OnboardingService(this._prefs) {
|
||||
_staticPrefs = _prefs;
|
||||
}
|
||||
|
||||
bool get shouldShowOnboarding {
|
||||
static bool get shouldShowOnboarding {
|
||||
if (kDebugMode) {
|
||||
return !_shownInSession;
|
||||
}
|
||||
return !(_prefs.getBool(_key) ?? false);
|
||||
return !(_staticPrefs?.getBool(_key) ?? false);
|
||||
}
|
||||
|
||||
static void markCompleted() {
|
||||
_shownInSession = true;
|
||||
}
|
||||
|
||||
bool get shouldShowOnboardingInstance => shouldShowOnboarding;
|
||||
|
||||
Future<void> completeOnboarding() async {
|
||||
_shownInSession = true;
|
||||
if (!kDebugMode) {
|
||||
|
||||
Reference in New Issue
Block a user