@@ -17,8 +17,10 @@ import androidx.compose.foundation.layout.width
1717import androidx.compose.foundation.pager.rememberPagerState
1818import androidx.compose.material3.Card
1919import androidx.compose.material3.CardDefaults
20+ import androidx.compose.material3.ExperimentalMaterial3Api
2021import androidx.compose.material3.Icon
2122import androidx.compose.material3.Switch
23+ import androidx.compose.material3.rememberTooltipState
2224import androidx.compose.runtime.Composable
2325import androidx.compose.runtime.DisposableEffect
2426import androidx.compose.runtime.LaunchedEffect
@@ -27,6 +29,7 @@ import androidx.compose.runtime.getValue
2729import androidx.compose.runtime.mutableIntStateOf
2830import androidx.compose.runtime.mutableStateOf
2931import androidx.compose.runtime.remember
32+ import androidx.compose.runtime.rememberCoroutineScope
3033import androidx.compose.ui.Alignment
3134import androidx.compose.ui.Modifier
3235import androidx.compose.ui.draw.rotate
@@ -59,6 +62,7 @@ import to.bitkit.ui.components.Caption13Up
5962import to.bitkit.ui.components.Headline
6063import to.bitkit.ui.components.PrimaryButton
6164import to.bitkit.ui.components.QrCodeImage
65+ import to.bitkit.ui.components.Tooltip
6266import to.bitkit.ui.scaffold.SheetTopBar
6367import to.bitkit.ui.screens.wallets.send.AddTagScreen
6468import to.bitkit.ui.shared.PagerWithIndicator
@@ -100,7 +104,7 @@ fun ReceiveQrSheet(
100104 val cjitInvoice = remember { mutableStateOf<String ?>(null ) }
101105 val showCreateCjit = remember { mutableStateOf(false ) }
102106 val cjitEntryDetails = remember { mutableStateOf<CjitEntryDetails ?>(null ) }
103- val lightningState : LightningState by wallet.lightningState.collectAsStateWithLifecycle()
107+ val lightningState: LightningState by wallet.lightningState.collectAsStateWithLifecycle()
104108
105109 LaunchedEffect (Unit ) {
106110 try {
@@ -130,7 +134,7 @@ fun ReceiveQrSheet(
130134
131135 LaunchedEffect (Unit ) {
132136 wallet.walletEffect.collect { effect ->
133- when (effect) {
137+ when (effect) {
134138 WalletViewModelEffects .NavigateGeoBlockScreen -> {
135139 navController.navigate(ReceiveRoutes .LOCATION_BLOCK )
136140 }
@@ -150,6 +154,7 @@ fun ReceiveQrSheet(
150154 showCreateCjit.value = false
151155 cjitInvoice.value = null
152156 }
157+
153158 active && cjitInvoice.value == null -> {
154159 showCreateCjit.value = true
155160 navController.navigate(ReceiveRoutes .AMOUNT )
@@ -419,6 +424,7 @@ private fun ReceiveLightningFunds(
419424 }
420425}
421426
427+ @OptIn(ExperimentalMaterial3Api ::class )
422428@Composable
423429private fun ReceiveQrSlide (
424430 uri : String ,
@@ -429,14 +435,18 @@ private fun ReceiveQrSlide(
429435 val context = LocalContext .current
430436 val clipboard = LocalClipboardManager .current
431437
438+ val qrButtonTooltipState = rememberTooltipState()
439+ val coroutineScope = rememberCoroutineScope()
440+
432441 Column (
433442 horizontalAlignment = Alignment .CenterHorizontally ,
434443 modifier = modifier
435444 ) {
436445 QrCodeImage (
437446 content = uri,
438447 logoPainter = qrLogoPainter,
439- modifier = Modifier .weight(1f , fill = false )
448+ tipMessage = stringResource(R .string.wallet__receive_copied),
449+ modifier = Modifier .weight(1f , fill = false ),
440450 )
441451
442452 Spacer (modifier = Modifier .height(16 .dp))
@@ -459,21 +469,29 @@ private fun ReceiveQrSlide(
459469 )
460470 }
461471 )
462- PrimaryButton (
463- text = stringResource(R .string.common__copy),
464- size = ButtonSize .Small ,
465- onClick = { clipboard.setText(AnnotatedString (uri)) },
466- fullWidth = false ,
467- color = Colors .White10 ,
468- icon = {
469- Icon (
470- painter = painterResource(R .drawable.ic_copy),
471- contentDescription = null ,
472- tint = Colors .Brand ,
473- modifier = Modifier .size(18 .dp)
474- )
475- }
476- )
472+ Tooltip (
473+ text = stringResource(R .string.wallet__receive_copied),
474+ tooltipState = qrButtonTooltipState
475+ ) {
476+ PrimaryButton (
477+ text = stringResource(R .string.common__copy),
478+ size = ButtonSize .Small ,
479+ onClick = {
480+ clipboard.setText(AnnotatedString (uri))
481+ coroutineScope.launch { qrButtonTooltipState.show() }
482+ },
483+ fullWidth = false ,
484+ color = Colors .White10 ,
485+ icon = {
486+ Icon (
487+ painter = painterResource(R .drawable.ic_copy),
488+ contentDescription = null ,
489+ tint = Colors .Brand ,
490+ modifier = Modifier .size(18 .dp)
491+ )
492+ }
493+ )
494+ }
477495 PrimaryButton (
478496 text = stringResource(R .string.common__share),
479497 size = ButtonSize .Small ,
@@ -532,6 +550,7 @@ private fun CopyValuesSlide(
532550
533551enum class CopyAddressType { ONCHAIN , LIGHTNING }
534552
553+ @OptIn(ExperimentalMaterial3Api ::class )
535554@Composable
536555private fun CopyAddressCard (
537556 title : String ,
@@ -540,6 +559,10 @@ private fun CopyAddressCard(
540559) {
541560 val clipboard = LocalClipboardManager .current
542561 val context = LocalContext .current
562+
563+ val tooltipState = rememberTooltipState()
564+ val coroutineScope = rememberCoroutineScope()
565+
543566 Column (
544567 modifier = Modifier
545568 .fillMaxWidth()
@@ -559,21 +582,30 @@ private fun CopyAddressCard(
559582 Row (
560583 horizontalArrangement = Arrangement .spacedBy(16 .dp)
561584 ) {
562- PrimaryButton (
563- text = stringResource(R .string.common__copy),
564- size = ButtonSize .Small ,
565- onClick = { clipboard.setText(AnnotatedString (address)) },
566- fullWidth = false ,
567- color = Colors .White10 ,
568- icon = {
569- Icon (
570- painter = painterResource(R .drawable.ic_copy),
571- contentDescription = null ,
572- tint = if (type == CopyAddressType .ONCHAIN ) Colors .Brand else Colors .Purple ,
573- modifier = Modifier .size(18 .dp)
574- )
575- }
576- )
585+
586+ Tooltip (
587+ text = stringResource(R .string.wallet__receive_copied),
588+ tooltipState = tooltipState
589+ ) {
590+ PrimaryButton (
591+ text = stringResource(R .string.common__copy),
592+ size = ButtonSize .Small ,
593+ onClick = {
594+ clipboard.setText(AnnotatedString (address))
595+ coroutineScope.launch { tooltipState.show() }
596+ },
597+ fullWidth = false ,
598+ color = Colors .White10 ,
599+ icon = {
600+ Icon (
601+ painter = painterResource(R .drawable.ic_copy),
602+ contentDescription = null ,
603+ tint = if (type == CopyAddressType .ONCHAIN ) Colors .Brand else Colors .Purple ,
604+ modifier = Modifier .size(18 .dp)
605+ )
606+ }
607+ )
608+ }
577609 PrimaryButton (
578610 text = stringResource(R .string.common__share),
579611 size = ButtonSize .Small ,
0 commit comments