Merge pull request #790 from mpretty-cyro/fix/voice-recording-breaking-input

Fixed an issue where the voice recording could break the input view
pull/793/head
Morgan Pretty 3 years ago committed by GitHub
commit afc698e370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -405,8 +405,11 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
func handleInputViewButtonLongPressBegan(_ inputViewButton: InputViewButton?) { func handleInputViewButtonLongPressBegan(_ inputViewButton: InputViewButton?) {
guard inputViewButton == voiceMessageButton else { return } guard inputViewButton == voiceMessageButton else { return }
delegate?.startVoiceMessageRecording() // Note: The 'showVoiceMessageUI' call MUST come before triggering 'startVoiceMessageRecording'
// because if something goes wrong it'll trigger `hideVoiceMessageUI` and we don't want it to
// end up in a state with the input content hidden
showVoiceMessageUI() showVoiceMessageUI()
delegate?.startVoiceMessageRecording()
} }
func handleInputViewButtonLongPressMoved(_ inputViewButton: InputViewButton, with touch: UITouch?) { func handleInputViewButtonLongPressMoved(_ inputViewButton: InputViewButton, with touch: UITouch?) {
@ -467,9 +470,9 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
UIView.animate(withDuration: 0.25, animations: { UIView.animate(withDuration: 0.25, animations: {
allOtherViews.forEach { $0.alpha = 1 } allOtherViews.forEach { $0.alpha = 1 }
self.voiceMessageRecordingView?.alpha = 0 self.voiceMessageRecordingView?.alpha = 0
}, completion: { _ in }, completion: { [weak self] _ in
self.voiceMessageRecordingView?.removeFromSuperview() self?.voiceMessageRecordingView?.removeFromSuperview()
self.voiceMessageRecordingView = nil self?.voiceMessageRecordingView = nil
}) })
} }

Loading…
Cancel
Save