v0.12.26 iOS notification bug fix

This commit is contained in:
2026-03-28 14:51:00 -04:00
parent f40bb123d2
commit 252c0e09cb
5 changed files with 43 additions and 9 deletions

View File

@@ -262,7 +262,15 @@ export default function Chat() {
const handleVisibility = () => {
if (document.visibilityState === 'visible') registerPush();
};
const handlePushInit = () => registerPush();
// When the user explicitly requests push (via the Notifications toggle or
// re-register button), ask for permission if it hasn't been granted yet.
const handlePushInit = async () => {
if (typeof Notification !== 'undefined' && Notification.permission === 'default') {
const result = await Notification.requestPermission();
if (result !== 'granted') return;
}
registerPush();
};
document.addEventListener('visibilitychange', handleVisibility);
window.addEventListener('rosterchirp:push-init', handlePushInit);
return () => {