瀏覽代碼

fix: improve deep-link compatibility (#198)

Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/198
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 7 月之前
父節點
當前提交
4ac0820bbf

+ 3 - 2
app-common/src/main/AndroidManifest.xml

@@ -45,8 +45,9 @@
                 <!-- Accepts URIs that begin with "lpa:" -->
                 <!-- for example: "LPA:1$..." -->
                 <!-- refs: https://www.iana.org/assignments/uri-schemes/prov/lpa -->
-                <data android:scheme="lpa"/>
-                <data android:sspPrefix="1$"/>
+                <data android:scheme="lpa" />
+                <data android:scheme="LPA" tools:ignore="AppLinkUrlError" />
+                <data android:sspPrefix="1$" />
             </intent-filter>
         </activity>
 

+ 2 - 2
app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardActivity.kt

@@ -123,8 +123,8 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
         // If we get an LPA string from deep-link intents, extract from there.
         // Note that `onRestoreInstanceState` could override this with user input,
         // but that _is_ the desired behavior.
-        val uri = intent.data
-        if (uri?.scheme == "lpa") {
+        val uri = intent.data ?: return
+        if (uri.scheme.contentEquals("lpa", ignoreCase = true)) {
             val parsed = LPAString.parse(uri.schemeSpecificPart)
             state.smdp = parsed.address
             state.matchingId = parsed.matchingId