Add geo debug
This commit is contained in:
@@ -46,7 +46,7 @@ export function Provider({children}: {children: React.ReactNode}) {
|
|||||||
(() => ({
|
(() => ({
|
||||||
data: {
|
data: {
|
||||||
updatedAt: undefined,
|
updatedAt: undefined,
|
||||||
status: 'pending',
|
status: 'unknown',
|
||||||
} as TempAgeAssuranceState,
|
} as TempAgeAssuranceState,
|
||||||
}))(),
|
}))(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ export function beginResolveGeolocation() {
|
|||||||
*/
|
*/
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
geolocationResolution = new Promise(y => y({success: true}))
|
geolocationResolution = new Promise(y => y({success: true}))
|
||||||
|
if (!device.get(['geolocation'])) {
|
||||||
device.set(['geolocation'], DEFAULT_GEOLOCATION)
|
device.set(['geolocation'], DEFAULT_GEOLOCATION)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,3 +179,17 @@ export function Provider({children}: {children: React.ReactNode}) {
|
|||||||
export function useGeolocation() {
|
export function useGeolocation() {
|
||||||
return React.useContext(context)
|
return React.useContext(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (__DEV__) {
|
||||||
|
// @ts-ignore
|
||||||
|
window.setGeolocation = (geo: Device['geolocation']) => {
|
||||||
|
if (!geo?.countryCode || !geo?.isAgeRestrictedGeo) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected {countryCode: string, isAgeRestrictedGeo: boolean}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
device.set(['geolocation'], geo)
|
||||||
|
emitGeolocationUpdate(geo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user