Skip to content

Commit

Permalink
Integrate zoom transitions in Theme browser
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jan 6, 2025
1 parent fcc9cf5 commit 26058c7
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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: {
Expand Down

0 comments on commit 26058c7

Please sign in to comment.