parent
e2ddebe47c
commit
2828c25c21
|
@ -163,6 +163,7 @@ data class TransactionItemTextStyles(
|
||||||
val valueFirstPart: TextStyle,
|
val valueFirstPart: TextStyle,
|
||||||
val valueSecondPart: TextStyle,
|
val valueSecondPart: TextStyle,
|
||||||
val content: TextStyle,
|
val content: TextStyle,
|
||||||
|
val contentItalic: TextStyle,
|
||||||
val contentMedium: TextStyle,
|
val contentMedium: TextStyle,
|
||||||
val contentUnderline: TextStyle,
|
val contentUnderline: TextStyle,
|
||||||
val contentLineThrough: TextStyle,
|
val contentLineThrough: TextStyle,
|
||||||
|
@ -336,6 +337,11 @@ val LocalExtendedTypography =
|
||||||
PrimaryTypography.bodySmall.copy(
|
PrimaryTypography.bodySmall.copy(
|
||||||
fontSize = 13.sp
|
fontSize = 13.sp
|
||||||
),
|
),
|
||||||
|
contentItalic =
|
||||||
|
PrimaryTypography.bodySmall.copy(
|
||||||
|
fontSize = 13.sp,
|
||||||
|
fontStyle = FontStyle.Italic
|
||||||
|
),
|
||||||
contentMedium =
|
contentMedium =
|
||||||
PrimaryTypography.bodySmall.copy(
|
PrimaryTypography.bodySmall.copy(
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
|
|
|
@ -3,6 +3,7 @@ package co.electriccoin.zcash.ui.screen.account.history.fixture
|
||||||
import cash.z.ecc.android.sdk.fixture.TransactionOverviewFixture
|
import cash.z.ecc.android.sdk.fixture.TransactionOverviewFixture
|
||||||
import cash.z.ecc.android.sdk.model.Account
|
import cash.z.ecc.android.sdk.model.Account
|
||||||
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
import co.electriccoin.zcash.ui.screen.account.ext.TransactionOverviewExt
|
import co.electriccoin.zcash.ui.screen.account.ext.TransactionOverviewExt
|
||||||
import co.electriccoin.zcash.ui.screen.account.state.TransactionHistorySyncState
|
import co.electriccoin.zcash.ui.screen.account.state.TransactionHistorySyncState
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
@ -11,9 +12,21 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
internal object TransactionHistorySyncStateFixture {
|
internal object TransactionHistorySyncStateFixture {
|
||||||
val TRANSACTIONS =
|
val TRANSACTIONS =
|
||||||
persistentListOf(
|
persistentListOf(
|
||||||
TransactionOverviewExt(TransactionOverviewFixture.new(), TransactionRecipient.Account(Account.DEFAULT)),
|
TransactionOverviewExt(
|
||||||
TransactionOverviewExt(TransactionOverviewFixture.new(), TransactionRecipient.Account(Account(1))),
|
TransactionOverviewFixture.new(),
|
||||||
TransactionOverviewExt(TransactionOverviewFixture.new(), null),
|
TransactionRecipient.Account(Account.DEFAULT),
|
||||||
|
AddressType.Shielded
|
||||||
|
),
|
||||||
|
TransactionOverviewExt(
|
||||||
|
TransactionOverviewFixture.new(),
|
||||||
|
TransactionRecipient.Account(Account(1)),
|
||||||
|
AddressType.Transparent
|
||||||
|
),
|
||||||
|
TransactionOverviewExt(
|
||||||
|
TransactionOverviewFixture.new(),
|
||||||
|
null,
|
||||||
|
AddressType.Unified
|
||||||
|
),
|
||||||
)
|
)
|
||||||
val STATE = TransactionHistorySyncState.Syncing(TRANSACTIONS)
|
val STATE = TransactionHistorySyncState.Syncing(TRANSACTIONS)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import cash.z.ecc.android.sdk.model.FiatCurrency
|
||||||
import cash.z.ecc.android.sdk.model.PercentDecimal
|
import cash.z.ecc.android.sdk.model.PercentDecimal
|
||||||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||||
import cash.z.ecc.android.sdk.model.TransactionOverview
|
import cash.z.ecc.android.sdk.model.TransactionOverview
|
||||||
|
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
import cash.z.ecc.android.sdk.model.WalletAddresses
|
import cash.z.ecc.android.sdk.model.WalletAddresses
|
||||||
import cash.z.ecc.android.sdk.model.WalletBalance
|
import cash.z.ecc.android.sdk.model.WalletBalance
|
||||||
import cash.z.ecc.android.sdk.model.Zatoshi
|
import cash.z.ecc.android.sdk.model.Zatoshi
|
||||||
|
@ -224,9 +225,24 @@ class WalletViewModel(application: Application) : AndroidViewModel(application)
|
||||||
}
|
}
|
||||||
.map {
|
.map {
|
||||||
if (it.isSentTransaction) {
|
if (it.isSentTransaction) {
|
||||||
TransactionOverviewExt(it, synchronizer.getRecipients(it).firstOrNull())
|
val recipient = synchronizer.getRecipients(it).firstOrNull()
|
||||||
|
TransactionOverviewExt(
|
||||||
|
overview = it,
|
||||||
|
recipient = recipient,
|
||||||
|
recipientAddressType =
|
||||||
|
if (recipient != null && (recipient is TransactionRecipient.Address)) {
|
||||||
|
synchronizer.validateAddress(recipient.addressValue)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
TransactionOverviewExt(it, null)
|
// Note that recipients can only be queried for sent transactions
|
||||||
|
TransactionOverviewExt(
|
||||||
|
overview = it,
|
||||||
|
recipient = null,
|
||||||
|
recipientAddressType = null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status.isSyncing()) {
|
if (status.isSyncing()) {
|
||||||
|
|
|
@ -3,10 +3,12 @@ package co.electriccoin.zcash.ui.screen.account.ext
|
||||||
import cash.z.ecc.android.sdk.model.BlockHeight
|
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||||
import cash.z.ecc.android.sdk.model.TransactionOverview
|
import cash.z.ecc.android.sdk.model.TransactionOverview
|
||||||
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
|
|
||||||
data class TransactionOverviewExt(
|
data class TransactionOverviewExt(
|
||||||
val overview: TransactionOverview,
|
val overview: TransactionOverview,
|
||||||
val recipient: TransactionRecipient?
|
val recipient: TransactionRecipient?,
|
||||||
|
val recipientAddressType: AddressType?
|
||||||
)
|
)
|
||||||
|
|
||||||
fun TransactionOverview.getSortHeight(networkHeight: BlockHeight): BlockHeight {
|
fun TransactionOverview.getSortHeight(networkHeight: BlockHeight): BlockHeight {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import cash.z.ecc.android.sdk.fixture.WalletFixture
|
||||||
import cash.z.ecc.android.sdk.model.TransactionOverview
|
import cash.z.ecc.android.sdk.model.TransactionOverview
|
||||||
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||||
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
import co.electriccoin.zcash.ui.screen.account.model.TransactionUi
|
import co.electriccoin.zcash.ui.screen.account.model.TransactionUi
|
||||||
import co.electriccoin.zcash.ui.screen.account.model.TrxItemState
|
import co.electriccoin.zcash.ui.screen.account.model.TrxItemState
|
||||||
|
|
||||||
|
@ -16,6 +17,8 @@ object TransactionUiFixture {
|
||||||
WalletFixture.Alice.getAddresses(ZcashNetwork.Mainnet).sapling
|
WalletFixture.Alice.getAddresses(ZcashNetwork.Mainnet).sapling
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val RECIPIENT_ADDRESS_TYPE: AddressType = AddressType.Shielded
|
||||||
|
|
||||||
val EXPANDABLE_STATE: TrxItemState = TrxItemState.COLLAPSED
|
val EXPANDABLE_STATE: TrxItemState = TrxItemState.COLLAPSED
|
||||||
|
|
||||||
val MESSAGES: List<String> = listOf("Thanks for the coffee", "It was great to meet you!")
|
val MESSAGES: List<String> = listOf("Thanks for the coffee", "It was great to meet you!")
|
||||||
|
@ -23,11 +26,13 @@ object TransactionUiFixture {
|
||||||
internal fun new(
|
internal fun new(
|
||||||
overview: TransactionOverview = OVERVIEW,
|
overview: TransactionOverview = OVERVIEW,
|
||||||
recipient: TransactionRecipient = RECIPIENT,
|
recipient: TransactionRecipient = RECIPIENT,
|
||||||
|
recipientAddressType: AddressType = RECIPIENT_ADDRESS_TYPE,
|
||||||
expandableState: TrxItemState = EXPANDABLE_STATE,
|
expandableState: TrxItemState = EXPANDABLE_STATE,
|
||||||
messages: List<String> = MESSAGES,
|
messages: List<String> = MESSAGES,
|
||||||
) = TransactionUi(
|
) = TransactionUi(
|
||||||
overview = overview,
|
overview = overview,
|
||||||
recipient = recipient,
|
recipient = recipient,
|
||||||
|
recipientAddressType = recipientAddressType,
|
||||||
expandableState = expandableState,
|
expandableState = expandableState,
|
||||||
messages = messages
|
messages = messages
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,11 +2,13 @@ package co.electriccoin.zcash.ui.screen.account.model
|
||||||
|
|
||||||
import cash.z.ecc.android.sdk.model.TransactionOverview
|
import cash.z.ecc.android.sdk.model.TransactionOverview
|
||||||
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
import co.electriccoin.zcash.ui.screen.account.ext.TransactionOverviewExt
|
import co.electriccoin.zcash.ui.screen.account.ext.TransactionOverviewExt
|
||||||
|
|
||||||
data class TransactionUi(
|
data class TransactionUi(
|
||||||
val overview: TransactionOverview,
|
val overview: TransactionOverview,
|
||||||
val recipient: TransactionRecipient?,
|
val recipient: TransactionRecipient?,
|
||||||
|
val recipientAddressType: AddressType?,
|
||||||
val expandableState: TrxItemState,
|
val expandableState: TrxItemState,
|
||||||
val messages: List<String>?
|
val messages: List<String>?
|
||||||
) {
|
) {
|
||||||
|
@ -18,6 +20,7 @@ data class TransactionUi(
|
||||||
) = TransactionUi(
|
) = TransactionUi(
|
||||||
overview = data.overview,
|
overview = data.overview,
|
||||||
recipient = data.recipient,
|
recipient = data.recipient,
|
||||||
|
recipientAddressType = data.recipientAddressType,
|
||||||
expandableState = expandableState,
|
expandableState = expandableState,
|
||||||
messages = messages
|
messages = messages
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,6 +44,7 @@ import cash.z.ecc.android.sdk.model.TransactionRecipient
|
||||||
import cash.z.ecc.android.sdk.model.TransactionState
|
import cash.z.ecc.android.sdk.model.TransactionState
|
||||||
import cash.z.ecc.android.sdk.model.Zatoshi
|
import cash.z.ecc.android.sdk.model.Zatoshi
|
||||||
import cash.z.ecc.android.sdk.model.toZecString
|
import cash.z.ecc.android.sdk.model.toZecString
|
||||||
|
import cash.z.ecc.android.sdk.type.AddressType
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.compose.SynchronizationStatus
|
import co.electriccoin.zcash.ui.common.compose.SynchronizationStatus
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
||||||
|
@ -556,6 +557,17 @@ private fun HistoryItemExpandedPart(
|
||||||
onAction = onAction
|
onAction = onAction
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingDefault))
|
||||||
|
} else if (transaction.recipientAddressType == null ||
|
||||||
|
transaction.recipientAddressType == AddressType.Shielded
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.account_history_item_no_message),
|
||||||
|
style = ZcashTheme.extendedTypography.transactionItemStyles.contentItalic,
|
||||||
|
color = ZcashTheme.colors.textCommon,
|
||||||
|
modifier = Modifier.fillMaxWidth(EXPANDED_TRANSACTION_WIDTH_RATIO)
|
||||||
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingDefault))
|
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingDefault))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,8 +613,8 @@ private fun List<String>.deduplicateMemos(): List<String> {
|
||||||
return distinct()
|
return distinct()
|
||||||
}
|
}
|
||||||
|
|
||||||
const val EXPANDED_TRANSACTION_ID_WIDTH_RATIO = 0.75f
|
const val EXPANDED_TRANSACTION_WIDTH_RATIO = 0.75f
|
||||||
const val COLLAPSED_TRANSACTION_ID_WIDTH_RATIO = 0.5f
|
const val COLLAPSED_TRANSACTION_WIDTH_RATIO = 0.5f
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Suppress("LongMethod")
|
@Suppress("LongMethod")
|
||||||
|
@ -631,7 +643,7 @@ private fun HistoryItemTransactionIdPart(
|
||||||
color = ZcashTheme.colors.textCommon,
|
color = ZcashTheme.colors.textCommon,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth(EXPANDED_TRANSACTION_ID_WIDTH_RATIO)
|
.fillMaxWidth(EXPANDED_TRANSACTION_WIDTH_RATIO)
|
||||||
.testTag(HistoryTag.TRANSACTION_ID)
|
.testTag(HistoryTag.TRANSACTION_ID)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -683,7 +695,7 @@ private fun HistoryItemTransactionIdPart(
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth(COLLAPSED_TRANSACTION_ID_WIDTH_RATIO)
|
.fillMaxWidth(COLLAPSED_TRANSACTION_WIDTH_RATIO)
|
||||||
.testTag(HistoryTag.TRANSACTION_ID)
|
.testTag(HistoryTag.TRANSACTION_ID)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<string name="account_history_item_received_prefix">+</string>
|
<string name="account_history_item_received_prefix">+</string>
|
||||||
<string name="account_history_item_tap_to_copy">Tap to copy</string>
|
<string name="account_history_item_tap_to_copy">Tap to copy</string>
|
||||||
<string name="account_history_item_message">Message</string>
|
<string name="account_history_item_message">Message</string>
|
||||||
|
<string name="account_history_item_no_message">No message included in transaction</string>
|
||||||
<string name="account_history_item_collapse_transaction">Collapse transaction</string>
|
<string name="account_history_item_collapse_transaction">Collapse transaction</string>
|
||||||
<string name="account_history_item_transaction_id">Transaction ID</string>
|
<string name="account_history_item_transaction_id">Transaction ID</string>
|
||||||
<string name="account_history_item_transaction_fee">Transaction Fee</string>
|
<string name="account_history_item_transaction_fee">Transaction Fee</string>
|
||||||
|
|
Loading…
Reference in New Issue