File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11var notify = { } ;
22
3- ( async function ( ) {
4- notify . permission = await Notification . requestPermission ( ) ;
5- } ) ( ) ;
6-
73var lastNotifcation = null ;
84
5+ notify . requestPermission = async function ( ) {
6+ try {
7+ notify . permission = await Notification . requestPermission ( ) ;
8+ } catch ( e ) { }
9+ } ;
10+
911notify . sendIfNotOnScreen = function ( tag , message , title = "Random Rants +" ) {
1012 if ( document . visibilityState !== "visible" ) {
1113 if ( lastNotifcation ) {
Original file line number Diff line number Diff line change 22var elements = require ( "../../gp2/elements.js" ) ;
33var accountHelper = require ( "../../accounthelper/index.js" ) ;
44var dialogs = require ( "../../dialogs.js" ) ;
5+ var notify = require ( "./notify.js" ) ;
56var session = accountHelper . getCurrentValidationState ( ) ;
67var ASK_STORAGE_ID = "pushNotificationsDialogNoShow" ;
78
@@ -32,6 +33,7 @@ var pushPromptCloseButtonNoShow = elements.getGPId("pushPromptCloseButtonNoShow"
3233 subscribing = true ;
3334 activatePushButton . textContent = "Now click the *real* allow button!" ;
3435 try {
36+ await notify . requestPermission ( ) ;
3537 await accountHelper . pushNotificationHelper . subscribe ( true ) ;
3638 activatePushDialog . hidden = true ;
3739 dialogs . alert ( "Registered push notification subscription successfully!" ) ;
@@ -56,6 +58,7 @@ var pushPromptCloseButtonNoShow = elements.getGPId("pushPromptCloseButtonNoShow"
5658 }
5759 } else {
5860 localStorage . removeItem ( ASK_STORAGE_ID ) ;
61+ await notify . requestPermission ( ) ;
5962 }
6063
6164 }
Original file line number Diff line number Diff line change 1- {"timestamp" :" 1770737002846 " }
1+ {"timestamp" :" 1770737157769 " }
You can’t perform that action at this time.
0 commit comments