Persist the playback state of voice messages across different screens

This commit is contained in:
Florian Renaud 2022-11-09 11:29:12 +01:00
parent d9454af63e
commit dca379b80f
3 changed files with 4 additions and 5 deletions

View file

@ -253,8 +253,8 @@ class AudioMessageHelper @Inject constructor(
playbackTicker = null
}
fun clearTracker() {
playbackTracker.clear()
fun stopTracking() {
playbackTracker.unregisterListeners()
}
fun stopAllVoiceActions(deleteRecord: Boolean = true): MultiPickerAudioType? {

View file

@ -960,7 +960,7 @@ class MessageComposerViewModel @AssistedInject constructor(
}
fun endAllVoiceActions(deleteRecord: Boolean = true) {
audioMessageHelper.clearTracker()
audioMessageHelper.stopTracking()
audioMessageHelper.stopAllVoiceActions(deleteRecord)
}

View file

@ -136,12 +136,11 @@ class AudioMessagePlaybackTracker @Inject constructor() {
}
}
fun clear() {
fun unregisterListeners() {
listeners.forEach {
it.value.onUpdate(Listener.State.Idle)
}
listeners.clear()
states.clear()
}
companion object {