Skip to content

Commit 7c2a62d

Browse files
authored
Merge pull request #285 from synonymdev/feat/transfer-activities-text
Transfer activity title and subtitle
2 parents 0c10cb9 + 7e75f10 commit 7c2a62d

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/activity/components/ActivityRow.kt

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ fun ActivityRow(
6868
is Activity.Lightning -> null
6969
is Activity.Onchain -> item.v1.confirmed
7070
}
71+
val isTransfer = when (item) {
72+
is Activity.Lightning -> false
73+
is Activity.Onchain -> item.v1.isTransfer
74+
}
75+
7176
Row(
7277
verticalAlignment = Alignment.CenterVertically,
7378
modifier = Modifier
@@ -85,16 +90,41 @@ fun ActivityRow(
8590
txType = txType,
8691
isLightning = isLightning,
8792
status = status,
88-
confirmed = confirmed,
93+
isTransfer = isTransfer
8994
)
9095
val subtitleText = when (item) {
9196
is Activity.Lightning -> item.v1.message.ifEmpty { formattedTime(timestamp) }
9297
is Activity.Onchain -> {
93-
if (confirmed == true) {
94-
formattedTime(timestamp)
95-
} else {
96-
// TODO: calculate confirmsIn text
97-
stringResource(R.string.wallet__activity_confirms_in).replace("{feeRateDescription}", "± 1h")
98+
when {
99+
isTransfer && isSent -> {
100+
if (item.v1.confirmed) {
101+
stringResource(R.string.wallet__activity_transfer_spending_done)
102+
} else {
103+
stringResource(R.string.wallet__activity_transfer_spending_pending)
104+
.replace("{duration}", "1h") // TODO: calculate confirmsIn text
105+
}
106+
}
107+
108+
isTransfer && !isSent -> {
109+
if (item.v1.confirmed) {
110+
stringResource(R.string.wallet__activity_transfer_savings_done)
111+
} else {
112+
stringResource(R.string.wallet__activity_transfer_savings_pending)
113+
.replace("{duration}", "1h") // TODO: calculate confirmsIn text
114+
}
115+
}
116+
117+
confirmed == true -> {
118+
formattedTime(timestamp)
119+
}
120+
121+
else -> {
122+
// TODO: calculate confirmsIn text
123+
stringResource(R.string.wallet__activity_confirms_in).replace(
124+
"{feeRateDescription}",
125+
"± 1h"
126+
)
127+
}
98128
}
99129
}
100130
}
@@ -117,9 +147,10 @@ private fun TransactionStatusText(
117147
txType: PaymentType,
118148
isLightning: Boolean,
119149
status: PaymentState?,
120-
confirmed: Boolean?,
150+
isTransfer: Boolean,
121151
) {
122152
when {
153+
isTransfer -> BodyMSB(text = stringResource(R.string.wallet__activity_transfer))
123154
isLightning -> {
124155
when (txType) {
125156
PaymentType.SENT -> when (status) {

app/src/main/java/to/bitkit/ui/screens/wallets/activity/utils/PreviewItems.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ val previewActivityItems = buildList {
8484
Activity.Onchain(
8585
OnchainActivity(
8686
id = "4",
87-
txType = PaymentType.RECEIVED,
87+
txType = PaymentType.SENT,
8888
txId = "04",
8989
value = 950_000_u,
9090
fee = 110_u,

0 commit comments

Comments
 (0)