-
Notifications
You must be signed in to change notification settings - Fork 139
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
Fix auto play when skipping last #2037
Fix auto play when skipping last #2037
Conversation
podcasts/PlaybackManager.swift
Outdated
@@ -1352,6 +1352,7 @@ class PlaybackManager: ServerPlaybackDelegate { | |||
} else { | |||
FileLog.shared.addMessage("Skipping last \(timeRemaining) seconds of episode because podcast has skip last of \(skipLast) set.") | |||
StatsManager.shared.addAutoSkipTime(timeRemaining) | |||
playerDidFinishPlayingEpisode() | |||
EpisodeManager.markAsPlayed(episode: episode, fireNotification: true) |
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.
@SergioEstevao Is the call to EpisodeManager.markAsPlayed()
still needed? I think all the episode cleanup is already done via playerDidFinishPlayingEpisode()
.
Also, this will fix the bug for Skip Outro, but not the similar bug when episode is marked as played from Mini Player or Episode list. It would be good to fix all instances, if possible.
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.
@SergioEstevao as @rviljoen mentioned I think we have duplicate calls with this change.
Also, following his comment, we could try to fix that in all instances. I played a bit with it and came up with this diff.
It involves adding a new notification and handling it accordingly. This should fix all instances: the reported bug, marking as played (from miniplayer or anywhere else).
We would need to test a bit more to make sure we haven't introduced any regression though.
Hi @leandroalonso - I think your approach can work well. You will just need to do the same for The other idea I had was to insert a call to pocket-casts-ios/podcasts/PlaybackManager.swift Lines 546 to 563 in 3747b79
I did some quick testing and I think it covers all the cases. In addition I think it is a low risk change, because the only thing that method call does is to add a single episode to the queue if the queue is empty and autoPlay is enabled. Rest of the app logic remains the same. |
Oh, nice! Agree that's a best approach and less risky! |
@rviljoen thanks for the suggestion So you believe with that change we don't need to do any other change? or this is in conjunction with Leandro changes? |
I think that one liner covers all the cases without the need for any other code changes. Please check my logic though 😄 |
@leandroalonso I update the code with @rviljoen suggestion. I tested it with the following scenarios:
It looks it's working correctly on the above do you mind give it another look? |
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.
Looks good to me!
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.
@SergioEstevao one last thing: you can remove the autoplayIfNeeded()
in line 978
.
I think that one has to stay in for the case where the episode plays to the end without skip outro and when episode is not mark as played/archived by the user. |
I agree with you @rviljoen . I just tested the above and we need that line to be there for Auto-play to work |
Ops, my mistake. 🤦 Thank you both! |
| 📘 Part of: # |
|:---:|
Fixes #2019
Updates the code to make sure that auto-play logic and other end of episode logic is activated when skip last is triggered.
To test
Checklist
CHANGELOG.md
if necessary.