'url-args' is required for safari website notifications
This commit is contained in:
Родитель
419027a18b
Коммит
38d2256360
|
@ -28,6 +28,8 @@ function Notification (payload) {
|
|||
this.compiled = false;
|
||||
|
||||
this.truncateAtWordEnd = false;
|
||||
|
||||
this.urlArgs = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,6 +56,7 @@ Notification.prototype.clone = function (device) {
|
|||
notification.contentAvailable = this.contentAvailable;
|
||||
notification.mdm = this.mdm;
|
||||
notification.truncateAtWordEnd = this.truncateAtWordEnd;
|
||||
notification.urlArgs = this.urlArgs;
|
||||
|
||||
return notification;
|
||||
};
|
||||
|
@ -208,10 +211,20 @@ Notification.prototype.setMDM = function (mdm) {
|
|||
* Set the 'truncateAtWordEnd' flag for truncation logic
|
||||
* @param {Boolean} [truncateAtWordEnd] Whether the truncateAtWordEnd flag should be set or not.
|
||||
*/
|
||||
|
||||
Notification.prototype.setTruncateAtWordEnd = function (truncateAtWordEnd) {
|
||||
this.truncateAtWordEnd = truncateAtWordEnd;
|
||||
return this;
|
||||
this.truncateAtWordEnd = truncateAtWordEnd;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the urlArgs for the notification
|
||||
* @param {Array} [urlArgs] The url args for the endpoint
|
||||
* @see The <a href="https://developer.apple.com/library/prerelease/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW12">Web Payload Documentation</a>
|
||||
* @since v1.4.1
|
||||
*/
|
||||
Notification.prototype.setUrlArgs = function (urlArgs) {
|
||||
this.urlArgs = urlArgs;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -354,6 +367,10 @@ Notification.prototype.toJSON = function () {
|
|||
if (this.newsstandAvailable || this.contentAvailable) {
|
||||
this.payload.aps['content-available'] = 1;
|
||||
}
|
||||
if (Array.isArray(this.urlArgs)) {
|
||||
this.payload.aps['url-args'] = this.urlArgs;
|
||||
}
|
||||
|
||||
return this.payload;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче