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: {
updatedAt: undefined,
status: 'pending',
status: 'unknown',
} as TempAgeAssuranceState,
}))(),
)
+17 -1
View File
@@ -68,7 +68,9 @@ export function beginResolveGeolocation() {
*/
if (__DEV__) {
geolocationResolution = new Promise(y => y({success: true}))
device.set(['geolocation'], DEFAULT_GEOLOCATION)
if (!device.get(['geolocation'])) {
device.set(['geolocation'], DEFAULT_GEOLOCATION)
}
return
}
@@ -177,3 +179,17 @@ export function Provider({children}: {children: React.ReactNode}) {
export function useGeolocation() {
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)
}
}