Commit graph

13 commits

Author SHA1 Message Date
27801f1dfc Legg til release-signeringskonfigurasjon v1.1.0
Konfigurerer release-signering med keystore i ~/.android/ slik at
release-APK kan bygges og distribueres direkte.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:44:19 +01:00
c79d47b1b9 Legg til MPL-2.0-lisens
Mozilla Public License 2.0 gir kopyleft på filnivå, men er
kompatibel med app-butikker og proprietære avhengigheter som
Google Play Services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:38:22 +01:00
8eeff3071f Merk PWA som utestet i README, opprett issue #1
PWA-koden kompilerer og enhetstester passerer, men den er ikke
manuelt verifisert i nettleser ennå.

Refs #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:34:43 +01:00
d0460cd686 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>
2026-03-08 18:33:38 +01:00
da7917d17b Legg til README med prosjektbeskrivelse på norsk
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:24:19 +01:00
c129de0a12 Improve error visibility and eliminate silent failures
- LocationProvider: close Flow with SecurityException when permission
  is missing (instead of silently completing), log trySend failures,
  handle lastLocation failure callback
- loadData(): wrap in top-level try-catch so database errors don't
  leave the app in a broken loading state
- Cache retry button: show "Waiting for GPS" toast when location is
  null instead of silently doing nothing
- selectShelterByData: use NaN for distance/bearing when no GPS fix
  yet, so UI shows "—" instead of misleading "0 m"
- DistanceUtils.formatDistance: handle NaN gracefully
- GeoJSON parser: require valid lokalId (primary key) — reject
  shelters with missing ID to prevent DB collisions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:56:54 +01:00
55761718e1 Improve lifecycle management, compass reliability, and accessibility
- Use repeatOnLifecycle(STARTED) for location updates so GPS stops
  when Activity is paused (battery conservation)
- Pair enableMyLocation/disableMyLocation with onResume/onPause
- Add low-pass filter for accelerometer+magnetometer compass fallback
  to reduce arrow jitter
- Detect missing compass sensors and show warning instead of frozen
  arrow
- Monitor compass accuracy via onAccuracyChanged and indicate
  degraded readings
- Show permission rationale dialog using existing i18n strings
- Guide user to Settings when location permission is permanently
  denied
- Check cacheMapArea return value and show banner on failure
- Add error handling around shelter Flow and location Flow collection
- Add contentDescription to direction arrow views for screen readers
- Use safe casts for system services (as? instead of as)
- Use explicit dark theme parent (Theme.Material3.Dark.NoActionBar)
  instead of DayNight with hardcoded dark colors
- Add error_no_compass and direction_arrow_description strings in
  en/nb/nn

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:54:06 +01:00
e93273bff4 Fix data safety, security, and coroutine correctness
- Wrap deleteAll+insertAll in Room transaction to prevent data loss
  on crash during refresh
- Add CancellationException rethrow in ShelterRepository and
  MapCacheManager to preserve structured concurrency
- Close OkHttp response body on error paths (response.use{})
- Add ZIP bomb protection (10MB cap) in GeoJSON parser
- Add per-feature error handling — skip malformed records instead of
  losing all shelters
- Validate coordinates within Norway's bounding box
- Enforce HTTPS-only via network_security_config (remove cleartext
  allowance for tile.openstreetmap.org)
- Disable android:allowBackup to prevent DB extraction via ADB
- Strip Log.v/d/i in release builds via ProGuard to prevent location
  data leakage
- Restore map position in MapCacheManager.finally block on
  cancellation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:53:51 +01:00
9639ad44f4 Remove build artifacts and add .gitignore for PWA
Remove accidentally committed node_modules/ and dist/ directories,
and add .gitignore to prevent them from being tracked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:41:55 +01:00
e8428de775 Add progressive web app companion for cross-platform access
Vite + TypeScript PWA that mirrors the Android app's core features:
- Pre-processed shelter data (build-time UTM33N→WGS84 conversion)
- Leaflet map with shelter markers, user location, and offline tiles
- Canvas compass arrow (ported from DirectionArrowView.kt)
- IndexedDB shelter cache with 7-day staleness check
- Service worker with CacheFirst tiles and precached app shell
- i18n for en, nb, nn (ported from Android strings.xml)
- iOS/Android compass handling with low-pass filter
- Respects user map interaction (no auto-snap on pan/zoom)
- Build revision cache-breaker for reliable SW updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:41:38 +01:00
46365b713b Add per-app language selection (Android 13+)
Declare supported locales (en, nb, nn) via localeConfig so users can
pick the app language from system settings without changing their
device locale. Accessed via long-press → App Info → Language.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:41:23 +01:00
92531ee971 Improve map interaction, shelter selection, and offline caching
- Rework selection model so any shelter marker can be tapped to select,
  not just the nearest three in the bottom sheet list
- Highlight selected shelter with a distinct amber marker icon
- Track user map interaction (pan/zoom) to prevent auto-recentering
- Add reset navigation FAB to re-fit map to user + selected shelter
- Add offline map cache prompt (OK/Skip) with warning banner and retry
- Rewrite MapCacheManager to use passive tile caching via map panning
- Respect system status bar with fitsSystemWindows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:41:15 +01:00
27cad094e7 Initial commit: Norwegian emergency shelter finder app
Android app (Kotlin) that locates the nearest public shelter (tilfluktsrom)
in Norway. Designed for offline-first emergency use.

Features:
- Downloads and caches all 556 Norwegian shelter locations from Geonorge
- GPS-based nearest shelter finding with distance and bearing
- OSMDroid map with offline tile caching for surroundings
- Large directional compass arrow pointing to selected shelter
- Compass sensor integration for real-time direction updates
- Shows 3 nearest shelters with distance, capacity, and address
- Toggle between map view and compass/arrow view
- Auto-caches map tiles on first launch for offline use
- Weekly background data refresh with manual force-update
- i18n: Norwegian Bokmål, Nynorsk, and English

Technical:
- EPSG:25833 (UTM33N) → WGS84 coordinate conversion
- Haversine distance and bearing calculations
- Room database for shelter persistence
- Fused Location Provider for precise GPS
- Sensor fusion (rotation vector with accel+mag fallback) for compass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:14:19 +01:00