Skip to content

Commit 8b5d312

Browse files
#2 Add 'isRegistered' function (renamed to 'areNotificationsEnabled')
1 parent 5882dd9 commit 8b5d312

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/android/com/plugin/gcm/PushPlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class PushPlugin extends CordovaPlugin {
2121

2222
public static final String REGISTER = "register";
2323
public static final String UNREGISTER = "unregister";
24-
public static final String IS_REGISTERED = "isRegistered";
24+
public static final String ARE_NOTIFICATIONS_ENABLED = "areNotificationsEnabled ";
2525
public static final String EXIT = "exit";
2626

2727
private static CordovaWebView gWebView;
@@ -75,11 +75,11 @@ public boolean execute(String action, JSONArray data, CallbackContext callbackCo
7575
gCachedExtras = null;
7676
}
7777

78-
} else if (IS_REGISTERED.equals(action)) {
78+
} else if (ARE_NOTIFICATIONS_ENABLED.equals(action)) {
7979

80-
Log.v(TAG, "IS_REGISTERED");
80+
Log.v(TAG, "ARE_NOTIFICATIONS_ENABLED");
8181
final boolean registered = GCMRegistrar.isRegistered(getApplicationContext());
82-
Log.d(TAG, "isRegistered? " + registered);
82+
Log.d(TAG, "areNotificationsEnabled? " + registered);
8383
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, registered));
8484
result = true;
8585

src/ios/PushPlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
- (void)register:(CDVInvokedUrlCommand*)command;
4848

49-
- (void)isRegistered:(CDVInvokedUrlCommand*)command;
49+
- (void)areNotificationsEnabled:(CDVInvokedUrlCommand*)command;
5050

5151
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
5252
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;

src/ios/PushPlugin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ - (void)unregister:(CDVInvokedUrlCommand*)command;
4343
[self successWithMessage:@"unregistered"];
4444
}
4545

46-
- (void)isRegistered:(CDVInvokedUrlCommand*)command;
46+
- (void)areNotificationsEnabled:(CDVInvokedUrlCommand*)command;
4747
{
4848
self.callbackId = command.callbackId;
4949
BOOL registered;

src/wp8/PushPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void unregister(string options)
7777
}
7878
}
7979

80-
public void isRegistered(string options)
80+
public void areNotificationsEnabled(string options)
8181
{
8282
Options isRegisteredOptions;
8383
if (!TryDeserializeOptions(options, out isRegisteredOptions))

www/PushNotification.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ PushNotification.prototype.unregister = function(successCallback, errorCallback,
3737
};
3838

3939
// Check to see if we've already registered
40-
PushNotification.prototype.isRegistered = function(successCallback, errorCallback, options) {
40+
PushNotification.prototype.areNotificationsEnabled = function(successCallback, errorCallback, options) {
4141
if (errorCallback == null) { errorCallback = function() {}}
4242

4343
if (typeof errorCallback != "function") {
44-
console.log("PushNotification.isRegistered failure: failure parameter not a function");
44+
console.log("PushNotification.areNotificationsEnabled failure: failure parameter not a function");
4545
return
4646
}
4747

4848
if (typeof successCallback != "function") {
49-
console.log("PushNotification.isRegistered failure: success callback parameter must be a function");
49+
console.log("PushNotification.areNotificationsEnabled failure: success callback parameter must be a function");
5050
return
5151
}
5252

53-
cordova.exec(successCallback, errorCallback, "PushPlugin", "isRegistered", [options]);
53+
cordova.exec(successCallback, errorCallback, "PushPlugin", "areNotificationsEnabled", [options]);
5454
};
5555

5656
// Call this if you want to show toast notification on WP8

0 commit comments

Comments
 (0)