Skip to content

Commit e8fedd3

Browse files
committed
feat: adapt activity icon to don't depend the activity
1 parent b0de637 commit e8fedd3

File tree

1 file changed

+30
-4
lines changed
  • app/src/main/java/to/bitkit/ui/screens/wallets/activity/components

1 file changed

+30
-4
lines changed

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

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,36 @@ fun ActivityIcon(
4545
is Activity.Lightning -> activity.v1.txType
4646
is Activity.Onchain -> activity.v1.txType
4747
}
48-
val arrowIcon = painterResource(if (txType == PaymentType.SENT) R.drawable.ic_sent else R.drawable.ic_received)
48+
49+
ActivityIcon(
50+
isLightning = isLightning,
51+
status = status,
52+
isSent = txType == PaymentType.SENT,
53+
isBoosted = activity.isBoosted(),
54+
isFished = activity.isFinished(),
55+
isTransfer = activity.isTransfer(),
56+
size = size,
57+
modifier = modifier
58+
)
59+
}
60+
61+
62+
@Composable
63+
fun ActivityIcon(
64+
isLightning: Boolean,
65+
status: PaymentState?,
66+
isSent: Boolean,
67+
isBoosted: Boolean,
68+
isFished: Boolean,
69+
isTransfer: Boolean,
70+
size: Dp = 32.dp,
71+
modifier: Modifier = Modifier,
72+
) {
73+
74+
val arrowIcon = painterResource(if (isSent) R.drawable.ic_sent else R.drawable.ic_received)
4975

5076
when {
51-
activity.isBoosted() && !activity.isFinished() -> {
77+
isBoosted && !isFished -> {
5278
CircularIcon(
5379
icon = painterResource(R.drawable.ic_timer_alt),
5480
iconColor = Colors.Yellow,
@@ -94,11 +120,11 @@ fun ActivityIcon(
94120

95121
else -> {
96122
CircularIcon(
97-
icon = if (activity.isTransfer()) painterResource(R.drawable.ic_transfer) else arrowIcon,
123+
icon = if (isTransfer) painterResource(R.drawable.ic_transfer) else arrowIcon,
98124
iconColor = Colors.Brand,
99125
backgroundColor = Colors.Brand16,
100126
size = size,
101-
modifier = modifier.testTag(if (activity.isTransfer()) "TransferIcon" else "ActivityIcon"),
127+
modifier = modifier.testTag(if (isTransfer) "TransferIcon" else "ActivityIcon"),
102128
)
103129
}
104130
}

0 commit comments

Comments
 (0)