Skip to content

Instantly share code, notes, and snippets.

View Kevinwlee's full-sized avatar

Kevin Lee Kevinwlee

View GitHub Profile
event = {
context = (),
data = {},
name = "location_changed",
payload = {}
}
NSData *imageData = UIImageJPEGRepresentation(profilePicture,.99);
NSString *fileName = @"ProfilePicture.png";
CCHVaultResource *profilePictureResource = [[CCHVaultResource alloc]initWithName:@"profile_picture_url"
fileName:fileName
mimeType:@"image/png"
data:imageData];
NSString *container = @"profiles";
[[CCHVaultService sharedService] deleteItem:item completion:^(NSDictionary *carbonResponse, NSError *error) {
if (!error) {
NSLog(@"Item Deleted %@", item);
} else {
NSLog(@"Error deleting item %@", item);
}
}];
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithDictionary:self.item];
[item setObject:self.nameTextField.text forKey:@"name"];
[[CCHVaultService sharedService] updateItem:item completion:^(NSDictionary *carbonResponse, NSError *error) {
if (error) {
NSLog(@"Error %@",error);
} else {
NSLog(@"Success %@", carbonResponse);
}
}];
[[CCHVaultService sharedService] getItemsInContainer:@"paintings" completion:^(NSArray *carbonResponses, NSError *error) {
if (error) {
NSLog(@"Error %@", error);
} else {
NSLog(@"Success %@", carbonResponse);
}
}];
NSString *containerName = @"paintings";
NSDictionary *item = @{@"name":self.nameTextField.text};
[[CCHVaultService sharedService] createItem:item inContainer:containerName completion:^(NSDictionary *carbonResponse, NSError *error) {
if (error) {
NSLog(@"Error %@", error);
} else {
NSLog(@"Success %@", carbonResponse);
}
}];
NSDictionary *userInfo = @{@"content-available":@"1", @"sound":@"", @"custom":self.customData.text, @"alert":@""};
[[CCHNotificationService sharedService] sendAPNSNotificationToAliases:@[[ContextHub deviceId]] userInfo:userInfo withCompletion:^(NSError *error) {
NSLog(@"Error %@", error);
}];
NSDictionary *userInfo = @{@"sound":@"techno.aif", @"custom":self.customData.text, @"alert":@"CAN YOU HEAR ME NOW?", @"badge":@"1000"};
[[CCHNotificationService sharedService] sendAPNSNotificationToAliases:@[[ContextHub deviceId]] userInfo:userInfo withCompletion:^(NSError *error) {
NSLog(@"Error %@", error);
}];
NSDictionary *userInfo = @{@"custom":self.customData.text, @"alert":@"Data was pushed!"};
[[CCHNotificationService sharedService] sendAPNSNotificationToAliases:@[[ContextHub deviceId]] userInfo:userInfo withCompletion:^(NSError *error) {
NSLog(@"Error %@", error);
}];
NSDictionary *userInfo = @{ @"alert":self.messageField.text};
[[CCHNotificationService sharedService] sendAPNSNotificationToTags:@[@"tag1"] userInfo:userInfo withCompletion:^(NSError *error) {
NSLog(@"Error %@", error);
}];