clean up
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user