feat: 앱 출시 빌드 설정(eas.json·권한 정리), 안드로이드 시트 키보드가 입력칸 가리던 것·첫 화면 테마 경고 수정
This commit is contained in:
1 parent
1bc39655c9
commit
dd2d02758b
5 files changed
+59
-9
No files matched your search
+11
-2
@@ -7,6 +7,16 @@ export type SkyApi = { kind: TimeKind; preview: TimeKind | null; setServerKind:
|
||||
|
||||
const SkyContext = createContext<SkyApi | null>(null);
|
||||
|
||||
/** 밤에만 어두운 테마 (기기 다크 모드와 상관없이 하늘 시간대를 따른다). 같으면 건드리지 않는다 */
|
||||
function applyTheme(kind: TimeKind) {
|
||||
const theme = kind === 'night' ? 'dark' : 'light';
|
||||
if (Uniwind.currentTheme !== theme) Uniwind.setTheme(theme);
|
||||
}
|
||||
|
||||
// 첫 화면을 그리기 전에 지금 시각의 테마로 맞춰, 그리는 도중에 테마가 바뀌지 않게 한다
|
||||
const t0 = kst(new Date());
|
||||
applyTheme(kindOfHour(t0.h, t0.mo, t0.mi));
|
||||
|
||||
export function useSky() {
|
||||
const ctx = use(SkyContext);
|
||||
if (!ctx) throw new Error('useSky must be used inside SkyProvider');
|
||||
@@ -23,8 +33,7 @@ export function SkyProvider({ children }: { children: ReactNode }) {
|
||||
}, []);
|
||||
const t = kst(now);
|
||||
const kind = preview ?? serverKind ?? kindOfHour(t.h, t.mo, t.mi);
|
||||
// 밤에만 어두운 테마 (기기 다크 모드와 상관없이 하늘 시간대를 따른다)
|
||||
useEffect(() => Uniwind.setTheme(kind === 'night' ? 'dark' : 'light'), [kind]);
|
||||
useEffect(() => applyTheme(kind), [kind]);
|
||||
const api = useMemo(() => ({ kind, preview, setPreview, setServerKind }), [kind, preview]);
|
||||
return <SkyContext value={api}>{children}</SkyContext>;
|
||||
}
|
||||
Reference in new issue
Block a user