Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate zoom transitions in Theme browser #23945

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [*] Fix an issue with comments being lost on request failure [#23942]
* [*] Fix an issue with Referrers in Stats showing invalid icons [#23943]
* [*] Update site menu style on iPhone [#23944]
* [*] Integrate zoom transitions in Themes [#23945]


25.6
Expand Down
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