fix release build not working

This commit is contained in:
greenart7c3 2023-09-11 18:12:55 -03:00
parent ff4d704bde
commit c3ddc4f7ad
4 changed files with 17 additions and 25 deletions

View File

@ -35,14 +35,13 @@ object AmberUtils {
intent.putExtra("type", signerType)
intent.putExtra("pubKey", pubKey)
intent.putExtra("id", id)
intent.`package` = "com.greenart7c3.nostrsigner.debug"
intent.`package` = "com.greenart7c3.nostrsigner"
intentResult.launch(intent)
}
fun openAmber(event: EventInterface) {
checkNotInMainThread()
ServiceManager.shouldPauseService = false
content = ""
isActivityRunning = true
openAmber(
event.toJson(),
@ -52,14 +51,12 @@ object AmberUtils {
event.id()
)
while (isActivityRunning) {
// do nothing
Thread.sleep(100)
}
}
fun loginWithAmber() {
checkNotInMainThread()
content = ""
isActivityRunning = true
openAmber(
"",
SignerType.GET_PUBLIC_KEY,
@ -67,9 +64,6 @@ object AmberUtils {
"",
""
)
while (isActivityRunning) {
// do nothing
}
}
fun decrypt(encryptedContent: String, pubKey: HexKey, id: String, signerType: SignerType = SignerType.NIP04_DECRYPT) {
@ -89,18 +83,16 @@ object AmberUtils {
}
fun encrypt(decryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_ENCRYPT) {
if (content.isBlank()) {
isActivityRunning = true
openAmber(
decryptedContent,
signerType,
IntentUtils.activityResultLauncher,
pubKey,
""
)
while (isActivityRunning) {
// do nothing
}
isActivityRunning = true
openAmber(
decryptedContent,
signerType,
IntentUtils.activityResultLauncher,
pubKey,
"encrypt"
)
while (isActivityRunning) {
Thread.sleep(100)
}
}
@ -114,7 +106,7 @@ object AmberUtils {
event.id
)
while (isActivityRunning) {
// do nothing
Thread.sleep(100)
}
}
}

View File

@ -34,11 +34,11 @@ object IntentUtils {
}
val event = it.data?.getStringExtra("signature") ?: ""
AmberUtils.content = event
val id = it.data?.getStringExtra("id") ?: ""
if (id.isNotBlank()) {
AmberUtils.cachedDecryptedContent[id] = event
}
AmberUtils.content = event
AmberUtils.isActivityRunning = false
ServiceManager.shouldPauseService = true
}

View File

@ -12,6 +12,6 @@ object PackageUtils {
}
fun isAmberInstalled(context: Context): Boolean {
return isPackageInstalled(context, "com.greenart7c3.nostrsigner.debug")
return isPackageInstalled(context, "com.greenart7c3.nostrsigner")
}
}

View File

@ -34,7 +34,7 @@ class GiftWrapBenchmark {
val events = NIP24Factory().createMsgNIP24(
message,
listOf(receiver.pubKey.toHexKey()),
sender.privKey!!
sender
)
Assert.assertEquals(expectedLength, events.map { it.toJson() }.joinToString("").length)
@ -63,7 +63,7 @@ class GiftWrapBenchmark {
val giftWrap = NIP24Factory().createMsgNIP24(
message,
listOf(receiver.pubKey.toHexKey()),
sender.privKey!!
sender
).first()
val keyToUse = if (giftWrap.recipientPubKey() == sender.pubKey.toHexKey()) sender.privKey!! else receiver.privKey!!