diff --git a/lib/core/fiat_conversion_service.dart b/lib/core/fiat_conversion_service.dart index 69d8ec93e..29c34f249 100644 --- a/lib/core/fiat_conversion_service.dart +++ b/lib/core/fiat_conversion_service.dart @@ -58,7 +58,7 @@ Future _fetchHistoricalPrice(Map args) async { final intervalFromNow = DateTime.now().difference(date).inMinutes; final Map queryParams = { - 'interval_count': '5', + 'interval_count': '2', 'base': crypto.toString(), 'quote': fiat.toString(), 'key': secrets.fiatApiKey, @@ -93,6 +93,7 @@ Future _fetchHistoricalPrice(Map args) async { if (results.isNotEmpty) { price = results.values.first as double; } + print('results.key: ${results.keys.first} results.value: ${results.values.first}'); return price; } catch (e) { diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart index cb0828a33..66396b34d 100644 --- a/lib/view_model/transaction_details_view_model.dart +++ b/lib/view_model/transaction_details_view_model.dart @@ -34,12 +34,8 @@ abstract class TransactionDetailsViewModelBase with Store { isRecipientAddressShown = false, showRecipientAddress = settingsStore.shouldSaveRecipientAddress, fiatRateListItem = StandartListItem( - title: settingsStore.showHistoricalFiatRate - ? S.current.historical_fiat_rate - : S.current.fiat_rate, - value: settingsStore.showHistoricalFiatRate - ? '${S.current.fetching.toLowerCase()} ...' - : transactionInfo.fiatAmount() + ' ${settingsStore.fiatCurrency}') { + title: S.current.historical_fiat_rate, + value: '${S.current.fetching.toLowerCase()} ...') { final dateFormat = DateFormatter.withCurrentLocal(); final tx = transactionInfo; @@ -62,7 +58,8 @@ abstract class TransactionDetailsViewModelBase with Store { if (feeFormatted != null) StandartListItem( title: S.current.transaction_details_fee, value: feeFormatted), - if (settingsStore.fiatApiMode != FiatApiMode.disabled) + if (settingsStore.fiatApiMode != FiatApiMode.disabled && + settingsStore.showHistoricalFiatRate) fiatRateListItem, if (key?.isNotEmpty ?? false) StandartListItem(title: S.current.transaction_key, value: key!) @@ -118,7 +115,8 @@ abstract class TransactionDetailsViewModelBase with Store { StandartListItem( title: S.current.transaction_details_fee, value: tx.feeFormatted()!), - if (settingsStore.fiatApiMode != FiatApiMode.disabled) + if (settingsStore.fiatApiMode != FiatApiMode.disabled && + settingsStore.showHistoricalFiatRate) fiatRateListItem, ]; @@ -140,7 +138,8 @@ abstract class TransactionDetailsViewModelBase with Store { if (tx.feeFormatted()?.isNotEmpty ?? false) StandartListItem( title: S.current.transaction_details_fee, value: tx.feeFormatted()!), - if (settingsStore.fiatApiMode != FiatApiMode.disabled) + if (settingsStore.fiatApiMode != FiatApiMode.disabled && + settingsStore.showHistoricalFiatRate) fiatRateListItem, ]); } @@ -228,6 +227,7 @@ abstract class TransactionDetailsViewModelBase with Store { default: formattedFiatAmount; } + final historicalFiatAmountFormatted = formattedFiatAmount * historicalFiatRate; items[fiatRateItemIndex] = StandartListItem( title: S.current.historical_fiat_rate,