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

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

View File

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

View File

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