FIX: Restore stored fiat preference on launch

This commit is contained in:
Marcos Rodriguez Velez 2024-04-27 18:20:59 -04:00
parent 3030d3cf02
commit b28bf884d7
No known key found for this signature in database
GPG Key ID: 6030B2F48CCE86D7
2 changed files with 8 additions and 0 deletions

View File

@ -113,6 +113,11 @@ async function isRateOutdated(): Promise<boolean> {
}
}
async function restoreSavedPreferredFiatCurrencyAndExchangeFromStorage(): Promise<void> {
await _restoreSavedExchangeRatesFromStorage();
await _restoreSavedPreferredFiatCurrencyFromStorage();
}
async function initCurrencyDaemon(clearLastUpdatedTime: boolean = false): Promise<void> {
await _restoreSavedExchangeRatesFromStorage();
await _restoreSavedPreferredFiatCurrencyFromStorage();
@ -235,4 +240,5 @@ export {
LAST_UPDATED,
mostRecentFetchedRate,
isRateOutdated,
restoreSavedPreferredFiatCurrencyAndExchangeFromStorage,
};

View File

@ -7,6 +7,7 @@ import App from './App';
import { BlueStorageProvider } from './blue_modules/storage-context';
import A from './blue_modules/analytics';
import { SettingsProvider } from './components/Context/SettingsContext';
import { restoreSavedPreferredFiatCurrencyAndExchangeFromStorage } from './blue_modules/currency';
if (!Error.captureStackTrace) {
// captureStackTrace is only available when debugging
@ -15,6 +16,7 @@ if (!Error.captureStackTrace) {
const BlueAppComponent = () => {
useEffect(() => {
restoreSavedPreferredFiatCurrencyAndExchangeFromStorage();
A(A.ENUM.INIT);
}, []);