Bundle shelter data in APK and add shared versioning

- Add scripts/fetch-shelters.sh: downloads Geonorge data, converts
  UTM33N→WGS84 via PWA script, copies to both Android assets and
  PWA public dirs
- Bundle pre-processed shelters.json (556 shelters) in APK assets
  so the app works immediately on first launch with no network
- ShelterRepository.seedFromAsset(): seeds Room DB from bundled
  JSON on first launch, marks as stale so network refresh is
  attempted in the background
- MainActivity.loadData(): seeds from asset before trying network,
  always attempts background refresh when data is stale
- Add version.properties (1.1.0, versionCode=2) as single source
  of truth for versioning
- build.gradle.kts reads version from properties file and exposes
  via BuildConfig
- Bump PWA version to 1.1.0 to match

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 18:33:38 +01:00
commit d0460cd686
7 changed files with 4584 additions and 9 deletions

View file

@ -1,9 +1,16 @@
import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
}
// Read version from shared version.properties
val versionProps = Properties().apply {
rootProject.file("version.properties").inputStream().use { load(it) }
}
android {
namespace = "no.naiv.tilfluktsrom"
compileSdk = 35
@ -12,8 +19,13 @@ android {
applicationId = "no.naiv.tilfluktsrom"
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "1.0.0"
versionCode = versionProps.getProperty("versionCode").toInt()
versionName = "${versionProps.getProperty("versionMajor")}." +
"${versionProps.getProperty("versionMinor")}." +
versionProps.getProperty("versionPatch")
// Make version available in BuildConfig
buildConfigField("String", "VERSION_DISPLAY", "\"$versionName\"")
}
buildTypes {
@ -29,6 +41,7 @@ android {
buildFeatures {
viewBinding = true
buildConfig = true
}
compileOptions {