Skip to content

Visual design: Privacy Shield #6000

New issue

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

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

Already on GitHub? # to your account

Merged
merged 15 commits into from
May 6, 2025

Conversation

malmstein
Copy link
Contributor

@malmstein malmstein commented May 2, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1174433894299346/task/1210067401123377

Description

  • This PR updates the privacy shield and trackers animation for the new visual design.
  • To enable it, go to Settings / Experimental UI / Enable all O-A changes and restart the app

Steps to test this PR

Updates states

  • Install app and enable visual de#dates
  • Visit a site with trackers
  • Verify new privacy shield and trackers animation appears
  • Disable protection for the site
  • Verify new unprotected shield appears and no tracker animation is played

Copy link
Contributor Author

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

@malmstein malmstein marked this pull request as ready for review May 2, 2025 14:38
@malmstein malmstein requested a review from nalcalag as a code owner May 2, 2025 14:38
@malmstein malmstein force-pushed the feature/david/04-29-visual_design_privacy_shield branch from a8156fa to f4133d0 Compare May 2, 2025 15:24
@malmstein malmstein assigned LukasPaczos and unassigned anikiki May 5, 2025
Comment on lines +611 to +613
private fun shouldShowUpdatedPrivacyShield(navigationBarEnabled: Boolean): Boolean {
return senseOfProtectionExperiment.shouldShowNewPrivacyShield() || navigationBarEnabled
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of logic like this baked into the view (mainly for clarity and ease of testing reasons) - we make one if-check here and then another in BrowserLottieTrackersAnimatorHelper.kt to finally select the animation.

What do you think about turning OmnibarLayoutViewModel.LeadingIconState into a sealed class? That way, the view model could provide something like OmnibarLayoutViewModel.LeadingIconState.PRIVACY_SHIELD.resourceType, where resourceType defines which animation to use (out of production, sense of protection, or the new visual update).

I'm not going to block the PR over this, but if you agree this is a worthwhile improvement, it’d be great to incorporate here or as a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t like this logic either, and ideally we’d refactor BrowserLottieTrackersAnimatorHelper.kt but that’s not something I want to do now.

The problem is that now we have 3 different tracker animations and 2 of them have different layouts. This is far from optimal, but it solves the issue now knowing that this will be cleaned up once the experiments finish.

trackers == 1 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_1_visual_updates else R.raw.dark_trackers_1_visual_updates
trackers == 2 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_2_visual_updates else R.raw.dark_trackers_2_visual_updates
trackers >= 3 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_visual_updates else R.raw.dark_trackers_visual_updates
else -> TODO()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing case to handle (or not, but let's clean up the TODO()).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one still needs addressing in some way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will show a default and be done with it

Copy link
Contributor

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One TODO still to clean up, otherwise, LGTM.

trackers == 1 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_1_visual_updates else R.raw.dark_trackers_1_visual_updates
trackers == 2 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_2_visual_updates else R.raw.dark_trackers_2_visual_updates
trackers >= 3 -> if (theme.isLightModeEnabled()) R.raw.light_trackers_visual_updates else R.raw.dark_trackers_visual_updates
else -> TODO()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one still needs addressing in some way.

@malmstein malmstein force-pushed the feature/david/04-29-visual_design_privacy_shield branch from e6ec3d6 to bfba565 Compare May 6, 2025 08:52
@malmstein malmstein merged commit e021069 into develop May 6, 2025
6 checks passed
@malmstein malmstein deleted the feature/david/04-29-visual_design_privacy_shield branch May 6, 2025 09:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants