Commit fec41f9a authored by Leonardo Bazico's avatar Leonardo Bazico
Browse files

Resolved conflict

parents 978bb7e8 7cce609a
Loading
Loading
Loading
Loading
+55 −35
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

## Installation

This requires phonegap/cordova CLI 5.0+ ( current stable v1.4.0 )
This requires phonegap/cordova CLI 5.0+ ( current stable v1.4.3 )

```
phonegap plugin add phonegap-plugin-push
@@ -66,7 +66,7 @@ Parameter | Description
`options` | `JSON Object` platform specific initialization options.
`options.android` | `JSON Object` Android specific initialization options.
`options.android.senderID` | `String` Maps to the project number in the Google Developer Console.
`options.android.icon` | `String` Optional. The name of a drawable resource to use as the small-icon.
`options.android.icon` | `String` Optional. The name of a drawable resource to use as the small-icon. The name should not include the extension.
`options.android.iconColor` | `String` Optional. Sets the background color of the small icon on Android 5.0 and greater. [Supported Formats](http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String))
`options.android.sound` | `Boolean` Optional. If `true` it plays the sound specified in the push data or the default system sound. Default is `true`.
`options.android.vibrate` | `Boolean` Optional. If `true` the device vibrates on receipt of notification. Default is `true`.
@@ -158,6 +158,26 @@ push.on('error', function(e) {
});
```

### push.off(event, handle)

Parameter | Description
--------- | ------------
`event` | `String` Name of the event type. The possible event names are the same as for the ```push.on``` function.
`handle` | `Function` handle to the function to get removed.

#### Example
```javascript
var eventHandler = function(data){ /*...*/};

//Adding handler for notification event
push.on('notification', eventHandler);

//Removing handler for notification event
push.off('notification', eventHandler);
```

As stated in the example, you will have to store your event handler if you are planning to remove it.

### push.unregister(successHandler, errorHandler)

The unregister method is used when the application no longer wants to receive push notifications.
@@ -501,7 +521,7 @@ Execution failed for task ':processDebugManifest'.

Then you can add the following entry into your config.xml file in the android platform tag.

```
```xml
<platform name="android">
    <preference name="android-minSdkVersion" value="15"/>
 </platform>
+1 −1
Original line number Diff line number Diff line
{
    "name": "phonegap-plugin-push",
    "description": "Register and receive push notifications.",
    "version": "1.4.0",
    "version": "1.4.3",
    "homepage": "http://github.com/phonegap/phonegap-plugin-push#readme",
    "repository": {
        "type": "git",
+12 −7
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
    xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads"
    xmlns:rim="http://www.blackberry.com/ns/widgets"
    id="phonegap-plugin-push"
    version="1.4.0">
    version="1.4.3">

  <name>PushPlugin</name>
	<author>Bob Easterday</author>
@@ -71,9 +71,14 @@
                <intent-filter>
                    <action android:name="com.google.android.gms.iid.InstanceID"/>
                </intent-filter>
            </service>
            <service
                android:name="com.adobe.phonegap.push.RegistrationIntentService"
                android:exported="false">
            </service>
		</config-file>

        <framework src="push.gradle" custom="true" type="gradleReference" />
        <framework src="com.android.support:support-v13:23+" />
        <framework src="com.google.android.gms:play-services-gcm:+" />

@@ -82,6 +87,7 @@
		<source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/adobe/phonegap/push/PushPlugin.java" target-dir="src/com/adobe/phonegap/push/" />
        <source-file src="src/android/com/adobe/phonegap/push/RegistrationIntentService.java" target-dir="src/com/adobe/phonegap/push/" />

	</platform>

@@ -100,7 +106,6 @@
            </array>
        </config-file>

                <!-- Plugin Code -->
		<source-file src="src/ios/AppDelegate+notification.m" />
		<source-file src="src/ios/PushPlugin.m" />

push.gradle

0 → 100644
+21 −0
Original line number Diff line number Diff line
import java.util.regex.Pattern

def doExtractStringFromManifest(name) {
    def manifestFile = file(android.sourceSets.main.manifest.srcFile)
    def pattern = Pattern.compile(name + "=\"(.*?)\"")
    def matcher = pattern.matcher(manifestFile.getText())
    matcher.find()
    return matcher.group(1)
}

android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
        }
    }

    defaultConfig {
        applicationId = doExtractStringFromManifest("package")
    }
}
 No newline at end of file
+84 −40
Original line number Diff line number Diff line
@@ -162,5 +162,49 @@ describe('phonegap-plugin-push', function() {
                });
            });
        });

        describe('off "notification" event', function () {
            it('should exist and be registered a callback handle', function (done) {
                var push = PushNotification.init(options),
                    eventHandler = function () {
                    };

                push.on('notification', eventHandler);

                push.off('notification', eventHandler);

                expect(push._handlers.notification.indexOf(eventHandler)).toEqual(-1);
                done();
            });
        });

        describe('off "registration" event', function () {
            it('should exist and be registered a callback handle', function (done) {
                var push = PushNotification.init(options),
                    eventHandler = function () {
                    };

                push.on('registration', eventHandler);

                push.off('registration', eventHandler);

                expect(push._handlers.registration.indexOf(eventHandler)).toEqual(-1);
                done();
            });
        });

        describe('off "error" event', function () {
            it('should exist and be registered a callback handle', function (done) {
                var push = PushNotification.init(options),
                    eventHandler = function () {
                    };

                push.on('error', eventHandler);
                push.off('error', eventHandler);

                expect(push._handlers.error.indexOf(eventHandler)).toEqual(-1);
                done();
            });
        });
    });
});
Loading