diff --git a/CHANGELOG.md b/CHANGELOG.md index 70d318f0..f123146d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,19 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2 ## [Unreleased] +## [1.1.7 (717)] - 2024-09-06 + ### Added -- Balance now also displays USD value -- An option to enter USD amount in Send Transaction screen - Dependency injection using Koin has been added to the project. This helps us keep the codebase organized while adding new app features. +### Changed +- Zcash SDK version 2.2.3-SNAPSHOT has been adopted + +### Fixed +- The Zec to USD currency conversion logic on the Send screen, which caused issues on lower Android SDK versions + together with non-English device localizations, has been fixed. + ## [1.1.6 (712)] - 2024-09-04 ### Added @@ -32,10 +39,10 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2 - Thus, the balances widget now optionally displays the USD value as well - A new option to enter the USD amount in the Send screen has been added -## Changed +### Changed - Android NDK version has been bumped to 26.1.10909125 -## Fixed +### Fixed - The app screenshot testing has been re-enabled after we moved away from AppCompat components ## [1.1.5 (706)] - 2024-08-09 @@ -63,7 +70,7 @@ flag is used on Android SDK level 33 and higher, masking out the `Toast` text on - `targetSdk` property value changed from 33 to 34 - The Zcash SDK dependency has been switched from `2.1.2-SNAPSHOT` to `2.1.2` -## Fixed +### Fixed - Support Screen now shows the Send button above keyboard instead of overlaying it. This was achieved by setting `adjustResize` to `MainActivity` and adding `imePadding` to top level composable - QR code scanning speed and reliability have been improved to address the latest reported scan issue. The obtained @@ -73,7 +80,7 @@ flag is used on Android SDK level 33 and higher, masking out the `Toast` text on option has been added to the app's `AndroidManifest.xml`, leaving the configuration changes handling entirely to the Jetpack Compose layer. -## Removed +### Removed - `androidx.appcompat:appcompat` dependency has been removed ## [1.1.3 (682)] - 2024-07-03 diff --git a/docs/whatsNew/WHATS_NEW_EN.md b/docs/whatsNew/WHATS_NEW_EN.md index 979e74d6..d25f23cd 100644 --- a/docs/whatsNew/WHATS_NEW_EN.md +++ b/docs/whatsNew/WHATS_NEW_EN.md @@ -9,6 +9,18 @@ directly impact users rather than highlighting other key architectural updates.* ## [Unreleased] +## [1.1.7 (717)] - 2024-09-06 + +### Added +- We added ZEC/USD currency conversion to Zashi without compromising your IP address. +- You can now view your balances and type in transaction amounts in both USD and ZEC. + +### Changed +- We adopted the latest Zcash SDK version 2.2.0, which brings the ZIP 320 TEX addresses support, currency conversion feature that fetches ZEC/USD exchange rate over Tor, and support for restoring the full history from transparent-only wallets. + +### Fixed +- We re-enabled app screenshot testing after we moved away from the AppCompat components. + ## [1.1.6 (712)] - 2024-09-04 ### Added diff --git a/gradle.properties b/gradle.properties index 0346ee31..e16da797 100644 --- a/gradle.properties +++ b/gradle.properties @@ -205,7 +205,7 @@ ZXING_VERSION=3.5.3 ZCASH_BIP39_VERSION=1.0.8 # WARNING: Ensure a non-snapshot version is used before releasing to production -ZCASH_SDK_VERSION=2.2.2 +ZCASH_SDK_VERSION=2.2.3-SNAPSHOT # Toolchain is the Java version used to build the application, which is separate from the # Java version used to run the application. diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/compose/BalanceWidget.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/compose/BalanceWidget.kt index 64d39e4a..8fb62e1f 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/compose/BalanceWidget.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/compose/BalanceWidget.kt @@ -18,7 +18,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Devices import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp import cash.z.ecc.android.sdk.model.Zatoshi import cash.z.ecc.sdk.extension.toZecStringFull import cash.z.ecc.sdk.type.ZcashCurrency @@ -152,7 +151,7 @@ fun BalanceWidget( ) if (balanceState.exchangeRate is ExchangeRateState.Data) { - Spacer(modifier = Modifier.height(16.dp)) + Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingMid)) } StyledExchangeBalance( @@ -162,7 +161,7 @@ fun BalanceWidget( ) if (balanceState.exchangeRate is ExchangeRateState.Data) { - Spacer(modifier = Modifier.height(12.dp)) + Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingSmall)) } Row(verticalAlignment = Alignment.CenterVertically) { diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/extension/LocaleExt.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/extension/LocaleExt.kt deleted file mode 100644 index c2755044..00000000 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/common/extension/LocaleExt.kt +++ /dev/null @@ -1,7 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package co.electriccoin.zcash.ui.common.extension - -import androidx.compose.ui.text.intl.Locale - -fun Locale.toKotlinLocale() = cash.z.ecc.android.sdk.model.Locale(language, region, script) diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/balances/model/WalletDisplayValues.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/balances/model/WalletDisplayValues.kt index 1ad859c9..0a4b0681 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/balances/model/WalletDisplayValues.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/balances/model/WalletDisplayValues.kt @@ -1,15 +1,13 @@ package co.electriccoin.zcash.ui.screen.balances.model import android.content.Context -import androidx.compose.ui.text.intl.Locale import cash.z.ecc.android.sdk.Synchronizer import cash.z.ecc.android.sdk.model.FiatCurrencyConversionRateState -import cash.z.ecc.android.sdk.model.MonetarySeparators +import cash.z.ecc.android.sdk.model.Locale import cash.z.ecc.android.sdk.model.PercentDecimal import cash.z.ecc.android.sdk.model.toFiatCurrencyState import cash.z.ecc.android.sdk.model.toZecString import co.electriccoin.zcash.ui.R -import co.electriccoin.zcash.ui.common.extension.toKotlinLocale import co.electriccoin.zcash.ui.common.model.WalletSnapshot import co.electriccoin.zcash.ui.common.model.spendableBalance import co.electriccoin.zcash.ui.common.model.totalBalance @@ -38,8 +36,7 @@ data class WalletDisplayValues( val fiatCurrencyAmountState = walletSnapshot.spendableBalance().toFiatCurrencyState( null, - Locale.current.toKotlinLocale(), - MonetarySeparators.current(java.util.Locale.getDefault()) + Locale.getDefault(), ) var fiatCurrencyAmountText = getFiatCurrencyRateValue(context, fiatCurrencyAmountState) 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..cd2d49dd 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 @@ -30,15 +30,13 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import cash.z.ecc.android.sdk.model.FiatCurrencyConversion -import cash.z.ecc.android.sdk.model.MonetarySeparators +import cash.z.ecc.android.sdk.model.Locale import cash.z.ecc.android.sdk.model.Zatoshi import cash.z.ecc.android.sdk.model.toFiatString import co.electriccoin.zcash.ui.R -import co.electriccoin.zcash.ui.common.extension.toKotlinLocale import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState import co.electriccoin.zcash.ui.design.component.BlankSurface import co.electriccoin.zcash.ui.design.component.LottieProgress @@ -161,9 +159,7 @@ internal fun createExchangeRateText( val value = zatoshi.toFiatString( currencyConversion = state.currencyConversion, - locale = Locale.current.toKotlinLocale(), - monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()), - includeSymbols = false + locale = Locale.getDefault(), ) "$currencySymbol$value" diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/AndroidSend.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/AndroidSend.kt index 5a39c2e0..60f25f1a 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/AndroidSend.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/AndroidSend.kt @@ -62,9 +62,7 @@ internal fun WrapSend( val spendingKey = walletViewModel.spendingKey.collectAsStateWithLifecycle().value - // TODO [#1171]: Remove default MonetarySeparators locale - // TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171 - val monetarySeparators = MonetarySeparators.current(Locale.US) + val monetarySeparators = MonetarySeparators.current(Locale.getDefault()) val walletState = walletViewModel.walletStateInformation.collectAsStateWithLifecycle().value 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..cc1d2640 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 @@ -2,7 +2,7 @@ package co.electriccoin.zcash.ui.screen.send.model import android.content.Context import androidx.compose.runtime.saveable.mapSaver -import androidx.compose.ui.text.intl.Locale +import cash.z.ecc.android.sdk.model.Locale import cash.z.ecc.android.sdk.model.MonetarySeparators import cash.z.ecc.android.sdk.model.Zatoshi import cash.z.ecc.android.sdk.model.ZecStringExt @@ -11,7 +11,6 @@ import cash.z.ecc.android.sdk.model.toFiatString import cash.z.ecc.android.sdk.model.toZatoshi import cash.z.ecc.android.sdk.model.toZecString import co.electriccoin.zcash.spackle.Twig -import co.electriccoin.zcash.ui.common.extension.toKotlinLocale import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState sealed interface AmountState { @@ -42,7 +41,7 @@ sealed interface AmountState { return Invalid(value, if (value.isBlank()) "" else fiatValue) } - val zatoshi = Zatoshi.fromZecString(context, value, monetarySeparators) + val zatoshi = Zatoshi.fromZecString(context, value, Locale.getDefault()) val currencyConversion = if (exchangeRateState !is ExchangeRateState.Data || @@ -67,9 +66,7 @@ sealed interface AmountState { } else { zatoshi.toFiatString( currencyConversion = currencyConversion, - locale = Locale.current.toKotlinLocale(), - monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()), - includeSymbols = false + locale = Locale.getDefault(), ) } ) @@ -89,19 +86,23 @@ sealed interface AmountState { val isValid = validate(context, monetarySeparators, fiatValue) if (!isValid) { - return Invalid(value, fiatValue) + return Invalid(value = if (fiatValue.isBlank()) "" else value, fiatValue = fiatValue) } val zatoshi = (exchangeRateState as? ExchangeRateState.Data)?.currencyConversion?.toZatoshi( context = context, value = fiatValue, - monetarySeparators = MonetarySeparators.current(java.util.Locale.getDefault()) + locale = Locale.getDefault(), ) return when { - (zatoshi == null) -> Invalid(value, fiatValue) - (zatoshi.value == 0L && isTransparentOrTextRecipient) -> Invalid(value, fiatValue) + (zatoshi == null) -> { + Invalid(value = if (fiatValue.isBlank()) "" else value, fiatValue = fiatValue) + } + (zatoshi.value == 0L && isTransparentOrTextRecipient) -> { + Invalid(if (fiatValue.isBlank()) "" else value, fiatValue) + } else -> { Valid( value = zatoshi.toZecString(), diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/view/SendView.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/view/SendView.kt index 05549eb4..a7c8be3f 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/view/SendView.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/send/view/SendView.kt @@ -347,9 +347,7 @@ private fun SendForm( hasCameraFeature: Boolean, modifier: Modifier = Modifier, ) { - // TODO [#1171]: Remove default MonetarySeparators locale - // TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171 - val monetarySeparators = MonetarySeparators.current(Locale.US) + val monetarySeparators = MonetarySeparators.current(Locale.getDefault()) val scrollState = rememberScrollState() @@ -435,7 +433,6 @@ private fun SendForm( SendButton( amountState = amountState, memoState = memoState, - monetarySeparators = monetarySeparators, onCreateZecSend = onCreateZecSend, recipientAddressState = recipientAddressState, walletSnapshot = walletSnapshot, @@ -449,7 +446,6 @@ private fun SendForm( fun SendButton( amountState: AmountState, memoState: MemoState, - monetarySeparators: MonetarySeparators, onCreateZecSend: (ZecSend) -> Unit, recipientAddressState: RecipientAddressState, setScrollToFeePixels: (Int) -> Unit, @@ -486,7 +482,6 @@ fun SendButton( } else { memoState.text }, - monetarySeparators = monetarySeparators ) when (zecSendValidation) {