From fde1ea74de2ece5f333c7c90b75075f181f5b2b4 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Fri, 9 Dec 2022 19:55:23 +0200 Subject: [PATCH] Remove duplicate fetching for fiat rate [skip ci] --- lib/reactions/fiat_rate_update.dart | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/reactions/fiat_rate_update.dart b/lib/reactions/fiat_rate_update.dart index 70387be97..04276b567 100644 --- a/lib/reactions/fiat_rate_update.dart +++ b/lib/reactions/fiat_rate_update.dart @@ -15,28 +15,18 @@ Future 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); - } -}