Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version bumping to latest #375

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
95 changes: 47 additions & 48 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
allow-deny@1.0.5
babel-compiler@6.8.4
babel-runtime@0.1.9_1
base64@1.0.9
binary-heap@1.0.9
blaze@2.1.8
blaze-tools@1.0.9
boilerplate-generator@1.0.9
callback-hook@1.0.9
check@1.2.3
ddp@1.2.5
ddp-client@1.2.9
ddp-common@1.2.6
ddp-server@1.2.9
deps@1.0.12
diff-sequence@1.0.6
ecmascript@0.4.7
ecmascript-runtime@0.2.12
ejson@1.0.12
geojson-utils@1.0.9
html-tools@1.0.10
htmljs@1.0.10
id-map@1.0.8
jquery@1.11.9
logging@1.0.14
meteor@1.1.16
minimongo@1.0.17
modules@0.6.5
modules-runtime@0.6.5
mongo@1.1.9_1
mongo-id@1.0.5
npm-mongo@1.4.45
observe-sequence@1.0.12
ordered-dict@1.0.8
promise@0.7.3
raix:eventemitter@0.1.3
raix:eventstate@0.0.2
raix:push@3.1.0-pre.1
random@1.0.10
reactive-var@1.0.10
retry@1.0.8
routepolicy@1.0.11
spacebars@1.0.12
spacebars-compiler@1.0.12
tracker@1.0.14
ui@1.0.11
underscore@1.0.9
webapp@1.2.10
allow-deny@1.1.0
babel-compiler@7.5.3
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
boilerplate-generator@1.7.1
callback-hook@1.3.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-server@2.3.2
diff-sequence@1.1.1
dynamic-import@0.5.2
ecmascript@0.14.3
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.11.0
ecmascript-runtime-server@0.10.0
ejson@1.1.1
fetch@0.1.1
geojson-utils@1.0.10
id-map@1.1.0
inter-process-messaging@0.1.1
logging@1.1.20
meteor@1.9.3
minimongo@1.6.0
modern-browsers@0.1.5
modules@0.15.0
modules-runtime@0.12.0
mongo@1.10.0
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@3.8.1
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
shivangkar:eventemitter@1.0.0
shivangkar:eventstate@1.0.0
shivangkar:push@1.0.1
socket-stream-client@0.3.1
tracker@1.2.0
underscore@1.0.10
webapp@1.9.1
webapp-hashing@1.0.9
128 changes: 37 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,98 +23,18 @@ Status:

We are using [semantic-release](https://github.com/semantic-release/semantic-release) following the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) - Following this pattern will result in better versioning, better changelog and shorter release cycle.

## Updates For Android 8.0
## Breaking changes in 4.X.X

Meteor must be version 1.6.1

Cordova Android must be version 6.3.0
Cordova IOS must be version 4.5.0

Meteor release 1.6.1 https://docs.meteor.com/changelog.html#changes-10
"The cordova-lib package has been updated to version 7.1.0, cordova-android has been updated to version 6.4.0 (plus one additional commit), and cordova-ios has been updated to version 4.5.4"

To verify the correct installation ADD phonegap-plugin-push@2.1.2 to your cordova plugins file.

After your app builds, Make the following changes to your build.gradle file. The simpliest solution to modify this file is in android studio.

The correct gradle file to modify has this line at the begining of the file:

apply plugin: 'com.android.application'

Add this two your dependencies:

```js
classpath 'com.google.gms:google-services:4.1.0' // I added both of these
classpath 'com.google.firebase:firebase-core:11.0.1' // I added both of these
```
At the end of your build.gradle file add:

```js
apply plugin: 'com.google.gms.google-services'
```
In case your run into errors with conflicting google libraries add:

```js
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}

configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
}
```
Other errors refer to:

https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#co-existing-with-plugins-that-use-firebase


Changes for the API:
On the client make sure you add a android channel:

```js
PushNotification.createChannel(
() => {
console.log('createChannel');
},
() => {
console.log('error');
},
{
id: Meteor.userId(), //Use any Id you prefer, but the same Id for this channel must be sent from the server,
description: 'Android Channel', //And any description your prefer
importance: 3,
vibration: true
}
);
```

Server changes:
Add the android_channel_id so the Push message like below:

```js
Push.send({
from: 'test',
title: 'test',
text: 'hello',
android_channel_id:this.userId, //The android channel should match the id on the client
query: {
userId: this.userId
},
gcm: {
style: 'inbox',
summaryText: 'There are %n% notifications'
},
});
```
If you are using apn options and upgrading from any lower version. You have to make changes in config of apn. New configs are listed below.

## Install
Meteor version should be ≥ 1.8.1

For lower versions of meteor please follow the **_Four changes you need to do in your project for meteor < 1.8.1_** section [here](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#installation-requirements).
```bash
$ meteor add raix:push
$ meteor add cordova:cordova-plugin-device@1.1.5
$ meteor add cordova:phonegap-plugin-push@1.5.2
# Note: you probably want to adjust the version numbers to the latest versions of the packages
$ meteor add cordova:cordova-plugin-device@1.1.6
$ meteor add cordova:phonegap-plugin-push@2.2.3
```

## Getting started
Expand All @@ -131,10 +51,9 @@ Read the [raix:push Newbie Manual](https://github.com/raix/push/wiki/raix:push-N
Or check out the [DEMO](https://github.com/elvismercado/meteor-raix-push-demo) by [@elvismercado](https://github.com/elvismercado)
(This example uses the deprecated config.push.json)

Example code for [sound](https://github.com/raix/push/issues/9#issuecomment-216068188) *(todo: add in docs)*
For implementation of Notification Channels, check out the **Raix:Push - Support for Android Channels** by [Shivang Kar](https://medium.com/fasal-engineering/raix-push-support-for-android-channels-f3060b1bb7db)

Note:
Version 3 uses the cordova npm plugin [phonegap-plugin-push](https://github.com/phonegap/phonegap-plugin-push#pushnotificationinitoptions)
Example code for [sound](https://github.com/raix/push/issues/9#issuecomment-216068188) *(todo: add in docs)*

Note:
Some of the documentation is outdated, please file an issue or create a pull request - same if you find a bug or want to add tests
Expand Down Expand Up @@ -180,7 +99,34 @@ App.configurePlugin('phonegap-plugin-push', {

### Server

For example in `Meteor.startup()` block of main.js
For example in `Meteor.startup()` block of main.js. *Version 4.0.0 and above*

```js
Push.Configure({
apn: {
cert: Assets.getText('apnDevCert.pem'),
key: Assets.getText('apnDevKey.pem'),
passphrase: 'xxxxxxxxx',
production: true,
topic: 'com.your.app.identifier' //required
//gateway: 'gateway.push.apple.com',
},
gcm: {
apiKey: 'xxxxxxx', // GCM/FCM server key
}
// production: true,
// 'sound' true,
// 'badge' true,
// 'alert' true,
// 'vibrate' true,
// 'sendInterval': 15000, Configurable interval between sending
// 'sendBatchSize': 1, Configurable number of notifications to send per batch
// 'keepNotifications': false,
//
});
```

For example in `Meteor.startup()` block of main.js. *Version 3.0.2 and below*

```js
Push.Configure({
Expand Down
34 changes: 33 additions & 1 deletion docs/ANDROID.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ For more info and checking the validity of a server key, reference [official doc
To show you app's icon in the notification you will have to prepare an image file with your icon in it and every else being transparent. You can see [here](https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/) how it can be done.


Then put the file (e.g. "logo.png") in your project directory under this path:
Then based on your meteor version put the file (e.g. "logo.png") in your project directory under this path:

__For meteor ≥ 1.8.1__
```
cordova-build-override/platforms/android/app/src/main/res/drawable/
```

__For meteor < 1.8.1__
```
cordova-build-override/platforms/android/res/drawable/
```
Expand All @@ -115,4 +121,30 @@ In your `Push.configure` block on the **client** you have to set the name of the
},

```

## Notification Sound

If you want to notify your users using a personalized sound, prepare a mp3 file (e.g. yellow.mp3).

Then based on your meteor version put that file in your project directory under this path:

__For meteor ≥ 1.8.1__
```
cordova-build-override/platforms/android/app/src/main/res/raw/
```

__For meteor < 1.8.1__
```
cordova-build-override/platforms/android/res/raw/
```

In your `Push.configure` block on the **client** you have to set the sound property:

```js
Push.Configure({
android: {
...
sound: 'yellow'
},

```
4 changes: 2 additions & 2 deletions lib/client/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var isConfigured = false;
Push.Configure = function(options) {
var self = this;

options = options || {};
options = options || {};

// check(options, {
// gcm: Match.Optional(Match.ObjectIncluding({
Expand Down Expand Up @@ -199,7 +199,7 @@ Push.Configure = function(options) {
});

options.iframe.addEventListener('pushError', function(evt) {
Push.emit('error', { type: 'cordova.browser', error: evt.error || evt });
Push.emit('error', { type: 'cordova.browser', error: evt.error || evt });
});

});
Expand Down
2 changes: 1 addition & 1 deletion lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ initPushUpdates = function(appName) {
console.log('Got token:', token);
}
// The app should be ready, lets call in
reportTokenToServer(token, appName || 'main');
reportTokenToServer(token, appName || 'main');
});

// Start listening for user updates if accounts package is added
Expand Down
10 changes: 5 additions & 5 deletions lib/common/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ Push.send = function(options) {
if (typeof options.contentAvailable !== 'undefined') {
notification.contentAvailable = options.contentAvailable;
}
if (typeof options.forceStart !== 'undefined') {
notification.forceStart = options.forceStart;
}

if (typeof options.forceStart !== 'undefined') {
notification.forceStart = options.forceStart;
}

notification.sent = false;
notification.sending = 0;
Expand Down Expand Up @@ -143,4 +143,4 @@ Push.deny = function(rules) {
}
});
}
};
};