diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index dc538bd72b..8f532413e9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -709,10 +709,16 @@ class RoomDetailFragment @Inject constructor( } override fun onVoiceRecordingEnded(lastKnownState: RecordingUiState?) { - if (lastKnownState != RecordingUiState.Locked) { - val isCancelled = lastKnownState == RecordingUiState.Cancelled - roomDetailViewModel.handle(RoomDetailAction.EndRecordingVoiceMessage(isCancelled = isCancelled)) - updateRecordingUiState(RecordingUiState.None) + when (lastKnownState) { + RecordingUiState.Locked -> { + // do nothing, + // onSendVoiceMessage, onDeleteVoiceMessage or onRecordingLimitReached will be triggered instead + } + else -> { + val isCancelled = lastKnownState == RecordingUiState.Cancelled + roomDetailViewModel.handle(RoomDetailAction.EndRecordingVoiceMessage(isCancelled = isCancelled)) + updateRecordingUiState(RecordingUiState.None) + } } }