@@ -342,6 +342,16 @@ final class WebController: NSObject, WKNavigationDelegate, WKUIDelegate, WKScrip
342342
343343 // MARK: - Back
344344
345+ /// The slide back (BackTransition.swift) is off unless Info.plist's `OpenBotSlideBack` is true (or
346+ /// a DEBUG build's OPENBOT_SHELL_SLIDE_BACK=1): until it has been seen working end to end, a swipe
347+ /// past a third of the width simply goes back when it ends.
348+ static let slideBack : Bool = {
349+ #if DEBUG
350+ if ProcessInfo . processInfo . environment [ " OPENBOT_SHELL_SLIDE_BACK " ] == " 1 " { return true }
351+ #endif
352+ return ( Bundle . main . object ( forInfoDictionaryKey : " OpenBotSlideBack " ) as? Bool ) ?? false
353+ } ( )
354+
345355 /// What the left-edge swipe does now (from the page's last `route`: `ShellBack`).
346356 private( set) var backMode : ShellBack = . webHistory
347357 private var backSwipe : UIScreenEdgePanGestureRecognizer ?
@@ -390,7 +400,7 @@ final class WebController: NSObject, WKNavigationDelegate, WKUIDelegate, WKScrip
390400 let width = max ( webView . bounds . width , 1 )
391401 switch edge . state {
392402 case . began :
393- swipeSlides = backMode == . sendToPage && transition . canSlide
403+ swipeSlides = WebController . slideBack && backMode == . sendToPage && transition . canSlide
394404 if swipeSlides { transition . begin ( ) }
395405 case . changed :
396406 if swipeSlides { transition . update ( progress : move . x / width ) }
@@ -423,7 +433,7 @@ final class WebController: NSObject, WKNavigationDelegate, WKUIDelegate, WKScrip
423433 }
424434 switch direction {
425435 case " push " : transition . willPush ( tab : tab , completion : ok )
426- case " back " : transition . playBack ( back : ok )
436+ case " back " : if WebController . slideBack { transition . playBack ( back : ok ) } else { ok ( ) }
427437 default : ok ( )
428438 }
429439 }
@@ -1000,6 +1010,15 @@ extension WebController: UIGestureRecognizerDelegate {
10001010 shouldRecognizeSimultaneouslyWith other : UIGestureRecognizer ) -> Bool {
10011011 true
10021012 }
1013+
1014+ /// A drag from the left edge belongs to the swipe back: WebKit's own recognizers (text selection
1015+ /// took a slow edge drag in take 5) wait until the edge recognizer has failed, which it does at
1016+ /// once for a touch away from the edge.
1017+ func gestureRecognizer ( _ gestureRecognizer : UIGestureRecognizer ,
1018+ shouldBeRequiredToFailBy other : UIGestureRecognizer ) -> Bool {
1019+ guard gestureRecognizer === backSwipe , gestureRecognizer . isEnabled else { return false }
1020+ return ! ( other is TouchDownRecognizer ) && ! ( other is UIPanGestureRecognizer && other . view === webView )
1021+ }
10031022}
10041023
10051024extension WebController : WKDownloadDelegate {
0 commit comments