luismachado

Untitled

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