feat: persist volume

This commit is contained in:
edde746
2025-11-05 14:50:13 +01:00
parent c15bc6d4c2
commit 1c7fccdd6b
4 changed files with 29 additions and 7 deletions
+11
View File
@@ -29,6 +29,7 @@ class SettingsService {
static const String _keySleepTimerDuration = 'sleep_timer_duration';
static const String _keyAudioSyncOffset = 'audio_sync_offset';
static const String _keySubtitleSyncOffset = 'subtitle_sync_offset';
static const String _keyVolume = 'volume';
static SettingsService? _instance;
late SharedPreferences _prefs;
@@ -200,6 +201,15 @@ class SettingsService {
0; // Default: 0ms (no offset)
}
// Volume (0.0 to 100.0)
Future<void> setVolume(double volume) async {
await _prefs.setDouble(_keyVolume, volume);
}
double getVolume() {
return _prefs.getDouble(_keyVolume) ?? 100.0; // Default: full volume
}
// Keyboard Shortcuts (Legacy String-based)
Map<String, String> getDefaultKeyboardShortcuts() {
return {
@@ -716,6 +726,7 @@ class SettingsService {
_prefs.remove(_keySleepTimerDuration),
_prefs.remove(_keyAudioSyncOffset),
_prefs.remove(_keySubtitleSyncOffset),
_prefs.remove(_keyVolume),
]);
}