v0.12.15 PWA bug and schema error for GM
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user