Skip to content

Instantly share code, notes, and snippets.

@jlee42
Created January 24, 2013 20:39
Show Gist options
  • Save jlee42/4627475 to your computer and use it in GitHub Desktop.
Save jlee42/4627475 to your computer and use it in GitHub Desktop.
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