Compare commits

..

No commits in common. "83d406a6aae522a04e0cedc161d1dc9241868614" and "948625b777767153cfeb405ec37c958986cef7ff" have entirely different histories.

8 changed files with 14 additions and 55 deletions

View file

@ -14,8 +14,8 @@ android {
applicationId = "no.naiv.tilfluktsrom" applicationId = "no.naiv.tilfluktsrom"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 17 versionCode = 16
versionName = "1.10.2" versionName = "1.10.1"
// Deep link domain — single source of truth for manifest + Kotlin code // Deep link domain — single source of truth for manifest + Kotlin code
val deepLinkDomain = "tilfluktsrom.naiv.no" val deepLinkDomain = "tilfluktsrom.naiv.no"

View file

@ -46,7 +46,7 @@ class ShelterRepository(private val context: Context) {
.readTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS)
.addInterceptor(Interceptor { chain -> .addInterceptor(Interceptor { chain ->
chain.proceed(chain.request().newBuilder() chain.proceed(chain.request().newBuilder()
.header("User-Agent", "Tilfluktsrom/1.10.2") .header("User-Agent", "Tilfluktsrom/1.10.1")
.build()) .build())
}) })
.build() .build()

View file

@ -1,2 +0,0 @@
- PWA-only release: share button is now visually consistent with the other status-bar icons, and updates apply automatically the next time you bring the app to the foreground (no manual reload needed)
- No Android changes

View file

@ -1,2 +0,0 @@
- PWA-utgivelse: del-knappen er visuelt konsistent med de andre ikonene i statuslinjen, og oppdateringer trer i kraft automatisk neste gang du henter appen i forgrunnen (ingen manuell omlasting)
- Ingen Android-endringer

View file

@ -1,2 +0,0 @@
- PWA-utgjeving: del-knappen er visuelt jamn med dei andre ikona i statuslinja, og oppdateringar tek effekt automatisk neste gong du hentar appen i framgrunnen (inga manuell omlasting)
- Ingen Android-endringar

View file

@ -25,11 +25,7 @@
<header id="status-bar" role="banner"> <header id="status-bar" role="banner">
<span id="status-text" aria-live="polite"></span> <span id="status-text" aria-live="polite"></span>
<button id="about-btn" aria-label="About">&#x2139;</button> <button id="about-btn" aria-label="About">&#x2139;</button>
<button id="share-btn" aria-label="Share shelter"> <button id="share-btn" aria-label="Share shelter">&#x21AA;</button>
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true" focusable="false">
<path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z"/>
</svg>
</button>
<button id="refresh-btn" aria-label="Refresh data">&#x21bb;</button> <button id="refresh-btn" aria-label="Refresh data">&#x21bb;</button>
</header> </header>

View file

@ -11,44 +11,12 @@ import './styles/main.css';
import 'leaflet/dist/leaflet.css'; import 'leaflet/dist/leaflet.css';
import { initLocale } from './i18n/i18n'; import { initLocale } from './i18n/i18n';
import { init } from './app'; import { init } from './app';
import { setStatus } from './ui/status-bar';
import { t } from './i18n/i18n';
import { maybeShow as maybeShowIosInstallHint } from './ui/install-hint'; import { maybeShow as maybeShowIosInstallHint } from './ui/install-hint';
console.info(`[tilfluktsrom] build ${__BUILD_REVISION__}`); console.info(`[tilfluktsrom] build ${__BUILD_REVISION__}`);
// Make `registerType: 'autoUpdate'` actually auto-update the running tab.
// vite-plugin-pwa's autoUpdate strategy makes the new service worker
// skipWaiting + clientsClaim, but the JS already loaded in the open tab is
// the *old* build until something triggers a navigation. Without this
// listener, a deploy is invisible until the user manually refreshes.
//
// We *defer* the reload until the user next backgrounds the app
// (visibilityState === 'hidden') instead of reloading immediately. This is
// an emergency app: a mid-task reload would lose the selected shelter,
// compass mode, and any in-flight UI state right when the user can least
// afford to be surprised. Deferring keeps the "auto" promise (they're on
// the new version next time they look at the screen) without interrupting
// active use.
//
// The `wasAlreadyControlled` guard avoids reloading on the very first SW
// install (when there was no previous controller — that's a fresh visit,
// not an update).
if ('serviceWorker' in navigator) {
const wasAlreadyControlled = !!navigator.serviceWorker.controller;
let pendingReload = false;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (!wasAlreadyControlled) return;
pendingReload = true;
});
document.addEventListener('visibilitychange', () => {
if (pendingReload && document.visibilityState === 'hidden') {
pendingReload = false;
window.location.reload();
}
});
}
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
initLocale(); initLocale();
@ -57,6 +25,14 @@ document.addEventListener('DOMContentLoaded', async () => {
await navigator.storage.persist(); await navigator.storage.persist();
} }
// Listen for service worker updates — flash a status message when a new
// version activates so the user knows they have fresh code/data.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('controllerchange', () => {
setStatus(t('update_success'));
});
}
await init(); await init();
// Shown only on first iOS Safari visit, once per device. Placed after init() // Shown only on first iOS Safari visit, once per device. Placed after init()

View file

@ -86,13 +86,6 @@ html, body {
cursor: not-allowed; cursor: not-allowed;
} }
#share-btn svg {
display: block;
/* `` and `` glyphs sit on a baseline; an SVG inside an inline-flex
container can otherwise pick up extra descender space and look
misaligned next to them. `display:block` removes that. */
}
/* --- Main content area (map or compass) --- */ /* --- Main content area (map or compass) --- */
#main-content { #main-content {
flex: 1; flex: 1;