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.ObserveCurrentTransactionsUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveFastestServersUseCase
|
import co.electriccoin.zcash.ui.common.usecase.ObserveFastestServersUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveIsFlexaAvailableUseCase
|
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.ObservePersistableWalletUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedEndpointUseCase
|
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedEndpointUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSynchronizerUseCase
|
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.ObserveWalletAccountsUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveWalletStateUseCase
|
import co.electriccoin.zcash.ui.common.usecase.ObserveWalletStateUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveZashiAccountUseCase
|
import co.electriccoin.zcash.ui.common.usecase.ObserveZashiAccountUseCase
|
||||||
|
@ -119,7 +119,7 @@ val useCaseModule =
|
||||||
factoryOf(::ParseKeystonePCZTUseCase)
|
factoryOf(::ParseKeystonePCZTUseCase)
|
||||||
factoryOf(::ParseKeystoneSignInRequestUseCase)
|
factoryOf(::ParseKeystoneSignInRequestUseCase)
|
||||||
factoryOf(::CancelKeystoneProposalFlowUseCase)
|
factoryOf(::CancelKeystoneProposalFlowUseCase)
|
||||||
factoryOf(::ObserveKeystoneSendTransactionProposalUseCase)
|
factoryOf(::ObserveTransactionProposalUseCase)
|
||||||
factoryOf(::SharePCZTUseCase)
|
factoryOf(::SharePCZTUseCase)
|
||||||
factoryOf(::CreateKeystoneProposalPCZTEncoderUseCase)
|
factoryOf(::CreateKeystoneProposalPCZTEncoderUseCase)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@ import co.electriccoin.zcash.ui.common.repository.KeystoneProposalRepository
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
|
||||||
class ObserveKeystoneSendTransactionProposalUseCase(
|
class ObserveTransactionProposalUseCase(
|
||||||
private val keystoneProposalRepository: KeystoneProposalRepository,
|
private val keystoneProposalRepository: KeystoneProposalRepository,
|
||||||
) {
|
) {
|
||||||
operator fun invoke(): Flow<SendTransactionProposal?> =
|
operator fun invoke() = keystoneProposalRepository.transactionProposal
|
||||||
|
|
||||||
|
fun filterSendTransactions(): Flow<SendTransactionProposal?> =
|
||||||
keystoneProposalRepository.transactionProposal.map {
|
keystoneProposalRepository.transactionProposal.map {
|
||||||
when (it) {
|
when (it) {
|
||||||
is RegularTransactionProposal -> 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.CancelKeystoneProposalFlowUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.GetExchangeRateUseCase
|
import co.electriccoin.zcash.ui.common.usecase.GetExchangeRateUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveContactByAddressUseCase
|
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.ObserveSelectedWalletAccountUseCase
|
||||||
|
import co.electriccoin.zcash.ui.common.usecase.ObserveTransactionProposalUseCase
|
||||||
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
|
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
|
||||||
import co.electriccoin.zcash.ui.design.component.ButtonState
|
import co.electriccoin.zcash.ui.design.component.ButtonState
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiChipButtonState
|
import co.electriccoin.zcash.ui.design.component.ZashiChipButtonState
|
||||||
|
@ -39,7 +39,7 @@ import kotlinx.coroutines.flow.update
|
||||||
class ReviewKeystoneTransactionViewModel(
|
class ReviewKeystoneTransactionViewModel(
|
||||||
observeContactByAddress: ObserveContactByAddressUseCase,
|
observeContactByAddress: ObserveContactByAddressUseCase,
|
||||||
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
||||||
observeKeystoneSendTransactionProposal: ObserveKeystoneSendTransactionProposalUseCase,
|
observeKeystoneSendTransactionProposal: ObserveTransactionProposalUseCase,
|
||||||
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
||||||
private val getExchangeRate: GetExchangeRateUseCase,
|
private val getExchangeRate: GetExchangeRateUseCase,
|
||||||
private val navigationRouter: NavigationRouter,
|
private val navigationRouter: NavigationRouter,
|
||||||
|
@ -60,7 +60,7 @@ class ReviewKeystoneTransactionViewModel(
|
||||||
val state =
|
val state =
|
||||||
combine(
|
combine(
|
||||||
observeSelectedWalletAccount.require(),
|
observeSelectedWalletAccount.require(),
|
||||||
observeKeystoneSendTransactionProposal(),
|
observeKeystoneSendTransactionProposal.filterSendTransactions(),
|
||||||
isReceiverExpanded,
|
isReceiverExpanded,
|
||||||
exchangeRate,
|
exchangeRate,
|
||||||
) { wallet, zecSend, 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.BuildConfig
|
||||||
import co.electriccoin.zcash.ui.NavigationRouter
|
import co.electriccoin.zcash.ui.NavigationRouter
|
||||||
import co.electriccoin.zcash.ui.R
|
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.CancelKeystoneProposalFlowUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.CreateKeystoneProposalPCZTEncoderUseCase
|
import co.electriccoin.zcash.ui.common.usecase.CreateKeystoneProposalPCZTEncoderUseCase
|
||||||
import co.electriccoin.zcash.ui.common.usecase.ObserveSelectedWalletAccountUseCase
|
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.common.usecase.SharePCZTUseCase
|
||||||
import co.electriccoin.zcash.ui.design.component.ButtonState
|
import co.electriccoin.zcash.ui.design.component.ButtonState
|
||||||
import co.electriccoin.zcash.ui.design.util.stringRes
|
import co.electriccoin.zcash.ui.design.util.stringRes
|
||||||
|
@ -28,6 +30,7 @@ import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class SignKeystoneTransactionViewModel(
|
class SignKeystoneTransactionViewModel(
|
||||||
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
||||||
|
observeTransactionProposalUseCase: ObserveTransactionProposalUseCase,
|
||||||
private val navigationRouter: NavigationRouter,
|
private val navigationRouter: NavigationRouter,
|
||||||
private val createKeystoneProposalPCZTEncoder: CreateKeystoneProposalPCZTEncoderUseCase,
|
private val createKeystoneProposalPCZTEncoder: CreateKeystoneProposalPCZTEncoderUseCase,
|
||||||
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
private val cancelKeystoneProposalFlow: CancelKeystoneProposalFlowUseCase,
|
||||||
|
@ -38,13 +41,22 @@ class SignKeystoneTransactionViewModel(
|
||||||
private val currentQrPart = MutableStateFlow<String?>(null)
|
private val currentQrPart = MutableStateFlow<String?>(null)
|
||||||
|
|
||||||
val state: StateFlow<SignKeystoneTransactionState?> =
|
val state: StateFlow<SignKeystoneTransactionState?> =
|
||||||
combine(observeSelectedWalletAccount.require(), currentQrPart) { wallet, qrData ->
|
combine(
|
||||||
|
observeTransactionProposalUseCase(),
|
||||||
|
observeSelectedWalletAccount.require(),
|
||||||
|
currentQrPart
|
||||||
|
) { proposal, wallet, qrData ->
|
||||||
SignKeystoneTransactionState(
|
SignKeystoneTransactionState(
|
||||||
accountInfo =
|
accountInfo =
|
||||||
ZashiAccountInfoListItemState(
|
ZashiAccountInfoListItemState(
|
||||||
icon = R.drawable.ic_settings_info,
|
icon = R.drawable.ic_settings_info,
|
||||||
title = wallet.name,
|
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() } },
|
generateNextQrCode = { currentQrPart.update { encoder?.nextPart() } },
|
||||||
qrData = qrData,
|
qrData = qrData,
|
||||||
|
|
Loading…
Reference in New Issue