v0.12.26 iOS notification bug fix
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user