Modern Apps git

← Modern-Apps.git

appstore: support Accrescent listing links (#957)

Commit
957fd7d2aa25332b24c274171c362ce0970cc801
Author
Vayun Mathur <[email protected]>
When
2026-12-05 13:25 UTC (22 hours ago)
Parents
13a8849
Accrescent app pages (https://accrescent.app/app/<pkg>, e.g. the
AppVerifier page in the issue) did nothing when opened: the manifest
declared no intent filter for accrescent.app, and ExternalLinks only
parsed market://, Play and F-Droid URLs, so the launch fell through
to the home page.

Add a BROWSABLE https intent filter for accrescent.app/app/ on the
launcher activity (autoVerify off, matching the Play/F-Droid filters)
and teach ExternalLinks.parseExternalPackage to take the path segment
after "app", handling a trailing slash and query the same way the
F-Droid parser does. The parsed package flows through the existing
externalPkg path into the app detail page.

Test-first: three new ExternalLinksTest cases failed before the fix
(the two resolving cases) and pass after; full :appstore:lint,
:lintVitalRelease and :appstore:testDevUnitTest are green.

Diff

appstore/src/main/AndroidManifest.xml
diff --git a/appstore/src/main/AndroidManifest.xml b/appstore/src/main/AndroidManifest.xmlindex 4281e0ec13..7a505c0745 100644--- a/appstore/src/main/AndroidManifest.xml+++ b/appstore/src/main/AndroidManifest.xml@@ -122,6 +122,15 @@                 <data android:host="f-droid.org" />                 <data android:pathPattern="/.*/packages/.*" />             </intent-filter>+            <intent-filter android:autoVerify="false">+                <action android:name="android.intent.action.VIEW" />+                <category android:name="android.intent.category.DEFAULT" />+                <category android:name="android.intent.category.BROWSABLE" />+                <!-- Accrescent /app/<pkg> listing URLs. -->+                <data android:scheme="https" />+                <data android:host="accrescent.app" />+                <data android:pathPrefix="/app/" />+            </intent-filter>         </activity>          <!--
appstore/src/main/java/com/vayunmathur/appstore/data/ExternalLinks.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/ExternalLinks.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/ExternalLinks.ktindex 7c5f14736f..f5c62a8937 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/ExternalLinks.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/ExternalLinks.kt@@ -1,7 +1,7 @@ package com.vayunmathur.appstore.data  /**- * Package named by a `market://` details intent or a Play/F-Droid listing URL.+ * Package named by a `market://` details intent or a Play/F-Droid/Accrescent listing URL.  *  * Pure Kotlin (no Android types) so plain JVM unit tests can cover it.  */@@ -14,6 +14,7 @@ object ExternalLinks {         if (data.startsWith("market://")) return ID_PARAM.find(data)?.groupValues?.get(1)         if (data.contains("play.google.com")) return ID_PARAM.find(data)?.groupValues?.get(1)         if (data.contains("f-droid.org")) return parseFDroidPackage(data)+        if (data.contains("accrescent.app")) return parseAccrescentPackage(data)         return null     } @@ -31,4 +32,18 @@ object ExternalLinks {         if (packagesIdx < 0 || packagesIdx + 1 >= segments.size) return null         return segments[packagesIdx + 1]     }++    /**+     * Accrescent listing URLs carry the package as the path segment after `app`+     * (`https://accrescent.app/app/<pkg>`), with the same trailing-slash caveat+     * as F-Droid URLs.+     */+    private fun parseAccrescentPackage(data: String): String? {+        val path = data.substringBefore('?').substringBefore('#')+        if (!path.contains("/app/")) return null+        val segments = path.split('/').filter { it.isNotBlank() }+        val appIdx = segments.indexOfLast { it == "app" }+        if (appIdx < 0 || appIdx + 1 >= segments.size) return null+        return segments[appIdx + 1]+    } }
appstore/src/test/java/com/vayunmathur/appstore/data/ExternalLinksTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/data/ExternalLinksTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/data/ExternalLinksTest.ktindex a54d41808d..2e06a622ad 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/data/ExternalLinksTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/data/ExternalLinksTest.kt@@ -61,6 +61,30 @@ class ExternalLinksTest {         )     } +    @Test+    fun `accrescent url resolves the package`() {+        assertEquals(+            "dev.soupslurpr.appverifier",+            ExternalLinks.parseExternalPackage("https://accrescent.app/app/dev.soupslurpr.appverifier"),+        )+    }++    @Test+    fun `accrescent url with trailing slash and query resolves the package`() {+        assertEquals(+            "dev.soupslurpr.appverifier",+            ExternalLinks.parseExternalPackage(+                "https://accrescent.app/app/dev.soupslurpr.appverifier/?ref=share",+            ),+        )+    }++    @Test+    fun `accrescent bare app page resolves nothing`() {+        assertNull(ExternalLinks.parseExternalPackage("https://accrescent.app/app/"))+        assertNull(ExternalLinks.parseExternalPackage("https://accrescent.app/"))+    }+     @Test     fun `unrelated url resolves nothing`() {         assertNull(ExternalLinks.parseExternalPackage("https://example.com/some/page"))