Fixes bugs related to audio message duration being set incorrectly between activity states

This commit is contained in:
ericdecanini 2022-03-29 17:40:00 +02:00
parent cc5e8f35a7
commit 6adf4878f7
2 changed files with 6 additions and 3 deletions

View File

@ -900,6 +900,7 @@ class TimelineFragment @Inject constructor(
}
override fun onDestroyView() {
audioMessagePlaybackTracker.makeAllPlaybacksIdle()
lazyLoadedViews.unBind()
timelineEventController.callback = null
timelineEventController.removeModelBuildListener(modelBuildListener)

View File

@ -93,10 +93,12 @@ class AudioMessagePlaybackTracker @Inject constructor() {
}
fun pausePlayback(id: String) {
if (getPlaybackState(id) is Listener.State.Playing) {
val currentPlaybackTime = getPlaybackTime(id)
val currentPercentage = getPercentage(id)
setState(id, Listener.State.Paused(currentPlaybackTime, currentPercentage))
}
}
fun stopPlayback(id: String) {
setState(id, Listener.State.Idle)