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

[MOB-2561] Ecosia theme review and fixes #681

Merged

Conversation

d4r1091
Copy link
Member

@d4r1091 d4r1091 commented May 16, 2024

MOB-2561

Context

Throughout the testing of the latest upgrade version, some Theming issues arose.
This PR aims to fix all of them as well as provide a bit of touch to some details already present in production.

Approach

Also acknowledged the root cause of the theming issue when the app performs a cold start. The issue behind the LegacyThemeManager that needed another entry point in this current codebase and the fact that our landing is the Welcome screen / onboarding.

Bookmarks theme Bookmaks action sheet theme dark Bookmaks action sheet theme light Done button theme
Simulator Screenshot - iPhone 15 - 2024-05-14 at 23 24 08 Simulator Screenshot - iPhone 15 - 2024-05-14 at 23 26 59 Simulator Screenshot - iPhone 15 - 2024-05-14 at 23 27 08 Untitled 2

GIF showcasing the fix for all of them

Various Fixes test Theming cold start fix
Simulator Screen Recording - iPhone 15 - 2024-05-16 at 11 38 32 Simulator Screen Recording - iPhone 15 Pro - 2024-05-16 at 13 53 14

Other

The UI theming applied to the Done button is a personal proposal. The Done button is Green throughout the app in dark mode so I thought would be good to align it.

Before merging

Checklist

  • I performed some relevant testing on a real device and/or simulator
  • I added the // Ecosia: helper comments where needed

@d4r1091 d4r1091 requested a review from a team May 16, 2024 11:54
Copy link

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Nice color paintings 👨‍🎨

Added one clarification comment that is not a blocker

Comment on lines 53 to 58
if LegacyThemeManager.instance.systemThemeIsOn {
let userInterfaceStyle = UIScreen.main.traitCollection.userInterfaceStyle
LegacyThemeManager.instance.current = userInterfaceStyle == .dark ? LegacyDarkTheme() : LegacyNormalTheme()
}

changeCurrentTheme(loadInitialThemeType())

Choose a reason for hiding this comment

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

It feels like what you do here is exactly what should happen inside changeCurrentTheme(loadInitialThemeType()). I guess this has to do with the cold start, but any reason why not keeping just one of the two?

Copy link
Member Author

Choose a reason for hiding this comment

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

@lucaschifino thanks for asking!
While it may look the same, a small check makes (on our codebase with our references of the LegacyThemeManager throughout it) the whole logic behaves unexpectedly (from the User perspective), setting the wrong theme.
Within loadInitialThemeType(), a check of a persisted value is made 👇

let savedThemeDescription = userDefaults.string(forKey: ThemeKeys.themeName).

This check will extract the last saved theme before killing the app, therefore a different one in case we switched at app killed state where no observers were alive.

Choose a reason for hiding this comment

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

Got it! It's ok to leave it like that by me, but maybe making that a bit clearer for people reading the code would be good, either a comment like // Additional check in case the theme changed while the app was closed on top of your code or renaming the existing method to changeCurrentTheme(loadInitialStoredThemeType()).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good input will do that

Copy link

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Nice color paintings 👨‍🎨

Added one clarification comment that is not a blocker

For some reason it went duplicated 🤷

@d4r1091 d4r1091 requested a review from lucaschifino May 21, 2024 08:15
Copy link

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Awesome, thanks ❤️

@d4r1091 d4r1091 merged commit df7f34d into MOB-2012_firefox_120_upgrade May 21, 2024
@d4r1091 d4r1091 deleted the MOB-2561_ecose_theme_review_and_fixes branch May 21, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants