remove the need for application package name in the androidManifest for the external signer

pull/750/head
greenart7c3 2024-01-22 11:29:10 -03:00
rodzic f1388b46d5
commit e0ec8a741c
3 zmienionych plików z 16 dodań i 5 usunięć

Wyświetl plik

@ -3,8 +3,11 @@
xmlns:tools="http://schemas.android.com/tools">
<queries>
<package android:name="org.torproject.android"/>
<package android:name="com.greenart7c3.nostrsigner"/>
<package android:name="com.greenart7c3.nostrsigner.debug"/>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="nostrsigner" />
</intent>
</queries>
<!-- Doesn't require a camera -->

Wyświetl plik

@ -21,6 +21,8 @@
package com.vitorpamplona.amethyst.service
import android.content.Context
import android.content.Intent
import android.net.Uri
object PackageUtils {
private fun isPackageInstalled(
@ -36,7 +38,13 @@ object PackageUtils {
return isPackageInstalled(context, "org.torproject.android")
}
fun isAmberInstalled(context: Context): Boolean {
return isPackageInstalled(context, "com.greenart7c3.nostrsigner")
fun isExternalSignerInstalled(context: Context): Boolean {
val intent =
Intent().apply {
action = Intent.ACTION_VIEW
data = Uri.parse("nostrsigner:")
}
val infos = context.packageManager.queryIntentActivities(intent, 0)
return infos.size > 0
}
}

Wyświetl plik

@ -458,7 +458,7 @@ fun LoginPage(
}
}
if (PackageUtils.isAmberInstalled(context)) {
if (PackageUtils.isExternalSignerInstalled(context)) {
Box(modifier = Modifier.padding(40.dp, 20.dp, 40.dp, 0.dp)) {
Button(
enabled = acceptedTerms.value,