Android: get polyfills for geolocation working, some steps for logging in

This commit is contained in:
Pieter Vander Vennet 2024-12-12 00:46:24 +01:00
parent 76e9381650
commit 14e5f1efb3
5 changed files with 52 additions and 28 deletions

View file

@ -3,6 +3,7 @@ import { LocalStorageSource } from "../Web/LocalStorageSource"
import { QueryParameters } from "../Web/QueryParameters"
import { Translation } from "../../UI/i18n/Translation"
import Translations from "../../UI/i18n/Translations"
import { AndroidPolyfill } from "../Web/AndroidPolyfill"
export type GeolocationPermissionState = "prompt" | "requested" | "granted" | "denied"
@ -157,12 +158,20 @@ export class GeoLocationState {
this.permission.setData("denied")
return
}
if (this.permission.data !== "prompt" && this.permission.data !== "requested") {
// If the user denies the first prompt, revokes the deny and then tries again, we have to run the flow as well
// Hence that we continue the flow if it is "requested"
return
}
if(AndroidPolyfill.inAndroid.data){
this.permission.setData("requested")
AndroidPolyfill.geolocationPermission.addCallbackAndRunD(state => this.permission.set(state))
this.startWatching()
return
}
if (GeoLocationState.isSafari()) {
/*
This is probably safari