mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 05:14:09 +02:00
Add support for fading out on sleep timer end
Playback will start to fadeout during last 60 seconds of the sleep timer. Once faded out, playback will be paused, volume reset, and playback seeked to start of fadeout.
This commit is contained in:
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
// Override point for customization after application launch.
|
||||
|
||||
let configuration = Realm.Configuration(
|
||||
schemaVersion: 18,
|
||||
schemaVersion: 19,
|
||||
migrationBlock: { [weak self] migration, oldSchemaVersion in
|
||||
if (oldSchemaVersion < 1) {
|
||||
self?.logger.log("Realm schema version was \(oldSchemaVersion)")
|
||||
@@ -61,6 +61,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
newObject?["streamingUsingCellular"] = "ALWAYS"
|
||||
}
|
||||
}
|
||||
if (oldSchemaVersion < 18) {
|
||||
self?.logger.log("Realm schema version was \(oldSchemaVersion)... Adding disableSleepTimerFadeOut settings")
|
||||
migration.enumerateObjects(ofType: PlayerSettings.className()) { oldObject, newObject in
|
||||
newObject?["disableSleepTimerFadeOut"] = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
@@ -246,6 +246,7 @@ public class AbsDatabase: CAPPlugin {
|
||||
let languageCode = call.getString("languageCode") ?? "en-us"
|
||||
let downloadUsingCellular = call.getString("downloadUsingCellular") ?? "ALWAYS"
|
||||
let streamingUsingCellular = call.getString("streamingUsingCellular") ?? "ALWAYS"
|
||||
let disableSleepTimerFadeOut = call.getBool("disableSleepTimerFadeOut") ?? false
|
||||
let settings = DeviceSettings()
|
||||
settings.disableAutoRewind = disableAutoRewind
|
||||
settings.enableAltView = enableAltView
|
||||
@@ -257,6 +258,7 @@ public class AbsDatabase: CAPPlugin {
|
||||
settings.languageCode = languageCode
|
||||
settings.downloadUsingCellular = downloadUsingCellular
|
||||
settings.streamingUsingCellular = streamingUsingCellular
|
||||
settings.disableSleepTimerFadeOut = disableSleepTimerFadeOut
|
||||
|
||||
Database.shared.setDeviceSettings(deviceSettings: settings)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user