remove the need for application package name in the androidManifest for the external signer
This commit is contained in:
@@ -3,8 +3,11 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<queries>
|
<queries>
|
||||||
<package android:name="org.torproject.android"/>
|
<package android:name="org.torproject.android"/>
|
||||||
<package android:name="com.greenart7c3.nostrsigner"/>
|
<intent>
|
||||||
<package android:name="com.greenart7c3.nostrsigner.debug"/>
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="nostrsigner" />
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<!-- Doesn't require a camera -->
|
<!-- Doesn't require a camera -->
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
package com.vitorpamplona.amethyst.service
|
package com.vitorpamplona.amethyst.service
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
|
||||||
object PackageUtils {
|
object PackageUtils {
|
||||||
private fun isPackageInstalled(
|
private fun isPackageInstalled(
|
||||||
@@ -36,7 +38,13 @@ object PackageUtils {
|
|||||||
return isPackageInstalled(context, "org.torproject.android")
|
return isPackageInstalled(context, "org.torproject.android")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isAmberInstalled(context: Context): Boolean {
|
fun isExternalSignerInstalled(context: Context): Boolean {
|
||||||
return isPackageInstalled(context, "com.greenart7c3.nostrsigner")
|
val intent =
|
||||||
|
Intent().apply {
|
||||||
|
action = Intent.ACTION_VIEW
|
||||||
|
data = Uri.parse("nostrsigner:")
|
||||||
|
}
|
||||||
|
val infos = context.packageManager.queryIntentActivities(intent, 0)
|
||||||
|
return infos.size > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)) {
|
Box(modifier = Modifier.padding(40.dp, 20.dp, 40.dp, 0.dp)) {
|
||||||
Button(
|
Button(
|
||||||
enabled = acceptedTerms.value,
|
enabled = acceptedTerms.value,
|
||||||
|
|||||||
Reference in New Issue
Block a user