Update footer when returning to details via Tile view

// FREEBIE
This commit is contained in:
Michael Kirk 2018-03-19 20:46:35 -04:00
parent 5fdadf5bde
commit 2095cbb0c6
2 changed files with 35 additions and 3 deletions

View file

@ -377,11 +377,39 @@ class MediaGalleryViewController: UINavigationController, MediaGalleryDataSource
func mediaTileViewController(_ viewController: MediaTileViewController, didTapView tappedView: UIView, mediaGalleryItem: MediaGalleryItem) {
if self.fromNavController != nil {
// If from conversation settings view, we've already pushed
// If we got to the gallery via conversation settings, present the detail view
// on top of the tile view
//
// == ViewController Schematic ==
//
// [DetailView] <--,
// [TileView] -----'
// [ConversationSettingsView]
// [ConversationView]
//
self.presentDetailView(fromViewController: mediaTileViewController, initialDetailItem: mediaGalleryItem, replacingView: tappedView)
} else {
// If from conversation view
self.pageViewController!.currentItem = mediaGalleryItem
// If we got to the gallery via the conversation view, pop the tile view
// to return to the detail view
//
// == ViewController Schematic ==
//
// [TileView] -----,
// [DetailView] <--'
// [ConversationView]
//
guard let pageViewController = self.pageViewController else {
owsFail("\(logTag) in \(#function) pageeViewController was unexpectedly nil")
self.dismissSelf(animated: true)
return
}
pageViewController.currentItem = mediaGalleryItem
pageViewController.willBePresentedAgain()
// TODO fancy zoom animation
self.popViewController(animated: true)
}
}

View file

@ -179,6 +179,10 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// MARK: View Helpers
public func willBePresentedAgain() {
updateFooterBarButtonItems(isPlayingVideo: false)
}
public func wasPresented() {
let currentViewController = self.currentViewController