Skip to content
Open
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 iOS/Article/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class WebViewController: UIViewController {
weak var coordinator: SceneCoordinator!
weak var delegate: WebViewControllerDelegate?

private(set) var article: Article?
var article: Article?

let scrollPositionQueue = CoalescingQueue(name: "Article Scroll Position", interval: 0.3, maxInterval: 0.3)
var windowScrollY = 0 {
Expand Down
18 changes: 17 additions & 1 deletion iOS/MainTimeline/MainTimelineModernViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,14 @@ extension MainTimelineModernViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemsAt indexPaths: [IndexPath], point: CGPoint) -> UIContextMenuConfiguration? {
guard let firstIndex = indexPaths.first, let dataSource, let article = dataSource.itemIdentifier(for: firstIndex) else { return nil }

return UIContextMenuConfiguration(identifier: firstIndex.row as NSCopying, previewProvider: nil, actionProvider: { [weak self] _ in
return UIContextMenuConfiguration(identifier: firstIndex.row as NSCopying,
previewProvider: {
let previewController = WebViewController()
previewController.coordinator = self.coordinator
previewController.article = article
return previewController
},
actionProvider: { [weak self] _ in

guard let self = self else { return nil }

Expand Down Expand Up @@ -543,6 +550,15 @@ extension MainTimelineModernViewController: UICollectionViewDelegate {

})
}

func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: any UIContextMenuInteractionCommitAnimating) {
animator.addCompletion { [weak self] in
guard let indexRow = configuration.identifier as? Int,
let dataSource = self?.dataSource,
let article = dataSource.itemIdentifier(for: IndexPath(item: indexRow, section: 0)) else { return }
self?.coordinator?.selectArticle(article)
}
}

func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, highlightPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview? {
guard let row = configuration.identifier as? Int,
Expand Down