fix: inputAssistantItem duplicate setup issue

This commit is contained in:
CMK 2022-02-17 16:35:22 +08:00
parent 8f2e789183
commit 10eae495e4
1 changed files with 4 additions and 12 deletions

View File

@ -684,14 +684,15 @@ extension ComposeViewController {
// keyboard shortcutBar
private func setupInputAssistantItem(item: UITextInputAssistantItem) {
let groups = [UIBarButtonItemGroup(barButtonItems: [
let barButtonItems = [
composeToolbarView.mediaBarButtonItem,
composeToolbarView.pollBarButtonItem,
composeToolbarView.contentWarningBarButtonItem,
composeToolbarView.visibilityBarButtonItem,
], representativeItem: nil)]
]
let group = UIBarButtonItemGroup(barButtonItems: barButtonItems, representativeItem: nil)
item.trailingBarButtonGroups = groups
item.trailingBarButtonGroups = [group]
}
private func configureToolbarDisplay(keyboardHasShortcutBar: Bool) {
@ -770,15 +771,6 @@ extension ComposeViewController: UITextViewDelegate {
return true
}
func textViewDidBeginEditing(_ textView: UITextView) {
switch textView {
case textEditorView.textView:
setupInputAssistantItem(item: textView.inputAssistantItem)
default:
assertionFailure()
}
}
func textViewDidChange(_ textView: UITextView) {
switch textView {
case textEditorView.textView: