v0.12.15 PWA bug and schema error for GM

This commit is contained in:
2026-03-24 08:58:09 -04:00
parent 117b5cbe4c
commit 7c0c3e1132
6 changed files with 94 additions and 68 deletions

View File

@@ -121,10 +121,9 @@ export default function Chat() {
const reg = await navigator.serviceWorker.ready;
if (Notification.permission !== 'granted') {
const granted = await Notification.requestPermission();
if (granted !== 'granted') return;
}
// Never auto-request permission — that triggers a dialog on PWA launch.
// Permission is requested explicitly from the Notifications tab in the profile modal.
if (Notification.permission !== 'granted') return;
// Do NOT call deleteToken() here. Deleting the token on every page load (or
// every visibility-change) forces Chrome to create a new Web Push subscription
@@ -174,8 +173,13 @@ export default function Chat() {
const handleVisibility = () => {
if (document.visibilityState === 'visible') registerPush();
};
const handlePushInit = () => registerPush();
document.addEventListener('visibilitychange', handleVisibility);
return () => document.removeEventListener('visibilitychange', handleVisibility);
window.addEventListener('rosterchirp:push-init', handlePushInit);
return () => {
document.removeEventListener('visibilitychange', handleVisibility);
window.removeEventListener('rosterchirp:push-init', handlePushInit);
};
}, []);
// When a message is deleted, update the sidebar preview immediately.