Created
January 24, 2013 20:39
-
-
Save jlee42/4627475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if([attendanceIdentifierData length] > 0) { | |
NSString *activityTypeID = [[NSUserDefaults standardUserDefaults] | |
valueForKey:@"activity_type_id"]; | |
NSString *deviceUUID = [[NSUserDefaults standardUserDefaults] | |
valueForKey:@"application_uuid"]; | |
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: | |
attendanceIdentifierData, @"attendance_identifier", nil]; | |
NSString *authenticationToken = [[NSUserDefaults standardUserDefaults] | |
valueForKey:@"authentication_token"]; | |
NSString *postPath = [NSString stringWithFormat:@"/api/v2/json/%@/activity_types/%@/activities/create_or_update/%@", authenticationToken, activityTypeID, deviceUUID]; | |
[[RKObjectManager sharedManager].HTTPClient postPath:postPath | |
parameters:params | |
success:^(AFHTTPRequestOperation *operation, id JSON) | |
{ | |
[TestFlight passCheckpoint:@"AUTHORIZED_ENTRY"]; | |
NSString *activityStatus = [JSON objectForKey:@"activity_status"]; | |
NSLog(@"activityStatus: %@", activityStatus); | |
[self.activityInformationBackgroundView setHidden:NO]; | |
NSString *photoURLString = [NSString stringWithFormat:@"https://domain.com/api/v2/jpg/%@/photos/lsuid/%@?style=medium", | |
authenticationToken, | |
[[JSON valueForKey:@"user"] | |
valueForKey:@"photoHash"]]; | |
[self.userPhotoImage setImageWithURL:[NSURL URLWithString:photoURLString] | |
placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; | |
int sound[]={2730,150,0,30}; | |
[linea playSound:100 beepData:sound length:sizeof(sound) error:nil]; | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) | |
{ | |
if ([operation.responseString length] > 0) { | |
NSDictionary *parsedResponse = [NSJSONSerialization JSONObjectWithData:operation.responseData | |
options:0 | |
error:nil]; | |
[TestFlight passCheckpoint:@"FAILED_TO_AUTHORIZE_ENTRY"]; | |
TTShowAlertWithString([parsedResponse valueForKey:@"error"]); | |
} else { | |
TTShowAlertWithString([error localizedDescription]); | |
} | |
int sound[]={2730,150,0,30,2730,2730}; | |
[linea playSound:100 beepData:sound length:sizeof(sound) error:nil]; | |
}]; | |
[self.attendanceIdentifierField setText:nil]; | |
[TestFlight passCheckpoint:@"SUBMITTED_ATTENDANCE_DATA"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment