mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
To be able to resend, stop all voice actions without deleting.
This commit is contained in:
parent
13aee7d162
commit
39d92d8559
4 changed files with 10 additions and 6 deletions
|
@ -115,5 +115,5 @@ sealed class RoomDetailAction : VectorViewModelAction {
|
|||
object PauseRecordingVoiceMessage : RoomDetailAction()
|
||||
data class PlayOrPauseVoicePlayback(val eventId: String, val messageAudioContent: MessageAudioContent) : RoomDetailAction()
|
||||
object PlayOrPauseRecordingPlayback : RoomDetailAction()
|
||||
object EndAllVoiceActions : RoomDetailAction()
|
||||
data class EndAllVoiceActions(val deleteRecord: Boolean = true) : RoomDetailAction()
|
||||
}
|
||||
|
|
|
@ -1095,6 +1095,8 @@ class RoomDetailFragment @Inject constructor(
|
|||
|
||||
textComposerViewModel.handle(TextComposerAction.SaveDraft(views.composerLayout.text.toString()))
|
||||
|
||||
// We should improve the UX to support going into playback mode when paused and delete the media when the view is destroyed.
|
||||
roomDetailViewModel.handle(RoomDetailAction.EndAllVoiceActions(deleteRecord = false))
|
||||
views.voiceMessageRecorderView.initVoiceRecordingViews()
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
is RoomDetailAction.PlayOrPauseVoicePlayback -> handlePlayOrPauseVoicePlayback(action)
|
||||
RoomDetailAction.PauseRecordingVoiceMessage -> handlePauseRecordingVoiceMessage()
|
||||
RoomDetailAction.PlayOrPauseRecordingPlayback -> handlePlayOrPauseRecordingPlayback()
|
||||
RoomDetailAction.EndAllVoiceActions -> handleEndAllVoiceActions()
|
||||
is RoomDetailAction.EndAllVoiceActions -> handleEndAllVoiceActions(action.deleteRecord)
|
||||
is RoomDetailAction.RoomUpgradeSuccess -> {
|
||||
setState {
|
||||
copy(joinUpgradedRoomAsync = Success(action.replacementRoomId))
|
||||
|
@ -649,8 +649,8 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
voiceMessageHelper.startOrPauseRecordingPlayback()
|
||||
}
|
||||
|
||||
private fun handleEndAllVoiceActions() {
|
||||
voiceMessageHelper.stopAllVoiceActions()
|
||||
private fun handleEndAllVoiceActions(deleteRecord: Boolean) {
|
||||
voiceMessageHelper.stopAllVoiceActions(deleteRecord)
|
||||
}
|
||||
|
||||
private fun handlePauseRecordingVoiceMessage() {
|
||||
|
|
|
@ -217,10 +217,12 @@ class VoiceMessageHelper @Inject constructor(
|
|||
playbackTicker = null
|
||||
}
|
||||
|
||||
fun stopAllVoiceActions() {
|
||||
fun stopAllVoiceActions(deleteRecord: Boolean = true) {
|
||||
stopRecording()
|
||||
stopPlayback()
|
||||
if (deleteRecord) {
|
||||
deleteRecording()
|
||||
}
|
||||
playbackTracker.clear()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue