mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Remove duplicate fetching for fiat rate [skip ci]
This commit is contained in:
parent
5310c265a7
commit
fde1ea74de
1 changed files with 4 additions and 14 deletions
|
@ -15,28 +15,18 @@ Future<void> startFiatRateUpdate(
|
|||
return;
|
||||
}
|
||||
|
||||
_updateFiatRate(appStore, settingsStore, fiatConversionStore);
|
||||
|
||||
_timer = Timer.periodic(Duration(seconds: 30), (_) async {
|
||||
try {
|
||||
if (appStore.wallet!.type == WalletType.haven) {
|
||||
await updateHavenRate(fiatConversionStore);
|
||||
} else {
|
||||
_updateFiatRate(appStore, settingsStore, fiatConversionStore);
|
||||
if (appStore.wallet != null && settingsStore.fiatApiMode == FiatApiMode.enabled) {
|
||||
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
||||
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _updateFiatRate(
|
||||
AppStore appStore,
|
||||
SettingsStore settingsStore,
|
||||
FiatConversionStore fiatConversionStore,
|
||||
) async {
|
||||
if (appStore.wallet != null && settingsStore.fiatApiMode == FiatApiMode.enabled) {
|
||||
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
||||
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue