fix setTags/Alias bug

This commit is contained in:
huangminlinux 2017-07-07 11:21:14 +08:00
parent c72cde6632
commit 2df6ea47a8

View File

@ -99,44 +99,47 @@
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{ -(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
NSString *alias = [command argumentAtIndex:0]; NSString *alias = [command argumentAtIndex:0];
NSArray *tags = [command argumentAtIndex:1]; NSArray *tags = [command argumentAtIndex:1];
[JPUSHService setTags:[NSSet setWithArray:tags] [JPUSHService setTags:[NSSet setWithArray:tags]
alias:alias alias:alias
fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) { fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
CDVPluginResult *result; CDVPluginResult *result;
if (iResCode == 0) { if (iResCode == 0) {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
} else { } else {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
} }
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}]; }];
} }
-(void)setTags:(CDVInvokedUrlCommand*)command{ -(void)setTags:(CDVInvokedUrlCommand*)command{
NSArray *tags = command.arguments; NSArray *tags = command.arguments;
[JPUSHService setTags:[NSSet setWithArray:tags] [JPUSHService setTags:[NSSet setWithArray:tags]
alias:nil alias:nil
fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) { fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
CDVPluginResult *result; CDVPluginResult *result;
if (iResCode == 0) { if (iResCode == 0) {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
} else { } else {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
} }
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}]; }];
} }
-(void)setAlias:(CDVInvokedUrlCommand*)command{ -(void)setAlias:(CDVInvokedUrlCommand*)command{
NSString *alias = [command argumentAtIndex:0]; NSString *alias = [command argumentAtIndex:0];
[JPUSHService setTags:nil [JPUSHService setTags:nil
alias:alias alias:alias
fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) { fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
CDVPluginResult *result; CDVPluginResult *result;
if (iResCode == 0) { if (iResCode == 0) {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
} else { } else {
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
} }
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}]; }];
} }
@ -344,11 +347,11 @@
} }
#pragma mark #pragma mark
-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias { -(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias {
if (resultCode == 0) { // Success if (resultCode == 0) { // Success
} else { } else {
} }
} }