diff --git a/frontend/src/b/region.tsx b/frontend/src/b/region.tsx index 609eeed..b829793 100644 --- a/frontend/src/b/region.tsx +++ b/frontend/src/b/region.tsx @@ -49,10 +49,9 @@ export function RegionProvider({ children }: { children: ReactNode }) { .catch(() => setLocateStatus('error')) }, [setRegion]) - // ask=false 는 처음 들어왔을 때: 토스에서는 권한 창을 띄우지 않고, 이미 허용한 사람만 위치로 맞춘다 - const findNearest = useCallback((onFound?: () => void, ask = true) => { + const findNearest = useCallback((onFound?: () => void) => { if (IS_TOSS) { - tossLocation(ask).then( + tossLocation(true).then( (loc) => { if (loc === null) setLocateStatus('idle') else if (loc === 'denied') setLocateStatus('denied') @@ -83,7 +82,7 @@ export function RegionProvider({ children }: { children: ReactNode }) { // 처음 온 사람만 위치 권한을 물어 가장 가까운 구로 맞춘다 useEffect(() => { - if (!stored && canLocate) findNearest(undefined, false) + if (!stored && canLocate) findNearest() }, [stored, canLocate, findNearest]) const api = useMemo(() => ({ region, setRegion, locate, locateStatus }), [region, setRegion, locate, locateStatus]) diff --git a/frontend/src/lib/platform.ts b/frontend/src/lib/platform.ts index 2f1caeb..4f859ce 100644 --- a/frontend/src/lib/platform.ts +++ b/frontend/src/lib/platform.ts @@ -33,7 +33,7 @@ export async function tossShare(image: Blob, fileName: string, title: string): P export type TossLocation = { lat: number; lon: number } | 'denied' -/** 토스: 권한이 이미 있을 때만 위치를 읽는다. ask 면 권한 창을 띄운다 (앱에 들어오자마자 띄우지 않으려고) */ +/** 토스: 위치를 읽는다. 권한이 없으면 ask 일 때만 권한 창을 띄운다 */ export async function tossLocation(ask: boolean): Promise { const { Accuracy, Device } = await sdk() let status = await Device.getLocation.getPermission()