Skip to content

Commit

Permalink
Fixes #4843 - Prevent home screen horizontal scroll views from captur…
Browse files Browse the repository at this point in the history
…ing side menu swipe gestures.
  • Loading branch information
stefanceriu committed Sep 17, 2021
1 parent 521d75e commit f339db2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
29 changes: 26 additions & 3 deletions Riot/Modules/TabBar/TabBarCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
}

private func setupSideMenuGestures() {
if let rootViewController = self.masterNavigationController.viewControllers.first {
self.parameters.appNavigator.sideMenu.addScreenEdgePanGesturesToPresent(to: rootViewController.view)
}
let gesture = self.parameters.appNavigator.sideMenu.addScreenEdgePanGesturesToPresent(to: masterTabBarController.view)
gesture.delegate = self
}

// MARK: Navigation
Expand Down Expand Up @@ -382,3 +381,27 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate {
self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToDisplay: detailViewController)
}
}

// MARK: - UIGestureRecognizerDelegate

/**
Prevent the side menu gesture from clashing with other gestures like the home screen horizontal scroll views.
Also make sure that it doesn't cancel out UINavigationController backwards swiping
*/
extension TabBarCoordinator: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return false
}

public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}

public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if otherGestureRecognizer.isKind(of: UIScreenEdgePanGestureRecognizer.self) {
return false
} else {
return true
}
}
}
1 change: 1 addition & 0 deletions changelog.d/4843.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent home screen horizontal scroll views from capturing side menu swipe gestures.

0 comments on commit f339db2

Please sign in to comment.