diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1020965b0..ee6d5dd33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
- Choose server screen has been redesigned
- Settings and Advanced Settings screens have been redesigned
- Android `compileSdkVersion` and `targetSdkVersion` have been updated to version 35
+- Shielded transactions are properly indicated in transaction history
## [1.1.7 (718)] - 2024-09-06
diff --git a/docs/whatsNew/WHATS_NEW_EN.md b/docs/whatsNew/WHATS_NEW_EN.md
index 8d5bed872..d52d8b5d1 100644
--- a/docs/whatsNew/WHATS_NEW_EN.md
+++ b/docs/whatsNew/WHATS_NEW_EN.md
@@ -15,6 +15,7 @@ directly impact users rather than highlighting other key architectural updates.*
- The Choose server screen now provides a new search for the three fastest servers feature
- Android 15 (Android SDK API level 35) support for 16 KB memory page size has been added
- Coinbase Onramp integration button has been added to the Advanced Settings screen
+- Shielded transactions are properly indicated in transaction history
### Changed
- Choose server screen has been redesigned
diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/account/view/HistoryView.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/account/view/HistoryView.kt
index bddd8bc93..e607bd9f3 100644
--- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/account/view/HistoryView.kt
+++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/account/view/HistoryView.kt
@@ -306,7 +306,7 @@ private fun ComposableHistoryListItemsPreview() {
const val ADDRESS_IN_TITLE_WIDTH_RATIO = 0.5f
@Composable
-@Suppress("LongMethod")
+@Suppress("LongMethod", "CyclomaticComplexMethod")
private fun HistoryItem(
transaction: TransactionUi,
isHideBalances: Boolean,
@@ -359,6 +359,27 @@ private fun HistoryItem(
textColor = ZcashTheme.colors.historyRedColor
textStyle = ZcashTheme.extendedTypography.transactionItemStyles.titleFailed
}
+
+ TransactionExtendedState.SHIELDED -> {
+ typeText = stringResource(id = R.string.account_history_item_shielded_funds)
+ typeIcon = ImageVector.vectorResource(R.drawable.ic_trx_shielded_funds)
+ textColor = MaterialTheme.colorScheme.onBackground
+ textStyle = ZcashTheme.extendedTypography.transactionItemStyles.titleRegular
+ }
+
+ TransactionExtendedState.SHIELDING -> {
+ typeText = stringResource(id = R.string.account_history_item_shielding_funds)
+ typeIcon = ImageVector.vectorResource(R.drawable.ic_trx_shielded_funds)
+ textColor = ZcashTheme.colors.textDescription
+ textStyle = ZcashTheme.extendedTypography.transactionItemStyles.titleRunning
+ }
+
+ TransactionExtendedState.SHIELDING_FAILED -> {
+ typeText = stringResource(id = R.string.account_history_item_shielding_failed)
+ typeIcon = ImageVector.vectorResource(R.drawable.ic_trx_shielded_funds)
+ textColor = ZcashTheme.colors.historyRedColor
+ textStyle = ZcashTheme.extendedTypography.transactionItemStyles.titleFailed
+ }
}
Row(
@@ -556,7 +577,7 @@ private fun HistoryItemCollapsedAddressPart(
)
}
}
- } else {
+ } else if (!transaction.overview.isShielding) {
Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_trx_shielded),
contentDescription = stringResource(id = R.string.account_history_item_shielded)
@@ -636,7 +657,7 @@ private fun HistoryItemExpandedPart(
modifier: Modifier = Modifier
) {
Column(modifier = modifier) {
- if (transaction.messages.containsValidMemo()) {
+ if (transaction.overview.isShielding.not() && transaction.messages.containsValidMemo()) {
Text(
text =
pluralStringResource(
@@ -662,8 +683,8 @@ private fun HistoryItemExpandedPart(
)
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingDefault))
}
- } else if (transaction.recipientAddressType == null ||
- transaction.recipientAddressType == AddressType.Shielded
+ } else if (transaction.overview.isShielding.not() &&
+ (transaction.recipientAddressType == null || transaction.recipientAddressType == AddressType.Shielded)
) {
Text(
text = stringResource(id = R.string.account_history_item_no_message),
@@ -929,41 +950,41 @@ internal enum class TransactionExtendedState {
SEND_FAILED,
RECEIVED,
RECEIVING,
- RECEIVE_FAILED;
+ RECEIVE_FAILED,
+ SHIELDED,
+ SHIELDING,
+ SHIELDING_FAILED;
- fun isFailed(): Boolean = this == SEND_FAILED || this == RECEIVE_FAILED
+ fun isShielding() = this in listOf(SHIELDED, RECEIVE_FAILED, SHIELDING_FAILED)
- fun isSendType(): Boolean = this == SENDING || this == SENT || this == SEND_FAILED
+ fun isFailed(): Boolean = this in listOf(SEND_FAILED, RECEIVE_FAILED, SHIELDING_FAILED)
+
+ fun isSendType(): Boolean = this in listOf(SENDING, SENT, SEND_FAILED, SHIELDED, SHIELDING_FAILED, SHIELDING)
}
private fun TransactionOverview.getExtendedState(): TransactionExtendedState {
return when (transactionState) {
- TransactionState.Expired -> {
- if (isSentTransaction) {
- TransactionExtendedState.SEND_FAILED
- } else {
- TransactionExtendedState.RECEIVE_FAILED
+ TransactionState.Expired ->
+ when {
+ isShielding -> TransactionExtendedState.SHIELDING_FAILED
+ isSentTransaction -> TransactionExtendedState.SEND_FAILED
+ else -> TransactionExtendedState.RECEIVE_FAILED
}
- }
- TransactionState.Confirmed -> {
- if (isSentTransaction) {
- TransactionExtendedState.SENT
- } else {
- TransactionExtendedState.RECEIVED
+ TransactionState.Confirmed ->
+ when {
+ isShielding -> TransactionExtendedState.SHIELDED
+ isSentTransaction -> TransactionExtendedState.SENT
+ else -> TransactionExtendedState.RECEIVED
}
- }
- TransactionState.Pending -> {
- if (isSentTransaction) {
- TransactionExtendedState.SENDING
- } else {
- TransactionExtendedState.RECEIVING
+ TransactionState.Pending ->
+ when {
+ isShielding -> TransactionExtendedState.SHIELDING
+ isSentTransaction -> TransactionExtendedState.SENDING
+ else -> TransactionExtendedState.RECEIVING
}
- }
- else -> {
- error("Unexpected transaction state found while calculating its extended state.")
- }
+ else -> error("Unexpected transaction state found while calculating its extended state.")
}
}
diff --git a/ui-lib/src/main/res/ui/account/drawable/ic_trx_shielded_funds.xml b/ui-lib/src/main/res/ui/account/drawable/ic_trx_shielded_funds.xml
new file mode 100644
index 000000000..e414d3932
--- /dev/null
+++ b/ui-lib/src/main/res/ui/account/drawable/ic_trx_shielded_funds.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff --git a/ui-lib/src/main/res/ui/account/values/strings.xml b/ui-lib/src/main/res/ui/account/values/strings.xml
index 025109288..a11ffad0a 100644
--- a/ui-lib/src/main/res/ui/account/values/strings.xml
+++ b/ui-lib/src/main/res/ui/account/values/strings.xml
@@ -3,6 +3,9 @@
No transaction history
Sent
+ Shielded Funds
+ Shielding Funds...
+ Shielding Failed...
Received
Sending…
Receiving…