From a5583fc655d6ec887fe97edd371e9d9d8160c974 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 22 Apr 2020 18:18:20 -0500 Subject: [PATCH 1/2] Validate that the selected row hasn't been removed when trying to select or scroll to it. Issue #1976 --- iOS/UIKit Extensions/UITableView-Extensions.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iOS/UIKit Extensions/UITableView-Extensions.swift b/iOS/UIKit Extensions/UITableView-Extensions.swift index 368680ee9..fd0c4c0ee 100644 --- a/iOS/UIKit Extensions/UITableView-Extensions.swift +++ b/iOS/UIKit Extensions/UITableView-Extensions.swift @@ -14,6 +14,13 @@ extension UITableView { Selects a row and scrolls it to the middle if it is not visible */ public func selectRowAndScrollIfNotVisible(at indexPath: IndexPath, animations: Animations) { + guard let dataSource = dataSource, + let numberOfSections = dataSource.numberOfSections, + indexPath.section < numberOfSections(self), + indexPath.row < dataSource.tableView(self, numberOfRowsInSection: indexPath.section) else { + return + } + selectRow(at: indexPath, animated: animations.contains(.select), scrollPosition: .none) if let visibleIndexPaths = indexPathsForRows(in: safeAreaLayoutGuide.layoutFrame) { From 947c4f04d7254cbf827327738b917993b43cb04d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 22 Apr 2020 22:03:15 -0500 Subject: [PATCH 2/2] Implement fix that prevents wiggling on both the timeline and the article views. --- .../PoppableGestureRecognizerDelegate.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift b/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift index 8df7295bd..2906290bd 100644 --- a/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift +++ b/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift @@ -18,7 +18,14 @@ final class PoppableGestureRecognizerDelegate: NSObject, UIGestureRecognizerDele } func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { - return navigationController?.viewControllers.count ?? 0 > 2 + return true } + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool { + if otherGestureRecognizer is UIPanGestureRecognizer { + return true + } + return false + } + }