mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-09 04:29:29 +00:00
sleeptimer
This commit is contained in:
parent
d372a6b096
commit
b98188d7fb
17 changed files with 1262 additions and 363 deletions
|
|
@ -30,7 +30,7 @@ class PlayerSettings with _$PlayerSettings {
|
|||
@Default(1) double preferredDefaultVolume,
|
||||
@Default(1) double preferredDefaultSpeed,
|
||||
@Default([0.75, 1, 1.25, 1.5, 1.75, 2]) List<double> speedOptions,
|
||||
@Default(Duration(minutes: 15)) Duration sleepTimer,
|
||||
@Default(SleepTimerSettings()) SleepTimerSettings sleepTimerSettings,
|
||||
}) = _PlayerSettings;
|
||||
|
||||
factory PlayerSettings.fromJson(Map<String, dynamic> json) =>
|
||||
|
|
@ -57,3 +57,50 @@ class MinimizedPlayerSettings with _$MinimizedPlayerSettings {
|
|||
factory MinimizedPlayerSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$MinimizedPlayerSettingsFromJson(json);
|
||||
}
|
||||
|
||||
enum SleepTimerShakeSenseMode { never, always, nearEnds }
|
||||
|
||||
@freezed
|
||||
class SleepTimerSettings with _$SleepTimerSettings {
|
||||
const factory SleepTimerSettings({
|
||||
@Default(Duration(minutes: 15)) Duration defaultDuration,
|
||||
@Default(SleepTimerShakeSenseMode.always)
|
||||
SleepTimerShakeSenseMode shakeSenseMode,
|
||||
|
||||
/// the duration in which the shake is detected before the end of the timer and after the timer ends
|
||||
/// only used if [shakeSenseMode] is [SleepTimerShakeSenseMode.nearEnds]
|
||||
@Default(Duration(seconds: 30)) Duration shakeSenseDuration,
|
||||
@Default(true) bool vibrateWhenReset,
|
||||
@Default(false) bool beepWhenReset,
|
||||
@Default(false) bool fadeOutAudio,
|
||||
@Default(0.5) double shakeDetectThreshold,
|
||||
|
||||
/// if true, the player will automatically rewind the audio when the sleep timer is stopped
|
||||
@Default(false) bool autoRewindWhenStopped,
|
||||
|
||||
/// the key is the duration in minutes
|
||||
@Default({
|
||||
5: Duration(seconds: 10),
|
||||
15: Duration(seconds: 30),
|
||||
45: Duration(seconds: 45),
|
||||
60: Duration(minutes: 1),
|
||||
120: Duration(minutes: 2),
|
||||
})
|
||||
Map<int, Duration> autoRewindDurations,
|
||||
|
||||
/// auto turn on timer settings
|
||||
@Default(false) bool autoTurnOnTimer,
|
||||
|
||||
/// always auto turn on timer settings or during specific times
|
||||
@Default(true) bool alwaysAutoTurnOnTimer,
|
||||
|
||||
/// auto timer settings, only used if [alwaysAutoTurnOnTimer] is false
|
||||
///
|
||||
/// duration is the time from 00:00
|
||||
@Default(Duration(hours: 22, minutes: 0)) Duration autoTurnOnTime,
|
||||
@Default(Duration(hours: 6, minutes: 0)) Duration autoTurnOffTime,
|
||||
}) = _SleepTimerSettings;
|
||||
|
||||
factory SleepTimerSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$SleepTimerSettingsFromJson(json);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue