[#1153] Adopt SDK v2.0.4
* [#1153] Adopt SDK v2.0.4 - Closes #1153 - Add TODO inline - Changelog update
This commit is contained in:
parent
803ea86d8d
commit
d1eec2dae8
|
@ -13,6 +13,9 @@ directly impact users rather than highlighting other key architectural updates.*
|
|||
- Transaction history items now display Memos within the Android Toast, triggered by clicking the item
|
||||
- Transaction history items add displaying transaction IDs; the ID element is also clickable
|
||||
|
||||
### Changed
|
||||
- All project dependencies have been updated, including the Zcash SDK dependency
|
||||
|
||||
## [0.2.0 (517)] - 2023-12-21
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -188,7 +188,7 @@ ZCASH_BIP39_VERSION=1.0.7
|
|||
ZXING_VERSION=3.5.2
|
||||
|
||||
# WARNING: Ensure a non-snapshot version is used before releasing to production.
|
||||
ZCASH_SDK_VERSION=2.0.3
|
||||
ZCASH_SDK_VERSION=2.0.4-SNAPSHOT
|
||||
|
||||
# Toolchain is the Java version used to build the application, which is separate from the
|
||||
# Java version used to run the application.
|
||||
|
|
|
@ -5,6 +5,7 @@ import cash.z.ecc.android.sdk.model.MonetarySeparators
|
|||
import cash.z.ecc.android.sdk.model.PercentDecimal
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Test
|
||||
import java.util.Locale
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class PercentDecimalExtTest {
|
||||
|
@ -32,7 +33,7 @@ class PercentDecimalExtTest {
|
|||
runTest {
|
||||
val parsed = PercentDecimal(1f).toPercentageWithDecimal()
|
||||
|
||||
assertEquals("100${MonetarySeparators.current().decimal}00", parsed)
|
||||
assertEquals("100${MonetarySeparators.current(Locale.US).decimal}00", parsed)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
@file:Suppress("ktlint:standard:filename")
|
||||
|
||||
package cash.z.ecc.sdk.extension
|
||||
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import co.electriccoin.lightwallet.client.model.LightWalletEndpoint
|
||||
|
||||
/*
|
||||
* This set of extension functions suit for default values for the SDK initialization.
|
||||
*/
|
||||
|
||||
fun LightWalletEndpoint.Companion.defaultForNetwork(zcashNetwork: ZcashNetwork): LightWalletEndpoint {
|
||||
return when (zcashNetwork.id) {
|
||||
ZcashNetwork.Mainnet.id -> LightWalletEndpoint.Mainnet
|
||||
ZcashNetwork.Testnet.id -> LightWalletEndpoint.Testnet
|
||||
else -> error("Unknown network id: ${zcashNetwork.id}")
|
||||
}
|
||||
}
|
||||
|
||||
private const val DEFAULT_PORT = 9067
|
||||
|
||||
val LightWalletEndpoint.Companion.Mainnet
|
||||
get() =
|
||||
LightWalletEndpoint(
|
||||
"mainnet.lightwalletd.com",
|
||||
DEFAULT_PORT,
|
||||
isSecure = true
|
||||
)
|
||||
|
||||
val LightWalletEndpoint.Companion.Testnet
|
||||
get() =
|
||||
LightWalletEndpoint(
|
||||
"lightwalletd.testnet.electriccoin.co",
|
||||
DEFAULT_PORT,
|
||||
isSecure = true
|
||||
)
|
|
@ -7,6 +7,7 @@ import cash.z.ecc.android.sdk.model.MonetarySeparators
|
|||
import cash.z.ecc.android.sdk.model.PercentDecimal
|
||||
import java.math.RoundingMode
|
||||
import java.text.DecimalFormat
|
||||
import java.util.Locale
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
fun PercentDecimal.toPercentageWithDecimal(decimalFormat: DecimalFormat = preparePercentDecimalFormat()): String {
|
||||
|
@ -15,7 +16,9 @@ fun PercentDecimal.toPercentageWithDecimal(decimalFormat: DecimalFormat = prepar
|
|||
|
||||
private fun preparePercentDecimalFormat(): DecimalFormat =
|
||||
DecimalFormat().apply {
|
||||
val monetarySeparators = MonetarySeparators.current()
|
||||
// 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 localizedPattern = "##0${monetarySeparators.decimal}00"
|
||||
runCatching {
|
||||
applyLocalizedPattern(localizedPattern)
|
||||
|
|
|
@ -2,10 +2,10 @@ package cash.z.ecc.sdk.fixture
|
|||
|
||||
import cash.z.ecc.android.sdk.WalletInitMode
|
||||
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||
import cash.z.ecc.android.sdk.model.Mainnet
|
||||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||
import cash.z.ecc.android.sdk.model.SeedPhrase
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import cash.z.ecc.sdk.extension.Mainnet
|
||||
import co.electriccoin.lightwallet.client.model.LightWalletEndpoint
|
||||
|
||||
object PersistableWalletFixture {
|
||||
|
|
|
@ -19,8 +19,8 @@ import cash.z.ecc.android.sdk.model.WalletAddresses
|
|||
import cash.z.ecc.android.sdk.model.WalletBalance
|
||||
import cash.z.ecc.android.sdk.model.Zatoshi
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import cash.z.ecc.android.sdk.model.defaultForNetwork
|
||||
import cash.z.ecc.android.sdk.tool.DerivationTool
|
||||
import cash.z.ecc.sdk.extension.defaultForNetwork
|
||||
import cash.z.ecc.sdk.type.fromResources
|
||||
import co.electriccoin.lightwallet.client.model.LightWalletEndpoint
|
||||
import co.electriccoin.zcash.global.getInstance
|
||||
|
|
|
@ -39,7 +39,9 @@ data class WalletDisplayValues(
|
|||
walletSnapshot.spendableBalance().toFiatCurrencyState(
|
||||
null,
|
||||
Locale.current.toKotlinLocale(),
|
||||
MonetarySeparators.current()
|
||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
||||
MonetarySeparators.current(java.util.Locale.US)
|
||||
)
|
||||
var fiatCurrencyAmountText = getFiatCurrencyRateValue(context, fiatCurrencyAmountState)
|
||||
|
||||
|
|
|
@ -346,10 +346,7 @@ fun HistoryItem(
|
|||
}
|
||||
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingTiny))
|
||||
|
||||
// TODO [#1316]: Provide readable TxId on TransactionOverview
|
||||
// TODO [#1316]: https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/issues/1316
|
||||
// TODO [#1316]: transaction.rawId.byteArray.toHexReversed()
|
||||
val txId = "TODO [#1316]: SDK: Provide readable TxId"
|
||||
val txId = transaction.txIdString()
|
||||
Tiny(
|
||||
text = txId,
|
||||
modifier =
|
||||
|
|
|
@ -13,7 +13,7 @@ import cash.z.ecc.android.sdk.model.BlockHeight
|
|||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||
import cash.z.ecc.android.sdk.model.SeedPhrase
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import cash.z.ecc.android.sdk.model.defaultForNetwork
|
||||
import cash.z.ecc.sdk.extension.defaultForNetwork
|
||||
import cash.z.ecc.sdk.type.fromResources
|
||||
import co.electriccoin.lightwallet.client.model.LightWalletEndpoint
|
||||
import co.electriccoin.zcash.spackle.FirebaseTestLabUtil
|
||||
|
|
|
@ -43,6 +43,7 @@ import co.electriccoin.zcash.ui.design.component.GradientSurface
|
|||
import co.electriccoin.zcash.ui.design.component.PrimaryButton
|
||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.Locale
|
||||
|
||||
@Preview("Request")
|
||||
@Composable
|
||||
|
@ -112,7 +113,9 @@ private fun RequestMainContent(
|
|||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val monetarySeparators = MonetarySeparators.current()
|
||||
// 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 allowedCharacters = ZecString.allowedCharacters(monetarySeparators)
|
||||
|
||||
var amountZecString by rememberSaveable { mutableStateOf("") }
|
||||
|
|
|
@ -72,6 +72,7 @@ import co.electriccoin.zcash.ui.screen.send.ext.valueOrEmptyChar
|
|||
import co.electriccoin.zcash.ui.screen.send.model.SendArgumentsWrapper
|
||||
import co.electriccoin.zcash.ui.screen.send.model.SendStage
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.Locale
|
||||
|
||||
@Composable
|
||||
@Preview("SendForm")
|
||||
|
@ -304,7 +305,9 @@ private fun SendForm(
|
|||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val monetarySeparators = MonetarySeparators.current()
|
||||
// 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 allowedCharacters = ZecString.allowedCharacters(monetarySeparators)
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ data class EnvironmentInfo(
|
|||
|
||||
return EnvironmentInfo(
|
||||
context.resources.configuration.locales[0],
|
||||
// This MonetarySeparators calling reflects the real separators according to device Locale as its
|
||||
// goal is to represent information about the device, and it's not considered to be used in UI
|
||||
MonetarySeparators.current(),
|
||||
usableStorage
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue