Transparent address on sign transaction screen during shielding
This commit is contained in:
parent
ef4ccbec81
commit
9ae240ce29
|
@ -30,11 +30,11 @@ import co.electriccoin.zcash.ui.common.usecase.ObserveContactPickedUseCase
|
|||
import co.electriccoin.zcash.ui.common.usecase.ObserveCurrentTransactionsUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveFastestServersUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveIsFlexaAvailableUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveKeystoneSendTransactionProposalUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObservePersistableWalletUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedEndpointUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSynchronizerUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveTransactionProposalUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveWalletAccountsUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveWalletStateUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveZashiAccountUseCase
|
||||
|
@ -119,7 +119,7 @@ val useCaseModule =
|
|||
factoryOf(::ParseKeystonePCZTUseCase)
|
||||
factoryOf(::ParseKeystoneSignInRequestUseCase)
|
||||
factoryOf(::CancelKeystoneProposalFlowUseCase)
|
||||
factoryOf(::ObserveKeystoneSendTransactionProposalUseCase)
|
||||
factoryOf(::ObserveTransactionProposalUseCase)
|
||||
factoryOf(::SharePCZTUseCase)
|
||||
factoryOf(::CreateKeystoneProposalPCZTEncoderUseCase)
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import co.electriccoin.zcash.ui.common.repository.KeystoneProposalRepository
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class ObserveKeystoneSendTransactionProposalUseCase(
|
||||
class ObserveTransactionProposalUseCase(
|
||||
private val keystoneProposalRepository: KeystoneProposalRepository,
|
||||
) {
|
||||
operator fun invoke(): Flow<SendTransactionProposal?> =
|
||||
operator fun invoke() = keystoneProposalRepository.transactionProposal
|
||||
|
||||
fun filterSendTransactions(): Flow<SendTransactionProposal?> =
|
||||
keystoneProposalRepository.transactionProposal.map {
|
||||
when (it) {
|
||||
is RegularTransactionProposal -> it
|
|
@ -14,8 +14,8 @@ import co.electriccoin.zcash.ui.common.model.WalletAccount
|
|||
import co.electriccoin.zcash.ui.common.usecase.CancelKeystoneProposalFlowUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.GetExchangeRateUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveContactByAddressUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveKeystoneSendTransactionProposalUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveTransactionProposalUseCase
|
||||
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
|
||||
import co.electriccoin.zcash.ui.design.component.ButtonState
|
||||
import co.electriccoin.zcash.ui.design.component.ZashiChipButtonState
|
||||
|
@ -39,7 +39,7 @@ import kotlinx.coroutines.flow.update
|
|||
class ReviewKeystoneTransactionViewModel(
|
||||
observeContactByAddress: ObserveContactByAddressUseCase,
|
||||
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
||||
observeKeystoneSendTransactionProposal: ObserveKeystoneSendTransactionProposalUseCase,
|
||||
observeKeystoneSendTransactionProposal: ObserveTransactionProposalUseCase,
|
||||
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
||||
private val getExchangeRate: GetExchangeRateUseCase,
|
||||
private val navigationRouter: NavigationRouter,
|
||||
|
@ -60,7 +60,7 @@ class ReviewKeystoneTransactionViewModel(
|
|||
val state =
|
||||
combine(
|
||||
observeSelectedWalletAccount.require(),
|
||||
observeKeystoneSendTransactionProposal(),
|
||||
observeKeystoneSendTransactionProposal.filterSendTransactions(),
|
||||
isReceiverExpanded,
|
||||
exchangeRate,
|
||||
) { wallet, zecSend, isReceiverExpanded, exchangeRate ->
|
||||
|
|
|
@ -6,9 +6,11 @@ import cash.z.ecc.sdk.ANDROID_STATE_FLOW_TIMEOUT
|
|||
import co.electriccoin.zcash.ui.BuildConfig
|
||||
import co.electriccoin.zcash.ui.NavigationRouter
|
||||
import co.electriccoin.zcash.ui.R
|
||||
import co.electriccoin.zcash.ui.common.datasource.ShieldTransactionProposal
|
||||
import co.electriccoin.zcash.ui.common.usecase.CancelKeystoneProposalFlowUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.CreateKeystoneProposalPCZTEncoderUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.ObserveTransactionProposalUseCase
|
||||
import co.electriccoin.zcash.ui.common.usecase.SharePCZTUseCase
|
||||
import co.electriccoin.zcash.ui.design.component.ButtonState
|
||||
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||
|
@ -28,6 +30,7 @@ import kotlinx.coroutines.launch
|
|||
|
||||
class SignKeystoneTransactionViewModel(
|
||||
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
||||
observeTransactionProposalUseCase: ObserveTransactionProposalUseCase,
|
||||
private val navigationRouter: NavigationRouter,
|
||||
private val createKeystoneProposalPCZTEncoder: CreateKeystoneProposalPCZTEncoderUseCase,
|
||||
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
||||
|
@ -38,13 +41,22 @@ class SignKeystoneTransactionViewModel(
|
|||
private val currentQrPart = MutableStateFlow<String?>(null)
|
||||
|
||||
val state: StateFlow<SignKeystoneTransactionState?> =
|
||||
combine(observeSelectedWalletAccount.require(), currentQrPart) { wallet, qrData ->
|
||||
combine(
|
||||
observeTransactionProposalUseCase(),
|
||||
observeSelectedWalletAccount.require(),
|
||||
currentQrPart
|
||||
) { proposal, wallet, qrData ->
|
||||
SignKeystoneTransactionState(
|
||||
accountInfo =
|
||||
ZashiAccountInfoListItemState(
|
||||
icon = R.drawable.ic_settings_info,
|
||||
title = wallet.name,
|
||||
subtitle = stringRes("${wallet.unified.address.address.take(ADDRESS_MAX_LENGTH)}...")
|
||||
subtitle =
|
||||
if (proposal is ShieldTransactionProposal) {
|
||||
stringRes("${wallet.transparent.address.address.take(ADDRESS_MAX_LENGTH)}...")
|
||||
} else {
|
||||
stringRes("${wallet.unified.address.address.take(ADDRESS_MAX_LENGTH)}...")
|
||||
}
|
||||
),
|
||||
generateNextQrCode = { currentQrPart.update { encoder?.nextPart() } },
|
||||
qrData = qrData,
|
||||
|
|
Loading…
Reference in New Issue