Advertisement
luismachado

Untitled

Feb 17th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 3.37 KB | None | 0 0
  1. self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  2.     self.hud.labelText = @"Loading...";
  3.     self.hud.detailsLabelColor = [UIColor lightGrayColor];
  4.     self.hud.color = VAPPY_PURPLE;
  5.     [[ServerAPI sharedClient]getVideoProjectDetailsWithId:projectID successBlock:^(NSDictionary *projectDetail) {
  6.         [self.hud hide:YES];
  7.  
  8.         if ([notification type] == VAPPYProjectInvitation) {
  9.             if([projectDetail[@"status"] isEqualToString:@"waiting_acceptance"]){
  10.                 [self acceptProject:projectID];
  11.             } else {
  12.                 [self.hud hide:YES];
  13.                 self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  14.                 [self showAlert:@"Fehler" detailText:@"Diese Einladung ist bereits abgelaufen oder wurde zuvor akzeptiert." labelColor:[UIColor lightGrayColor] backgroundColor:VAPPY_PURPLE hideDelay:2.0];
  15.             }
  16.         } else {
  17.             if([projectDetail[@"status"] isEqualToString:@"finished"]){
  18.                 [self.hud hide:YES];
  19.                 AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  20.                 UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
  21.                 StartNavigationViewController *nvc = (StartNavigationViewController *)[mainSB instantiateViewControllerWithIdentifier:@"projectNavigationController"];
  22.                 NewProjectDetailsViewController *vc2 = (NewProjectDetailsViewController *)[mainSB instantiateViewControllerWithIdentifier:@"NewProjectDetailsViewController"];
  23.                 vc2.projectDetails=projectDetail;
  24.                 vc2.projectID=projectID;
  25.                 [appDelegate.msSlidingPanelController setCenterViewController:nvc];
  26.                 [nvc pushViewController:vc2 animated:YES];
  27.  
  28.                 [appDelegate.msSlidingPanelController closePanel];
  29.  
  30.                 appDelegate.selectedIndex = 2;
  31.             } else if ([projectDetail[@"status"] isEqualToString:@"waiting_server_process"]) {
  32.                 [self.hud hide:YES];
  33.                 self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  34.                 [self showAlert:@"Warning" detailText:@"VAPPYGRAM IN BEARBEITUNG" labelColor:[UIColor blackColor] backgroundColor:[UIColor colorWithCSS:@"#f6cb4a"] hideDelay:2.0];
  35.             } else {
  36.                 [self.hud hide:YES];
  37.                 UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
  38.                 StepsViewController *vc_step = [mainSB instantiateViewControllerWithIdentifier:@"stepViewController"];
  39.                 vc_step.projectDetails = [[NSMutableDictionary alloc] initWithDictionary:projectDetail];
  40.                 AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  41.                 UINavigationController *nav = (UINavigationController *)appDelegate.msSlidingPanelController.centerViewController;
  42.                 [nav pushViewController:vc_step animated:YES];
  43.                 [appDelegate.msSlidingPanelController closePanel];
  44.             }
  45.         }
  46.     } andErrorBlock:^(NSError *error, AFHTTPRequestOperation *operation) {
  47.         [self.hud hide:YES];
  48.         self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  49.         [self showAlert:@"Fehler" detailText:@"Kommunikationsproblem" labelColor:[UIColor lightGrayColor] backgroundColor:VAPPY_PURPLE hideDelay:2.0];
  50.     }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement