Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)setupProject:(NSString *)projectID notification:(VAPNotification *)notification {
- self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- self.hud.labelText = @"Loading...";
- self.hud.detailsLabelColor = [UIColor lightGrayColor];
- self.hud.color = VAPPY_PURPLE;
- [[ServerAPI sharedClient]getVideoProjectDetailsWithId:projectID successBlock:^(NSDictionary *projectDetail) {
- [self.hud hide:YES];
- if ([notification type] == VAPPYProjectInvitation) {
- if([projectDetail[@"status"] isEqualToString:@"waiting_acceptance"]){
- [self acceptProject:projectID];
- } else {
- [self.hud hide:YES];
- self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self showAlert:@"Fehler" detailText:@"Diese Einladung ist bereits abgelaufen oder wurde zuvor akzeptiert." labelColor:[UIColor lightGrayColor] backgroundColor:VAPPY_PURPLE hideDelay:2.0];
- }
- } else {
- if([projectDetail[@"status"] isEqualToString:@"finished"]){
- [self.hud hide:YES];
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
- StartNavigationViewController *nvc = (StartNavigationViewController *)[mainSB instantiateViewControllerWithIdentifier:@"projectNavigationController"];
- NewProjectDetailsViewController *vc2 = (NewProjectDetailsViewController *)[mainSB instantiateViewControllerWithIdentifier:@"NewProjectDetailsViewController"];
- vc2.projectDetails=projectDetail;
- vc2.projectID=projectID;
- [appDelegate.msSlidingPanelController setCenterViewController:nvc];
- [nvc pushViewController:vc2 animated:YES];
- [appDelegate.msSlidingPanelController closePanel];
- appDelegate.selectedIndex = 2;
- } else if ([projectDetail[@"status"] isEqualToString:@"waiting_server_process"]) {
- [self.hud hide:YES];
- self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self showAlert:@"Warning" detailText:@"VAPPYGRAM IN BEARBEITUNG" labelColor:[UIColor blackColor] backgroundColor:[UIColor colorWithCSS:@"#f6cb4a"] hideDelay:2.0];
- } else {
- [self.hud hide:YES];
- UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
- StepsViewController *vc_step = [mainSB instantiateViewControllerWithIdentifier:@"stepViewController"];
- vc_step.projectDetails = [[NSMutableDictionary alloc] initWithDictionary:projectDetail];
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- UINavigationController *nav = (UINavigationController *)appDelegate.msSlidingPanelController.centerViewController;
- [nav pushViewController:vc_step animated:YES];
- [appDelegate.msSlidingPanelController closePanel];
- }
- }
- } andErrorBlock:^(NSError *error, AFHTTPRequestOperation *operation) {
- [self.hud hide:YES];
- self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
- [self showAlert:@"Fehler" detailText:@"Kommunikationsproblem" labelColor:[UIColor lightGrayColor] backgroundColor:VAPPY_PURPLE hideDelay:2.0];
- }];
- }
Add Comment
Please, Sign In to add comment