mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-23 08:10:15 +01:00
Merge pull request #4215 from vector-im/feature/ons/fix_voice_message_resend
Voice message - Do not delete file to be able to resend
This commit is contained in:
commit
13ec4db8a2
1
changelog.d/4006.bugfix
Normal file
1
changelog.d/4006.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Voice Message not sendable if recorded while flight mode was on
|
@ -291,6 +291,11 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
|
||||
filesToDelete.forEach {
|
||||
tryOrNull { it.delete() }
|
||||
}
|
||||
|
||||
// Delete the temporary voice message file
|
||||
if (params.attachment.type == ContentAttachmentData.Type.AUDIO && params.attachment.mimeType == MimeTypes.Ogg) {
|
||||
context.contentResolver.delete(params.attachment.queryUri, null, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ 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)
|
||||
roomDetailViewModel.handle(RoomDetailAction.EndAllVoiceActions(deleteRecord = false))
|
||||
views.voiceMessageRecorderView.initVoiceRecordingViews()
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,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))
|
||||
@ -651,8 +651,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()
|
||||
deleteRecording()
|
||||
if (deleteRecord) {
|
||||
deleteRecording()
|
||||
}
|
||||
playbackTracker.clear()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user