@@ -3,7 +3,7 @@ title = 'We Need Your Help!';
33options = {
44 body : '' ,
55 icon : '/images/logo-192x192.png' ,
6- sound : '/sounds/alert.wav ' ,
6+ sound : '/sounds/alert.mp3 ' ,
77 actions : [
88 {
99 action : 'review' ,
@@ -13,18 +13,16 @@ options = {
1313 tag : 'help-notification' ,
1414 vibrate : [ 500 , 110 , 500 , 110 , 450 ]
1515 } ;
16- function helpNotification ( name , id ) {
16+ function updateHelpNotificationData ( name , id ) {
1717 if ( name == '404' )
1818 options . body = '' ;
1919 else {
2020 reviewRedirect = 'location/rating/' + id + '/5' ;
2121 options . body = 'Would you like to add a review to ' + name + '?' ;
2222 }
23- //self.registration.showNotification(title, options);
2423} ;
2524
26- function sendNotification ( ) {
27- //check to send here
25+ function sendHelpNotification ( ) {
2826 sendMessage ( { type : 'refresh' } ) ;
2927 if ( options . body !== '' )
3028 self . registration . showNotification ( title , options ) ;
@@ -64,9 +62,6 @@ self.addEventListener('activate', function(e) {
6462 console . log ( 'Service Worker Activated' ) ;
6563} )
6664
67- self . addEventListener ( 'fetch' , function ( e ) {
68- //console.log('fetching '+e);
69- } )
7065
7166self . addEventListener ( 'notificationclick' , function ( e ) {
7267 switch ( e . action ) {
@@ -81,10 +76,10 @@ self.addEventListener('notificationclick', function(e) {
8176} )
8277
8378self . addEventListener ( 'message' , function ( e ) {
84- helpNotification ( e . data . name , e . data . id ) ;
79+ updateHelpNotificationData ( e . data . name , e . data . id ) ;
8580} )
8681
8782//send first notification
88- setTimeout ( sendNotification , 5000 ) ;
83+ setTimeout ( sendHelpNotification , 5000 ) ;
8984//Starting the push notification clock
90- setTimeout ( setInterval ( sendNotification , 3600000 ) , 5000 ) ;
85+ setTimeout ( setInterval ( sendHelpNotification , 3600000 ) , 5000 ) ;
0 commit comments