Fix: shake to reset only during grace period or while playing

This commit is contained in:
Nicholas Wallace 2025-02-02 12:49:08 -07:00
parent c7f51e815c
commit e7e03697d6

View file

@ -343,9 +343,12 @@ constructor(private val playerNotificationService: PlayerNotificationService) {
} }
} }
/** Handles the shake event to reset the sleep timer. */ /**
* Handles the shake event to reset the sleep timer. Shaking to reset only works during the 2
* minute grace period after the timer ends or while media is playing.
*/
fun handleShake() { fun handleShake() {
if (sleepTimerRunning || sleepTimerFinishedAt > 0L) { if ((sleepTimerRunning && getIsPlaying()) || sleepTimerFinishedAt > 0L) {
if (DeviceManager.deviceData.deviceSettings?.disableShakeToResetSleepTimer == true) { if (DeviceManager.deviceData.deviceSettings?.disableShakeToResetSleepTimer == true) {
Log.d(tag, "Shake to reset sleep timer is disabled") Log.d(tag, "Shake to reset sleep timer is disabled")
return return