This commit is contained in:
1
2026-01-30 16:34:40 +08:00
parent d08deef478
commit 0c71494815
9 changed files with 193 additions and 156 deletions

View File

@@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native';
import { useRouter } from 'expo-router';
import { getOnboardingCompleted, getConsentAccepted } from '@/src/storage/appStorage';
import { getOnboardingCompleted, getConsentAccepted, setOnboardingCompleted } from '@/src/storage/appStorage';
/**
* 启动分发:根据 consent 和 onboarding 状态跳转
@@ -13,10 +13,19 @@ export default function Index() {
useEffect(() => {
let cancelled = false;
(async () => {
// 临时重置引导页状态(开发调试用)
await setOnboardingCompleted(false);
// 1. 检查是否同意协议
const consentAccepted = await getConsentAccepted();
if (cancelled) return;
if (!consentAccepted) {
router.replace('/(splash)/splash');
return;
}
if (cancelled) return;
if (!consentAccepted) {
router.replace('/(splash)/splash');
return;