UI Push Deep Links und Drive Diagnose verbessern
All checks were successful
CI / Build and Deploy (push) Successful in 2m30s

This commit is contained in:
jan
2026-05-06 00:11:33 +02:00
parent f87a82e02f
commit 6dec4b8a10
23 changed files with 491 additions and 81 deletions

View File

@@ -62,18 +62,27 @@ self.addEventListener("push", (event) => {
self.addEventListener("notificationclick", (event) => {
event.notification.close();
const targetUrl = new URL(event.notification.data?.url || "/", self.location.origin).href;
const targetUrl = new URL(event.notification.data?.url || "/", self.location.origin);
event.waitUntil(
clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => {
clients.matchAll({ type: "window", includeUncontrolled: true }).then(async (clientList) => {
for (const client of clientList) {
if ("focus" in client) {
client.navigate(targetUrl);
const clientUrl = new URL(client.url);
if (clientUrl.origin === targetUrl.origin && "focus" in client) {
if ("navigate" in client) {
await client.navigate(targetUrl.href).catch(() => null);
}
return client.focus();
}
}
return clients.openWindow(targetUrl);
if (clients.openWindow) {
return clients.openWindow(targetUrl.href);
}
return undefined;
})
);
});