mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-23 03:36:34 +10:00
giveUpMentionUserAction for MessageToolbar to hide mentionView if it's not be use
This commit is contained in:
@@ -976,6 +976,10 @@ class ConversationViewController: BaseViewController {
|
||||
}
|
||||
}
|
||||
|
||||
messageToolbar.giveUpMentionUserAction = { [weak self] in
|
||||
self?.mentionView.hide()
|
||||
}
|
||||
|
||||
// 在这里才尝试恢复 messageToolbar 的状态,因为依赖 stateTransitionAction
|
||||
|
||||
func tryRecoverMessageToolBar() {
|
||||
|
||||
@@ -144,6 +144,7 @@ class MessageToolbar: UIToolbar {
|
||||
var notifyTypingAction: (() -> Void)?
|
||||
|
||||
var tryMentionUserAction: ((usernamePrefix: String) -> Void)?
|
||||
var giveUpMentionUserAction: (() -> Void)?
|
||||
|
||||
var textSendAction: ((messageToolBar: MessageToolbar) -> Void)?
|
||||
|
||||
@@ -494,8 +495,12 @@ extension MessageToolbar: UITextViewDelegate {
|
||||
let usernamePrefix = lastPart.substringFromIndex(lastPart.startIndex.advancedBy(1))
|
||||
mentionUsernameRange = text.rangeOfString(lastPart)
|
||||
tryMentionUserAction?(usernamePrefix: usernamePrefix)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
giveUpMentionUserAction?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user