diff --git a/CHANGELOG.md b/CHANGELOG.md index 8662182ed82..3accfaeb9da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ([#817](https://github.com/Automattic/pocket-casts-android/pull/817)). * Fixed Automotive Up Next podcast images not loading. ([#819](https://github.com/Automattic/pocket-casts-android/pull/819)). + * Fixed missing seek bar in the notification drawer and Android Automotive. + ([#822](https://github.com/Automattic/pocket-casts-android/pull/822)). 7.34 ----- diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/MediaSessionManager.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/MediaSessionManager.kt index 9c712c48aa7..d1cd3cbace7 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/MediaSessionManager.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/MediaSessionManager.kt @@ -109,7 +109,13 @@ class MediaSessionManager( observePlaybackState() observeCustomMediaActionsVisibility() observeMediaNotificationControls() - playbackManager.upNextQueue.changesObservable + playbackManager.upNextQueue.getChangesObservableWithLiveCurrentEpisode(episodeManager, podcastManager) + // ignore the playing episode progress updates, but update when the media player read the duration from the file. + .distinctUntilChanged { stateOne, stateTwo -> + UpNextQueue.State.isEqualWithEpisodeCompare(stateOne, stateTwo) { episodeOne, episodeTwo -> + episodeOne.uuid == episodeTwo.uuid && episodeOne.duration == episodeTwo.duration + } + } .observeOn(Schedulers.io()) .doOnNext { updateUpNext(it) } .subscribeBy(onError = { Timber.e(it) }) diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/UpNextQueue.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/UpNextQueue.kt index 41550c4e823..109234435e8 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/UpNextQueue.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/UpNextQueue.kt @@ -44,6 +44,19 @@ interface UpNextQueue { fun queueSize(): Int { return if (this is Loaded) queue.size else 0 } + + companion object { + fun isEqualWithEpisodeCompare(stateOne: State, stateTwo: State, isPlayingEpisodeEqual: (Playable, Playable) -> Boolean): Boolean { + return when { + stateOne is Empty && stateTwo is Empty -> true + stateOne is Loaded && stateTwo is Loaded -> { + stateOne.queue.map { it.uuid } == stateTwo.queue.map { it.uuid } && + isPlayingEpisodeEqual(stateOne.episode, stateTwo.episode) + } + else -> false + } + } + } } fun setup()