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 Reader #23947

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
2 changes: 1 addition & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +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]
* [*] Integrate zoom transitions in Themes, Reader [#23945, #23947]


25.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ final class ReaderPostCell: ReaderStreamBaseCell {
}
return ImageSize(scaling: CGSize(width: coverWidth, height: coverWidth), in: window)
}

func getViewForZoomTransition() -> UIView {
view
}
}

private final class ReaderPostCellView: UIView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,10 @@ extension ReaderStreamViewController: WPTableViewHandlerDelegate {
// Check to see if we need to load more.
syncMoreContentIfNeeded(for: tableView, indexPathForVisibleRow: indexPath)

if traitCollection.horizontalSizeClass == .regular, #available(iOS 18, *) {
cell.selectionStyle = .none
}

guard cell.isKind(of: ReaderCrossPostCell.self) else {
return
}
Expand Down Expand Up @@ -1471,6 +1475,18 @@ extension ReaderStreamViewController: WPTableViewHandlerDelegate {
WPAnalytics.trackReader(.readerPostCardTapped, properties: topicPropertyForStats() ?? [:])
}

if traitCollection.horizontalSizeClass == .regular, #available(iOS 18, *) {
controller.preferredTransition = .zoom { [weak self] context in
guard let self, let cell = self.tableView.cellForRow(at: indexPath) else {
return nil
}
if let cell = (cell as? ReaderPostCell) {
return cell.getViewForZoomTransition()
}
return cell.contentView
}
}

navigationController?.pushViewController(controller, animated: true)

tableView.deselectRow(at: indexPath, animated: false)
Expand Down