Skip to content

Commit

Permalink
Merge pull request #98 from deepmehtait/master
Browse files Browse the repository at this point in the history
Returns Meta data of notification
  • Loading branch information
avishayil authored Oct 28, 2016
2 parents e0ce095 + 8a0328f commit 8d5fbbd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,14 @@ Notifications.idsAvailable = function(idsAvailable) {

DeviceEventEmitter.addListener(DEVICE_NOTIF_EVENT, function(notifData) {
var message = notifData.message;
var hasAdditionalData = notifData.additionalData !== null && typeof notifData.additionalData === 'object';
var data = hasAdditionalData ? notifData.additionalData : null;
var data = null;
if (notifData.additionalData != null && notifData.additionalData != '{}') {
if (typeof notifData.additionalData === 'object') {
data = notifData.additionalData;
} else {
data = JSON.parse(notifData.additionalData);
}
}
var isActive = notifData.isActive;
Notifications._onNotificationOpened(message, data, isActive);
});
Expand Down

0 comments on commit 8d5fbbd

Please sign in to comment.