From 7b808c53c859b2b16bfe8a380320d0c718b02afd Mon Sep 17 00:00:00 2001 From: Milan Cerovsky Date: Mon, 26 Aug 2024 10:19:30 +0200 Subject: [PATCH] Currency conversion floating point hotfix --- gradle.properties | 2 +- .../exchangerate/widget/StyledExchangeBalance.kt | 14 +++++--------- .../zcash/ui/screen/send/model/AmountState.kt | 3 +-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9c8e93b4..4821b0ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -131,7 +131,7 @@ ZCASH_EMULATOR_WTF_API_KEY= # Optional absolute path to a Zcash SDK checkout. # When blank, it pulls the SDK from Maven. # When set, it uses the path for a Gradle included build. Path can either be absolute or relative to the root of this app's Gradle project. -SDK_INCLUDED_BUILD_PATH= +SDK_INCLUDED_BUILD_PATH=/Users/milancerovsky/Developer/zcash/zcash-android-wallet-sdk # When blank, it pulls the BIP-39 library from Maven. # When set, it uses the path for a Gradle included build. Path can either be absolute or relative to the root of this app's Gradle project. diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/exchangerate/widget/StyledExchangeBalance.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/exchangerate/widget/StyledExchangeBalance.kt index 7be2b30f..000e19b6 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/exchangerate/widget/StyledExchangeBalance.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/exchangerate/widget/StyledExchangeBalance.kt @@ -158,15 +158,11 @@ internal fun createExchangeRateText( if (isHideBalances) { "${currencySymbol}${hiddenBalancePlaceholder.getValue()}" } else if (state.currencyConversion != null) { - val value = - zatoshi.toFiatString( - currencyConversion = state.currencyConversion, - locale = Locale.current.toKotlinLocale(), - monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()), - includeSymbols = false - ) - - "$currencySymbol$value" + zatoshi.toFiatString( + currencyConversion = state.currencyConversion, + locale = Locale.current.toKotlinLocale(), + monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()), + ) } else { currencySymbol } diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/model/AmountState.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/model/AmountState.kt index 5b7b96c7..785925b4 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/model/AmountState.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/model/AmountState.kt @@ -69,8 +69,7 @@ sealed interface AmountState { currencyConversion = currencyConversion, locale = Locale.current.toKotlinLocale(), monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()), - includeSymbols = false - ) + ).replace(currencyConversion.fiatCurrency.symbol, "") } ) }