diff --git a/TODO.md b/TODO.md index e1cf051..8a57574 100644 --- a/TODO.md +++ b/TODO.md @@ -166,7 +166,10 @@ | [x] | 1단계: 웹·앱 공통 코드 `shared/`(`@nalssigak/shared`) 분리, 루트 npm workspaces, 웹 Docker 빌드 대상을 루트로 | 앱과 API 클라이언트·로직 공유 | `package.json`, `shared/`, `frontend/Dockerfile`, `compose.yaml`, `.dockerignore` | | [x] | 2단계: 앱에 react-query·Uniwind 설정 + Metro가 `react`를 `mobile/node_modules`(19.2.3) 것만 쓰게 설정 — 루트에는 웹용 react 19.3.0이 있고 RN 렌더러는 19.2.3에서만 돌아감 | 앱 시작 준비 | `mobile/metro.config.js`, `mobile/src/app/_layout.tsx`, `mobile/src/lib/query-client.ts` | | [x] | 앱 토큰 저장소 `expo-secure-store`로 `configureApi` 연결, API 주소는 `EXPO_PUBLIC_API_BASE_URL` | 웹은 localStorage | `mobile/src/lib/api.ts`, `mobile/.env.example` | -| [ ] | Xcode 설치 후 시뮬레이터에서 전체 확인 (시트·로그인·좋아요·위치 권한·이미지 공유) — 지금은 Expo 웹 화면과 iOS 번들 빌드까지만 확인 | | `mobile/` | +| [x] | 안드로이드 에뮬레이터(Expo Go)에서 확인: 오늘 화면 실데이터, 위치 권한 창, 탭 이동, 각 근거 시트 | | `mobile/` | +| [ ] | 안드로이드에서 로그인·좋아요·이미지 공유 눌러 보기 (에뮬레이터가 느려 일부만 확인) | | `mobile/` | +| [ ] | Xcode 설치 후 iOS 시뮬레이터에서 전체 확인 | | `mobile/` | +| [ ] | 앱 아이콘은 지금 평면 로고(`~/Desktop/nalssigak-logo-600.png`)를 SVG로 다시 그린 것 — 3D 해 원본 파일을 받으면 교체. Expo Go 에선 아이콘이 안 보이고 개발 빌드·스토어 빌드부터 보임 | 원본 파일이 PC에 없음 | `mobile/assets/images/` | | [x] | 3단계-1: 탭 5개 구조·위 막대·하늘 배경·밤 테마(Uniwind dark), Today 히어로·각 순위·행사/TOP5/계절 띠 | | `mobile/src/app/`, `mobile/src/components/` | | [x] | Today 게시물 카드(슬라이드 7종·넘기기·좋아요·댓글·텍스트 공유), 3·6·9번째 글 뒤 띠 | | `mobile/src/components/post/`, `mobile/src/app/index.tsx` | | [x] | 시트 7종(각 근거·읽을거리·댓글·이번 주 특집·로그인/가입·내 정보·지역 고르기)을 RN `Modal`로, 위 막대 로그인/아바타 | 새 패키지 없이 | `mobile/src/components/sheets/`, `mobile/src/components/top-bar.tsx` | diff --git a/mobile/app.json b/mobile/app.json index c2ae299..83465fc 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -1,18 +1,18 @@ { "expo": { - "name": "mobile", - "slug": "mobile", + "name": "날씨각", + "slug": "nalssigak", "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", - "scheme": "mobile", + "scheme": "nalssigak", "userInterfaceStyle": "automatic", "ios": { - "icon": "./assets/expo.icon" + "icon": "./assets/images/icon.png" }, "android": { "adaptiveIcon": { - "backgroundColor": "#E6F4FE", + "backgroundColor": "#d6ebff", "foregroundImage": "./assets/images/android-icon-foreground.png", "backgroundImage": "./assets/images/android-icon-background.png", "monochromeImage": "./assets/images/android-icon-monochrome.png" @@ -28,9 +28,9 @@ [ "expo-splash-screen", { - "backgroundColor": "#208AEF", + "backgroundColor": "#d6ebff", "image": "./assets/images/splash-icon.png", - "imageWidth": 76 + "imageWidth": 200 } ], "expo-secure-store", diff --git a/mobile/assets/expo.icon/Assets/expo-symbol 2.svg b/mobile/assets/expo.icon/Assets/expo-symbol 2.svg deleted file mode 100644 index 51d3676..0000000 --- a/mobile/assets/expo.icon/Assets/expo-symbol 2.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/mobile/assets/expo.icon/Assets/grid.png b/mobile/assets/expo.icon/Assets/grid.png deleted file mode 100644 index eefea24..0000000 Binary files a/mobile/assets/expo.icon/Assets/grid.png and /dev/null differ diff --git a/mobile/assets/expo.icon/icon.json b/mobile/assets/expo.icon/icon.json deleted file mode 100644 index 7a2c33c..0000000 --- a/mobile/assets/expo.icon/icon.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "fill" : { - "automatic-gradient" : "extended-srgb:0.00000,0.47843,1.00000,1.00000" - }, - "groups" : [ - { - "layers" : [ - { - "image-name" : "expo-symbol 2.svg", - "name" : "expo-symbol 2", - "position" : { - "scale" : 1, - "translation-in-points" : [ - 1.1008400065293245e-05, - -16.046875 - ] - } - }, - { - "image-name" : "grid.png", - "name" : "grid" - } - ], - "shadow" : { - "kind" : "neutral", - "opacity" : 0.5 - }, - "translucency" : { - "enabled" : true, - "value" : 0.5 - } - } - ], - "supported-platforms" : { - "circles" : [ - "watchOS" - ], - "squares" : "shared" - } -} \ No newline at end of file diff --git a/mobile/assets/images/android-icon-background.png b/mobile/assets/images/android-icon-background.png index 5ffefc5..585dc5f 100644 Binary files a/mobile/assets/images/android-icon-background.png and b/mobile/assets/images/android-icon-background.png differ diff --git a/mobile/assets/images/android-icon-foreground.png b/mobile/assets/images/android-icon-foreground.png index 3a9e501..e01e320 100644 Binary files a/mobile/assets/images/android-icon-foreground.png and b/mobile/assets/images/android-icon-foreground.png differ diff --git a/mobile/assets/images/android-icon-monochrome.png b/mobile/assets/images/android-icon-monochrome.png index 77484eb..3b56236 100644 Binary files a/mobile/assets/images/android-icon-monochrome.png and b/mobile/assets/images/android-icon-monochrome.png differ diff --git a/mobile/assets/images/expo-badge-white.png b/mobile/assets/images/expo-badge-white.png deleted file mode 100644 index 2863067..0000000 Binary files a/mobile/assets/images/expo-badge-white.png and /dev/null differ diff --git a/mobile/assets/images/expo-badge.png b/mobile/assets/images/expo-badge.png deleted file mode 100644 index 5d5c5bb..0000000 Binary files a/mobile/assets/images/expo-badge.png and /dev/null differ diff --git a/mobile/assets/images/expo-logo.png b/mobile/assets/images/expo-logo.png deleted file mode 100644 index 6b1642a..0000000 Binary files a/mobile/assets/images/expo-logo.png and /dev/null differ diff --git a/mobile/assets/images/favicon.png b/mobile/assets/images/favicon.png index 408bd74..285e0c6 100644 Binary files a/mobile/assets/images/favicon.png and b/mobile/assets/images/favicon.png differ diff --git a/mobile/assets/images/icon.png b/mobile/assets/images/icon.png index 67c777a..fef6be6 100644 Binary files a/mobile/assets/images/icon.png and b/mobile/assets/images/icon.png differ diff --git a/mobile/assets/images/logo-glow.png b/mobile/assets/images/logo-glow.png deleted file mode 100644 index edc99be..0000000 Binary files a/mobile/assets/images/logo-glow.png and /dev/null differ diff --git a/mobile/assets/images/react-logo.png b/mobile/assets/images/react-logo.png deleted file mode 100644 index 9d72a9f..0000000 Binary files a/mobile/assets/images/react-logo.png and /dev/null differ diff --git a/mobile/assets/images/react-logo@2x.png b/mobile/assets/images/react-logo@2x.png deleted file mode 100644 index 2229b13..0000000 Binary files a/mobile/assets/images/react-logo@2x.png and /dev/null differ diff --git a/mobile/assets/images/react-logo@3x.png b/mobile/assets/images/react-logo@3x.png deleted file mode 100644 index a99b203..0000000 Binary files a/mobile/assets/images/react-logo@3x.png and /dev/null differ diff --git a/mobile/assets/images/splash-icon.png b/mobile/assets/images/splash-icon.png index 6b1642a..eaf8058 100644 Binary files a/mobile/assets/images/splash-icon.png and b/mobile/assets/images/splash-icon.png differ diff --git a/mobile/assets/images/tabIcons/explore.png b/mobile/assets/images/tabIcons/explore.png deleted file mode 100644 index 73d8258..0000000 Binary files a/mobile/assets/images/tabIcons/explore.png and /dev/null differ diff --git a/mobile/assets/images/tabIcons/explore@2x.png b/mobile/assets/images/tabIcons/explore@2x.png deleted file mode 100644 index 21b9bd2..0000000 Binary files a/mobile/assets/images/tabIcons/explore@2x.png and /dev/null differ diff --git a/mobile/assets/images/tabIcons/explore@3x.png b/mobile/assets/images/tabIcons/explore@3x.png deleted file mode 100644 index 422202d..0000000 Binary files a/mobile/assets/images/tabIcons/explore@3x.png and /dev/null differ diff --git a/mobile/assets/images/tabIcons/home.png b/mobile/assets/images/tabIcons/home.png deleted file mode 100644 index ad5699c..0000000 Binary files a/mobile/assets/images/tabIcons/home.png and /dev/null differ diff --git a/mobile/assets/images/tabIcons/home@2x.png b/mobile/assets/images/tabIcons/home@2x.png deleted file mode 100644 index 22a1f2c..0000000 Binary files a/mobile/assets/images/tabIcons/home@2x.png and /dev/null differ diff --git a/mobile/assets/images/tabIcons/home@3x.png b/mobile/assets/images/tabIcons/home@3x.png deleted file mode 100644 index f5d1f9a..0000000 Binary files a/mobile/assets/images/tabIcons/home@3x.png and /dev/null differ diff --git a/mobile/assets/images/tutorial-web.png b/mobile/assets/images/tutorial-web.png deleted file mode 100644 index e4a8c58..0000000 Binary files a/mobile/assets/images/tutorial-web.png and /dev/null differ diff --git a/mobile/src/components/first-load.tsx b/mobile/src/components/first-load.tsx index 8e81571..3294d22 100644 --- a/mobile/src/components/first-load.tsx +++ b/mobile/src/components/first-load.tsx @@ -1,5 +1,5 @@ import type { TimeKind } from '@nalssigak/shared/lib'; -import { useIsFetching } from '@tanstack/react-query'; +import { useQueryClient } from '@tanstack/react-query'; import { useEffect, useState } from 'react'; import { StyleSheet, Text, View } from 'react-native'; import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withSequence, withTiming } from 'react-native-reanimated'; @@ -38,19 +38,23 @@ function Hop({ name }: { name: string }) { /** 처음 들어올 때만: 첫 데이터를 다 받을 때까지 하늘 위에 캐릭터와 '날씨 불러오는 중…'. 한 번 사라지면 다시 안 뜬다 */ export function FirstLoad() { - const fetching = useIsFetching(); + const queryClient = useQueryClient(); const { kind } = useSky(); - const [started, setStarted] = useState(false); const [done, setDone] = useState(false); const [gone, setGone] = useState(false); - // 받기 시작했다가 받는 게 없어지면 끝 (렌더 중에 바로 맞춘다) - if (fetching > 0 && !started) setStarted(true); - if (fetching === 0 && started && !done) setDone(true); - // 느린 망에서도 10초 넘게 막지 않는다 (그 뒤는 화면 안 스켈레톤이 맡는다) + // 받기 시작했다가 받는 게 없어지면 끝. 느린 망에서도 10초 넘게 막지 않는다 (그 뒤는 화면 안 스켈레톤이 맡는다) useEffect(() => { + let seen = false; + const unsubscribe = queryClient.getQueryCache().subscribe(() => { + if (queryClient.isFetching() > 0) seen = true; + else if (seen) setDone(true); + }); const id = setTimeout(() => setDone(true), 10000); - return () => clearTimeout(id); - }, []); + return () => { + unsubscribe(); + clearTimeout(id); + }; + }, [queryClient]); const shown = useSharedValue(1); useEffect(() => { if (!done) return; diff --git a/mobile/src/lib/region.tsx b/mobile/src/lib/region.tsx index b2055fc..a852dac 100644 --- a/mobile/src/lib/region.tsx +++ b/mobile/src/lib/region.tsx @@ -29,11 +29,16 @@ function readStored(): RegionData | null { } } +/** 위치를 못 잡으면(실내·에뮬레이터) 끝없이 기다리지 않게 웹처럼 10초에 끊는다 */ +function withTimeout(p: Promise, ms: number): Promise { + return Promise.race([p, new Promise((_, reject) => setTimeout(() => reject(new Error('위치 찾기 시간 초과')), ms))]); +} + /** 위치 권한을 받아 가장 가까운 구. 권한이 없으면 'denied' */ async function findNearest(): Promise { const { status } = await Location.requestForegroundPermissionsAsync(); if (status !== 'granted') return 'denied'; - const pos = (await Location.getLastKnownPositionAsync({ maxAge: 600000 })) ?? (await Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.Balanced })); + const pos = (await Location.getLastKnownPositionAsync({ maxAge: 600000 })) ?? (await withTimeout(Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.Balanced }), 10000)); const { data } = await nearestRegion({ query: { lat: pos.coords.latitude, lon: pos.coords.longitude } }); if (!data.region) throw new Error('가까운 구를 찾지 못함'); return data.region;