feat: 앱을 날씨각 웹(weather.o2o.kr)을 띄우는 웹뷰 셸로 전환 (안드로이드) — 전체 화면 웹뷰·뒤로 가기·실패 화면, 구글 로그인·위치·공유 브리지, 앱 링크(assetlinks·인텐트 필터)·nalssigak:// 링크 열기, 안전 영역은 웹이 처리하도록 패딩 없음. 푸시·iOS 는 제외, expo-file-system 추가
This commit is contained in:
1 parent
2a94ebe85b
commit
a228fcf560
8 files changed
+288
-46
No files matched your search
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 들어오는 링크(nalssigak://…, https://weather.o2o.kr/…)를 Expo Router 경로로 읽지 않고 항상 '/' 로 돌린다.
|
||||
* 안 그러면 사이트 주소(/today/…)가 앱 경로로 읽혀 'Unmatched Route' 화면이 셸을 덮는다.
|
||||
* 링크는 웹 셸(components/web-shell.tsx)이 Linking 으로 직접 받아 웹뷰에서 연다.
|
||||
*/
|
||||
export function redirectSystemPath() {
|
||||
return '/';
|
||||
}
|
||||
+17
-46
@@ -1,59 +1,30 @@
|
||||
import '@/lib/api';
|
||||
import { BagelFatOne_400Regular } from '@expo-google-fonts/bagel-fat-one';
|
||||
import { GowunBatang_400Regular } from '@expo-google-fonts/gowun-batang';
|
||||
import { Jua_400Regular, useFonts } from '@expo-google-fonts/jua';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { Stack } from 'expo-router';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
|
||||
import '@/global.css';
|
||||
import { SkyBg } from '@/components/sky-bg';
|
||||
import { FirstLoad } from '@/components/first-load';
|
||||
import { SheetProvider } from '@/components/sheets';
|
||||
import { AuthProvider } from '@/lib/auth';
|
||||
import { LevelWatcher } from '@/lib/level';
|
||||
import { queryClient } from '@/lib/query-client';
|
||||
import { RegionProvider } from '@/lib/region';
|
||||
import { SkyProvider, useSky } from '@/lib/sky';
|
||||
import { WebShell } from '@/components/web-shell';
|
||||
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
|
||||
function Shell() {
|
||||
const { kind } = useSky();
|
||||
return (
|
||||
<View className="flex-1">
|
||||
<SkyBg />
|
||||
<StatusBar style={kind === 'night' ? 'light' : 'dark'} />
|
||||
{/* 탭 묶음 위에 사주·게임 같은 탭 밖 화면이 쌓인다. 하늘 배경이 비치게 화면 바탕은 투명 */}
|
||||
<Stack screenOptions={{ headerShown: false, contentStyle: { backgroundColor: 'transparent' } }}>
|
||||
<Stack.Screen name="(tabs)" />
|
||||
</Stack>
|
||||
<FirstLoad />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
/** 웹이 뜨지 않아도 시작 화면에 갇히지 않게 하는 최대 대기 시간 */
|
||||
const SPLASH_MAX_MS = 8000;
|
||||
|
||||
/** 앱은 날씨각 웹을 띄우는 껍데기 하나뿐이다. 화면 이동은 모두 웹이 한다 */
|
||||
export default function RootLayout() {
|
||||
const [loaded, error] = useFonts({ Jua_400Regular, BagelFatOne_400Regular, GowunBatang_400Regular });
|
||||
const hideSplash = useCallback(() => {
|
||||
SplashScreen.hideAsync().catch((e: unknown) => console.warn('[splash] 숨기지 못함', e));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (loaded || error) SplashScreen.hideAsync();
|
||||
}, [loaded, error]);
|
||||
if (!loaded && !error) return null;
|
||||
const t = setTimeout(hideSplash, SPLASH_MAX_MS);
|
||||
return () => clearTimeout(t);
|
||||
}, [hideSplash]);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SkyProvider>
|
||||
<AuthProvider>
|
||||
<RegionProvider>
|
||||
<SheetProvider>
|
||||
<LevelWatcher />
|
||||
<Shell />
|
||||
</SheetProvider>
|
||||
</RegionProvider>
|
||||
</AuthProvider>
|
||||
</SkyProvider>
|
||||
</QueryClientProvider>
|
||||
<>
|
||||
<StatusBar style="dark" />
|
||||
<WebShell onReady={hideSplash} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user