added keyguard to qr code key export
This commit is contained in:
@@ -539,7 +539,7 @@ fun ListContent(
|
|||||||
MediaServersListView({ editMediaServers = false }, accountViewModel = accountViewModel, nav = nav)
|
MediaServersListView({ editMediaServers = false }, accountViewModel = accountViewModel, nav = nav)
|
||||||
}
|
}
|
||||||
if (backupDialogOpen) {
|
if (backupDialogOpen) {
|
||||||
AccountBackupDialog(accountViewModel, nav, onClose = { backupDialogOpen = false })
|
AccountBackupDialog(accountViewModel, onClose = { backupDialogOpen = false })
|
||||||
}
|
}
|
||||||
if (conectOrbotDialogOpen) {
|
if (conectOrbotDialogOpen) {
|
||||||
ConnectTorDialog(
|
ConnectTorDialog(
|
||||||
|
|||||||
+19
-13
@@ -92,8 +92,6 @@ import com.halilibo.richtext.ui.material3.RichText
|
|||||||
import com.halilibo.richtext.ui.resolveDefaults
|
import com.halilibo.richtext.ui.resolveDefaults
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.Account
|
import com.vitorpamplona.amethyst.model.Account
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.EmptyNav
|
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.INav
|
|
||||||
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.authenticate
|
import com.vitorpamplona.amethyst.ui.note.authenticate
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.qrcode.BackButton
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.qrcode.BackButton
|
||||||
@@ -113,14 +111,13 @@ import kotlinx.coroutines.launch
|
|||||||
@Composable
|
@Composable
|
||||||
fun AccountBackupDialog(
|
fun AccountBackupDialog(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: INav,
|
|
||||||
onClose: () -> Unit,
|
onClose: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Dialog(
|
Dialog(
|
||||||
onDismissRequest = onClose,
|
onDismissRequest = onClose,
|
||||||
properties = DialogProperties(usePlatformDefaultWidth = false),
|
properties = DialogProperties(usePlatformDefaultWidth = false),
|
||||||
) {
|
) {
|
||||||
DialogContents(accountViewModel, nav, onClose)
|
DialogContents(accountViewModel, onClose)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +127,6 @@ fun DialogContentsPreview() {
|
|||||||
ThemeComparisonRow {
|
ThemeComparisonRow {
|
||||||
DialogContents(
|
DialogContents(
|
||||||
mockAccountViewModel(),
|
mockAccountViewModel(),
|
||||||
EmptyNav,
|
|
||||||
{},
|
{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -140,7 +136,6 @@ fun DialogContentsPreview() {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun DialogContents(
|
private fun DialogContents(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: INav,
|
|
||||||
onClose: () -> Unit,
|
onClose: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
@@ -198,7 +193,7 @@ private fun DialogContents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
QrCodeButton(nav, accountViewModel)
|
QrCodeButton(accountViewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,17 +301,28 @@ private fun DialogContents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun QrCodeButton(
|
private fun QrCodeButton(accountViewModel: AccountViewModel) {
|
||||||
nav: INav,
|
val context = LocalContext.current
|
||||||
accountViewModel: AccountViewModel,
|
|
||||||
) {
|
|
||||||
// store the dialog open or close state
|
// store the dialog open or close state
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val keyguardLauncher =
|
||||||
|
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
|
||||||
|
if (result.resultCode == Activity.RESULT_OK) {
|
||||||
|
dialogOpen = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
dialogOpen = true
|
authenticate(
|
||||||
nav.closeDrawer()
|
title = stringRes(context, R.string.copy_my_secret_key),
|
||||||
|
context = context,
|
||||||
|
keyguardLauncher = keyguardLauncher,
|
||||||
|
onApproved = { dialogOpen = true },
|
||||||
|
onError = { title, message -> accountViewModel.toast(title, message) },
|
||||||
|
)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
Reference in New Issue
Block a user