Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions plugins/push/api/send/platforms/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const key = 'a';
* - has its own compilation part;
* - has its own sending part;
* - has no distinct representation in UI, therefore it's virtual.
*
*
* Huawei push is only available on select Android devices, therefore it doesn't deserve a separate checkbox in UI from users perspective.
* Yet notification payload, provider communication and a few other things are different, therefore it's a virtual platform. You can send to huawei directly using
* API, but whenever you send to Android you'll also send to huawei if Huawei credentials are set.
Expand All @@ -27,20 +27,20 @@ const virtuals = ['h'];

/**
* Extract token & field from token_session request
*
*
* @param {object} qstring request params
* @returns {string[]|undefined} array of [platform, field, token] if qstring has platform-specific token data, undefined otherwise
*/
function extractor(qstring) {
if (qstring.android_token !== undefined && (!qstring.token_provider || qstring.token_provider === 'FCM')) {
const token = qstring.android_token === 'BLACKLISTED' ? '' : qstring.android_token;
return [key, FIELDS['0'], token, util.hashInt(token)];
return [key, FIELDS['0'], token, util.hash(token)];
}
}

/**
* Make an estimated guess about request platform
*
*
* @param {string} userAgent user-agent header
* @returns {string} platform key if it looks like request made by this platform
*/
Expand All @@ -56,7 +56,7 @@ class FCM extends Splitter {
* Standard constructor
* @param {string} log logger name
* @param {string} type type of connection: ap, at, id, ia, ip, ht, hp
* @param {Credentials} creds FCM credentials
* @param {Credentials} creds FCM credentials
* @param {Object[]} messages initial array of messages to send
* @param {Object} options standard stream options
* @param {number} options.pool.pushes number of notifications which can be processed concurrently, this parameter is strictly set to 500
Expand Down Expand Up @@ -90,8 +90,8 @@ class FCM extends Splitter {
}

/**
* Compile & send messages
*
* Compile & send messages
*
* @param {Object[]} data pushes to send, no more than 500 per function call as enforced by stream writableHighWaterMark
* @param {integer} length number of bytes in data
* @returns {Promise} sending promise
Expand Down Expand Up @@ -217,7 +217,7 @@ class FCM extends Splitter {

/**
* Create new empty payload for the note object given
*
*
* @param {Message} msg NMessageote object
* @returns {object} empty payload object
*/
Expand All @@ -227,7 +227,7 @@ function empty(msg) {

/**
* Finish data object after setting all the properties
*
*
* @param {object} data platform-specific data to finalize
* @return {object} resulting object
*/
Expand Down Expand Up @@ -256,7 +256,7 @@ const fields = [
*/
const map = {
/**
* Sends sound
* Sends sound
* @param {Template} t template
* @param {string} sound sound string
*/
Expand All @@ -267,7 +267,7 @@ const map = {
},

/**
* Sends badge
* Sends badge
* @param {Template} t template
* @param {number} badge badge (0..N)
*/
Expand All @@ -278,7 +278,7 @@ const map = {
/**
* Sends buttons
* !NOTE! buttons & messagePerLocale are inter-dependent as buttons urls/titles are locale-specific
*
*
* @param {Template} t template
* @param {number} buttons buttons (1..2)
*/
Expand All @@ -290,7 +290,7 @@ const map = {

/**
* Set title string
*
*
* @param {Template} t template
* @param {String} title title string
*/
Expand All @@ -300,7 +300,7 @@ const map = {

/**
* Set message string
*
*
* @param {Template} t template
* @param {String} message message string
*/
Expand All @@ -310,7 +310,7 @@ const map = {

/**
* Send collapse_key.
*
*
* @param {Template} template template
* @param {boolean} ck collapseKey of the Content
*/
Expand All @@ -322,7 +322,7 @@ const map = {

/**
* Send timeToLive.
*
*
* @param {Template} template template
* @param {boolean} ttl timeToLive of the Content
*/
Expand All @@ -334,7 +334,7 @@ const map = {

/**
* Send notification-tap url
*
*
* @param {Template} template template
* @param {string} url on-tap url
*/
Expand All @@ -345,7 +345,7 @@ const map = {
/**
* Send media (picture, video, gif, etc) along with the message.
* Sets mutable-content in order for iOS extension to be run.
*
*
* @param {Template} template template
* @param {string} media attached media url
*/
Expand All @@ -355,7 +355,7 @@ const map = {

/**
* Sends custom data along with the message
*
*
* @param {Template} template template
* @param {Object} data data to be sent
*/
Expand All @@ -365,7 +365,7 @@ const map = {

/**
* Sends user props along with the message
*
*
* @param {Template} template template
* @param {[string]} extras extra user props to be sent
* @param {Object} data personalization
Expand All @@ -381,7 +381,7 @@ const map = {

/**
* Sends platform specific fields
*
*
* @param {Template} template template
* @param {object} specific platform specific props to be sent
*/
Expand Down Expand Up @@ -417,7 +417,7 @@ const CREDS = {
'fcm': class FCMCreds extends Creds {
/**
* Validation scheme of this class
*
*
* @returns {object} validateArgs scheme
*/
static get scheme() {
Expand All @@ -429,7 +429,7 @@ const CREDS = {

/**
* Check credentials for correctness, throw PushError otherwise
*
*
* @throws PushError in case the check fails
* @returns {undefined}
*/
Expand Down Expand Up @@ -469,7 +469,7 @@ const CREDS = {

/**
* "View" json, that is some truncated/simplified version of credentials that is "ok" to display
*
*
* @returns {object} json without sensitive information
*/
get view() {
Expand Down
Loading
Loading