Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-20 15:15:57 +04:00
parent 20eba62956
commit e92074bbb0
21 changed files with 36 additions and 75 deletions

View file

@ -73,9 +73,8 @@ private fun TokenReceiveBottomSheetContent(content: TokenReceiveBottomSheetConfi
)
Buttons(
address = selectedAddress.value,
snackbarHostState = snackbarHostState,
onShareClick = content.onShareClick,
onShareClick = { content.onShareClick(selectedAddress.value) },
onCopyClick = { content.onCopyClick(selectedAddress.value) },
)
}
@ -227,7 +226,6 @@ private fun getName(content: TokenReceiveBottomSheetConfig, index: Int): String
@Composable
private fun Buttons(
address: String,
snackbarHostState: SnackbarHostState,
onShareClick: () -> Unit,
onCopyClick: () -> Unit,
@ -264,10 +262,9 @@ private fun Buttons(
text = stringResourceSafe(id = R.string.common_share),
iconResId = R.drawable.ic_share_24,
onClick = {
onShareClick()
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
context.shareText(address)
onShareClick()
},
)
}

View file

@ -10,5 +10,5 @@ data class TokenReceiveBottomSheetConfig(
val addresses: ImmutableList<AddressModel>,
val showMemoDisclaimer: Boolean,
val onCopyClick: (String) -> Unit,
val onShareClick: () -> Unit,
val onShareClick: (String) -> Unit,
) : TangemBottomSheetConfigContent

View file

@ -1,15 +0,0 @@
package com.tangem.core.ui.extensions
import android.content.Context
import android.content.Intent
import androidx.core.content.ContextCompat
fun Context.shareText(text: String) {
val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, text)
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, null)
ContextCompat.startActivity(this, shareIntent, null)
}