Add geo debug

This commit is contained in:
Eric Bailey
2025-06-25 17:33:42 -05:00
parent 5ef52f708f
commit 8ec5d93e0d
2 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -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,
}))(), }))(),
) )
+16
View File
@@ -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)
}
}