Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)acceptFriendRequest:(VAPNotification *) not {
- VAPFriendRequestNotification *friendRequestNot = (VAPFriendRequestNotification *)not;
- if (friendRequestNot == nil) {
- [self gotToFriendsFrom:not];
- return;
- }
- [self alreadyAcceptedFriend:not completion:^(BOOL success) {
- if (success) {
- self.hud.mode = MBProgressHUDModeText;
- self.hud.labelText = @"Fehler";
- self.hud.detailsLabelText = @"Freund bereits akzeptiert oder Anfrage abgelaufen";
- self.hud.detailsLabelColor = [UIColor lightGrayColor];
- self.hud.color = VAPPY_PURPLE;
- [self.hud hide:YES afterDelay:2.0];
- } else {
- [self.hud hide:YES];
- UIAlertController *view = [UIAlertController alertControllerWithTitle:@"Akzeptieren?"
- message:nil
- preferredStyle:UIAlertControllerStyleActionSheet];
- view.view.tintColor = VAPPY_PURPLE;
- UIAlertAction *accept = [UIAlertAction
- actionWithTitle:@"Ja"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action) {
- [self acceptFriendship:friendRequestNot.friendRequestID completion:^(BOOL success) {
- [view dismissViewControllerAnimated:YES completion:nil];
- [self gotToFriendsFrom:not];
- }];
- }];
- UIAlertAction *decline = [UIAlertAction
- actionWithTitle:@"Nein"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction *action) {
- [self rejectFriendship:friendRequestNot.friendRequestID completion:^(BOOL success) {
- [view dismissViewControllerAnimated:YES completion:nil];
- }];
- }];
- UIAlertAction *cancel = [UIAlertAction
- actionWithTitle:@"Abbrechen"
- style:UIAlertActionStyleCancel
- handler:^(UIAlertAction *action) {
- [view dismissViewControllerAnimated:YES completion:nil];
- }];
- [view addAction:accept];
- [view addAction:decline];
- [view addAction:cancel];
- [self presentViewController:view animated:YES completion:nil];
- }
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement