Advertisement
luismachado

Untitled

Feb 17th, 2019
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void) alreadyAcceptedFriend:(VAPNotification*)notification completion:(void (^)(BOOL success))completionBlock {
  2.     self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  3.     self.hud.labelText = @"Loading...";
  4.     self.hud.detailsLabelColor = [UIColor lightGrayColor];
  5.     self.hud.color = VAPPY_PURPLE;
  6.  
  7.     [[ServerAPI sharedClient] getAllFriends:^(NSArray *info) {
  8.         BOOL hasAccepted=YES;
  9.         for (NSDictionary* friend in info) {
  10.             if([friend hasKey:@"id"]){
  11.                 NSNumber* fRId=friend[@"id"];
  12.                 NSNumber* notFRId = notification.raw[@"friend_request_id"];
  13.                 if ([fRId isEqual:notFRId]) {
  14.                     hasAccepted=NO;
  15.                 }
  16.             }
  17.         }
  18.         completionBlock(hasAccepted);
  19.     } andErrorBlock:^(NSError *error, AFHTTPRequestOperation *operation) {
  20.         [self.hud hide:YES];
  21.         completionBlock(FALSE);
  22.     }];
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement