mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
check nullability of wallet and disable fiat api state before updating rates [skip ci]
This commit is contained in:
parent
fde1ea74de
commit
899e999d78
1 changed files with 7 additions and 4 deletions
|
@ -17,13 +17,16 @@ Future<void> startFiatRateUpdate(
|
|||
|
||||
_timer = Timer.periodic(Duration(seconds: 30), (_) async {
|
||||
try {
|
||||
if (appStore.wallet == null || settingsStore.fiatApiMode == FiatApiMode.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (appStore.wallet!.type == WalletType.haven) {
|
||||
await updateHavenRate(fiatConversionStore);
|
||||
} else {
|
||||
if (appStore.wallet != null && settingsStore.fiatApiMode == FiatApiMode.enabled) {
|
||||
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
||||
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
||||
}
|
||||
fiatConversionStore.prices[appStore.wallet!.currency] =
|
||||
await FiatConversionService.fetchPrice(
|
||||
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
|
|
Loading…
Reference in a new issue