feat(push): 新增iOS APNs推送通知功能
- 添加推送通知管理器和设备令牌管理 - 实现推送通知权限请求和令牌注册 - 新增推送通知设置页面 - 集成推送通知初始化到应用启动流程 - 添加推送通知API服务和本地存储管理 - 更新个人页面添加推送通知设置入口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ThemedView } from '@/components/ThemedView';
|
||||
import { ROUTES } from '@/constants/Routes';
|
||||
import { usePushNotifications } from '@/hooks/usePushNotifications';
|
||||
import { useThemeColor } from '@/hooks/useThemeColor';
|
||||
import { preloadUserData } from '@/store/userSlice';
|
||||
import { router } from 'expo-router';
|
||||
@@ -12,6 +13,7 @@ export default function SplashScreen() {
|
||||
const backgroundColor = useThemeColor({}, 'background');
|
||||
const primaryColor = useThemeColor({}, 'primary');
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const { initializePushNotifications } = usePushNotifications();
|
||||
|
||||
useEffect(() => {
|
||||
checkOnboardingStatus();
|
||||
@@ -24,6 +26,12 @@ export default function SplashScreen() {
|
||||
await preloadUserData();
|
||||
console.log('用户数据预加载完成');
|
||||
|
||||
// 初始化推送通知(不阻塞应用启动)
|
||||
console.log('开始初始化推送通知...');
|
||||
initializePushNotifications().catch((error) => {
|
||||
console.warn('推送通知初始化失败,但不影响应用正常使用:', error);
|
||||
});
|
||||
|
||||
// const onboardingCompleted = await AsyncStorage.getItem(ONBOARDING_COMPLETED_KEY);
|
||||
|
||||
// if (onboardingCompleted === 'true') {
|
||||
|
||||
Reference in New Issue
Block a user