Commits

lissyx committed 40eb25c Draft

Bug 968955 - Register and send back timestamp of Notification

Comments (0)

Files changed (4)

b2g/chrome/content/shell.js

             lang: listener.lang,
             dir: listener.dir,
             id: listener.id,
-            tag: listener.tag
+            tag: listener.tag,
+            timestamp: listener.timestamp
           },
           Services.io.newURI(listener.target, null, null),
           Services.io.newURI(listener.manifestURL, null, null)
                                                     uid,
                                                     bidi,
                                                     lang,
-                                                    manifestUrl) {
+                                                    manifestUrl,
+                                                    timestamp) {
     function send(appName, appIcon) {
       shell.sendChromeEvent({
         type: "desktop-notification",
         lang: lang,
         appName: appName,
         appIcon: appIcon,
-        manifestURL: manifestUrl
+        manifestURL: manifestUrl,
+        timestamp: timestamp
       });
     }
 
       lang: details.lang || undefined,
       id: details.id || undefined,
       dir: details.dir || undefined,
-      tag: details.tag || undefined
+      tag: details.tag || undefined,
+      timestamp: details.timestamp || undefined
     };
     this.registerAppListener(data.uid, listener);
 
     this.showNotification(data.imageURL, data.title, data.text,
                           details.textClickable, null,
                           data.uid, details.dir,
-                          details.lang, details.manifestURL);
+                          details.lang, details.manifestURL,
+                          details.timestamp);
   },
 }
 

b2g/components/AlertsService.js

       lang: aDetails.lang || undefined,
       id: aDetails.id || undefined,
       dir: aDetails.dir || undefined,
-      tag: aDetails.tag || undefined
+      tag: aDetails.tag || undefined,
+      timestamp: aDetails.timestamp || undefined
     };
 
     cpmm.sendAsyncMessage("app-notification-send", {
             lang: listener.lang,
             dir: listener.dir,
             id: listener.id,
-            tag: listener.tag
+            tag: listener.tag,
+            timestamp: listener.timestamp
           },
           Services.io.newURI(data.target, null, null),
           Services.io.newURI(listener.manifestURL, null, null));

dom/src/notification/ChromeNotifications.js

           id: notification.alertName,
           dir: notification.dir,
           lang: notification.lang,
-          tag: notification.tag
+          tag: notification.tag,
+          timestamp: notification.timestamp
         }
       );
       this.resentNotifications++;

dom/src/notification/NotificationStorage.js

       body: body,
       tag: tag,
       icon: icon,
-      alertName: alertName
+      alertName: alertName,
+      timestamp: new Date().getTime()
     };
 
     this._notifications[id] = notification;