[#1569] Release 1.1.7 (717)

* Make fiat widget paddings smaller

* Remove LocaleExt

* Adopt latest Zcash SDK changes

- These changes adopt the latest Zcash SDK snapshot changes that bring simplification in zec and fiat APIs localization
- Fixes bug of requesting fiat for non-english device locale
- Closes #1569
- Closes #1171 too

* Target Zcash SDK 2.2.3-SNAPSHOT

* Changelogs update

* Remove unnecessary import

* Code cleanup
This commit is contained in:
Honza Rychnovský 2024-09-06 15:47:11 +02:00 committed by GitHub
parent d29b0f7bb2
commit 13108ca9f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 45 additions and 47 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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) {

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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(),

View File

@ -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) {