Views presented from ConversationVC must become first responder.

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 41aa7eafe3
commit 353abfc13e

@ -220,6 +220,21 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
fatalError("init(coder:) has not been implemented") 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 // MARK: View Lifecyle
override func viewDidLoad() { override func viewDidLoad() {
@ -296,7 +311,7 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
self.applyInitialMediaViewConstraints() self.applyInitialMediaViewConstraints()
// Restore presentationView.alpha in case a previous dismiss left us in a bad state. // 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 self.presentationView.alpha = 1
// We want to animate the tapped media from it's position in the previous VC // 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 self.view.isUserInteractionEnabled = true
pageViewController.wasPresented() 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()
}) })
} }
} }

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

Loading…
Cancel
Save