feat: 앱 이름 '날씨각'·해 아이콘·스플래시, 위치 찾기 10초 제한, 첫 로딩 덮개가 안 걷히던 것 수정
No files matched your search
@@ -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",
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<svg width="652" height="606" viewBox="0 0 652 606" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M353.554 0H298.446C273.006 0 249.684 14.6347 237.962 37.9539L4.37994 502.646C-1.04325 513.435 -1.45067 526.178 3.2716 537.313L22.6123 582.918C34.6475 611.297 72.5404 614.156 88.4414 587.885L309.863 222.063C313.34 216.317 319.439 212.826 326 212.826C332.561 212.826 338.659 216.317 342.137 222.063L563.559 587.885C579.46 614.156 617.352 611.297 629.388 582.918L648.728 537.313C653.451 526.178 653.043 513.435 647.62 502.646L414.038 37.9539C402.316 14.6347 378.994 0 353.554 0Z" fill="white"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 52 KiB |
@@ -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"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 780 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 324 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 347 B |
|
Before Width: | Height: | Size: 468 B |
|
Before Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 58 KiB |
@@ -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;
|
||||
|
||||
@@ -29,11 +29,16 @@ function readStored(): RegionData | null {
|
||||
}
|
||||
}
|
||||
|
||||
/** 위치를 못 잡으면(실내·에뮬레이터) 끝없이 기다리지 않게 웹처럼 10초에 끊는다 */
|
||||
function withTimeout<T>(p: Promise<T>, ms: number): Promise<T> {
|
||||
return Promise.race([p, new Promise<never>((_, reject) => setTimeout(() => reject(new Error('위치 찾기 시간 초과')), ms))]);
|
||||
}
|
||||
|
||||
/** 위치 권한을 받아 가장 가까운 구. 권한이 없으면 'denied' */
|
||||
async function findNearest(): Promise<RegionData | 'denied'> {
|
||||
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;
|
||||
|
||||