File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
app/src/main/java/to/bitkit
ui/screens/wallets/activity/components Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ fun Activity.rawId(): String = when (this) {
99 is Activity .Onchain -> v1.id
1010}
1111
12+ fun Activity.txType (): PaymentType = when (this ) {
13+ is Activity .Lightning -> v1.txType
14+ is Activity .Onchain -> v1.txType
15+ }
16+
1217/* *
1318 * Calculates the total value of an activity based on its type.
1419 *
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import to.bitkit.R
2727import to.bitkit.ext.isBoosted
2828import to.bitkit.ext.isFinished
2929import to.bitkit.ext.isTransfer
30+ import to.bitkit.ext.txType
3031import to.bitkit.ui.theme.AppThemeSurface
3132import to.bitkit.ui.theme.Colors
3233
@@ -41,10 +42,7 @@ fun ActivityIcon(
4142 is Activity .Lightning -> activity.v1.status
4243 is Activity .Onchain -> null
4344 }
44- val txType: PaymentType = when (activity) {
45- is Activity .Lightning -> activity.v1.txType
46- is Activity .Onchain -> activity.v1.txType
47- }
45+ val txType: PaymentType = activity.txType()
4846 val arrowIcon = painterResource(if (txType == PaymentType .SENT ) R .drawable.ic_sent else R .drawable.ic_received)
4947
5048 when {
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import to.bitkit.ext.isSent
3131import to.bitkit.ext.isTransfer
3232import to.bitkit.ext.rawId
3333import to.bitkit.ext.totalValue
34+ import to.bitkit.ext.txType
3435import to.bitkit.models.PrimaryDisplay
3536import to.bitkit.models.formatToModernDisplay
3637import to.bitkit.ui.LocalCurrencies
@@ -64,10 +65,7 @@ fun ActivityRow(
6465 is Activity .Lightning -> item.v1.timestamp
6566 is Activity .Onchain -> item.v1.timestamp
6667 }
67- val txType: PaymentType = when (item) {
68- is Activity .Lightning -> item.v1.txType
69- is Activity .Onchain -> item.v1.txType
70- }
68+ val txType: PaymentType = item.txType()
7169 val isSent = item.isSent()
7270 val amountPrefix = if (isSent) " -" else " +"
7371 val confirmed: Boolean? = when (item) {
You can’t perform that action at this time.
0 commit comments