From 621a12004fab65d29dc296ad4f7c49b4a60b34ad Mon Sep 17 00:00:00 2001 From: Nicholas Murray Date: Tue, 2 Nov 2021 13:11:44 -0700 Subject: [PATCH 1/5] Test and commetn out setLocale --- src/libs/Navigation/AppNavigator/AuthScreens.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 73a390a7967d..b5175a1a3cca 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -146,9 +146,14 @@ class AuthScreens extends React.Component { returnValueList: 'nameValuePairs', nvpNames: ONYXKEYS.NVP_PREFERRED_LOCALE, }).then((response) => { + console.log("IN API GET", response); const preferredLocale = lodashGet(response, ['nameValuePairs', 'preferredLocale'], CONST.DEFAULT_LOCALE); + // const newPreferredLocale = + console.log("IN API GET currentPreferred", currentPreferredLocale); + console.log("IN API GET preferredLocale", preferredLocale); if ((currentPreferredLocale !== CONST.DEFAULT_LOCALE) && (preferredLocale !== currentPreferredLocale)) { - setLocale(currentPreferredLocale); + Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); + // setLocale(currentPreferredLocale); } else { Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); } From 5953b4134539a949e6742894c7542c8dec33cec8 Mon Sep 17 00:00:00 2001 From: Nicholas Murray Date: Tue, 2 Nov 2021 13:15:15 -0700 Subject: [PATCH 2/5] Get rid of if --- src/libs/Navigation/AppNavigator/AuthScreens.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index b5175a1a3cca..436fa6ba641a 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -148,14 +148,10 @@ class AuthScreens extends React.Component { }).then((response) => { console.log("IN API GET", response); const preferredLocale = lodashGet(response, ['nameValuePairs', 'preferredLocale'], CONST.DEFAULT_LOCALE); - // const newPreferredLocale = console.log("IN API GET currentPreferred", currentPreferredLocale); console.log("IN API GET preferredLocale", preferredLocale); if ((currentPreferredLocale !== CONST.DEFAULT_LOCALE) && (preferredLocale !== currentPreferredLocale)) { Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); - // setLocale(currentPreferredLocale); - } else { - Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); } }); From 2bd11988d4581f922cce9c0db7854225b9cb41a9 Mon Sep 17 00:00:00 2001 From: Nicholas Murray Date: Tue, 2 Nov 2021 13:16:16 -0700 Subject: [PATCH 3/5] Delete consoles --- src/libs/Navigation/AppNavigator/AuthScreens.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 436fa6ba641a..4611490837f6 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -146,10 +146,7 @@ class AuthScreens extends React.Component { returnValueList: 'nameValuePairs', nvpNames: ONYXKEYS.NVP_PREFERRED_LOCALE, }).then((response) => { - console.log("IN API GET", response); const preferredLocale = lodashGet(response, ['nameValuePairs', 'preferredLocale'], CONST.DEFAULT_LOCALE); - console.log("IN API GET currentPreferred", currentPreferredLocale); - console.log("IN API GET preferredLocale", preferredLocale); if ((currentPreferredLocale !== CONST.DEFAULT_LOCALE) && (preferredLocale !== currentPreferredLocale)) { Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); } From f8654ef7f27bfc24a8843c88cbf24c35716ed806 Mon Sep 17 00:00:00 2001 From: Nicholas Murray Date: Tue, 2 Nov 2021 13:23:01 -0700 Subject: [PATCH 4/5] Lint --- src/libs/Navigation/AppNavigator/AuthScreens.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 4611490837f6..797a32a5fdbf 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -61,7 +61,6 @@ import Timers from '../../Timers'; import LogInWithShortLivedTokenPage from '../../../pages/LogInWithShortLivedTokenPage'; import defaultScreenOptions from './defaultScreenOptions'; import * as API from '../../API'; -import {setLocale} from '../../actions/App'; import {cleanupSession} from '../../actions/Session'; Onyx.connect({ From 7d532abea047816a2067aa2199e475d1282a2c14 Mon Sep 17 00:00:00 2001 From: Nicholas Murray Date: Tue, 2 Nov 2021 13:28:28 -0700 Subject: [PATCH 5/5] Get rid of default condition in if statement --- src/libs/Navigation/AppNavigator/AuthScreens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 797a32a5fdbf..13315aaae872 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -146,7 +146,7 @@ class AuthScreens extends React.Component { nvpNames: ONYXKEYS.NVP_PREFERRED_LOCALE, }).then((response) => { const preferredLocale = lodashGet(response, ['nameValuePairs', 'preferredLocale'], CONST.DEFAULT_LOCALE); - if ((currentPreferredLocale !== CONST.DEFAULT_LOCALE) && (preferredLocale !== currentPreferredLocale)) { + if (preferredLocale !== currentPreferredLocale) { Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale); } });