diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3d592c6d..52528ca8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,6 +21,7 @@
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
+ android:documentLaunchMode="intoExisting"
android:theme="@style/Theme.appverifier">
@@ -31,6 +32,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/kotlin/dev/soupslurpr/appverifier/AppVerifier.kt b/app/src/main/kotlin/dev/soupslurpr/appverifier/AppVerifier.kt
index 48b16cfd..e816b11a 100644
--- a/app/src/main/kotlin/dev/soupslurpr/appverifier/AppVerifier.kt
+++ b/app/src/main/kotlin/dev/soupslurpr/appverifier/AppVerifier.kt
@@ -52,6 +52,7 @@ fun AppVerifierApp(
verifyAppViewModel: VerifyAppViewModel,
preferencesViewModel: PreferencesViewModel,
isActionSend: Boolean,
+ isActionView: Boolean,
) {
val verifyAppUiState = verifyAppViewModel.uiState.collectAsState()
@@ -92,7 +93,7 @@ fun AppVerifierApp(
) { innerPadding ->
NavHost(
navController = navController,
- startDestination = if (isActionSend) {
+ startDestination = if (isActionSend || isActionView) {
AppVerifierScreens.VerifyApp.name
} else {
AppVerifierScreens.Start.name
diff --git a/app/src/main/kotlin/dev/soupslurpr/appverifier/MainActivity.kt b/app/src/main/kotlin/dev/soupslurpr/appverifier/MainActivity.kt
index 24f07a3a..caa56034 100644
--- a/app/src/main/kotlin/dev/soupslurpr/appverifier/MainActivity.kt
+++ b/app/src/main/kotlin/dev/soupslurpr/appverifier/MainActivity.kt
@@ -2,6 +2,7 @@ package dev.soupslurpr.appverifier
import android.content.Context
import android.content.Intent
+import android.net.Uri
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
@@ -35,17 +36,37 @@ class MainActivity : ComponentActivity() {
val isActionSend =
(intent.action == Intent.ACTION_SEND)
+ val isActionView =
+ (intent.action == Intent.ACTION_VIEW)
+
if (isActionSend) {
- val text = intent.getStringExtra(Intent.EXTRA_TEXT)
+ val extraText = intent.getStringExtra(Intent.EXTRA_TEXT)
+ val extraStream: Uri? = intent.getParcelableExtra(Intent.EXTRA_STREAM)
- if (text != null) {
- val verificationInfoText = verifyAppViewModel.getVerificationInfoText(text)
+ if (extraText != null) {
+ val verificationInfoText = verifyAppViewModel.getVerificationInfoText(extraText)
verifyAppViewModel.findAndSetAppVerificationInfoFromPackageName(
verificationInfoText.lines()[0],
packageManager
)
verifyAppViewModel.verifyFromText(verificationInfoText)
+ } else if (extraStream != null) {
+ verifyAppViewModel.setApkVerificationInfoAndInternalDatabaseStatusFromUri(
+ contentResolver,
+ extraStream,
+ packageManager
+ )
+ }
+ } else if (isActionView) {
+ if (intent.data != null) {
+ intent.data?.let {
+ verifyAppViewModel.setApkVerificationInfoAndInternalDatabaseStatusFromUri(
+ contentResolver,
+ it,
+ packageManager
+ )
+ }
}
}
@@ -62,6 +83,7 @@ class MainActivity : ComponentActivity() {
verifyAppViewModel = verifyAppViewModel,
preferencesViewModel = preferencesViewModel,
isActionSend = isActionSend,
+ isActionView = isActionView,
)
}
}