Advertisement
luismachado

Untitled

Feb 17th, 2019
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void)acceptFriendRequest:(VAPNotification *) not {
  2.  
  3.     VAPFriendRequestNotification *friendRequestNot = (VAPFriendRequestNotification *)not;
  4.  
  5.     if (friendRequestNot == nil) {
  6.         [self gotToFriendsFrom:not];
  7.         return;
  8.     }
  9.  
  10.     [self alreadyAcceptedFriend:not completion:^(BOOL success) {
  11.         if (success) {
  12.             self.hud.mode = MBProgressHUDModeText;
  13.             self.hud.labelText = @"Fehler";
  14.             self.hud.detailsLabelText = @"Freund bereits akzeptiert oder Anfrage abgelaufen";
  15.             self.hud.detailsLabelColor = [UIColor lightGrayColor];
  16.             self.hud.color = VAPPY_PURPLE;
  17.             [self.hud hide:YES afterDelay:2.0];
  18.         } else {
  19.             [self.hud hide:YES];
  20.             UIAlertController *view = [UIAlertController alertControllerWithTitle:@"Akzeptieren?"
  21.                                                                           message:nil
  22.                                                                    preferredStyle:UIAlertControllerStyleActionSheet];
  23.  
  24.             view.view.tintColor = VAPPY_PURPLE;
  25.  
  26.             UIAlertAction *accept = [UIAlertAction
  27.                                      actionWithTitle:@"Ja"
  28.                                      style:UIAlertActionStyleDefault
  29.                                      handler:^(UIAlertAction *action) {
  30.  
  31.                                          [self acceptFriendship:friendRequestNot.friendRequestID completion:^(BOOL success) {
  32.                                              [view dismissViewControllerAnimated:YES completion:nil];
  33.                                              [self gotToFriendsFrom:not];
  34.                                          }];
  35.  
  36.  
  37.                                      }];
  38.  
  39.             UIAlertAction *decline = [UIAlertAction
  40.                                       actionWithTitle:@"Nein"
  41.                                       style:UIAlertActionStyleDefault
  42.                                       handler:^(UIAlertAction *action) {
  43.                                           [self rejectFriendship:friendRequestNot.friendRequestID completion:^(BOOL success) {
  44.                                               [view dismissViewControllerAnimated:YES completion:nil];
  45.                                           }];
  46.  
  47.                                       }];
  48.  
  49.             UIAlertAction *cancel = [UIAlertAction
  50.                                      actionWithTitle:@"Abbrechen"
  51.                                      style:UIAlertActionStyleCancel
  52.                                      handler:^(UIAlertAction *action) {
  53.                                          [view dismissViewControllerAnimated:YES completion:nil];
  54.                                      }];
  55.  
  56.             [view addAction:accept];
  57.             [view addAction:decline];
  58.             [view addAction:cancel];
  59.             [self presentViewController:view animated:YES completion:nil];
  60.         }
  61.     }];
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement