Notifications: Fix opening PWA from push on Android (#1544)
This commit is contained in:
parent
e2a79b9d7f
commit
9b4cad1e23
@ -180,19 +180,21 @@ async function focusChatMessage(client: WindowClient, data: { chatId?: string; m
|
|||||||
messageId,
|
messageId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Catch "focus not allowed" DOM Exceptions
|
if (!client.focused) {
|
||||||
try {
|
// Catch "focus not allowed" DOM Exceptions
|
||||||
await client.focus();
|
try {
|
||||||
} catch (error) {
|
await client.focus();
|
||||||
if (DEBUG) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
if (DEBUG) {
|
||||||
console.warn('[SW] ', error);
|
// eslint-disable-next-line no-console
|
||||||
|
console.warn('[SW] ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleNotificationClick(e: NotificationEvent) {
|
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.
|
e.notification.close(); // Android needs explicit close.
|
||||||
const { data } = e.notification;
|
const { data } = e.notification;
|
||||||
const notifyClients = async () => {
|
const notifyClients = async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user