feat(pwa): reopen the trip and tab the installed app was in (#1024)

This commit is contained in:
Maurice
2026-10-01 13:18:47 +02:00
parent 1f464ce805
commit d1f4deaa31
5 changed files with 191 additions and 10 deletions
@@ -5,6 +5,7 @@ import { getCoMapsUrlForPlace } from './placeCoMaps'
import { getGoogleMapsUrlForPlace } from './placeGoogleMaps'
import { getOpenStreetMapUrlForPlace } from './placeOpenStreetMap'
import { useSettingsStore } from '../../store/settingsStore'
import { isInstalledApp } from '../../utils/resumeRoute'
type PlaceLike = Pick<Place | AssignmentPlace, 'name' | 'address' | 'lat' | 'lng' | 'google_place_id' | 'google_ftid'>
@@ -197,13 +198,3 @@ export function openNavigationTarget(target: NavigationTarget): void {
if (target.id === 'geo' || isInstalledApp()) window.location.href = target.url
else window.open(target.url, '_blank', 'noopener,noreferrer')
}
/** True in a display mode that has no tab strip to close a stray window from. */
function isInstalledApp(): boolean {
if (typeof window === 'undefined') return false
const standalone = ['standalone', 'fullscreen', 'minimal-ui'].some(
mode => window.matchMedia?.(`(display-mode: ${mode})`).matches,
)
// iOS predates the display-mode query for home-screen apps.
return standalone || (window.navigator as { standalone?: boolean }).standalone === true
}