Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab Switcher Animation: Add show/hide behaviour #5729

Draft
wants to merge 22 commits into
base: feature/mike/tab-switcher-tile-animation/translations
Choose a base branch
from

Conversation

mikescamell
Copy link
Contributor

@mikescamell mikescamell commented Mar 4, 2025

Task/Issue URL: https://app.asana.com/0/1207908166761516/1209368500700767

Description

Added show/hide logic for the animated tile. The tile appears when users have blocked at least 10 trackers and have 2 or more tabs open.

Once visible the tile does not get removed unless:

  • The user dismisses it
  • The user clears data either manually or automatically through data clearing settings

Once dismissed, the tile will not reappear until explicitly re-enabled or reset through dev settings.

Steps to test this PR

Pre-requisites: tabSwitcherAnimation feature toggle is turned on

Tab Switcher Animated Tile Showing

  • Open the TabSwitcher
  • The animated tile should not should be visible
  • Open a website in the new tab (bbc.com for example)
  • Add another tab and open another website (cnn.com for example)
  • Open the TabSwitcher
  • The Animation Tile should be visible
  • If it's not visible it is probably because you do not have enough trackers. Open another website in either one of the tabs (ign.com for example)
  • The Animation Tile should now be visible and display the tracker count

Tab Switcher Animated Tile Stays Visible Once Seen

  • Delete one of the tabs
  • The animated tile should still be visible
  • Leave the Tab Switcher
  • Re-enter
  • The animated tile should still be visible

Tab Switcher Animated Tile Dismissal

  • Dismiss the animated tile
  • Leave the Tab Switcher
  • Re-enter
  • The animated tile should not be visible

Tab Switcher Animated Tile Clearing Data

  • Go to Dev Settings
  • Click "Reset TabSwitcher Animated Tile"
  • Open the TabSwitcher
  • Open a new tab and load a website
  • Go back to the TabSwitcher
  • The animated tile should be visible
  • Open Settings
  • Open Data Clearing
  • Click "Automatically Clear Data"
  • Select "App exit only"
  • Leave Settings
  • Exit the app
  • Swipe the app away from recents
  • Open the app
  • Open the Tab Switcher
  • The animated tile and all tabs should no longer exist

Tab Switcher Animated Tile Show Again

  • Repeat steps for Tab Switcher Animated Tile Showing
  • Animated tile should show again

Tab Switcher Animated Tile Close All Tabs

  • Go to Dev Settings
  • Click "Reset TabSwitcher Animated Tile"
  • Open 2 new tabs and load websites
  • Open the TabSwitcher
  • The animated tile should be visible
  • Press the overflow menu button
  • Click "Close All Tabs"
  • Click "Close" in the dialog
  • The animated tile and all tabs should no longer exist

Demo

Screen_recording_20250307_190356.mp4

Copy link
Contributor Author

mikescamell commented Mar 4, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@mikescamell mikescamell changed the title Tab Switcher Animation: Add dismissal behaviour Tab Switcher Animation: Add show/hide behaviour Mar 4, 2025
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/add-show-hide-logic branch from c08e5e9 to 684efba Compare March 6, 2025 17:16
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/translations branch 2 times, most recently from 6b63d29 to a5c2d0d Compare March 6, 2025 18:07
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/add-show-hide-logic branch from 684efba to 6f1378c Compare March 6, 2025 18:08
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/add-show-hide-logic branch from 6f1378c to cf82097 Compare March 7, 2025 07:50
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/translations branch from a5c2d0d to faeee79 Compare March 7, 2025 07:50
…de based on tab count

Only show if we have 2 or more tabs open

Next we'll extract this logic out
The logic for determining the visibility of the Tracker Animation Tile has been moved to a new `TabSwitcherTileAnimationMonitor` class.

This includes:
- Determining the tracker count in the last 7 days.
- Determining the number of open tabs.
- Checking if the animation tile is dismissed.
- Defining the minimum requirements for displaying the tile (minimum tracker count and minimum tab count).

The `WebTrackersBlockedAppRepository` has been updated to have a new public method to retrieve the number of tracker count for last 7 days.

The `TabSwitcherViewModel` was refactored to use the new `TabSwitcherTileAnimationMonitor` and the `observeAnimationTileVisibility` function.

The `createTrackerAnimationTile` and `getTrackerCountForLast7Days` were deleted.
- Adds a new state to track if the animation tile has been seen.
- Modifies the logic for displaying the animation tile to include the new state.
- The animation tile will show if NOT dismissed but already seen, even if we have less than 2 tabs
We want the text in the Animation tile to match the text in the tabs.
This change ensures that the dismissed state of the tab animation tile is cleared when user clears app data.
It adds the `TabSwitcherAnimationFeature` and `TabSwitcherPrefsDataStore` dependencies to the `ClearPersonalDataAction`.
When `clearPersonalData` is called, it now also checks if the animation feature is enabled and clears the `isDismissed` flag accordingly.
@mikescamell mikescamell force-pushed the feature/mike/tab-switcher-tile-animation/add-show-hide-logic branch from cf82097 to 2603460 Compare March 7, 2025 16:48
Makes it much easier to test. Renamed the text to make it clear we're resetting as the new logic for showing/hiding determines whether you will see it.
…clear

We've decided to reset the tile if a user clears data as it's done so often that they might not see the tile much
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant