Comparing version 2.0.1 to 2.1.0
@@ -0,0 +0,0 @@ # MPNS: Changelog |
@@ -41,2 +41,8 @@ // Copyright Jeff Wilcox | ||
var IconicTile = function(options) { | ||
options = options || {}; | ||
options.tileTemplate = 'IconicTile'; | ||
return new PushMessage('tile', '1', 'token', options); | ||
}; | ||
var RawNotification = function(payload, options) { | ||
@@ -282,2 +288,8 @@ if (options === undefined) { | ||
wrapValue(options, 'wideBackBackgroundImage', 'WideBackBackgroundImage') + | ||
wrapValue(options, 'backgroundColor', 'BackgroundColor') + | ||
wrapValue(options, 'iconImage', 'IconImage') + | ||
wrapValue(options, 'smallIconImage', 'SmallIconImage') + | ||
wrapValue(options, 'wideContent1', 'WideContent1') + | ||
wrapValue(options, 'wideContent2', 'WideContent2') + | ||
wrapValue(options, 'wideContent3', 'WideContent3') + | ||
getPushFooter(type); | ||
@@ -381,2 +393,13 @@ } | ||
], | ||
iconicTile: [ | ||
'backgroundColor', | ||
'count', | ||
'title', | ||
'iconImage', | ||
'smallIconImage', | ||
'wideContent1', | ||
'wideContent2', | ||
'wideContent3', | ||
'id' | ||
], | ||
ofInterest: [ | ||
@@ -390,3 +413,10 @@ 'payload', | ||
properties.flipTile = properties.flipTile.concat(properties.tile); | ||
properties.ofInterest = properties.ofInterest.concat(properties.toast, properties.flipTile); | ||
properties.ofInterest = properties.ofInterest.concat( | ||
properties.toast, properties.flipTile, properties.iconicTile); | ||
// Because of the fixed positions of the elements, addition of iconic tile | ||
// support introduces duplicate elements in ofInterest. Have to get rid of them. | ||
properties.ofInterest = properties.ofInterest.slice().sort().reduce(function (a, x) { | ||
if (a.slice(-1) != x) a.push(x); | ||
return a; | ||
}, []); | ||
@@ -402,2 +432,6 @@ module.exports = { | ||
sendIconicTile: function() { | ||
send('tile', properties.iconicTile, IconicTile, arguments); | ||
}, | ||
sendToast: function () { | ||
@@ -419,2 +453,6 @@ send('toast', properties.toast, Toast, arguments); | ||
createIconicTile: function() { | ||
return create('tile', properties.iconicTile, IconicTile, arguments); | ||
}, | ||
createToast: function () { | ||
@@ -421,0 +459,0 @@ return create('toast', properties.toast, Toast, arguments); |
{ | ||
"name": "mpns", | ||
"description": "A Node.js interface to the Microsoft Push Notification Service (MPNS) for Windows Phone.", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"author": "Jeff Wilcox <jeffwilcox+github@gmail.com>", | ||
@@ -21,2 +21,2 @@ "contributors": [ | ||
} | ||
} | ||
} |
@@ -72,2 +72,12 @@ #mpns | ||
Another format is called "iconic tile". This can be sent using `sendIconicTile` method with the following parameters: | ||
* `backgroundColor` hexadecimal color code in format ARGB | ||
* `count` the number that apper on the right of an icon | ||
* `title` the title of the tile | ||
* `iconImage` URI of the normal icon | ||
* `smallIconImage` URI of the icon for small tile | ||
* `wideContent1` top line of text shown in a wide tile | ||
* `wideContent2` second line of text | ||
* `wideContent3` third line of text | ||
### Sending a raw notification | ||
@@ -74,0 +84,0 @@ When creating the notification object, either provide the raw payload first, or as the `options.payload` property. |
@@ -0,0 +0,0 @@ // Copyright Jeff Wilcox |
@@ -82,2 +82,18 @@ // Copyright Jeff Wilcox | ||
test('IconicTileProperties', function () { | ||
assert.notEqual(mpns.Properties.iconicTile, null); | ||
assert.deepEqual(mpns.Properties.iconicTile.sort(), | ||
[ | ||
'count', | ||
'title', | ||
'id', | ||
'backgroundColor', | ||
'iconImage', | ||
'smallIconImage', | ||
'wideContent1', | ||
'wideContent2', | ||
'wideContent3' | ||
].sort()); | ||
}); | ||
test('OfInterestProperties', function () { | ||
@@ -103,2 +119,9 @@ assert.notEqual(mpns.Properties.ofInterest, null); | ||
'backgroundColor', | ||
'iconImage', | ||
'smallIconImage', | ||
'wideContent1', | ||
'wideContent2', | ||
'wideContent3', | ||
'text1', | ||
@@ -166,2 +189,24 @@ 'text2', | ||
}); | ||
}); | ||
test('CreateIconicTileWithObject', function () { | ||
var obj = { | ||
count: 1, | ||
title: 'hello', | ||
backgroundColor: '#FFAABBCC', | ||
iconImage: '/images/icon.png', | ||
smallIconImage: '/images/small-icon.png', | ||
wideContent1: 'wide content 1', | ||
wideContent2: 'wide content 2', | ||
wideContent3: 'wide content 3' | ||
}; | ||
var tile = mpns.createIconicTile(obj); | ||
assert.deepEqual(tile.count, obj.count); | ||
assert.deepEqual(tile.title, obj.title); | ||
assert.deepEqual(tile.backgroundColor, obj.backgroundColor); | ||
assert.deepEqual(tile.wideContent1, obj.wideContent1); | ||
assert.deepEqual(tile.wideContent2, obj.wideContent2); | ||
assert.deepEqual(tile.wideContent3, obj.wideContent3); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37524
666
194