WIP: feat(ui): Migrate to new UI implementation
This commit is contained in:
@@ -2,12 +2,14 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:moonwell_launcher/core/moonwell_theme_variant.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_session.dart';
|
||||
import 'package:moonwell_launcher/features/preferences/domain/repositories/preferences_repository.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
const _outputDirKey = 'output_dir';
|
||||
const _launcherSessionKey = 'launcher_session';
|
||||
const _themeVariantKey = 'theme_variant';
|
||||
|
||||
@LazySingleton(as: PreferencesRepository, env: ['flutter'])
|
||||
class LocalPreferencesRepository implements PreferencesRepository {
|
||||
@@ -73,6 +75,18 @@ class LocalPreferencesRepository implements PreferencesRepository {
|
||||
await _maybeClearLegacyLauncherSession();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MoonWellThemeVariant> getThemeVariant() async {
|
||||
return MoonWellThemeVariant.fromStoredValue(
|
||||
_preferences.getString(_themeVariantKey),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setThemeVariant(MoonWellThemeVariant variant) {
|
||||
return _preferences.setString(_themeVariantKey, variant.name);
|
||||
}
|
||||
|
||||
Future<void> _maybeClearLegacyLauncherSession() async {
|
||||
if (_preferences.containsKey(_launcherSessionKey)) {
|
||||
await _preferences.remove(_launcherSessionKey);
|
||||
|
||||
Reference in New Issue
Block a user