import { History } from "history" ; const isStandalone = ! ! ( window . navigator as any ) . standalone || window . matchMedia ( "(display-mode: standalone)" ) . matches || document . referrer . includes ( "android-app://" ) ; const storageKey = "grouptabs_last_visited_location" ; export function restoreLocation ( ) { if ( ! isStandalone ) { return ; } let lastVisitedUrl = window . localStorage . getItem ( storageKey ) ; if ( lastVisitedUrl ) { lastVisitedUrl = lastVisitedUrl . replace ( "/#/tabs/" , "/tabs/" ) ; window . history . replaceState ( null , "" , lastVisitedUrl ) ; } } export function startPersistingLocation ( history ) { if ( ! isStandalone ) { return ; } history . listen ( ( ) => window . localStorage . setItem ( storageKey , window . location . href ) ) ; }