From 26058c7f82575c99771215233006f6600a2e49a3 Mon Sep 17 00:00:00 2001 From: kean Date: Mon, 6 Jan 2025 10:56:25 -0500 Subject: [PATCH] Integrate zoom transitions in Theme browser --- .../Themes/ThemeBrowserViewController.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Themes/ThemeBrowserViewController.swift b/WordPress/Classes/ViewRelated/Themes/ThemeBrowserViewController.swift index 7d37c1187616..5228e9a640e3 100644 --- a/WordPress/Classes/ViewRelated/Themes/ThemeBrowserViewController.swift +++ b/WordPress/Classes/ViewRelated/Themes/ThemeBrowserViewController.swift @@ -850,7 +850,13 @@ public protocol ThemePresenter: AnyObject { presentUrlForTheme(theme, url: theme?.viewUrl(), onClose: onWebkitViewControllerClose) } - @objc open func presentUrlForTheme(_ theme: Theme?, url: String?, activeButton: Bool = true, modalStyle: UIModalPresentationStyle = .pageSheet, onClose: (() -> Void)? = nil) { + @objc open func presentUrlForTheme( + _ theme: Theme?, + url: String?, + activeButton: Bool = true, + modalStyle: UIModalPresentationStyle = .pageSheet, + onClose: (() -> Void)? = nil + ) { guard let theme, let url = url.flatMap(URL.init(string:)) else { return } @@ -870,8 +876,14 @@ public protocol ThemePresenter: AnyObject { let webViewController = WebViewControllerFactory.controller(configuration: configuration, source: "theme_browser") webViewController.navigationItem.rightBarButtonItem = activateButton + let navigation = UINavigationController(rootViewController: webViewController) navigation.modalPresentationStyle = modalStyle + if #available(iOS 18, *), let indexPath = collectionView.indexPathsForSelectedItems?.first { + navigation.preferredTransition = .zoom(sourceViewProvider: { [weak self] _ in + self?.collectionView.cellForItem(at: indexPath)?.contentView + }) + } if searchController != nil && searchController.isActive { searchController.dismiss(animated: true, completion: {