fix an keyboard issue of Calls

pull/1061/head
Ryan ZHAO 3 months ago
parent 1b40c1363a
commit dcaec4b2a8

@ -28,8 +28,8 @@ extension SessionCallManager {
let callVC = CallVC(for: call)
if let conversationVC = presentingVC as? ConversationVC {
callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0
conversationVC.resignFirstResponder()
conversationVC.hideInputAccessoryView()
}
presentingVC.present(callVC, animated: true) {

@ -246,6 +246,7 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
{
let callVC = CallVC(for: call)
callVC.conversationVC = conversationVC
conversationVC.resignFirstResponder()
conversationVC.hideInputAccessoryView()
presentingVC.present(callVC, animated: true, completion: nil)
}

@ -204,8 +204,8 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
let callVC = CallVC(for: self.call)
if let conversationVC = (presentingVC as? TopBannerController)?.wrappedViewController() as? ConversationVC {
callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0
conversationVC.resignFirstResponder()
conversationVC.hideInputAccessoryView()
}
presentingVC.present(callVC, animated: true) { [weak self] in

@ -807,6 +807,8 @@ extension ConversationVC:
}
return
}
self.isKeyboardVisible = self.snInputView.isKeyboardVisible
self.inputAccessoryView?.resignFirstResponder()
self.inputAccessoryView?.isHidden = true
self.inputAccessoryView?.alpha = 0
}
@ -821,6 +823,9 @@ extension ConversationVC:
UIView.animate(withDuration: 0.25, animations: {
self.inputAccessoryView?.isHidden = false
self.inputAccessoryView?.alpha = 1
if self.isKeyboardVisible {
self.inputAccessoryView?.becomeFirstResponder()
}
})
}

@ -22,6 +22,7 @@ final class ConversationVC: BaseVC, LibSessionRespondingViewController, Conversa
private var isAutoLoadingNextPage: Bool = false
private var isLoadingMore: Bool = false
var isReplacingThread: Bool = false
var isKeyboardVisible: Bool = false
/// This flag indicates whether the thread data has been reloaded after a disappearance (it defaults to true as it will
/// never have disappeared before - this is only needed for value observers since they run asynchronously)

@ -141,6 +141,10 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
}()
private lazy var additionalContentContainer = UIView()
public var isKeyboardVisible: Bool {
inputTextView.isFirstResponder
}
// MARK: - Initialization
@ -446,6 +450,10 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
override func resignFirstResponder() -> Bool {
inputTextView.resignFirstResponder()
}
override func becomeFirstResponder() -> Bool {
inputTextView.becomeFirstResponder()
}
func handleLongPress(_ gestureRecognizer: UITapGestureRecognizer) {
// Not relevant in this case

@ -904,8 +904,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
conversationVC.viewModel.threadData.threadId == call.sessionId
{
callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0
conversationVC.resignFirstResponder()
conversationVC.hideInputAccessoryView()
}
presentingVC.present(callVC, animated: true, completion: nil)

Loading…
Cancel
Save