mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Prevent invalid composer mode crashes
Cause by voice recording racing against the send action.
This commit is contained in:
@@ -189,6 +189,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
switch state.composerMode {
|
||||
case .previewVoiceMessage:
|
||||
actionsSubject.send(.voiceMessage(.send))
|
||||
case .recordVoiceMessage:
|
||||
MXLog.warning("Ignoring send action while recording a voice message.")
|
||||
default:
|
||||
if context.composerFormattingEnabled {
|
||||
actionsSubject.send(.sendMessage(plain: wysiwygViewModel.content.markdown,
|
||||
|
||||
@@ -807,7 +807,8 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
intentionalMentions: intentionalMentions)
|
||||
}
|
||||
case .recordVoiceMessage, .previewVoiceMessage:
|
||||
fatalError("invalid composer mode.")
|
||||
MXLog.error("Ignoring sendCurrentMessage with invalid composer mode: \(mode)")
|
||||
return
|
||||
}
|
||||
|
||||
scrollToBottom()
|
||||
|
||||
Reference in New Issue
Block a user