Fixes bugs related to audio message duration being set incorrectly between activity states
This commit is contained in:
parent
cc5e8f35a7
commit
6adf4878f7
|
@ -900,6 +900,7 @@ class TimelineFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
audioMessagePlaybackTracker.makeAllPlaybacksIdle()
|
||||||
lazyLoadedViews.unBind()
|
lazyLoadedViews.unBind()
|
||||||
timelineEventController.callback = null
|
timelineEventController.callback = null
|
||||||
timelineEventController.removeModelBuildListener(modelBuildListener)
|
timelineEventController.removeModelBuildListener(modelBuildListener)
|
||||||
|
|
|
@ -93,10 +93,12 @@ class AudioMessagePlaybackTracker @Inject constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pausePlayback(id: String) {
|
fun pausePlayback(id: String) {
|
||||||
|
if (getPlaybackState(id) is Listener.State.Playing) {
|
||||||
val currentPlaybackTime = getPlaybackTime(id)
|
val currentPlaybackTime = getPlaybackTime(id)
|
||||||
val currentPercentage = getPercentage(id)
|
val currentPercentage = getPercentage(id)
|
||||||
setState(id, Listener.State.Paused(currentPlaybackTime, currentPercentage))
|
setState(id, Listener.State.Paused(currentPlaybackTime, currentPercentage))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun stopPlayback(id: String) {
|
fun stopPlayback(id: String) {
|
||||||
setState(id, Listener.State.Idle)
|
setState(id, Listener.State.Idle)
|
||||||
|
|
Loading…
Reference in New Issue