This commit is contained in:
2026-06-01 20:45:37 +07:00
parent b1d9135394
commit 9629162d0c
3 changed files with 16 additions and 10 deletions

View File

@@ -90,7 +90,7 @@ fun ImportScreen() {
val profile = metadata?.asRecord()
val displayName = profile?.displayName ?: profile?.name ?: pubkey?.short() ?: "Unknown"
val picture = profile?.picture
LaunchedEffect(qrScanResult.content) {
qrScanResult.content?.let { result ->
runCatching {
@@ -205,6 +205,7 @@ fun ImportScreen() {
BasicTextField(
value = secret,
onValueChange = { secret = it },
enabled = !isLoggedIn,
modifier = Modifier.fillMaxWidth(),
maxLines = 4,
keyboardOptions = KeyboardOptions(
@@ -217,10 +218,10 @@ fun ImportScreen() {
),
visualTransformation = PasswordVisualTransformation('*'),
textStyle = MaterialTheme.typography.bodyMediumEmphasized.copy(
color = MaterialTheme.colorScheme.primaryFixed,
color = MaterialTheme.colorScheme.tertiaryFixedDim,
fontWeight = FontWeight.SemiBold,
),
cursorBrush = SolidColor(MaterialTheme.colorScheme.secondary),
cursorBrush = SolidColor(MaterialTheme.colorScheme.tertiaryContainer),
decorationBox = { innerTextField ->
Box(contentAlignment = Alignment.CenterStart) {
if (secret.isEmpty()) {
@@ -263,7 +264,7 @@ fun ImportScreen() {
LoadingIndicator()
} else {
Text(
text = if (pubkey == null) "Verify" else "Continue",
text = if (pubkey == null) "Verify" else "Click again to Continue",
style = MaterialTheme.typography.titleMediumEmphasized,
)
}

View File

@@ -183,6 +183,7 @@ fun NewIdentityScreen() {
BasicTextField(
value = name,
onValueChange = { name = it },
enabled = !isLoggedIn,
modifier = Modifier.fillMaxWidth(),
singleLine = true,
keyboardOptions = KeyboardOptions(
@@ -194,10 +195,10 @@ fun NewIdentityScreen() {
}
),
textStyle = MaterialTheme.typography.headlineLargeEmphasized.copy(
color = MaterialTheme.colorScheme.primaryFixed,
color = MaterialTheme.colorScheme.tertiaryFixedDim,
fontWeight = FontWeight.SemiBold,
),
cursorBrush = SolidColor(MaterialTheme.colorScheme.secondary),
cursorBrush = SolidColor(MaterialTheme.colorScheme.tertiaryContainer),
decorationBox = { innerTextField ->
Box(contentAlignment = Alignment.CenterStart) {
if (name.isEmpty()) {
@@ -225,6 +226,7 @@ fun NewIdentityScreen() {
BasicTextField(
value = bio,
onValueChange = { bio = it },
enabled = !isLoggedIn,
modifier = Modifier.fillMaxWidth(),
maxLines = 3,
keyboardOptions = KeyboardOptions(

View File

@@ -375,13 +375,16 @@ class NostrViewModel(
}
suspend fun verifyIdentity(secret: String): PublicKey? {
return runCatching {
try {
val signer = createSigner(secret)
if (secret.startsWith("bunker://")) {
showError("Please approve the connection.")
}
signer.getPublicKeyAsync()
}.getOrNull()
return signer.getPublicKeyAsync()
} catch (e: Exception) {
showError("Error: ${e.message}")
return null
}
}
suspend fun importIdentity(secret: String) {
@@ -394,7 +397,7 @@ class NostrViewModel(
showError("Error: ${e.message}")
} finally {
_signerRequired.value = false
_isLoggedIn.value = true
_isLoggedIn.value = false
}
}