feat: show all media view with media & document sections from tapping All Media nav button

This commit is contained in:
ryanzhao 2022-08-10 13:41:24 +10:00
parent a162f324b1
commit fa1a67d957
2 changed files with 17 additions and 4 deletions

View File

@ -184,6 +184,19 @@ extension AllMediaViewController: MediaTileViewControllerDelegate {
} }
} }
// MARK: - UIViewControllerTransitioningDelegate
extension AllMediaViewController: UIViewControllerTransitioningDelegate {
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return self.mediaTitleViewController.animationController(forPresented: presented, presenting: presenting, source: source)
}
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return self.mediaTitleViewController.animationController(forDismissed: dismissed)
}
}
// MARK: - MediaPresentationContextProvider // MARK: - MediaPresentationContextProvider
extension AllMediaViewController: MediaPresentationContextProvider { extension AllMediaViewController: MediaPresentationContextProvider {

View File

@ -458,7 +458,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// MediaTileViewController then just pop/dismiss the screen // MediaTileViewController then just pop/dismiss the screen
guard guard
let presentingNavController: UINavigationController = (self.presentingViewController as? UINavigationController), let presentingNavController: UINavigationController = (self.presentingViewController as? UINavigationController),
!(presentingNavController.viewControllers.last is MediaTileViewController) !(presentingNavController.viewControllers.last is AllMediaViewController)
else { else {
guard self.navigationController?.viewControllers.count == 1 else { guard self.navigationController?.viewControllers.count == 1 else {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
@ -471,7 +471,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// Otherwise if we came via the conversation screen we need to push a new // Otherwise if we came via the conversation screen we need to push a new
// instance of MediaTileViewController // instance of MediaTileViewController
let tileViewController: MediaTileViewController = MediaGalleryViewModel.createMediaTileViewController( let allMediaViewController: AllMediaViewController = MediaGalleryViewModel.createAllMediaViewController(
threadId: self.viewModel.threadId, threadId: self.viewModel.threadId,
threadVariant: self.viewModel.threadVariant, threadVariant: self.viewModel.threadVariant,
focusedAttachmentId: currentItem.attachment.id, focusedAttachmentId: currentItem.attachment.id,
@ -479,9 +479,9 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
) )
let navController: MediaGalleryNavigationController = MediaGalleryNavigationController() let navController: MediaGalleryNavigationController = MediaGalleryNavigationController()
navController.viewControllers = [tileViewController] navController.viewControllers = [allMediaViewController]
navController.modalPresentationStyle = .overFullScreen navController.modalPresentationStyle = .overFullScreen
navController.transitioningDelegate = tileViewController navController.transitioningDelegate = allMediaViewController
self.navigationController?.present(navController, animated: true) self.navigationController?.present(navController, animated: true)
} }