buliding new auth setup to remove race condition during login (#961)

* buliding new auth setup to remove race condition during login

* revert complex fix. Just add local is loaded property

* Apply suggestion from @bitcoinuser

Co-authored-by: bitcoinuser <bitcoinuser@users.noreply.github.com>

---------

Co-authored-by: bitcoinuser <bitcoinuser@users.noreply.github.com>
This commit is contained in:
Blake Kaufman
2026-06-24 18:21:37 -04:00
committed by GitHub
co-authored by bitcoinuser
parent e5a9c3096f
commit 2d4956fe68
12 changed files with 31 additions and 14 deletions
+5 -1
View File
@@ -507,6 +507,10 @@ function ResetStack(): JSX.Element | null {
...prev,
isLoggedIn: !!pin.value && !!mnemonic.value,
hasSecurityEnabled: parsedSettings.isSecurityEnabled,
// Settings are now resolved — unblock the render gate below. Until this
// is true the navigator stays unmounted so Home never mounts with the
// wrong (still-loading) component. This is the login race-condition fix.
isLoaded: true,
};
});
@@ -583,7 +587,7 @@ function ResetStack(): JSX.Element | null {
return CreateAccountHome;
}, [initSettings.isLoggedIn, initSettings.hasSecurityEnabled]);
if (theme === null || darkModeType === null) {
if (theme === null || darkModeType === null || !initSettings.isLoaded) {
return null;
}
@@ -29,7 +29,7 @@ export default function AddContactsPage({ selectedContact }) {
<View style={styles.infoContainer}>
<ThemeText
styles={styles.infoLabel}
content={t('contacts.editMyProfilePage.lightningAddress')}
content={t('contacts.editMyProfilePage.addContactLightningAddress')}
/>
<ThemeText styles={styles.infoValue} content={lnurl} />
</View>
+1 -4
View File
@@ -178,10 +178,7 @@ const AppStatusProvider = ({ children }) => {
(async () => {
try {
const [
submarineSwapStats,
reverseSwapStats,
] = await Promise.all([
const [submarineSwapStats, reverseSwapStats] = await Promise.all([
getBoltzSwapPairInformation('submarine'),
getBoltzSwapPairInformation('reverse'),
]);
+8
View File
@@ -53,6 +53,14 @@ jest.mock('@react-native-firebase/storage', () => ({
getStorage: jest.fn(() => ({})),
}));
// react-native-localize is a native module (RNLocalize) that throws at import
// time under Jest. Provide a sensible English default; tests can override locally.
jest.mock('react-native-localize', () => ({
getLocales: jest.fn(() => [
{ languageCode: 'en', countryCode: 'US', languageTag: 'en-US', isRTL: false },
]),
}));
// react-native-quick-crypto is a Nitro/Turbo native module that throws at import
// time under Jest. Delegate to Node's crypto so modules in the encryption chain
// (e.g. messaging/encodingAndDecodingMessages.js) load AND actually work.
+2 -1
View File
@@ -1418,7 +1418,8 @@
"invalidCharactersError": "Name und Biografie dürfen die Zeichen < > { } ` \\ nicht enthalten",
"invalidReceiveAddressError": "Bitte geben Sie eine gültige Lightning-Adresse ein (z. B. benutzer@domain.com)",
"aboutYou": "Über Sie",
"lightningAddress": "Lightning-Adresse"
"lightningAddress": "Lightning-Adresse",
"addContactLightningAddress": "Lightning-Adresse"
},
"remotePaymentCurrencySelect": {
"title": "Empfangswährung",
+2 -1
View File
@@ -1419,7 +1419,8 @@
"invalidCharactersError": "Name and bio cannot contain the characters < > { } ` \\",
"invalidReceiveAddressError": "Please enter a valid Lightning address (e.g. user@domain.com)",
"aboutYou": "About you",
"lightningAddress": "Lightning Address"
"lightningAddress": "Lightning Address",
"addContactLightningAddress": "Lightning Address"
},
"remotePaymentCurrencySelect": {
"title": "Receive currency",
+2 -1
View File
@@ -1419,7 +1419,8 @@
"invalidCharactersError": "El nombre y la biografía no pueden contener los caracteres < > { } ` \\",
"invalidReceiveAddressError": "Introduce una dirección Lightning válida (p. ej., usuario@dominio.com)",
"aboutYou": "Sobre ti",
"lightningAddress": "Dirección Lightning"
"lightningAddress": "Dirección Lightning",
"addContactLightningAddress": "Dirección Lightning"
},
"remotePaymentCurrencySelect": {
"title": "Moneda de recepción",
+2 -1
View File
@@ -1419,7 +1419,8 @@
"invalidCharactersError": "Le nom et la bio ne peuvent pas contenir les caractères < > { } ` \\",
"invalidReceiveAddressError": "Veuillez saisir une adresse Lightning valide (p. ex. utilisateur@domaine.com)",
"aboutYou": "À propos de vous",
"lightningAddress": "Adresse Lightning"
"lightningAddress": "Adresse Lightning",
"addContactLightningAddress": "Adresse Lightning"
},
"remotePaymentCurrencySelect": {
"title": "Devise de réception",
+2 -1
View File
@@ -1419,7 +1419,8 @@
"invalidCharactersError": "Nome e bio non possono contenere i caratteri < > { } ` \\",
"invalidReceiveAddressError": "Inserisci un indirizzo Lightning valido (es. utente@dominio.com)",
"aboutYou": "Su di te",
"lightningAddress": "Indirizzo Lightning"
"lightningAddress": "Indirizzo Lightning",
"addContactLightningAddress": "Indirizzo Lightning"
},
"remotePaymentCurrencySelect": {
"title": "Valuta di ricezione",
+2 -1
View File
@@ -1418,7 +1418,8 @@
"invalidCharactersError": "O nome e a bio não podem conter os caracteres < > { } ` \\",
"invalidReceiveAddressError": "Digite um endereço de pagamento válido (ex.: usuario@dominio.com)",
"aboutYou": "Sobre você",
"lightningAddress": "Endereço Blitz"
"lightningAddress": "Endereço Blitz",
"addContactLightningAddress": "Endereço Lightning"
},
"remotePaymentCurrencySelect": {
"title": "Moeda de recebimento",
+2 -1
View File
@@ -1420,7 +1420,8 @@
"invalidCharactersError": "Имя и био не могут содержать символы < > { } ` \\",
"invalidReceiveAddressError": "Введите корректный адрес Молнии (например, user@domain.com)",
"aboutYou": "О вас",
"lightningAddress": "Lightning-адрес"
"lightningAddress": "Lightning-адрес",
"addContactLightningAddress": "Lightning-адрес"
},
"remotePaymentCurrencySelect": {
"title": "Валюта получения",
+2 -1
View File
@@ -1419,7 +1419,8 @@
"invalidCharactersError": "Namn och bio får inte innehålla tecknen < > { } ` \\",
"invalidReceiveAddressError": "Ange en giltig Lightning-adress (t.ex. användare@domän.com)",
"aboutYou": "Om dig",
"lightningAddress": "Lightning-adress"
"lightningAddress": "Lightning-adress",
"addContactLightningAddress": "Lightning-adress"
},
"remotePaymentCurrencySelect": {
"title": "Mottagningsvaluta",