Media Picker: Apply Ribot design

This commit is contained in:
giomfo
2016-01-19 18:59:40 +01:00
parent 5ab6e04ee0
commit 092ac321f4
14 changed files with 1077 additions and 747 deletions
@@ -743,52 +743,18 @@
}
}
- (void)mediaPickerController:(MediaPickerViewController *)mediaPickerController didSelectVideo:(NSURL*)videoURL isCameraRecording:(BOOL)isCameraRecording
- (void)mediaPickerController:(MediaPickerViewController *)mediaPickerController didSelectVideo:(NSURL*)videoURL
{
// this method should not be called
[self dismissMediaPicker];
}
- (void)mediaPickerController:(MediaPickerViewController *)mediaPickerController didSelectAssets:(NSArray *)assets
{
if (assets.count > 0)
{
PHAsset* asset = [assets objectAtIndex:0];
PHContentEditingInputRequestOptions *editOptions = [[PHContentEditingInputRequestOptions alloc] init];
[asset requestContentEditingInputWithOptions:editOptions
completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
if (contentEditingInput.mediaType == PHAssetMediaTypeImage)
{
// Here the fullSizeImageURL is related to a local file path
NSData *data = [NSData dataWithContentsOfURL:contentEditingInput.fullSizeImageURL];
UIImage *image = [UIImage imageWithData:data];
if (image)
{
[self getNavigationItem].rightBarButtonItem.enabled = YES;
NSMutableDictionary* dict = [self getUpdatedItemsDict];
[dict setObject:image forKey:@"ROOM_SECTION_PHOTO"];
[self.tableView reloadData];
}
}
}];
}
[self dismissMediaPicker];
}
#pragma mark - actions
- (void)onRoomAvatarTap:(UITapGestureRecognizer *)recognizer
{
mediaPicker = [MediaPickerViewController mediaPickerViewController];
mediaPicker.mediaTypes = @[(NSString *)kUTTypeImage];
mediaPicker.multipleSelections = NO;
mediaPicker.selectionButtonCustomLabel = NSLocalizedStringFromTable(@"media_picker_attach", @"Vector", nil);
mediaPicker.delegate = self;
UINavigationController *navigationController = [UINavigationController new];
[navigationController pushViewController:mediaPicker animated:NO];