From 480321c1d52b65d03ce33bc29bbf8fe37394eb84 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 2 Oct 2023 16:25:01 -0300 Subject: [PATCH] do not show login screen when account doesn't exists --- .../com/greenart7c3/nostrsigner/ui/AccountStateViewModel.kt | 5 ++++- .../main/java/com/greenart7c3/nostrsigner/ui/MainScreen.kt | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/AccountStateViewModel.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/AccountStateViewModel.kt index f0b21f22..f8c4edd0 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/AccountStateViewModel.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/AccountStateViewModel.kt @@ -25,7 +25,10 @@ class AccountStateViewModel(npub: String?) : ViewModel() { } private fun tryLoginExistingAccount(route: String?, npub: String?) { - val currentUser = npub ?: LocalPreferences.currentAccount() + var currentUser = npub ?: LocalPreferences.currentAccount() + if (currentUser != null && !LocalPreferences.containsAccount(currentUser)) { + currentUser = LocalPreferences.currentAccount() + } LocalPreferences.loadFromEncryptedStorage(currentUser)?.let { startUI(it, route) } diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/MainScreen.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/MainScreen.kt index e1894903..d84984e5 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/MainScreen.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/MainScreen.kt @@ -89,10 +89,8 @@ fun sendResult( // Convert the compressed data to Base64 val compressedData = byteArrayOutputStream.toByteArray() val encodedString = Base64.getEncoder().encodeToString(compressedData) - val encodedString2 = Uri.encode(encodedString) - val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(callBackUrl + encodedString2) + intent.data = Uri.parse(callBackUrl + Uri.encode("Signer1$encodedString")) context.startActivity(intent) } else { clipboardManager.setText(AnnotatedString(value))