From 7afb705555c73c2e4d644bf0bcfae5e3746fe8c6 Mon Sep 17 00:00:00 2001 From: Hevin Date: Fri, 22 Sep 2017 20:08:37 +0800 Subject: [PATCH] Update tag & alias api --- src/android/JPushEventReceiver.java | 6 +++--- src/ios/Plugins/JPushPlugin.m | 28 ++++++++++++++-------------- www/JPushPlugin.js | 3 +-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/android/JPushEventReceiver.java b/src/android/JPushEventReceiver.java index da6f1b8..d69349c 100644 --- a/src/android/JPushEventReceiver.java +++ b/src/android/JPushEventReceiver.java @@ -58,7 +58,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { } else { try { - resultJson.put("errorCode", jPushMessage.getErrorCode()); + resultJson.put("code", jPushMessage.getErrorCode()); } catch (JSONException e) { e.printStackTrace(); } @@ -99,7 +99,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { } else { try { - resultJson.put("errorCode", jPushMessage.getErrorCode()); + resultJson.put("code", jPushMessage.getErrorCode()); } catch (JSONException e) { e.printStackTrace(); } @@ -143,7 +143,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { } else { try { - resultJson.put("errorCode", jPushMessage.getErrorCode()); + resultJson.put("code", jPushMessage.getErrorCode()); } catch (JSONException e) { e.printStackTrace(); } diff --git a/src/ios/Plugins/JPushPlugin.m b/src/ios/Plugins/JPushPlugin.m index 7417e32..5281292 100644 --- a/src/ios/Plugins/JPushPlugin.m +++ b/src/ios/Plugins/JPushPlugin.m @@ -116,11 +116,11 @@ CDVPluginResult* result; - if (iResCode == 0) { // success + if (iResCode == 0) { [dic setObject:[iTags allObjects] forKey:@"tags"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -140,11 +140,11 @@ CDVPluginResult* result; - if (iResCode == 0) { // success + if (iResCode == 0) { [dic setObject:[iTags allObjects] forKey:@"tags"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -164,11 +164,11 @@ CDVPluginResult* result; - if (iResCode == 0) { // success + if (iResCode == 0) { [dic setObject:[iTags allObjects] forKey:@"tags"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -189,7 +189,7 @@ if (iResCode == 0) { result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -207,11 +207,11 @@ CDVPluginResult* result; - if (iResCode == 0) { // success + if (iResCode == 0) { [dic setObject:[iTags allObjects] forKey:@"tags"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -230,12 +230,12 @@ CDVPluginResult* result; - if (iResCode == 0) { // success + if (iResCode == 0) { [dic setObject:[iTags allObjects] forKey:@"tags"]; [dic setObject:[NSNumber numberWithBool:isBind] forKey:@"isBind"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -259,7 +259,7 @@ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -280,7 +280,7 @@ if (iResCode == 0) { result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } @@ -302,7 +302,7 @@ [dic setObject:iAlias forKey:@"alias"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic]; } else { - [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"errorCode"]; + [dic setValue:[NSNumber numberWithUnsignedInteger:iResCode] forKey:@"code"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic]; } diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index f31fbba..4c79699 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -95,8 +95,7 @@ JPushPlugin.prototype.setTags = function (params, successCallback, errorCallback } /** - * 新增标签,新增不代表设置。 - * 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。 + * 新增标签。 * * @param params = { 'sequence': number, 'tags': ['tag1', 'tag2'] } */