mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-07-20 19:05:15 +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 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 =
|
||||||
|
@ -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(
|
||||||
|
Reference in New Issue
Block a user