Loading plugin.xml +12 −9 Changes for plugin.xml: 12 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.phonegap.plugins.PushPlugin" version="1.3.7"> version="2.0.0"> <name>PushPlugin</name> <author>Bob Easterday</author> Loading @@ -16,12 +16,16 @@ <asset src="www/PushNotification.js" target="PushNotification.js" /> <engines> <engine name="cordova" version="<3.0.0" /> <engine name="cordova" version=">=3.0.0" /> </engines> <!-- android --> <platform name="android"> <config-file target="res/xml/config.xml" parent="plugins"> <plugin name="PushPlugin" value="com.plugin.gcm.PushPlugin" /> <config-file target="res/xml/config.xml" parent="/*"> <feature name="PushPlugin" > <param name="android-package" value="com.plugin.gcm.PushPlugin"/> </feature> </config-file> <config-file target="AndroidManifest.xml" parent="/manifest"> Loading Loading @@ -57,12 +61,11 @@ <!-- ios --> <platform name="ios"> <!-- Cordova < 2.3 --> <plugins-plist key="PushPlugin" string="PushPlugin" /> <!-- Cordova >= 2.3 --> <config-file target="config.xml" parent="plugins"> <plugin name="PushPlugin" value="PushPlugin"/> <config-file target="config.xml" parent="/*"> <feature name="PushPlugin"> <param name="ios-package" value="PushPlugin"/> </feature> </config-file> <source-file src="src/ios/AppDelegate+notification.m" /> Loading src/android/com/plugin/gcm/PushPlugin.java +2 −2 Changes for src/android/com/plugin/gcm/PushPlugin.java: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ import android.os.Bundle; import android.util.Log; import org.apache.cordova.CordovaWebView; import org.apache.cordova.api.CallbackContext; import org.apache.cordova.api.CordovaPlugin; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import com.google.android.gcm.*; Loading src/ios/AppDelegate+notification.m +0 −1 Changes for src/ios/AppDelegate+notification.m: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -113,7 +113,6 @@ static char launchNotificationKey; - (void)dealloc { self.launchNotification = nil; // clear the association and release the object [super dealloc]; } @end src/ios/PushPlugin.h +3 −2 Changes for src/ios/PushPlugin.h: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #import <Foundation/Foundation.h> #import <Cordova/CDV.h> #import <Cordova/CDVPlugin.h> @interface PushPlugin : CDVPlugin { Loading @@ -40,10 +41,10 @@ @property (nonatomic, copy) NSString *notificationCallbackId; @property (nonatomic, copy) NSString *callback; @property (nonatomic, retain) NSDictionary *notificationMessage; @property (nonatomic, strong) NSDictionary *notificationMessage; @property BOOL isInline; - (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options; - (void)register:(CDVInvokedUrlCommand*)command; - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; - (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; Loading src/ios/PushPlugin.m +10 −14 Changes for src/ios/PushPlugin.m: 10 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -34,26 +34,20 @@ @synthesize notificationCallbackId; @synthesize callback; - (void)dealloc { [notificationMessage release]; self.notificationCallbackId = nil; self.callback = nil; [super dealloc]; } - (void)unregister:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options - (void)unregister:(CDVInvokedUrlCommand*)command; { self.callbackId = [arguments pop]; self.callbackId = command.callbackId; [[UIApplication sharedApplication] unregisterForRemoteNotifications]; [self successWithMessage:@"unregistered"]; } - (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options - (void)register:(CDVInvokedUrlCommand*)command; { self.callbackId = [arguments pop]; self.callbackId = command.callbackId; NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; Loading Loading @@ -97,11 +91,13 @@ [self notificationReceived]; // go ahead and process it } /* - (void)isEnabled:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; NSString *jsStatement = [NSString stringWithFormat:@"navigator.PushPlugin.isEnabled = %d;", type != UIRemoteNotificationTypeNone]; NSLog(@"JSStatement %@",jsStatement); } */ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { Loading Loading @@ -234,7 +230,7 @@ { CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; [self writeJavascript:[commandResult toSuccessCallbackString:self.callbackId]]; [self.commandDelegate sendPluginResult:commandResult callbackId:self.callbackId]; } -(void)failWithMessage:(NSString *)message withError:(NSError *)error Loading @@ -242,7 +238,7 @@ NSString *errorMessage = (error) ? [NSString stringWithFormat:@"%@ - %@", message, [error localizedDescription]] : message; CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage]; [self writeJavascript:[commandResult toErrorCallbackString:self.callbackId]]; [self.commandDelegate sendPluginResult:commandResult callbackId:self.callbackId]; } @end Loading
plugin.xml +12 −9 Changes for plugin.xml: 12 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.phonegap.plugins.PushPlugin" version="1.3.7"> version="2.0.0"> <name>PushPlugin</name> <author>Bob Easterday</author> Loading @@ -16,12 +16,16 @@ <asset src="www/PushNotification.js" target="PushNotification.js" /> <engines> <engine name="cordova" version="<3.0.0" /> <engine name="cordova" version=">=3.0.0" /> </engines> <!-- android --> <platform name="android"> <config-file target="res/xml/config.xml" parent="plugins"> <plugin name="PushPlugin" value="com.plugin.gcm.PushPlugin" /> <config-file target="res/xml/config.xml" parent="/*"> <feature name="PushPlugin" > <param name="android-package" value="com.plugin.gcm.PushPlugin"/> </feature> </config-file> <config-file target="AndroidManifest.xml" parent="/manifest"> Loading Loading @@ -57,12 +61,11 @@ <!-- ios --> <platform name="ios"> <!-- Cordova < 2.3 --> <plugins-plist key="PushPlugin" string="PushPlugin" /> <!-- Cordova >= 2.3 --> <config-file target="config.xml" parent="plugins"> <plugin name="PushPlugin" value="PushPlugin"/> <config-file target="config.xml" parent="/*"> <feature name="PushPlugin"> <param name="ios-package" value="PushPlugin"/> </feature> </config-file> <source-file src="src/ios/AppDelegate+notification.m" /> Loading
src/android/com/plugin/gcm/PushPlugin.java +2 −2 Changes for src/android/com/plugin/gcm/PushPlugin.java: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ import android.os.Bundle; import android.util.Log; import org.apache.cordova.CordovaWebView; import org.apache.cordova.api.CallbackContext; import org.apache.cordova.api.CordovaPlugin; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import com.google.android.gcm.*; Loading
src/ios/AppDelegate+notification.m +0 −1 Changes for src/ios/AppDelegate+notification.m: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -113,7 +113,6 @@ static char launchNotificationKey; - (void)dealloc { self.launchNotification = nil; // clear the association and release the object [super dealloc]; } @end
src/ios/PushPlugin.h +3 −2 Changes for src/ios/PushPlugin.h: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #import <Foundation/Foundation.h> #import <Cordova/CDV.h> #import <Cordova/CDVPlugin.h> @interface PushPlugin : CDVPlugin { Loading @@ -40,10 +41,10 @@ @property (nonatomic, copy) NSString *notificationCallbackId; @property (nonatomic, copy) NSString *callback; @property (nonatomic, retain) NSDictionary *notificationMessage; @property (nonatomic, strong) NSDictionary *notificationMessage; @property BOOL isInline; - (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options; - (void)register:(CDVInvokedUrlCommand*)command; - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; - (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; Loading
src/ios/PushPlugin.m +10 −14 Changes for src/ios/PushPlugin.m: 10 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -34,26 +34,20 @@ @synthesize notificationCallbackId; @synthesize callback; - (void)dealloc { [notificationMessage release]; self.notificationCallbackId = nil; self.callback = nil; [super dealloc]; } - (void)unregister:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options - (void)unregister:(CDVInvokedUrlCommand*)command; { self.callbackId = [arguments pop]; self.callbackId = command.callbackId; [[UIApplication sharedApplication] unregisterForRemoteNotifications]; [self successWithMessage:@"unregistered"]; } - (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options - (void)register:(CDVInvokedUrlCommand*)command; { self.callbackId = [arguments pop]; self.callbackId = command.callbackId; NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; Loading Loading @@ -97,11 +91,13 @@ [self notificationReceived]; // go ahead and process it } /* - (void)isEnabled:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; NSString *jsStatement = [NSString stringWithFormat:@"navigator.PushPlugin.isEnabled = %d;", type != UIRemoteNotificationTypeNone]; NSLog(@"JSStatement %@",jsStatement); } */ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { Loading Loading @@ -234,7 +230,7 @@ { CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; [self writeJavascript:[commandResult toSuccessCallbackString:self.callbackId]]; [self.commandDelegate sendPluginResult:commandResult callbackId:self.callbackId]; } -(void)failWithMessage:(NSString *)message withError:(NSError *)error Loading @@ -242,7 +238,7 @@ NSString *errorMessage = (error) ? [NSString stringWithFormat:@"%@ - %@", message, [error localizedDescription]] : message; CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage]; [self writeJavascript:[commandResult toErrorCallbackString:self.callbackId]]; [self.commandDelegate sendPluginResult:commandResult callbackId:self.callbackId]; } @end