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("type", signerType)
intent.putExtra("pubKey", pubKey) intent.putExtra("pubKey", pubKey)
intent.putExtra("id", id) intent.putExtra("id", id)
intent.`package` = "com.greenart7c3.nostrsigner.debug" intent.`package` = "com.greenart7c3.nostrsigner"
intentResult.launch(intent) intentResult.launch(intent)
} }
fun openAmber(event: EventInterface) { fun openAmber(event: EventInterface) {
checkNotInMainThread() checkNotInMainThread()
ServiceManager.shouldPauseService = false ServiceManager.shouldPauseService = false
content = ""
isActivityRunning = true isActivityRunning = true
openAmber( openAmber(
event.toJson(), event.toJson(),
@@ -52,14 +51,12 @@ object AmberUtils {
event.id() event.id()
) )
while (isActivityRunning) { while (isActivityRunning) {
// do nothing Thread.sleep(100)
} }
} }
fun loginWithAmber() { fun loginWithAmber() {
checkNotInMainThread() checkNotInMainThread()
content = ""
isActivityRunning = true
openAmber( openAmber(
"", "",
SignerType.GET_PUBLIC_KEY, 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) { 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) { fun encrypt(decryptedContent: String, pubKey: HexKey, signerType: SignerType = SignerType.NIP04_ENCRYPT) {
if (content.isBlank()) { isActivityRunning = true
isActivityRunning = true openAmber(
openAmber( decryptedContent,
decryptedContent, signerType,
signerType, IntentUtils.activityResultLauncher,
IntentUtils.activityResultLauncher, pubKey,
pubKey, "encrypt"
"" )
) while (isActivityRunning) {
while (isActivityRunning) { Thread.sleep(100)
// do nothing
}
} }
} }
@@ -114,7 +106,7 @@ object AmberUtils {
event.id event.id
) )
while (isActivityRunning) { while (isActivityRunning) {
// do nothing Thread.sleep(100)
} }
} }
} }

View File

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

View File

@@ -12,6 +12,6 @@ object PackageUtils {
} }
fun isAmberInstalled(context: Context): Boolean { 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( val events = NIP24Factory().createMsgNIP24(
message, message,
listOf(receiver.pubKey.toHexKey()), listOf(receiver.pubKey.toHexKey()),
sender.privKey!! sender
) )
Assert.assertEquals(expectedLength, events.map { it.toJson() }.joinToString("").length) Assert.assertEquals(expectedLength, events.map { it.toJson() }.joinToString("").length)
@@ -63,7 +63,7 @@ class GiftWrapBenchmark {
val giftWrap = NIP24Factory().createMsgNIP24( val giftWrap = NIP24Factory().createMsgNIP24(
message, message,
listOf(receiver.pubKey.toHexKey()), listOf(receiver.pubKey.toHexKey()),
sender.privKey!! sender
).first() ).first()
val keyToUse = if (giftWrap.recipientPubKey() == sender.pubKey.toHexKey()) sender.privKey!! else receiver.privKey!! val keyToUse = if (giftWrap.recipientPubKey() == sender.pubKey.toHexKey()) sender.privKey!! else receiver.privKey!!