Skip to content

Commit

Permalink
Merge branch 'release/1.2.2' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Feng committed Jul 1, 2014
2 parents d3b02a9 + cf978d7 commit b9883e0
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (c) 2013-2014 StrongLoop, Inc.

loopback-push-notification uses a 'dual license' model. Users may use
loopback-push-notification under the terms of the Artistic 2.0 license, or under
loopback-component-push uses a 'dual license' model. Users may use
loopback-component-push under the terms of the Artistic 2.0 license, or under
the StrongLoop License. The text of both is included below.

Artistic License 2.0
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# LoopBack Push Notification
# LoopBack Push Notification Component

**NOTE: The loopback-component-push module supersedes [loopback-push-notification](https://www.npmjs.org/package/loopback-push-notification). Please update your package.json accordingly.**

This module provides a set of LoopBack models to enable mobile device push notifications.

Please see the full documentation: [Creating push notifications](http://docs.strongloop.com/display/DOC/Creating+push+notifications).
Please see the full documentation: [Creating push notifications](http://docs.strongloop.com/display/LB/Creating+push+notifications).

## Architecture

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class DemoActivity extends Activity {
* application you registered in your LoopBack server by calling
* Application.register().
*/
String LOOPBACK_APP_ID = "loopback-push-notification-app";
String LOOPBACK_APP_ID = "loopback-component-push-app";

/**
* Tag used on log messages.
Expand Down
2 changes: 1 addition & 1 deletion example/ios/apnagent/Settings.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>RootPath</key>
<string>http://demo.strongloop.com:3010/api</string>
<key>AppId</key>
<string>loopback-push-notification-app</string>
<string>loopback-component-push-app</string>
<key>AppVersion</key>
<string>1.0.0</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions example/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var app = module.exports = loopback();
// Load up the push data source as the example cannot declaratively define
// the push data source in datasources.json as it cannot resolve the connector
// module by name
var connector = require('loopback-push-notification');
var connector = require('loopback-component-push');
app.dataSources.push = loopback.createDataSource("push", {
"defaultForType": "push",
"connector": connector
Expand Down Expand Up @@ -165,7 +165,7 @@ function startPushServer() {
var config = require('./config');

var demoApp = {
id: 'loopback-push-notification-app',
id: 'loopback-component-push-app',
userId: 'strongloop',
name: config.appName,

Expand Down Expand Up @@ -215,7 +215,7 @@ function startPushServer() {
// the client settings
Application.beforeSave = function (next) {
if(this.name === demoApp.name) {
this.id = 'loopback-push-notification-app';
this.id = 'loopback-component-push-app';
}
next();
};
Expand Down
2 changes: 1 addition & 1 deletion example/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"loopback": "~1.7.0",
"loopback-push-notification": "~1.2.0",
"loopback-component-push": "~1.2.0",
"loopback-connector-mongodb": "~1.2.0"
},
"optionalDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/apns.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;

var debug = require('debug')('loopback-push-notification:provider:apns');
var debug = require('debug')('loopback:component:push:provider:apns');
var apn = require('apn');

function ApnsProvider(pushSettings) {
Expand Down
8 changes: 5 additions & 3 deletions lib/providers/gcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var inherits = require('util').inherits;
var extend = require('util')._extend;
var EventEmitter = require('events').EventEmitter;
var gcm = require('node-gcm');
var debug = require('debug')('loopback-push-notification:provider:gcm');
var debug = require('debug')('loopback:component:push:provider:gcm');

function GcmProvider(pushSettings) {
var settings = pushSettings.gcm || {};
Expand Down Expand Up @@ -58,8 +58,10 @@ GcmProvider.prototype._createMessage = function(notification) {
delayWhileIdle: notification.delayWhileIdle
});

Object.keys(notification).forEach(function(key) {
message.addData(key, notification[key]);
Object.keys(notification).forEach(function (key) {
if (notification[key] != null) {
message.addData(key, notification[key]);
}
});

return message;
Expand Down
2 changes: 1 addition & 1 deletion lib/push-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var format = require('util').format;
var async = require('async');
var providers = require('./providers');
var loopback = require('loopback');
var debug = require('debug')('loopback-push-notification:push-manager');
var debug = require('debug')('loopback:component:push:push-manager');

var Installation = require('../models/installation');
var Notification = require('../models/notification');
Expand Down
3 changes: 3 additions & 0 deletions models/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ var Notification = loopback.createModel(
}
);

// Avoid exposure of internal properties such __data
Notification.hideInternalProperties = true;

Notification.beforeCreate = function(next) {
var notification = this;
notification.created = notification.modified = notification.scheduledTime = new Date();
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "loopback-push-notification",
"version": "1.2.1",
"name": "loopback-component-push",
"version": "1.2.2",
"description": "Loopback Push Notification",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha --timeout 30000 test/*test.js"
},
"dependencies": {
"async": "~0.2.10",
"debug": "~0.7.4",
"apn": "~1.4.4",
"node-gcm": "~0.9.9",
"async": "~0.9.0",
"debug": "~1.0.2",
"apn": "~1.5.2",
"node-gcm": "~0.9.11",
"mpns": "~2.1.0"
},
"peerDependencies": {
Expand All @@ -19,7 +19,7 @@
"devDependencies": {
"loopback": "1.x >=1.7.0",
"loopback-connector-mongodb": "1.x",
"loopback-testing": "~0.1.2",
"loopback-testing": "~0.2.0",
"should": "*",
"mocha": "*",
"sinon": "*",
Expand All @@ -28,11 +28,11 @@
},
"repository": {
"type": "git",
"url": "https://github.com/strongloop/loopback-push-notification.git"
"url": "https://github.com/strongloop/loopback-component-push.git"
},
"license": {
"name": "Dual Artistic-2.0/StrongLoop",
"url": "https://github.com/strongloop/loopback-push-notification/blob/master/LICENSE"
"url": "https://github.com/strongloop/loopback-component-push/blob/master/LICENSE"
}

}

0 comments on commit b9883e0

Please sign in to comment.