Provide geo-gated users optional GPS fallback for precise location data (#8973)
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
} from '#/state/ageAssurance/types'
|
||||
import {useIsAgeAssuranceEnabled} from '#/state/ageAssurance/useIsAgeAssuranceEnabled'
|
||||
import {logger} from '#/state/ageAssurance/util'
|
||||
import {useGeolocation} from '#/state/geolocation'
|
||||
import {useGeolocationStatus} from '#/state/geolocation'
|
||||
import {useAgent} from '#/state/session'
|
||||
|
||||
export const createAgeAssuranceQueryKey = (did: string) =>
|
||||
@@ -43,7 +43,7 @@ AgeAssuranceAPIContext.displayName = 'AgeAssuranceAPIContext'
|
||||
*/
|
||||
export function Provider({children}: {children: React.ReactNode}) {
|
||||
const agent = useAgent()
|
||||
const {geolocation} = useGeolocation()
|
||||
const {status: geolocation} = useGeolocationStatus()
|
||||
const isAgeAssuranceEnabled = useIsAgeAssuranceEnabled()
|
||||
const getAndRegisterPushToken = useGetAndRegisterPushToken()
|
||||
const [refetchWhilePending, setRefetchWhilePending] = useState(false)
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import {isNetworkError} from '#/lib/hooks/useCleanError'
|
||||
import {logger} from '#/logger'
|
||||
import {createAgeAssuranceQueryKey} from '#/state/ageAssurance'
|
||||
import {useGeolocation} from '#/state/geolocation'
|
||||
import {useGeolocationStatus} from '#/state/geolocation'
|
||||
import {useAgent} from '#/state/session'
|
||||
|
||||
let APPVIEW = PUBLIC_APPVIEW
|
||||
@@ -36,7 +36,7 @@ let APPVIEW_DID = PUBLIC_APPVIEW_DID
|
||||
export function useInitAgeAssurance() {
|
||||
const qc = useQueryClient()
|
||||
const agent = useAgent()
|
||||
const {geolocation} = useGeolocation()
|
||||
const {status: geolocation} = useGeolocationStatus()
|
||||
return useMutation({
|
||||
async mutationFn(
|
||||
props: Omit<AppBskyUnspeccedInitAgeAssurance.InputSchema, 'countryCode'>,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {useMemo} from 'react'
|
||||
|
||||
import {useGeolocation} from '#/state/geolocation'
|
||||
import {useGeolocationStatus} from '#/state/geolocation'
|
||||
|
||||
export function useIsAgeAssuranceEnabled() {
|
||||
const {geolocation} = useGeolocation()
|
||||
const {status: geolocation} = useGeolocationStatus()
|
||||
|
||||
return useMemo(() => {
|
||||
return !!geolocation?.isAgeRestrictedGeo
|
||||
|
||||
Reference in New Issue
Block a user