This commit is contained in:
binwiederhier
2026-02-08 22:30:47 -05:00
parent c6ab380ea4
commit 4cd556f5aa
4 changed files with 8 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
// and cannot be used in the service worker
import emojisMapped from "./emojisMapped";
import { ACTION_COPY, ACTION_HTTP, ACTION_VIEW } from "./actions";
import { ACTION_HTTP, ACTION_VIEW } from "./actions";
const toEmojis = (tags) => {
if (!tags) return [];
@@ -82,7 +82,7 @@ export const toNotificationParams = ({ message, defaultTitle, topicRoute, baseUr
topicRoute,
},
actions: message.actions
?.filter(({ action }) => action === ACTION_VIEW || action === ACTION_HTTP || action === ACTION_COPY)
?.filter(({ action }) => action === ACTION_VIEW || action === ACTION_HTTP)
.map(({ label }) => ({
action: label,
title: label,

View File

@@ -12,15 +12,6 @@ const registerSW = () => {
return;
}
// Listen for messages from the service worker (e.g., "copy" action)
navigator.serviceWorker.addEventListener("message", (event) => {
if (event.data?.type === "copy" && event.data?.value) {
navigator.clipboard?.writeText(event.data.value).catch((e) => {
console.error("[ServiceWorker] Failed to copy to clipboard", e);
});
}
});
viteRegisterSW({
onRegisteredSW(swUrl, registration) {
console.log("[ServiceWorker] Registered:", { swUrl, registration });