@@ -99,24 +99,45 @@ +(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString{
9999-(void )setTagsWithAlias : (CDVInvokedUrlCommand*)command {
100100    NSString  *alias = [command argumentAtIndex: 0 ];
101101    NSArray   *tags  = [command argumentAtIndex: 1 ];
102-     [JPUSHService setTags: [NSSet  setWithArray: tags]
103-                     alias: alias
104-          callbackSelector: @selector (tagsWithAliasCallback:tags:alias: )
105-                    object: self ];
106- }
107- 
108- -(void )setTags : (CDVInvokedUrlCommand *)command {
109-     NSArray  *tags = command.arguments ;
110-     [JPUSHService setTags: [NSSet  setWithArray: tags]
111-          callbackSelector: @selector (tagsWithAliasCallback:tags:alias: )
112-                    object: self ];
113- }
114- 
115- -(void )setAlias : (CDVInvokedUrlCommand *)command {
102+ 
103+     [JPUSHService setTags: [NSSet  setWithArray: tags]
104+                     alias: alias
105+     fetchCompletionHandle: ^(int  iResCode, NSSet  *iTags, NSString  *iAlias) {
106+         CDVPluginResult *result;
107+         if  (iResCode == 0 ) {
108+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: nil ];
109+         } else  {
110+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: nil ];
111+         }
112+     }];
113+ }
114+ 
115+ -(void )setTags : (CDVInvokedUrlCommand*)command {
116+     NSArray  *tags = command.arguments ;
117+     [JPUSHService setTags: [NSSet  setWithArray: tags]
118+                     alias: nil 
119+     fetchCompletionHandle: ^(int  iResCode, NSSet  *iTags, NSString  *iAlias) {
120+         CDVPluginResult *result;
121+         if  (iResCode == 0 ) {
122+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: nil ];
123+         } else  {
124+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: nil ];
125+         }
126+     }];
127+ }
128+ 
129+ -(void )setAlias : (CDVInvokedUrlCommand*)command {
116130    NSString  *alias = [command argumentAtIndex: 0 ];
117-     [JPUSHService setAlias: alias
118-           callbackSelector: @selector (tagsWithAliasCallback:tags:alias: )
119-                     object: self ];
131+     [JPUSHService setTags: nil 
132+                     alias: alias
133+     fetchCompletionHandle: ^(int  iResCode, NSSet  *iTags, NSString  *iAlias) {
134+         CDVPluginResult *result;
135+         if  (iResCode == 0 ) {
136+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: nil ];
137+         } else  {
138+             result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: nil ];
139+         }
140+     }];
120141}
121142
122143-(void )getRegistrationID : (CDVInvokedUrlCommand*)command {
@@ -149,12 +170,12 @@ -(void)resetBadge:(CDVInvokedUrlCommand*)command{
149170    [JPUSHService resetBadge ];
150171}
151172
152- -(void )setApplicationIconBadgeNumber : (CDVInvokedUrlCommand  *)command {
173+ -(void )setApplicationIconBadgeNumber : (CDVInvokedUrlCommand*)command {
153174    NSNumber  *badge = [command argumentAtIndex: 0 ];
154175    [UIApplication sharedApplication ].applicationIconBadgeNumber  = badge.intValue ;
155176}
156177
157- -(void )getApplicationIconBadgeNumber : (CDVInvokedUrlCommand  *)command  {
178+ -(void )getApplicationIconBadgeNumber : (CDVInvokedUrlCommand*)command  {
158179    NSInteger  num = [UIApplication sharedApplication ].applicationIconBadgeNumber ;
159180    NSNumber  *number = [NSNumber  numberWithInteger: num];
160181    [self  handleResultWithValue: number command: command];
@@ -252,16 +273,22 @@ -(void)addActions:(CDVInvokedUrlCommand*)command dismiss:(BOOL)dimiss{
252273            NSString  *textInputPlaceholder = dict[@" textInputPlaceholder"  ];
253274            UNTextInputNotificationAction  *inputAction = [UNTextInputNotificationAction  actionWithIdentifier: identifier title: title options: option.integerValue textInputButtonTitle: textInputButtonTitle textInputPlaceholder: textInputPlaceholder];
254275            [actions addObject: inputAction];
255-         }else {
276+         }  else   {
256277            UNNotificationAction  *action = [UNNotificationAction  actionWithIdentifier: title title: title options: option.integerValue];
257278            [actions addObject: action];
258279        }
259280    }
260281    UNNotificationCategory  *category;
261282    if  (dimiss) {
262-         category = [UNNotificationCategory  categoryWithIdentifier: categoryId actions: actions intentIdentifiers: @[] options: UNNotificationCategoryOptionCustomDismissAction ];
263-     }else {
264-         category = [UNNotificationCategory  categoryWithIdentifier: categoryId actions: actions intentIdentifiers: @[] options: UNNotificationCategoryOptionNone ];
283+         category = [UNNotificationCategory  categoryWithIdentifier: categoryId
284+                                                           actions: actions
285+                                                 intentIdentifiers: @[]
286+                                                           options: UNNotificationCategoryOptionCustomDismissAction ];
287+     } else  {
288+         category = [UNNotificationCategory  categoryWithIdentifier: categoryId
289+                                                           actions: actions
290+                                                 intentIdentifiers: @[]
291+                                                           options: UNNotificationCategoryOptionNone ];
265292    }
266293    [[UNUserNotificationCenter  currentNotificationCenter ] setNotificationCategories: [NSSet  setWithObject: category]];
267294}
@@ -282,7 +309,7 @@ +(void)setupJPushSDK:(NSDictionary*)userInfo{
282309    NSNumber  *isIDFA       = [plistData valueForKey: JPushConfig_IsIDFA];
283310
284311    NSString  *advertisingId = nil ;
285-     if (isIDFA.boolValue ){
312+     if (isIDFA.boolValue )  {
286313        advertisingId = [[[ASIdentifierManager sharedManager ] advertisingIdentifier ] UUIDString ];
287314    }
288315    [JPUSHService setupWithOption: userInfo
@@ -293,7 +320,7 @@ +(void)setupJPushSDK:(NSDictionary*)userInfo{
293320}
294321
295322#pragma mark  将参数返回给js
296- -(void )handleResultWithValue : (id )value  command : (CDVInvokedUrlCommand*)command {
323+ -(void )handleResultWithValue : (id )value  command : (CDVInvokedUrlCommand*)command   {
297324    CDVPluginResult *result = nil ;
298325    CDVCommandStatus status = CDVCommandStatus_OK;
299326
@@ -317,17 +344,18 @@ -(void)handleResultWithValue:(id)value command:(CDVInvokedUrlCommand*)command{
317344}
318345
319346#pragma mark  设置标签及别名回调
320- -(void )tagsWithAliasCallback : (int )resultCode  tags : (NSSet  *)tags  alias : (NSString  *)alias {
321-     NSDictionary  *dict = @{ @" resultCode " :[ NSNumber   numberWithInt: resultCode], 
322-                             @" tags "       :tags  ==  nil  ? [ NSNull   null ] : [tags  allObjects ], 
323-                             @" alias "      :alias ==  nil  ? [ NSNull   null ] : alias 
324-                            }; 
325-     [JPushPlugin  fireDocumentEvent: JPushDocumentEvent_SetTagsWithAlias  jsString: [dict  toJsonString ]]; 
347+ -(void )tagsWithAliasCallback : (int )resultCode  tags : (NSSet  *)tags  alias : (NSString  *)alias   {
348+     if  (resultCode ==  0 ) {   //  Success 
349+ 
350+     }  else  { 
351+ 
352+     } 
326353}
327354
328355- (void )networkDidReceiveMessage : (NSNotification  *)notification  {
329356    if  (notification && notification.userInfo ) {
330-         [JPushPlugin fireDocumentEvent: JPushDocumentEvent_ReceiveMessage jsString: [notification.userInfo  toJsonString ]];
357+         [JPushPlugin fireDocumentEvent: JPushDocumentEvent_ReceiveMessage
358+                               jsString: [notification.userInfo toJsonString ]];
331359    }
332360}
333361
0 commit comments