This commit is contained in:
cpu
2025-03-28 05:50:28 +01:00
parent d1ad962ec3
commit 2e47461f34
5 changed files with 15 additions and 306 deletions

View File

@@ -101,7 +101,6 @@ async function subscribeToPush() {
return;
}
// Send to backend
await sendSubscriptionToServer(finalSubscription, buttonId);
} catch (error) {
@@ -154,7 +153,7 @@ async function sendSubscriptionToServer(subscription, buttonId) {
// Called by app.js when a message is received from the service worker
export function handleFlicAction(action, buttonId, timestamp) {
console.log(`[PushFlic] Received Action: ${action} from Button: ${buttonId}`);
console.log(`[PushFlic] Received Action: ${action} from Button: ${buttonId} at ${timestamp}`);
// Ignore actions from buttons other than the configured one
if (buttonId !== FLIC_BUTTON_ID) {
@@ -166,7 +165,17 @@ export function handleFlicAction(action, buttonId, timestamp) {
const handler = actionHandlers[action];
if (handler && typeof handler === 'function') {
console.log(`[PushFlic] Executing handler for ${action}`);
handler(); // Execute the handler registered in app.js
// Execute the handler registered in app.js
switch(action) {
case FLIC_ACTIONS.SINGLE_CLICK:
nextPlayer();
break;
case FLIC_ACTIONS.DOUBLE_CLICK:
previousPlayer();
break;
case FLIC_ACTIONS.HOLD:
togglePauseResume();
}
} else {
console.warn(`[PushFlic] No handler registered for action: ${action}`);
}