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()
|
object PauseRecordingVoiceMessage : RoomDetailAction()
|
||||||
data class PlayOrPauseVoicePlayback(val eventId: String, val messageAudioContent: MessageAudioContent) : RoomDetailAction()
|
data class PlayOrPauseVoicePlayback(val eventId: String, val messageAudioContent: MessageAudioContent) : RoomDetailAction()
|
||||||
object PlayOrPauseRecordingPlayback : 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()))
|
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()
|
views.voiceMessageRecorderView.initVoiceRecordingViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
is RoomDetailAction.PlayOrPauseVoicePlayback -> handlePlayOrPauseVoicePlayback(action)
|
is RoomDetailAction.PlayOrPauseVoicePlayback -> handlePlayOrPauseVoicePlayback(action)
|
||||||
RoomDetailAction.PauseRecordingVoiceMessage -> handlePauseRecordingVoiceMessage()
|
RoomDetailAction.PauseRecordingVoiceMessage -> handlePauseRecordingVoiceMessage()
|
||||||
RoomDetailAction.PlayOrPauseRecordingPlayback -> handlePlayOrPauseRecordingPlayback()
|
RoomDetailAction.PlayOrPauseRecordingPlayback -> handlePlayOrPauseRecordingPlayback()
|
||||||
RoomDetailAction.EndAllVoiceActions -> handleEndAllVoiceActions()
|
is RoomDetailAction.EndAllVoiceActions -> handleEndAllVoiceActions(action.deleteRecord)
|
||||||
is RoomDetailAction.RoomUpgradeSuccess -> {
|
is RoomDetailAction.RoomUpgradeSuccess -> {
|
||||||
setState {
|
setState {
|
||||||
copy(joinUpgradedRoomAsync = Success(action.replacementRoomId))
|
copy(joinUpgradedRoomAsync = Success(action.replacementRoomId))
|
||||||
|
@ -649,8 +649,8 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
voiceMessageHelper.startOrPauseRecordingPlayback()
|
voiceMessageHelper.startOrPauseRecordingPlayback()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleEndAllVoiceActions() {
|
private fun handleEndAllVoiceActions(deleteRecord: Boolean) {
|
||||||
voiceMessageHelper.stopAllVoiceActions()
|
voiceMessageHelper.stopAllVoiceActions(deleteRecord)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handlePauseRecordingVoiceMessage() {
|
private fun handlePauseRecordingVoiceMessage() {
|
||||||
|
|
|
@ -217,10 +217,12 @@ class VoiceMessageHelper @Inject constructor(
|
||||||
playbackTicker = null
|
playbackTicker = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stopAllVoiceActions() {
|
fun stopAllVoiceActions(deleteRecord: Boolean = true) {
|
||||||
stopRecording()
|
stopRecording()
|
||||||
stopPlayback()
|
stopPlayback()
|
||||||
|
if (deleteRecord) {
|
||||||
deleteRecording()
|
deleteRecording()
|
||||||
|
}
|
||||||
playbackTracker.clear()
|
playbackTracker.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue