Views presented from ConversationVC must become first responder.

// FREEBIE
This commit is contained in:
Michael Kirk 2018-05-07 19:24:48 -04:00
parent 41aa7eafe3
commit 353abfc13e
2 changed files with 27 additions and 3 deletions

View File

@ -220,6 +220,21 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
fatalError("init(coder:) has not been implemented")
}
override var canBecomeFirstResponder: Bool {
Logger.debug("\(self.logTag) in \(#function)")
return true
}
override public func becomeFirstResponder() -> Bool {
Logger.debug("\(self.logTag) in \(#function)")
return super.becomeFirstResponder()
}
override public func resignFirstResponder() -> Bool {
Logger.debug("\(self.logTag) in \(#function)")
return super.resignFirstResponder()
}
// MARK: View Lifecyle
override func viewDidLoad() {
@ -296,7 +311,7 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
self.applyInitialMediaViewConstraints()
// Restore presentationView.alpha in case a previous dismiss left us in a bad state.
pageViewController.navigationController?.setNavigationBarHidden(false, animated: false)
self.setNavigationBarHidden(false, animated: false)
self.presentationView.alpha = 1
// We want to animate the tapped media from it's position in the previous VC
@ -362,6 +377,15 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
self.view.isUserInteractionEnabled = true
pageViewController.wasPresented()
// Since we're presenting *over* the ConversationVC, we need to `becomeFirstResponder`.
//
// Otherwise, the `ConversationVC.inputAccessoryView` will appear over top of us whenever
// OWSWindowManager window juggling calls `[rootWindow makeKeyAndVisible]`.
//
// We don't need to do this when pushing VCs onto the SignalsNavigationController - only when
// presenting directly from ConversationVC.
_ = self.becomeFirstResponder()
})
}
}

View File

@ -346,8 +346,8 @@ const UIWindowLevel UIWindowLevel_ScreenBlocking(void)
}
// By calling makeKeyAndVisible we ensure the rootViewController becomes firt responder.
// In the normal case, that means the SignalViewController will call `becomeFirstResponder` on the vc on top of it's
// navigation stack.
// In the normal case, that means the SignalViewController will call `becomeFirstResponder`
// on the vc on top of its navigation stack.
[self.rootWindow makeKeyAndVisible];
}