Notifications: Fix opening PWA from push on Android (#1544)

This commit is contained in:
Alexander Zinchuk 2021-11-17 17:49:35 +03:00
parent e2a79b9d7f
commit 9b4cad1e23

View File

@ -180,6 +180,7 @@ async function focusChatMessage(client: WindowClient, data: { chatId?: string; m
messageId,
},
});
if (!client.focused) {
// Catch "focus not allowed" DOM Exceptions
try {
await client.focus();
@ -189,10 +190,11 @@ async function focusChatMessage(client: WindowClient, data: { chatId?: string; m
console.warn('[SW] ', error);
}
}
}
}
export function handleNotificationClick(e: NotificationEvent) {
const appUrl = new URL(self.registration.scope).origin;
const appUrl = self.registration.scope;
e.notification.close(); // Android needs explicit close.
const { data } = e.notification;
const notifyClients = async () => {