Fixes single click login screen

This commit is contained in:
Vitor Pamplona
2023-11-19 17:45:00 -05:00
parent b1cfa2219d
commit d4ed6661dd
2 changed files with 6 additions and 3 deletions

View File

@ -83,6 +83,7 @@ import com.vitorpamplona.quartz.signers.ExternalSignerLauncher
import com.vitorpamplona.quartz.signers.SignerType import com.vitorpamplona.quartz.signers.SignerType
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.UUID
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
@Composable @Composable
@ -108,6 +109,7 @@ fun LoginPage(
if (loginWithExternalSigner) { if (loginWithExternalSigner) {
val externalSignerLauncher = remember { ExternalSignerLauncher("") } val externalSignerLauncher = remember { ExternalSignerLauncher("") }
val id = remember { UUID.randomUUID().toString() }
val launcher = rememberLauncherForActivityResult( val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.StartActivityForResult(), contract = ActivityResultContracts.StartActivityForResult(),
@ -159,8 +161,9 @@ fun LoginPage(
"", "",
SignerType.GET_PUBLIC_KEY, SignerType.GET_PUBLIC_KEY,
"", "",
"" id
) { pubkey -> ) { pubkey ->
println("AAAA- COME BACK")
key.value = TextFieldValue(pubkey) key.value = TextFieldValue(pubkey)
if (!acceptedTerms.value) { if (!acceptedTerms.value) {
termsAcceptanceIsRequired = termsAcceptanceIsRequired =

View File

@ -152,7 +152,7 @@ class ExternalSignerLauncher(
} }
fun decrypt(encryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_DECRYPT, onReady: (String)-> Unit) { fun decrypt(encryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_DECRYPT, onReady: (String)-> Unit) {
val id = (encryptedContent + pubKey).hashCode().toString() val id = (encryptedContent + pubKey + onReady.toString()).hashCode().toString()
val result = getDataFromResolver(signerType, arrayOf(encryptedContent, pubKey)) val result = getDataFromResolver(signerType, arrayOf(encryptedContent, pubKey))
if (result == null) { if (result == null) {
openSignerApp( openSignerApp(
@ -168,7 +168,7 @@ class ExternalSignerLauncher(
} }
fun encrypt(decryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_ENCRYPT, onReady: (String)-> Unit) { fun encrypt(decryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_ENCRYPT, onReady: (String)-> Unit) {
val id = (decryptedContent + pubKey).hashCode().toString() val id = (decryptedContent + pubKey + onReady.toString()).hashCode().toString()
val result = getDataFromResolver(signerType, arrayOf(decryptedContent, pubKey)) val result = getDataFromResolver(signerType, arrayOf(decryptedContent, pubKey))
if (result == null) { if (result == null) {
openSignerApp( openSignerApp(