From 5399ec67d7020cb4507925afb0a325892279118d Mon Sep 17 00:00:00 2001 From: hstephens Date: Sat, 29 Apr 2023 15:38:51 -0600 Subject: [PATCH 1/9] Added Auto Rewind on Sleep Timer setting --- .../audiobookshelf/app/data/DeviceClasses.kt | 5 + .../app/managers/SleepTimerManager.kt | 5 + .../AutoSleepTimerRewindLengthModal.vue | 95 +++++++++++++++++++ pages/settings.vue | 41 +++++++- 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 components/modals/AutoSleepTimerRewindLengthModal.vue diff --git a/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt b/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt index 93fd4c72..6bda6d1b 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt @@ -103,6 +103,8 @@ data class DeviceSettings( var autoSleepTimer: Boolean, var autoSleepTimerStartTime: String, var autoSleepTimerEndTime: String, + var autoSleepTimerAutoRewind: Boolean, + var autoSleepTimerAutoRewindTime: Long, //Time in milliseconds var sleepTimerLength: Long, // Time in milliseconds var disableSleepTimerFadeOut: Boolean, var disableSleepTimerResetFeedback: Boolean @@ -123,6 +125,8 @@ data class DeviceSettings( autoSleepTimerStartTime = "22:00", autoSleepTimerEndTime = "06:00", sleepTimerLength = 900000L, // 15 minutes + autoSleepTimerAutoRewind = false, + autoSleepTimerAutoRewindTime = 300000L, disableSleepTimerFadeOut = false, disableSleepTimerResetFeedback = false ) @@ -142,6 +146,7 @@ data class DeviceSettings( @get:JsonIgnore val autoSleepTimerEndMinute get() = autoSleepTimerEndTime.split(":")[1].toInt() + @JsonIgnore fun getShakeThresholdGravity() : Float { // Used in ShakeDetector return if (shakeSensitivity == ShakeSensitivitySetting.VERY_HIGH) 1.2f diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index 47c3113c..e5413598 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -1,6 +1,7 @@ package com.audiobookshelf.app.managers import android.content.Context +import android.media.metrics.PlaybackSession import android.os.* import android.util.Log import com.audiobookshelf.app.device.DeviceManager @@ -343,6 +344,10 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe if (currentCalendar.after(startCalendar) && currentCalendar.before(endCalendar)) { Log.i(tag, "Current hour $currentHour is between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime} - starting sleep timer") + // Automatically Rewind in the book if settings is enabled + if (deviceSettings.autoSleepTimerAutoRewind) { + playerNotificationService.seekBackward(deviceSettings.autoSleepTimerAutoRewindTime) + } // Set sleep timer // When sleepTimerLength is 0 then use end of chapter/track time if (deviceSettings.sleepTimerLength == 0L) { diff --git a/components/modals/AutoSleepTimerRewindLengthModal.vue b/components/modals/AutoSleepTimerRewindLengthModal.vue new file mode 100644 index 00000000..2f13df25 --- /dev/null +++ b/components/modals/AutoSleepTimerRewindLengthModal.vue @@ -0,0 +1,95 @@ + + + diff --git a/pages/settings.vue b/pages/settings.vue index 66a8a5e3..ce7c3ff7 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -95,9 +95,23 @@ +
+
+ +
+

Auto Sleep Timer Auto Rewind

+ info +
+
+

Auto Rewind Time

+
+ +
+
+ @@ -110,6 +124,7 @@ export default { deviceData: null, showMoreMenuDialog: false, showSleepTimerLengthModal: false, + showAutoSleepTimerRewindLengthModal: false, moreMenuSetting: '', settings: { disableAutoRewind: false, @@ -125,7 +140,9 @@ export default { autoSleepTimerEndTime: '06:00', sleepTimerLength: 900000, // 15 minutes disableSleepTimerFadeOut: false, - disableSleepTimerResetFeedback: false + disableSleepTimerResetFeedback: false, + autoSleepTimerAutoRewind: false, + autoSleepTimerAutoRewindTime: 300000, // 5 minutes }, lockCurrentOrientation: false, settingInfo: { @@ -144,6 +161,10 @@ export default { disableSleepTimerResetFeedback: { name: 'Disable vibrate on reset', message: 'When the sleep timer gets reset your device will vibrate. Enable this setting to not vibrate when the sleep timer resets.' + }, + autoSleepTimerAutoRewind: { + name: "Enable sleep timer auto rewind", + message: "When the Auto Sleep Timer plays, automatically rewind your position in the book. " } }, hapticFeedbackItems: [ @@ -234,6 +255,10 @@ export default { const minutes = Number(this.settings.sleepTimerLength) / 1000 / 60 return `${minutes} min` }, + autoSleepTimerRewindLengthOption() { + const minutes = Number(this.settings.autoSleepTimerAutoRewindTime) / 1000 / 60 + return `${minutes} min` + }, moreMenuItems() { if (this.moreMenuSetting === 'shakeSensitivity') return this.shakeSensitivityItems else if (this.moreMenuSetting === 'hapticFeedback') return this.hapticFeedbackItems @@ -245,9 +270,16 @@ export default { this.settings.sleepTimerLength = value this.saveSettings() }, + showAutoSleepTimerRewindLengthModalSelection(value) { + this.settings.autoSleepTimerAutoRewindTime = value + this.saveSettings() + }, showSleepTimerOptions() { this.showSleepTimerLengthModal = true }, + showAutoSleepTimerRewindOptions() { + this.showAutoSleepTimerRewindLengthModal = true + }, showHapticFeedbackOptions() { this.moreMenuSetting = 'hapticFeedback' this.showMoreMenuDialog = true @@ -287,6 +319,10 @@ export default { this.settings.autoSleepTimer = !this.settings.autoSleepTimer this.saveSettings() }, + toggleAutoSleepTimerAutoRewind() { + this.settings.autoSleepTimerAutoRewind = !this.settings.autoSleepTimerAutoRewind + this.saveSettings + }, toggleDisableSleepTimerFadeOut() { this.settings.disableSleepTimerFadeOut = !this.settings.disableSleepTimerFadeOut this.saveSettings() @@ -364,6 +400,9 @@ export default { this.settings.sleepTimerLength = !isNaN(deviceSettings.sleepTimerLength) ? deviceSettings.sleepTimerLength : 900000 // 15 minutes this.settings.disableSleepTimerFadeOut = !!deviceSettings.disableSleepTimerFadeOut this.settings.disableSleepTimerResetFeedback = !!deviceSettings.disableSleepTimerResetFeedback + + this.settings.autoSleepTimerAutoRewind = !!deviceSettings.autoSleepTimerAutoRewind + this.settings.autoSleepTimerAutoRewindTime = !isNaN(deviceSettings.autoSleepTimerAutoRewindTime) ? deviceSettings.autoSleepTimerAutoRewindTime : 600000 // 10 minutes } }, mounted() { From 695ab84940adb37bf4f58ffcf1fb14a6d4e7490a Mon Sep 17 00:00:00 2001 From: hstephens Date: Sat, 29 Apr 2023 16:48:43 -0600 Subject: [PATCH 2/9] changed behavior for first timer set --- .../com/audiobookshelf/app/managers/SleepTimerManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index e5413598..5a76b1a6 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -22,6 +22,7 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe private var sleepTimerElapsed:Long = 0L private var sleepTimerFinishedAt:Long = 0L private var isAutoSleepTimer:Boolean = false // When timer was auto-set + private var isFirstAutoSleepTimer: Boolean = true private fun getCurrentTime():Long { return playerNotificationService.getCurrentTime() @@ -345,8 +346,10 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe Log.i(tag, "Current hour $currentHour is between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime} - starting sleep timer") // Automatically Rewind in the book if settings is enabled - if (deviceSettings.autoSleepTimerAutoRewind) { + if (deviceSettings.autoSleepTimerAutoRewind and !isFirstAutoSleepTimer) { playerNotificationService.seekBackward(deviceSettings.autoSleepTimerAutoRewindTime) + } else { + isFirstAutoSleepTimer = false } // Set sleep timer // When sleepTimerLength is 0 then use end of chapter/track time @@ -363,6 +366,7 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe setSleepTimer(deviceSettings.sleepTimerLength, false) } } else { + isFirstAutoSleepTimer = true Log.d(tag, "Current hour $currentHour is NOT between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime}") } } From a3794a6a6a576ce6bb48e09bd46b8cebd82ed38d Mon Sep 17 00:00:00 2001 From: hstephens Date: Sat, 29 Apr 2023 17:20:04 -0600 Subject: [PATCH 3/9] added check before setting state --- .../java/com/audiobookshelf/app/managers/SleepTimerManager.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index 5a76b1a6..261c0b7f 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -366,7 +366,8 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe setSleepTimer(deviceSettings.sleepTimerLength, false) } } else { - isFirstAutoSleepTimer = true + if !isFirstAutoSleepTimer: + isFirstAutoSleepTimer = true Log.d(tag, "Current hour $currentHour is NOT between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime}") } } From 65b69cc020363f5e8d387e67c9f19d5f95b04089 Mon Sep 17 00:00:00 2001 From: hstephens Date: Fri, 12 May 2023 20:19:18 -0600 Subject: [PATCH 4/9] fixed if statement syntax --- .../java/com/audiobookshelf/app/managers/SleepTimerManager.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index 261c0b7f..14985242 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -366,8 +366,9 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe setSleepTimer(deviceSettings.sleepTimerLength, false) } } else { - if !isFirstAutoSleepTimer: + if (!isFirstAutoSleepTimer) { isFirstAutoSleepTimer = true + } Log.d(tag, "Current hour $currentHour is NOT between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime}") } } From 8061ac0cedb3b5e54c213c833ca5adac28ac14aa Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 20 May 2023 11:41:39 -0500 Subject: [PATCH 5/9] Fix auto rewind when check resetting sleep timer --- .../app/managers/SleepTimerManager.kt | 41 ++++++++++++++----- .../app/player/PlayerListener.kt | 13 +++--- .../app/plugins/AbsAudioPlayer.kt | 3 +- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index 14985242..4d2e0751 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -23,6 +23,7 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe private var sleepTimerFinishedAt:Long = 0L private var isAutoSleepTimer:Boolean = false // When timer was auto-set private var isFirstAutoSleepTimer: Boolean = true + private var sleepTimerSessionId:String = "" private fun getCurrentTime():Long { return playerNotificationService.getCurrentTime() @@ -125,7 +126,8 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe return true } - fun setManualSleepTimer(time: Long, isChapterTime:Boolean):Boolean { + fun setManualSleepTimer(playbackSessionId:String, time: Long, isChapterTime:Boolean):Boolean { + sleepTimerSessionId = playbackSessionId isAutoSleepTimer = false return setSleepTimer(time, isChapterTime) } @@ -135,7 +137,6 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe sleepTimerTask = null sleepTimerEndTime = 0 sleepTimerRunning = false - isAutoSleepTimer = false playerNotificationService.unregisterSensor() setVolume(1f) @@ -229,6 +230,17 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe return } + // Automatically Rewind in the book if settings is enabled + if (isAutoSleepTimer) { + DeviceManager.deviceData.deviceSettings?.let { deviceSettings -> + if (deviceSettings.autoSleepTimerAutoRewind && !isFirstAutoSleepTimer) { + Log.i(tag, "Auto sleep timer auto rewind seeking back ${deviceSettings.autoSleepTimerAutoRewindTime}ms") + playerNotificationService.seekBackward(deviceSettings.autoSleepTimerAutoRewindTime) + } + isFirstAutoSleepTimer = false + } + } + // Set sleep timer // When sleepTimerLength is 0 then use end of chapter/track time if (sleepTimerLength == 0L) { @@ -346,11 +358,12 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe Log.i(tag, "Current hour $currentHour is between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime} - starting sleep timer") // Automatically Rewind in the book if settings is enabled - if (deviceSettings.autoSleepTimerAutoRewind and !isFirstAutoSleepTimer) { + if (deviceSettings.autoSleepTimerAutoRewind && !isFirstAutoSleepTimer) { + Log.i(tag, "Auto sleep timer auto rewind seeking back ${deviceSettings.autoSleepTimerAutoRewindTime}ms") playerNotificationService.seekBackward(deviceSettings.autoSleepTimerAutoRewindTime) - } else { - isFirstAutoSleepTimer = false } + isFirstAutoSleepTimer = false + // Set sleep timer // When sleepTimerLength is 0 then use end of chapter/track time if (deviceSettings.sleepTimerLength == 0L) { @@ -366,16 +379,24 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe setSleepTimer(deviceSettings.sleepTimerLength, false) } } else { - if (!isFirstAutoSleepTimer) { - isFirstAutoSleepTimer = true - } + Log.d(tag, "[TEST] sleep timer window not in $isFirstAutoSleepTimer") + isFirstAutoSleepTimer = true Log.d(tag, "Current hour $currentHour is NOT between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime}") } } } - fun handleMediaPlayEvent() { - checkShouldResetSleepTimer() + fun handleMediaPlayEvent(playbackSessionId:String) { + // Check if the playback session has changed + // If it hasn't changed OR the sleep timer is running then check reset the timer + // e.g. You set a manual sleep timer for 10 mins, then decide to change books, the sleep timer will stay on and reset to 10 mins + if (sleepTimerSessionId == playbackSessionId || sleepTimerRunning) { + checkShouldResetSleepTimer() + } else { + isFirstAutoSleepTimer = true + sleepTimerSessionId = playbackSessionId + } + checkAutoSleepTimer() } } diff --git a/android/app/src/main/java/com/audiobookshelf/app/player/PlayerListener.kt b/android/app/src/main/java/com/audiobookshelf/app/player/PlayerListener.kt index d7d42f7a..e4ae9c47 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/player/PlayerListener.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/player/PlayerListener.kt @@ -92,12 +92,15 @@ class PlayerListener(var playerNotificationService:PlayerNotificationService) : // Start/stop progress sync interval if (isPlaying) { - // Handles auto-starting sleep timer and resetting sleep timer - playerNotificationService.sleepTimerManager.handleMediaPlayEvent() - - player.volume = 1F // Volume on sleep timer might have decreased this val playbackSession: PlaybackSession? = playerNotificationService.mediaProgressSyncer.currentPlaybackSession ?: playerNotificationService.currentPlaybackSession - playbackSession?.let { playerNotificationService.mediaProgressSyncer.play(it) } + playbackSession?.let { + // Handles auto-starting sleep timer and resetting sleep timer + playerNotificationService.sleepTimerManager.handleMediaPlayEvent(it.id) + + player.volume = 1F // Volume on sleep timer might have decreased this + + playerNotificationService.mediaProgressSyncer.play(it) + } } else { playerNotificationService.mediaProgressSyncer.pause { Log.d(tag, "Media Progress Syncer paused and synced") diff --git a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt index a19d2227..a3b6a6e1 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt @@ -341,7 +341,8 @@ class AbsAudioPlayer : Plugin() { val isChapterTime:Boolean = call.getBoolean("isChapterTime", false) == true Handler(Looper.getMainLooper()).post { - val success:Boolean = playerNotificationService.sleepTimerManager.setManualSleepTimer(time, isChapterTime) + val playbackSession: PlaybackSession? = playerNotificationService.mediaProgressSyncer.currentPlaybackSession ?: playerNotificationService.currentPlaybackSession + val success:Boolean = playerNotificationService.sleepTimerManager.setManualSleepTimer(playbackSession?.id ?: "", time, isChapterTime) val ret = JSObject() ret.put("success", success) call.resolve(ret) From cb9e317e74d793942165335a1e3c901701b42638 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 20 May 2023 11:56:36 -0500 Subject: [PATCH 6/9] Initialize auto rewind time and update description --- .../audiobookshelf/app/data/DeviceClasses.kt | 2 +- .../audiobookshelf/app/device/DeviceManager.kt | 4 ++++ pages/settings.vue | 18 +++++++++--------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt b/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt index 6bda6d1b..a85a84a2 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt @@ -126,7 +126,7 @@ data class DeviceSettings( autoSleepTimerEndTime = "06:00", sleepTimerLength = 900000L, // 15 minutes autoSleepTimerAutoRewind = false, - autoSleepTimerAutoRewindTime = 300000L, + autoSleepTimerAutoRewindTime = 300000L, // 5 minutes disableSleepTimerFadeOut = false, disableSleepTimerResetFeedback = false ) diff --git a/android/app/src/main/java/com/audiobookshelf/app/device/DeviceManager.kt b/android/app/src/main/java/com/audiobookshelf/app/device/DeviceManager.kt index 57245e19..77391ae2 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/device/DeviceManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/device/DeviceManager.kt @@ -39,6 +39,10 @@ object DeviceManager { if (deviceData.deviceSettings?.shakeSensitivity == null) { deviceData.deviceSettings?.shakeSensitivity = ShakeSensitivitySetting.MEDIUM } + // Initialize auto sleep timer auto rewind added in v0.9.64 + if (deviceData.deviceSettings?.autoSleepTimerAutoRewindTime == null) { + deviceData.deviceSettings?.autoSleepTimerAutoRewindTime = 300000L // 5 minutes + } } fun getBase64Id(id:String):String { diff --git a/pages/settings.vue b/pages/settings.vue index ce7c3ff7..746b5319 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -95,11 +95,11 @@ -
-
- -
-

Auto Sleep Timer Auto Rewind

+
+
+ +
+

Auto Sleep Timer Auto Rewind

info
@@ -142,7 +142,7 @@ export default { disableSleepTimerFadeOut: false, disableSleepTimerResetFeedback: false, autoSleepTimerAutoRewind: false, - autoSleepTimerAutoRewindTime: 300000, // 5 minutes + autoSleepTimerAutoRewindTime: 300000 // 5 minutes }, lockCurrentOrientation: false, settingInfo: { @@ -163,8 +163,8 @@ export default { message: 'When the sleep timer gets reset your device will vibrate. Enable this setting to not vibrate when the sleep timer resets.' }, autoSleepTimerAutoRewind: { - name: "Enable sleep timer auto rewind", - message: "When the Auto Sleep Timer plays, automatically rewind your position in the book. " + name: 'Enable sleep timer auto rewind', + message: 'When the auto sleep timer finishes, playing the item again will automatically rewind your position.' } }, hapticFeedbackItems: [ @@ -402,7 +402,7 @@ export default { this.settings.disableSleepTimerResetFeedback = !!deviceSettings.disableSleepTimerResetFeedback this.settings.autoSleepTimerAutoRewind = !!deviceSettings.autoSleepTimerAutoRewind - this.settings.autoSleepTimerAutoRewindTime = !isNaN(deviceSettings.autoSleepTimerAutoRewindTime) ? deviceSettings.autoSleepTimerAutoRewindTime : 600000 // 10 minutes + this.settings.autoSleepTimerAutoRewindTime = !isNaN(deviceSettings.autoSleepTimerAutoRewindTime) ? deviceSettings.autoSleepTimerAutoRewindTime : 300000 // 5 minutes } }, mounted() { From e39a5e1ba3302fd73c838be9be270d15c2c84a26 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 20 May 2023 11:58:27 -0500 Subject: [PATCH 7/9] Fix saveSettings function call --- pages/settings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/settings.vue b/pages/settings.vue index 746b5319..76c7a594 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -321,7 +321,7 @@ export default { }, toggleAutoSleepTimerAutoRewind() { this.settings.autoSleepTimerAutoRewind = !this.settings.autoSleepTimerAutoRewind - this.saveSettings + this.saveSettings() }, toggleDisableSleepTimerFadeOut() { this.settings.disableSleepTimerFadeOut = !this.settings.disableSleepTimerFadeOut From c530e0f7e3493ab3f57a4be2659877c6b7688d12 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 20 May 2023 12:00:19 -0500 Subject: [PATCH 8/9] Remove test log --- .../java/com/audiobookshelf/app/managers/SleepTimerManager.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index 4d2e0751..def27905 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -379,7 +379,6 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe setSleepTimer(deviceSettings.sleepTimerLength, false) } } else { - Log.d(tag, "[TEST] sleep timer window not in $isFirstAutoSleepTimer") isFirstAutoSleepTimer = true Log.d(tag, "Current hour $currentHour is NOT between ${deviceSettings.autoSleepTimerStartTime} and ${deviceSettings.autoSleepTimerEndTime}") } From 9386ae95a3b63d2b935f9b4f5b7717e0f7f61c11 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 20 May 2023 12:17:41 -0500 Subject: [PATCH 9/9] Fix set sleepTimerSessionId --- .../java/com/audiobookshelf/app/managers/SleepTimerManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index def27905..1d13eb30 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -393,8 +393,8 @@ class SleepTimerManager constructor(private val playerNotificationService: Playe checkShouldResetSleepTimer() } else { isFirstAutoSleepTimer = true - sleepTimerSessionId = playbackSessionId } + sleepTimerSessionId = playbackSessionId checkAutoSleepTimer() }