Hide input view after user left group

This commit is contained in:
Niels Andriesse 2021-02-23 11:28:22 +11:00
parent 1b9aa9aea2
commit d833bbc44c
1 changed files with 14 additions and 1 deletions

View File

@ -33,8 +33,15 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
var audioSession: OWSAudioSession { Environment.shared.audioSession }
var dbConnection: YapDatabaseConnection { OWSPrimaryStorage.shared().uiDatabaseConnection }
var viewItems: [ConversationViewItem] { viewModel.viewState.viewItems }
override var inputAccessoryView: UIView? { isShowingSearchUI ? searchController.resultsBar : snInputView }
override var canBecomeFirstResponder: Bool { true }
override var inputAccessoryView: UIView? {
if let thread = thread as? TSGroupThread, thread.groupModel.groupType == .closedGroup && !thread.isCurrentUserMemberInGroup() {
return nil
} else {
return isShowingSearchUI ? searchController.resultsBar : snInputView
}
}
var tableViewUnobscuredHeight: CGFloat {
let bottomInset = messagesTableView.adjustedContentInset.bottom
@ -135,6 +142,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
notificationCenter.addObserver(self, selector: #selector(handleKeyboardWillHideNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
notificationCenter.addObserver(self, selector: #selector(handleAudioDidFinishPlayingNotification(_:)), name: .SNAudioDidFinishPlaying, object: nil)
notificationCenter.addObserver(self, selector: #selector(addOrRemoveBlockedBanner), name: NSNotification.Name(rawValue: kNSNotificationName_BlockListDidChange), object: nil)
notificationCenter.addObserver(self, selector: #selector(handleGroupUpdatedNotification), name: .groupThreadUpdated, object: nil)
// Mentions
MentionsManager.populateUserPublicKeyCacheIfNeeded(for: thread.uniqueId!)
}
@ -312,6 +320,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
}
@objc private func handleGroupUpdatedNotification() {
thread.reload()
reloadInputViews()
}
// MARK: General
@objc func addOrRemoveBlockedBanner() {
func detach() {