From 076791c52fc87b430e2bd0d36e5ef6fa11d6a782 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Mon, 1 Dec 2025 18:06:09 +0700 Subject: yay it works. changes to notification permission request --- frontend/start.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'frontend/start.js') diff --git a/frontend/start.js b/frontend/start.js index 21c5a6d..5c9fc5d 100644 --- a/frontend/start.js +++ b/frontend/start.js @@ -8,14 +8,19 @@ console.log(urlParams); startUpdateMachines(); -const notbtn = document.getElementById("notbtn") +const notbtn = document.getElementById("notbtn"); +const startbtn = document.getElementById("startbtn"); notbtn.addEventListener("click", () => requestPermission()) async function requestPermission() { console.log("Requesting permission..."); - const onesig_res = await OneSignal.Notifications.requestPermission(); - alert(onesig_res); + const onesignal_result = await OneSignal.Notifications.requestPermission(); + if (onesignal_result) { + notif.remove(); + startbtn.disabled = false; + } } const notif = document.getElementById("notif-panel"); -if (Notification.permission == 'granted') { +if (OneSignal.Notifications.permission) { notif.remove(); + startbtn.disabled = false; } -- cgit v1.2.3