Add highcontrast btn in signin page and sync it with server values#92117
Add highcontrast btn in signin page and sync it with server values#92117rushatgabhane wants to merge 6 commits into
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
Co-authored-by: Rushat Gabhane <rushatgabhane@gmail.com>
|
@Eskalifer1 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| // When a logged-out user enabled high contrast on the sign-in page, apply it to whatever base theme | ||
| // the server returns once they sign in. OpenApp merges the server's nvp_preferredTheme before flipping | ||
| // IS_LOADING_APP back to false, so the true -> false edge is when the server base theme is available. | ||
| useEffect(() => { |
There was a problem hiding this comment.
❌ CLEAN-REACT-PATTERNS-4 (docs)
The AuthScreensInitHandler component already aggregates multiple unrelated responsibilities (session management, Pusher initialization, navigation setup, app loading). This new useEffect for reconciling the high-contrast theme intent after sign-in is an unrelated concern that further adds to the mix. If the high-contrast reconciliation logic changes, it requires navigating through all the other unrelated effects in this component.
Extract this effect into a focused custom hook, for example:
function useReconcileHighContrastIntent() {
const [preferredTheme] = useOnyx(ONYXKEYS.PREFERRED_THEME);
const [highContrastIntent] = useOnyx(ONYXKEYS.SIGN_IN_HIGH_CONTRAST_INTENT);
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [session] = useOnyx(ONYXKEYS.SESSION);
const wasLoadingApp = useRef<boolean | undefined>(undefined);
useEffect(() => {
const hasFinishedLoading = !!wasLoadingApp.current && !isLoadingApp;
wasLoadingApp.current = isLoadingApp;
if (!hasFinishedLoading || !highContrastIntent || !session?.authToken) {
return;
}
const currentTheme = preferredTheme ?? CONST.THEME.DEFAULT;
const targetTheme = getContrastTheme(getBaseTheme(currentTheme));
if (currentTheme !== targetTheme) {
User.updateTheme(targetTheme, false);
}
Onyx.set(ONYXKEYS.SIGN_IN_HIGH_CONTRAST_INTENT, null);
}, [isLoadingApp, highContrastIntent, preferredTheme, session?.authToken]);
}Then call useReconcileHighContrastIntent() inside AuthScreensInitHandler (or in a separate component if appropriate), keeping the concern isolated and independently testable.
Reviewed at: 7f87a7e | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
@Eskalifer1 lemme know if you agree with this and I'll change it.
Because I think it's probably fine to keep it in this file
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f87a7e0d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Hi! I will review it on Monday |



Explanation of Change
Fixed Issues
$ #92049
PROPOSAL:
Tests
Tests: high contrast on sign-in
Post login
Offline tests
QA Steps
Same as QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-29.at.23.23.48.mov