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

[$500] mWeb - Magic link - "Open in app" banner is dark themed on magic code page in light mode #33476

Closed
1 of 6 tasks
lanitochka17 opened this issue Dec 22, 2023 · 21 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 22, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.15-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Enter an email you have access to
  3. Tap on "Continue"
  4. Go to email inbox and copy the Magic link and change it to staging
  5. Open an incognito tab and navigate to the staging magic link

Expected Result:

The "Open in app" banner should be in light mode

Actual Result:

The "Open in app" banner is in dark mode even if the app is in light mode.
It also happens if the app has 2FA enabled and on the "Magic code expired" page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6323352_1703203267833!IMG_E2161

Bug6323352_1703203267842!IMG_E2163

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f555a808f6be075d
  • Upwork Job ID: 1737996800572018688
  • Last Price Increase: 2024-01-05
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 22, 2023
@melvin-bot melvin-bot bot changed the title mWeb - Magic link - "Open in app" banner is dark themed on magic code page in light mode [$500] mWeb - Magic link - "Open in app" banner is dark themed on magic code page in light mode Dec 22, 2023
Copy link

melvin-bot bot commented Dec 22, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f555a808f6be075d

Copy link

melvin-bot bot commented Dec 22, 2023

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 22, 2023
Copy link

melvin-bot bot commented Dec 22, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 22, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (External)

@ikevin127

This comment was marked as outdated.

@rushatgabhane
Copy link
Member

rushatgabhane commented Dec 22, 2023

Proposal

Root cause:

When logged out, the preferred theme from storage isn't set and defaults to dark mode.

const theme = preferredThemeFromStorage ?? CONST.THEME.DEFAULT;
// If the user chooses to use the device theme settings, we need to set the theme preference to the system theme
if (theme === CONST.THEME.SYSTEM) {
setThemePreference(systemTheme ?? CONST.THEME.FALLBACK);

Solution

cc: @grgia @chrispader I'm pretty sure this is the expected behavior?

@tienifr
Copy link
Contributor

tienifr commented Dec 22, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Smart App Banner is always in dark mode.

What is the root cause of that problem?

The problem here is the inconsistency.

The validate code page is supposed to always have dark mode (just like SignInPage) but it doesn't. In SignInPage, we manually set the theme to be dark here. But we didn't do it for ValidateCodeModal so it will fallback to system theme, which was light in OP.

In SignInPage, we disable the CustomStatusbar which determines the theme of smart app banner here. That's why even when the theme changes, the banner remains dark.

What changes do you think we should make in order to solve the problem?

  1. If we want ValidateCodeModal to be in dark, we can implement the same as SignInPage.
  2. We can implement the smart app banner to follow whichever theme the page has

What alternative solutions did you explore? (Optional)

NA

@cubuspl42
Copy link
Contributor

@rushatgabhane Please stick to the proposal template, read the contributing guidelines for more details.

😎

@cubuspl42
Copy link
Contributor

@tienifr

We can implement the smart app banner to follow whichever theme the page has

Can we? Would you share some details?

@ikevin127
Copy link
Contributor

ikevin127 commented Dec 22, 2023

@rushatgabhane is right about the persistence of the preferredTheme onyx variable upon logout, we already have an open issue #33160 that's pending review.

Having said that, the current issue can be fixed independent of that one because this one is regarding the system default theme logic compared to the other issue which is regarding the persistence of a chosen theme.

Proposal

Please re-state the problem that we are trying to solve in this issue

The "Open in app" banner is in dark mode even if the app is in light mode.

It happens for all ValidateLoginPage screens:

  • Here is your magic code
  • 2FA
  • Magic code expired
  • Abracadabra, you are signed in!
  • FullScreenLoadingIndicator

What is the root cause of that problem?

The root cause is that we hardcoded the theme to dark for the SignInPage ThemeProvider which is wrapping the nested CustomStatusBarAndBackground and because of this when the device system theme is light (system default) the custom status bar and background are always using the dark theme colors.

<ThemeProvider theme={CONST.THEME.DARK}>
<ThemeStylesProvider>
<ColorSchemeWrapper>
<CustomStatusBarAndBackground isNested />

Therefore the currentScreenBackgroundColor is always equal to theme.appBG which is #061B09 dark theme color.

What changes do you think we should make in order to solve the problem?

To preserve the SignInPage always dark themed but not force it on the CustomStatusBarAndBackground we can wrap CustomStatusBarAndBackground with another ThemeProvider without theme prop which will fix the issue by using system default theme or onyx preferredTheme (if existing) instead of the hardcoded dark theme.

This way when the user reaches the above mentioned screens while in light mode, the background of the "Open in app" banner will use the correct theme.

Changed code

function SignInPage(props) {
    return (
        <ThemeProvider theme={CONST.THEME.DARK}>
            <ThemeStylesProvider>
                <ColorSchemeWrapper>
+                   {/* Re-wrap CustomStatusBarAndBackground to override the hardcoded dark theme set above to system default or onyx `preferredTheme` (if existing) */ }
+                   <ThemeProvider> 
+                       <CustomStatusBarAndBackground isNested />
+                   </ThemeProvider>
                    ...

What alternative solutions did you explore? (Optional)

Moving CustomStatusBarAndBackground outside of the ThemeProvider like stated here #33476 (comment) would work the same way.

Below I added videos for both cases - when system default theme is light or dark showing both the issue screen and sign in screen. I cannot get the banner to show on local development - it will only be seen once the fix is deployed to staging.

Note: When the theme is light, the status bar of the SignInPage will be white (including during the splash screen).

In order to keep the status bar dark while theme is light it would require overidding theme.PAGE_THEMES['Home'] with darkTheme.PAGE_THEMES['Home'] which would persist the dark themed status bar in the Home screen once logged in and I don't think we want that because it looks like broken theme.

Videos

iOS: mWeb Safari
Screen.Recording.2023-12-22.at.19.05.09.mov

@chrispader
Copy link
Contributor

Changed code

function SignInPage(props) {
    return (
        <ThemeProvider theme={CONST.THEME.DARK}>
            <ThemeStylesProvider>
                <ColorSchemeWrapper>
+                   {/* Re-wrap CustomStatusBarAndBackground to override the hardcoded dark theme set above to system default or onyx `preferredTheme` (if existing) */ }
+                   <ThemeProvider> 
+                       <CustomStatusBarAndBackground isNested />
+                   </ThemeProvider>
                    ...

Instead of this, we can also just move the CustomStatusBarAndBackground element outside of the ThemeProvider, like this:

function SignInPage(props) {
    return (
+    <>
+      <CustomStatusBarAndBackground isNested />
        <ThemeProvider theme={CONST.THEME.DARK}>
            <ThemeStylesProvider>
                <ColorSchemeWrapper>
-                       <CustomStatusBarAndBackground isNested />
                    ...
+    </>

@melvin-bot melvin-bot bot added the Overdue label Dec 24, 2023
Copy link

melvin-bot bot commented Dec 25, 2023

@cubuspl42, @dylanexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Dec 27, 2023

@cubuspl42, @dylanexpensify Eep! 4 days overdue now. Issues have feelings too...

@cubuspl42
Copy link
Contributor

@grgia Would you comment on the Rushat's question?

@melvin-bot melvin-bot bot removed the Overdue label Dec 27, 2023
@chrispader
Copy link
Contributor

When logged out, the preferred theme from storage isn't set and defaults to dark mode.
cc: @grgia @chrispader I'm pretty sure this is the expected behavior?

Yes, if (previously) logged out all the data will be cleared and the default theme should be dark. Am i right? @grgia

@melvin-bot melvin-bot bot added the Overdue label Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 1, 2024

@cubuspl42, @dylanexpensify Huh... This is 4 days overdue. Who can take care of this?

@cubuspl42
Copy link
Contributor

@dylanexpensify I think we should close this one. It's more like a design discussion than an apparent bug. Also, the impact seems to be negligible. The dark banner, arguably, composes well with the system bar.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 2, 2024
Copy link

melvin-bot bot commented Jan 5, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 5, 2024

@cubuspl42 @dylanexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Jan 5, 2024

@cubuspl42, @dylanexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

7 participants