Skip to content

Commit

Permalink
Merge pull request #1989 from wikimedia/bug/location_3d_touch
Browse files Browse the repository at this point in the history
Fix article location detail view peek/pop
  • Loading branch information
Natalia Harateh committed Dec 15, 2017
2 parents 9aa68e2 + 7b98d7a commit 6f2f583
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GEM
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.0)
fastlane (2.69.2)
fastlane (2.69.3)
CFPropertyList (>= 2.3, < 3.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
Expand Down
5 changes: 4 additions & 1 deletion Wikipedia/Code/ArticleLocationCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ extension ArticleLocationCollectionViewController {
// MARK: - UIViewControllerPreviewingDelegate
extension ArticleLocationCollectionViewController {
override func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = collectionView.indexPathForItem(at: location) else {
guard let indexPath = collectionView.indexPathForItem(at: location),
let cell = collectionView.cellForItem(at: indexPath) else {
return nil
}
previewingContext.sourceRect = cell.convert(cell.bounds, to: collectionView)
let url = articleURL(at: indexPath)
let articleViewController = WMFArticleViewController(articleURL: url, dataStore: dataStore, theme: self.theme)
articleViewController.articlePreviewingActionsDelegate = self
Expand All @@ -133,6 +135,7 @@ extension ArticleLocationCollectionViewController {
}

override func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
viewControllerToCommit.wmf_removePeekableChildViewControllers()
wmf_push(viewControllerToCommit, animated: true)
}
}
Expand Down

0 comments on commit 6f2f583

Please sign in to comment.