mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
feat(onboarding): add theme-aware 5.0 upgrade introduction
This commit is contained in:
1 parent
4283126381
commit
3eea711ed3
7 files changed
+976
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// Separate from settings migrations: migrating preferences must not consume
|
||||
/// the upgrade introduction before the user has actually seen it.
|
||||
class UpgradeIntroService {
|
||||
static const _seenKey = 'upgrade_intro_5_0_seen';
|
||||
|
||||
static bool shouldShow(
|
||||
SharedPreferences preferences, {
|
||||
required String version,
|
||||
required bool existingInstallation,
|
||||
}) =>
|
||||
version.split('.').first == '5' &&
|
||||
existingInstallation &&
|
||||
!(preferences.getBool(_seenKey) ?? false);
|
||||
|
||||
static Future<void> markSeen(SharedPreferences preferences) async {
|
||||
await preferences.setBool(_seenKey, true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user