properly restore navigation bar after dismissing mid-video
// FREEBIE
This commit is contained in:
parent
6a4642ed9b
commit
d94f355c2c
@ -174,7 +174,7 @@ protocol MediaGalleryDataSource: class {
|
||||
func galleryItem(after currentItem: MediaGalleryItem) -> MediaGalleryItem?
|
||||
|
||||
func showAllMedia(focusedItem: MediaGalleryItem)
|
||||
func dismissSelf(animated isAnimated: Bool, completion: (() -> Void)?)
|
||||
func dismissDetailView(_ pageViewController: MediaPageViewController, animated isAnimated: Bool, completion: (() -> Void)?)
|
||||
}
|
||||
|
||||
class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource, MediaTileViewControllerDelegate {
|
||||
@ -284,6 +284,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.presentationView.alpha = 1
|
||||
|
||||
// We want to animate the tapped media from it's position in the previous VC
|
||||
@ -408,8 +409,9 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
|
||||
//
|
||||
|
||||
guard let pageViewController = self.pageViewController else {
|
||||
owsFail("\(logTag) in \(#function) pageeViewController was unexpectedly nil")
|
||||
self.dismissSelf(animated: true)
|
||||
owsFail("\(logTag) in \(#function) pageViewController was unexpectedly nil")
|
||||
self.dismiss(animated: true)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -421,11 +423,11 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
|
||||
}
|
||||
}
|
||||
|
||||
public func dismissSelf(animated isAnimated: Bool, completion: (() -> Void)? = nil) {
|
||||
public func dismissDetailView(_ pageViewController: MediaPageViewController, animated isAnimated: Bool, completion: (() -> Void)?) {
|
||||
self.view.isUserInteractionEnabled = false
|
||||
UIApplication.shared.isStatusBarHidden = false
|
||||
|
||||
guard let detailView = pageViewController?.view else {
|
||||
guard let detailView = pageViewController.view else {
|
||||
owsFail("\(logTag) in \(#function) detailView was unexpectedly nil")
|
||||
self.presentingViewController?.dismiss(animated: false, completion: completion)
|
||||
return
|
||||
|
||||
@ -203,6 +203,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
|
||||
currentViewController.playVideo()
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
public func didPressAllMediaButton(sender: Any) {
|
||||
Logger.debug("\(logTag) in \(#function)")
|
||||
@ -255,7 +256,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
|
||||
private func updateFooterBarButtonItems(isPlayingVideo: Bool) {
|
||||
// TODO do we still need this? seems like a vestige
|
||||
// from when media detail view was used for attachment approval
|
||||
if (self.footerBar == nil) {
|
||||
if self.footerBar == nil {
|
||||
owsFail("\(logTag) No footer bar visible.")
|
||||
return
|
||||
}
|
||||
@ -453,7 +454,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
|
||||
return
|
||||
}
|
||||
|
||||
mediaGalleryDataSource.dismissSelf(animated: isAnimated, completion: completion)
|
||||
mediaGalleryDataSource.dismissDetailView(self, animated: isAnimated, completion: completion)
|
||||
}
|
||||
|
||||
public func mediaDetailViewController(_ mediaDetailViewController: MediaDetailViewController, isPlayingVideo: Bool) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user