mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 12:54:38 +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 {
|
_timer = Timer.periodic(Duration(seconds: 30), (_) async {
|
||||||
try {
|
try {
|
||||||
|
if (appStore.wallet == null || settingsStore.fiatApiMode == FiatApiMode.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (appStore.wallet!.type == WalletType.haven) {
|
if (appStore.wallet!.type == WalletType.haven) {
|
||||||
await updateHavenRate(fiatConversionStore);
|
await updateHavenRate(fiatConversionStore);
|
||||||
} else {
|
} else {
|
||||||
if (appStore.wallet != null && settingsStore.fiatApiMode == FiatApiMode.enabled) {
|
fiatConversionStore.prices[appStore.wallet!.currency] =
|
||||||
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
await FiatConversionService.fetchPrice(
|
||||||
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
appStore.wallet!.currency, settingsStore.fiatCurrency);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
Loading…
Reference in a new issue