Skip to content

Commit

Permalink
shot in the dark testing changes for notifications bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian committed Feb 16, 2024
1 parent 72cfa15 commit 394db40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion webtexting-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ self.addEventListener('push', function (event) {
});

self.addEventListener('notificationclick', function (event) {
e.notification.close();
event.notification.close();
event.waitUntil(
self.clients.matchAll().then(function (clientList) {
var tab = clientList.some(function (client) {
Expand Down
4 changes: 3 additions & 1 deletion webtexting.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function toggleNotifications() {
method: "POST",
body: JSON.stringify({
endpoint: subscription.toJSON(),
state: currentState == "on" || currentState == "all" ? "off" : "on",
state: (currentState == "on" || currentState == "all") ? "off" : "on",
extension_uuid: window.notification_data.extension_uuid,
remote_identifier: window.notification_data.remote_identifier,
}),
Expand Down Expand Up @@ -104,10 +104,12 @@ if (window.notification_data) {
const state = await registration.pushManager.permissionState({userVisibleOnly:true});
console.log("push notification permission state:", state);
if (state == "denied") {
console.log("Push notification permissions denied. Please contact [email protected].")
return;
}

var subscription = await registration.pushManager.getSubscription();
console.log("permissionState = " , permissionState)
var buttonState = {state: "off"};
if(subscription) {
console.log(subscription.toJSON());
Expand Down

0 comments on commit 394db40

Please sign in to comment.