-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sleep Timer: automatically restart if playback is resumed within 5 minutes #2048
Conversation
I personally would find 5 mins a tad long, personally i think it should be between 90 seconds or a maximum of 3 mins but if it's a factor of accurate clocks then fair, I would potentially also have a toast with a button to cancel because a user might be unaware of the functionality & that would be quite bad in my opinion 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Feature works as described. I've tried breaking it by kill app process and leaving only media notification but everything worked. I left some comments regarding design of the class that would make it easier to maintain in the long-term.
Also, a changelog entry is missing.
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
e78cad9
to
8e687f5
Compare
Hey @MiSikora Thanks for your review! I've just addressed all changes |
@CookieyedCodes Thank you for share your feedback! I will share this with our team. I agree that we should at least let the user knows about it |
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
...epositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SleepTimer.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left one formatting nitpick.
} | ||
private fun cancelAutomaticSleepAfterTimeRestart() { | ||
lastSleepAfterTime = null | ||
} | ||
private fun cancelAutomaticSleepOnEpisodeEndRestart() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some empty space formatting is missing here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
I thought ./gradlew spotlessApply
would handle cases like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm surprised it doesn't complain about it. Maybe something to configure.
281c2d1
to
e5e96c7
Compare
Description
This PR implements a mechanism to restart the sleep timer whenever the user restarts playback within 5 minutes.
While I was working on this, I have found two issues that I reported here:
Testing Instructions
Restarting timer for a given amount of time
🔵 Tracked: player_sleep_timer_restarted ["time": [time here]]
is trackedNot restarting timer
SleepTimer.MIN_TIME_TO_RESTART_SLEEP_TIMER_IN_MINUTES
to 1 so you don't need to wait for 5 minutesRestarting timer for end of episode
🔵 Tracked: player_sleep_timer_restarted ["time": "end_of_episode"]
is trackedCanceling
Checklist
./gradlew spotlessApply
to automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xml
I have tested any UI changes...