fix:推送权限弹窗时序问题

This commit is contained in:
jingyun committed 2026-09-01 15:03:27 +08:00
1 parent 33235f450b
commit afee4b5aec
2 files changed
+27 -5

No files matched your search

+8 -2
View File
@@ -23,9 +23,15 @@ abstract final class NotificationPermission {
return isGranted();
}
if (await isGranted() || !context.mounted) return true;
await showNotificationPermissionTip(context);
final tip = showNotificationPermissionTip(context);
await StorageService.to.setBool(storagePushPermissionPrompted, true);
return (await Permission.notification.request()).isGranted;
try {
// Match the legacy app's persistent top snackbar: keep the in-app
// explanation on screen until the system authorization dialog closes.
return (await Permission.notification.request()).isGranted;
} finally {
tip.remove();
}
}
/// 设置页不使用顶部说明;iOS/Android 都直接请求系统授权。