@@ -28,10 +28,13 @@ import androidx.compose.ui.tooling.preview.Preview
2828import androidx.compose.ui.unit.dp
2929import androidx.lifecycle.compose.collectAsStateWithLifecycle
3030import to.bitkit.R
31+ import to.bitkit.ext.ellipsisMiddle
3132import to.bitkit.ext.idValue
3233import to.bitkit.ext.toActivityItemDate
3334import to.bitkit.ext.toActivityItemTime
35+ import to.bitkit.models.Toast
3436import to.bitkit.ui.Routes
37+ import to.bitkit.ui.appViewModel
3538import to.bitkit.ui.components.BalanceHeaderView
3639import to.bitkit.ui.components.BodySSB
3740import to.bitkit.ui.components.ButtonSize
@@ -43,8 +46,10 @@ import to.bitkit.ui.scaffold.AppTopBar
4346import to.bitkit.ui.scaffold.CloseNavIcon
4447import to.bitkit.ui.scaffold.ScreenColumn
4548import to.bitkit.ui.screens.wallets.activity.components.ActivityIcon
49+ import to.bitkit.ui.shared.util.clickableAlpha
4650import to.bitkit.ui.theme.AppThemeSurface
4751import to.bitkit.ui.theme.Colors
52+ import to.bitkit.ui.utils.copyToClipboard
4853import to.bitkit.ui.utils.getScreenTitleRes
4954import to.bitkit.viewmodels.ActivityListViewModel
5055import uniffi.bitkitcore.Activity
@@ -65,6 +70,9 @@ fun ActivityItemScreen(
6570 val item = activities?.find { it.idValue == activityItem.id }
6671 ? : return
6772
73+ val app = appViewModel ? : return
74+ val copyToastTitle = stringResource(R .string.common__copied)
75+
6876 ScreenColumn {
6977 AppTopBar (
7078 titleText = stringResource(item.getScreenTitleRes()),
@@ -74,6 +82,13 @@ fun ActivityItemScreen(
7482 ActivityItemView (
7583 item = item,
7684 onExploreClick = onExploreClick,
85+ onCopy = { text ->
86+ app.toast(
87+ type = Toast .ToastType .SUCCESS ,
88+ title = copyToastTitle,
89+ description = text.ellipsisMiddle(40 )
90+ )
91+ }
7792 )
7893 }
7994}
@@ -83,6 +98,7 @@ fun ActivityItemScreen(
8398private fun ActivityItemView (
8499 item : Activity ,
85100 onExploreClick : (String ) -> Unit ,
101+ onCopy : (String ) -> Unit ,
86102) {
87103 val isLightning = item is Activity .Lightning
88104 val accentColor = if (isLightning) Colors .Purple else Colors .Brand
@@ -267,7 +283,14 @@ private fun ActivityItemView(
267283
268284 // Note section for Lightning payments with message
269285 if (item is Activity .Lightning && item.v1.message.isNotEmpty()) {
270- Column (modifier = Modifier .fillMaxWidth()) {
286+ val message = item.v1.message
287+ Column (
288+ modifier = Modifier
289+ .fillMaxWidth()
290+ .clickableAlpha(onClick = copyToClipboard(message) {
291+ onCopy(message)
292+ })
293+ ) {
271294 Caption13Up (
272295 text = stringResource(R .string.wallet__activity_invoice_note),
273296 color = Colors .White64 ,
@@ -283,7 +306,7 @@ private fun ActivityItemView(
283306 .background(Colors .White10 )
284307 ) {
285308 Title (
286- text = item.v1. message,
309+ text = message,
287310 color = Colors .White ,
288311 modifier = Modifier .padding(24 .dp),
289312 )
@@ -511,6 +534,7 @@ private fun PreviewLightningSent() {
511534 )
512535 ),
513536 onExploreClick = {},
537+ onCopy = {},
514538 )
515539 }
516540 }
@@ -544,6 +568,7 @@ private fun PreviewOnchain() {
544568 )
545569 ),
546570 onExploreClick = {},
571+ onCopy = {},
547572 )
548573 }
549574 }
0 commit comments