Feature FXIOS-16158 [Toolbar] Add an interactive swipe gesture to close a tab and open the tab tray#34539
Feature FXIOS-16158 [Toolbar] Add an interactive swipe gesture to close a tab and open the tab tray#34539Alex-Bangu wants to merge 22 commits into
Conversation
|
This pull request has conflicts when rebasing. Could you fix it @Alex-Bangu? 🙏 |
🧩 Neat PieceThis PR changes 626 lines. It's a substantial update, 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 🦊 BrowserViewController CheckWe’re tracking the size of
Client.app: Coverage: 43.51
Generated by 🚫 Danger Swift against 39852d9 |
|
@Alex-Bangu, just took a glance at the video!! Great work, it looks awesome!! |
| var theme: Theme? | ||
|
|
||
| /// UUID of the tab currently minimizing into the tray during the open animation | ||
| var minimizingTabUUID: TabUUID? |
There was a problem hiding this comment.
nit: handle this on TabAnimation.swift
|
|
||
| let a11yId = "\(AccessibilityIdentifiers.TabTray.tabCell)_\(indexPath.section)_\(indexPath.row)" | ||
| cell.configure(with: tab, theme: theme, delegate: self, a11yId: a11yId, newTabTitle: newTabTitle) | ||
| if tab.tabUUID == self.minimizingTabUUID { |
| // safely re-enable the gesture | ||
| if state.addressToolbar.isEditing { | ||
| disablePanGestureRecognizer() | ||
| disableSwipeUpGestureRecognizer() |
There was a problem hiding this comment.
this can be one method for both up and down, to check also the feature flag inside
| addressToolbarContainer.addGestureRecognizer(panGesture) | ||
| panGestureRecognizer = panGesture | ||
|
|
||
| let swipeUpGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipe)) |
There was a problem hiding this comment.
Add FF check also here
| let bvcSnapshot = UIImageView(image: browserVC.view.screenshot(quality: UX.bvcScreenshotQuality)) | ||
| // Keep the selected tab cell hidden for the whole animation so it minimizes into an empty | ||
| // grid square | ||
| let tabDisplayView = panelViewController.tabDisplayView |
There was a problem hiding this comment.
this new code path should be under the feature flag
| var microsurveyState: MicrosurveyPromptState | ||
| var autoTranslatePromptState: AutoTranslatePromptState | ||
| var navigationDestination: NavigationDestination? | ||
| var cellBounds: CGRect? |
There was a problem hiding this comment.
nit: could we have this property more self explenatory
| } | ||
|
|
||
| /// The action to take when the gesture ends, based on where the finger is released on screen. | ||
| enum ReleaseOutcome { |
There was a problem hiding this comment.
nit: could be on top of the class
|
|
||
| // MARK: - UIGestureRecognizerDelegate | ||
|
|
||
| func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { |
There was a problem hiding this comment.
could be in the AddressBarPanGestureHandler
| case .ended: | ||
| let fingerLocation = gesture.location(in: tabPreview) | ||
| switch tabPreview.releaseOutcome(fingerLocation: fingerLocation) { | ||
| case .closeTab: |
There was a problem hiding this comment.
this switch could on a separate method
| import Redux | ||
|
|
||
| @MainActor | ||
| class SwipeUpTabPreviewGestureHandler: NSObject, UIGestureRecognizerDelegate, StoreSubscriber, FeatureFlaggable { |
There was a problem hiding this comment.
port the swipe up and down gesture inside here
OrlaM
left a comment
There was a problem hiding this comment.
This PR is too large. I can suggest a way to break it down into 4 PR's but feel free to tackle it a different way if you prefer.
1 PR for each:
Adding and configuring the feature flag.
SwipeUpTabWebViewPreview.swift
SwipeUpTabPreviewGestureHandler.swift
Refactor of the open tab tray animation in TabAnimation.swift
Small PR's are a little more work on the authors side but it makes a big difference in the PR review and code quality side of things.
|
Hi Orla! I'm currently working on breaking up this pr into three parts (new files, animation work, feature flag work). As such, I am going to close this PR and reuse the Jira ticket for the animation PR. Thanks for the advice! |
📜 Tickets
Jira ticket
Github issue
💡 Description
Implements a significantly more involved swipe up / pan up gesture. Users will be able to drag up on the address bar to open the tab tray. They will also be able to close the tab if they drag the tab into the top 1/4 of their screen, however this is gated behind a separate feature flag.
Major changes:
Other changes:
🎥 Demos
📝 Checklist