From 4dbb150ac2dd69022975128b855cace949204cc8 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 18 Nov 2021 17:21:03 +0000 Subject: [PATCH] clarifying why we do nothing when the state is locked on voice recording ended --- .../home/room/detail/RoomDetailFragment.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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) + } } }