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
HKQuantityType *heightType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeight]; | |
// Since we are interested in retrieving the user's latest sample | |
// we sort the samples in descending order by end date | |
// and set the limit to 1 | |
NSSortDescriptor *timeSortDescriptor = [[NSSortDescriptor alloc] initWithKey:HKSampleSortIdentifierEndDate ascending:NO]; | |
// construct the query & since we are not filtering the data the predicate is set to nil | |
HKSampleQuery *query = [[HKSampleQuery alloc] initWithSampleType:heightType predicate:nil limit:1 sortDescriptors:@[timeSortDescriptor] resultsHandler:^(HKSampleQuery *query, NSArray *results, NSError *error) { |
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
import Foundation | |
class Environment { | |
var environmentId: String | |
var data: Dictionary<String, AnyObject> | |
var deployed: Bool | |
var dirty: Bool | |
init(dict: Dictionary<String, AnyObject>) { | |
self.environmentId = (dict["environmentId"] as AnyObject?) as String |
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
{ | |
"name":"messages", | |
"schema":{ | |
"msgContent":"string", | |
"toPhone":"string", | |
"fromPhone":"string", | |
"timestamp":"string", | |
"isPhi":"boolean", | |
"fileId":"string", | |
"conversationsId":"string" |
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
{ | |
"name":"contacts", | |
"schema":{ | |
"user_username":"string", | |
"user_usersId":"string" | |
}, | |
"phi":false | |
} |
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
{ | |
"name":"conversations", | |
"schema":{ | |
"sender":"string", | |
"recipient":"string", | |
"sender_id":"string", | |
"recipient_id":"string" | |
}, | |
"phi":true | |
} |
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
[CatalyzeUser currentUser]; |
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
- (IBAction)login:(id)sender { | |
[CatalyzeUser logInWithUsernameInBackground:_txtUsername.text password:_txtPassword.text block:^(int status, NSString *response, NSError *error) { | |
if (error) { | |
[[[UIAlertView alloc] initWithTitle:@"Error" message:@"Invalid username / password" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; | |
} else { | |
[self.navigationController pushViewController:[[HealthTrackerViewController alloc] initWithNibName:nil bundle:nil] animated:YES]; | |
} | |
}]; | |
} |
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
- (IBAction)signUp:(id)sender { | |
Email *email = [[Email alloc] init]; | |
[email setPrimary:_txtEmail.text]; | |
Name *name = [[Name alloc] init]; | |
[name setFirstName:_txtFirstName.text]; | |
[name setLastName:_txtLastName.text]; | |
[CatalyzeUser signUpWithUsernameInBackground:_txtUsername.text email:email name:name password:_txtPassword.text block:^(int status, NSString *response, NSError *error) { | |
if (error) { |
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
- (void)logout { | |
[[CatalyzeUser currentUser] logoutWithBlock:^(int status, NSString *response, NSError *error) { | |
[self.navigationController popViewControllerAnimated:YES]; | |
}]; | |
} |
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
CatalyzeQuery *query = [CatalyzeQuery queryWithClassName:@"surveys"]; | |
[query setPageSize:20]; | |
[query setPageNumber:1]; | |
[query retrieveInBackgroundWithBlock:^(NSArray *objects, NSError *error) { | |
if (objects) { | |
_surveys = [NSMutableArray array]; | |
_otherSurveys = [NSMutableArray array]; | |
for (NSDictionary *dict in objects) { | |
if ([[dict valueForKey:@"parentId"] isEqualToString:[[CatalyzeUser currentUser] usersId]]) { |