fix: custom emoji picker not cancel when switch input. resolve #199

This commit is contained in:
CMK 2021-07-06 17:06:39 +08:00
parent d61a9b315f
commit 888d2a1408
1 changed files with 7 additions and 0 deletions

View File

@ -809,8 +809,12 @@ extension ComposeViewController: ComposeToolbarViewDelegate {
}
func composeToolbarView(_ composeToolbarView: ComposeToolbarView, pollButtonDidPressed sender: UIButton) {
// toggle poll composing state
viewModel.isPollComposing.value.toggle()
// cancel custom picker input
viewModel.isCustomEmojiComposing.value = false
// setup initial poll option if needs
if viewModel.isPollComposing.value, viewModel.pollOptionAttributes.value.isEmpty {
viewModel.pollOptionAttributes.value = [ComposeStatusPollItem.PollOptionAttribute(), ComposeStatusPollItem.PollOptionAttribute()]
@ -831,6 +835,9 @@ extension ComposeViewController: ComposeToolbarViewDelegate {
}
func composeToolbarView(_ composeToolbarView: ComposeToolbarView, contentWarningButtonDidPressed sender: UIButton) {
// cancel custom picker input
viewModel.isCustomEmojiComposing.value = false
// restore first responder for text editor when content warning dismiss
if viewModel.isContentWarningComposing.value {
if contentWarningEditorTextView()?.isFirstResponder == true {