Skip to content

Commit 7fd3089

Browse files
committed
On receiving webpush, simply sync() if message ID is unrecognized
1 parent 149ac57 commit 7fd3089

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

app/main.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,7 @@ function OneSignalLogin () {
449449
// Register handler for processing data received via web-push
450450
OneSignal.Notifications.addEventListener("foregroundWillDisplay", (notification) => {
451451
const payload = notification.notification.additionalData; // Access web-pushed data
452-
if (payload.webhook) return; // Ignore web-pushed data if webhook already received the data
453-
if ('data' in payload) {
454-
logThis(`Received via web-push: ${JSON.stringify(payload.data)}`);
455-
inbox([payload.data]);
456-
// If autoSync is on, still webhook didnt receive, then sync() to re-register webhook with Securelay.
457-
if (cache.getItem('autoSync') === 'on') sync();
458-
} else {
459-
sync();
460-
}
452+
if (! messagesReceived.includes(payload.id)) sync(); // Message not already received
461453
});
462454
});
463455
}

0 commit comments

Comments
 (0)