feat: Add clipboard functionality to SeedPhraseScreen for copying seed phrase
This commit is contained in:
@@ -19,6 +19,8 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.ui.platform.LocalClipboardManager
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
import com.rosetta.messenger.crypto.CryptoManager
|
import com.rosetta.messenger.crypto.CryptoManager
|
||||||
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@@ -40,6 +42,7 @@ fun SeedPhraseScreen(
|
|||||||
var hasCopied by remember { mutableStateOf(false) }
|
var hasCopied by remember { mutableStateOf(false) }
|
||||||
var visible by remember { mutableStateOf(false) }
|
var visible by remember { mutableStateOf(false) }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
delay(100)
|
delay(100)
|
||||||
@@ -181,6 +184,7 @@ fun SeedPhraseScreen(
|
|||||||
) {
|
) {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
clipboardManager.setText(AnnotatedString(seedPhrase.joinToString(" ")))
|
||||||
hasCopied = true
|
hasCopied = true
|
||||||
scope.launch {
|
scope.launch {
|
||||||
delay(2000)
|
delay(2000)
|
||||||
|
|||||||
Reference in New Issue
Block a user