clarifying why we do nothing when the state is locked on voice recording ended

This commit is contained in:
Adam Brown 2021-11-18 17:21:03 +00:00
parent 16ca7d5040
commit 4dbb150ac2
1 changed files with 10 additions and 4 deletions

View File

@ -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)
}
}
}