mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-07-12 22:23:24 +02:00
Fixes single click login screen
This commit is contained in:
@ -83,6 +83,7 @@ import com.vitorpamplona.quartz.signers.ExternalSignerLauncher
|
||||
import com.vitorpamplona.quartz.signers.SignerType
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.UUID
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
@ -108,6 +109,7 @@ fun LoginPage(
|
||||
|
||||
if (loginWithExternalSigner) {
|
||||
val externalSignerLauncher = remember { ExternalSignerLauncher("") }
|
||||
val id = remember { UUID.randomUUID().toString() }
|
||||
|
||||
val launcher = rememberLauncherForActivityResult(
|
||||
contract = ActivityResultContracts.StartActivityForResult(),
|
||||
@ -159,8 +161,9 @@ fun LoginPage(
|
||||
"",
|
||||
SignerType.GET_PUBLIC_KEY,
|
||||
"",
|
||||
""
|
||||
id
|
||||
) { pubkey ->
|
||||
println("AAAA- COME BACK")
|
||||
key.value = TextFieldValue(pubkey)
|
||||
if (!acceptedTerms.value) {
|
||||
termsAcceptanceIsRequired =
|
||||
|
@ -152,7 +152,7 @@ class ExternalSignerLauncher(
|
||||
}
|
||||
|
||||
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))
|
||||
if (result == null) {
|
||||
openSignerApp(
|
||||
@ -168,7 +168,7 @@ class ExternalSignerLauncher(
|
||||
}
|
||||
|
||||
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))
|
||||
if (result == null) {
|
||||
openSignerApp(
|
||||
|
Reference in New Issue
Block a user