mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
21 lines
672 B
Dart
21 lines
672 B
Dart
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);
|
|
}
|
|
}
|