fix:后端错误

This commit is contained in:
吕新雨
2026-02-10 16:47:18 +08:00
parent 1fbc0aa3f8
commit dec3ac82e1
5 changed files with 29 additions and 14 deletions

View File

@@ -87,6 +87,17 @@ export default function RootLayout() {
});
}, []);
useEffect(() => {
// 兜底:当用户在系统弹窗/系统设置里变更权限后App 回到前台时再同步一次 token
const sub = AppState.addEventListener('change', (state) => {
if (state !== 'active') return;
ensurePushTokenRegisteredIfPermitted().catch(() => {
// ignore不阻塞
});
});
return () => sub.remove();
}, []);
useEffect(() => {
// 字体与 i18n 都准备好后,允许渲染 App原生 splash 的隐藏交给 onLayout避免“硬切/闪白”)
if (loaded && i18nReady) setAppReady(true);