Bytt djuplenkjer frå tilfluktsrom:// til HTTPS App Links
SMS-appar gjenkjenner ikkje eigendefinerte URI-skjema som klikkbare lenkjer. Brukar no https://tilfluktsrom.naiv.no/shelter/{id} som opnar appen direkte (Android App Links med autoVerify) eller fell tilbake til PWA i nettlesaren. Android: DEEP_LINK_DOMAIN i build.gradle.kts, HTTPS intent-filter, oppdatert handleDeepLinkIntent og shareShelter med HTTPS-URL. PWA: assetlinks.json for Android-verifisering, djuplenkjehandtering i app.ts, base-sti endra frå './' til '/', config.ts for domene. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ae249d5d47
commit
015bc0d926
14 changed files with 114 additions and 15 deletions
|
|
@ -16,6 +16,11 @@ android {
|
|||
targetSdk = 35
|
||||
versionCode = 11
|
||||
versionName = "1.7.0"
|
||||
|
||||
// Deep link domain — single source of truth for manifest + Kotlin code
|
||||
val deepLinkDomain = "tilfluktsrom.naiv.no"
|
||||
buildConfigField("String", "DEEP_LINK_DOMAIN", "\"$deepLinkDomain\"")
|
||||
manifestPlaceholders["deepLinkHost"] = deepLinkDomain
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@
|
|||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data
|
||||
android:scheme="tilfluktsrom"
|
||||
android:host="shelter" />
|
||||
android:scheme="https"
|
||||
android:host="${deepLinkHost}"
|
||||
android:pathPrefix="/shelter/" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
|
|
|||
|
|
@ -143,12 +143,14 @@ class MainActivity : AppCompatActivity(), SensorEventListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle tilfluktsrom://shelter/{lokalId} deep link.
|
||||
* Handle https://{domain}/shelter/{lokalId} deep link.
|
||||
* If shelters are already loaded, select immediately; otherwise store as pending.
|
||||
*/
|
||||
private fun handleDeepLinkIntent(intent: Intent?) {
|
||||
val uri = intent?.data ?: return
|
||||
if (uri.scheme != "tilfluktsrom" || uri.host != "shelter") return
|
||||
if (uri.scheme != "https" ||
|
||||
uri.host != BuildConfig.DEEP_LINK_DOMAIN ||
|
||||
uri.path?.startsWith("/shelter/") != true) return
|
||||
|
||||
val lokalId = uri.lastPathSegment ?: return
|
||||
// Clear intent data so config changes don't re-trigger
|
||||
|
|
@ -669,8 +671,8 @@ class MainActivity : AppCompatActivity(), SensorEventListener {
|
|||
|
||||
/**
|
||||
* Share the currently selected shelter via ACTION_SEND.
|
||||
* Includes address, capacity, geo: URI (for non-app recipients),
|
||||
* and a tilfluktsrom:// deep link (for app users).
|
||||
* Includes address, capacity, geo: URI, and an HTTPS deep link
|
||||
* that opens the app (if installed) or the PWA (in browser).
|
||||
*/
|
||||
private fun shareShelter() {
|
||||
val selected = selectedShelter
|
||||
|
|
@ -680,12 +682,14 @@ class MainActivity : AppCompatActivity(), SensorEventListener {
|
|||
}
|
||||
|
||||
val shelter = selected.shelter
|
||||
val deepLink = "https://${BuildConfig.DEEP_LINK_DOMAIN}/shelter/${shelter.lokalId}"
|
||||
val body = getString(
|
||||
R.string.share_body,
|
||||
shelter.adresse,
|
||||
shelter.plasser,
|
||||
shelter.latitude,
|
||||
shelter.longitude
|
||||
shelter.longitude,
|
||||
deepLink
|
||||
)
|
||||
|
||||
val shareIntent = Intent(Intent.ACTION_SEND).apply {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<!-- Deling -->
|
||||
<string name="share_subject">Tilfluktsrom</string>
|
||||
<string name="share_body">Tilfluktsrom: %1$s\n%2$d plasser\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f</string>
|
||||
<string name="share_body">Tilfluktsrom: %1$s\n%2$d plasser\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f\n%5$s</string>
|
||||
<string name="share_no_shelter">Ingen tilfluktsrom valgt</string>
|
||||
|
||||
<!-- Tilgjengelighet -->
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<!-- Deling -->
|
||||
<string name="share_subject">Tilfluktsrom</string>
|
||||
<string name="share_body">Tilfluktsrom: %1$s\n%2$d plassar\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f</string>
|
||||
<string name="share_body">Tilfluktsrom: %1$s\n%2$d plassar\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f\n%5$s</string>
|
||||
<string name="share_no_shelter">Ingen tilfluktsrom valt</string>
|
||||
|
||||
<!-- Tilgjenge -->
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<!-- Sharing -->
|
||||
<string name="share_subject">Emergency shelter</string>
|
||||
<string name="share_body">Shelter: %1$s\n%2$d places\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f</string>
|
||||
<string name="share_body">Shelter: %1$s\n%2$d places\n%3$.6f, %4$.6f\ngeo:%3$.6f,%4$.6f\n%5$s</string>
|
||||
<string name="share_no_shelter">No shelter selected</string>
|
||||
|
||||
<!-- Accessibility -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue