Add smart album version

This commit is contained in:
Andrew Shini 2016-09-11 08:47:19 +10:00
parent 31d90cc6eb
commit acbd0963ac

View File

@ -174,6 +174,23 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
imagePickerController.showsNumberOfSelectedAssets = YES;
imagePickerController.mediaType = QBImagePickerMediaTypeImage;
if ([self.options objectForKey:@"smartAlbums"] != nil) {
NSDictionary *smartAlbums = @{
@"UserLibrary" : @(PHAssetCollectionSubtypeSmartAlbumUserLibrary),
@"PhotoStream" : @(PHAssetCollectionSubtypeAlbumMyPhotoStream),
@"Panoramas" : @(PHAssetCollectionSubtypeSmartAlbumPanoramas),
@"Videos" : @(PHAssetCollectionSubtypeSmartAlbumVideos),
@"Bursts" : @(PHAssetCollectionSubtypeSmartAlbumBursts),
};
NSMutableArray *albumsToShow = [NSMutableArray arrayWithCapacity:5];
for (NSString* album in [self.options objectForKey:@"smartAlbums"]) {
if ([smartAlbums objectForKey:album] != nil) {
[albumsToShow addObject:[smartAlbums objectForKey:album]];
}
}
imagePickerController.assetCollectionSubtypes = albumsToShow;
}
dispatch_async(dispatch_get_main_queue(), ^{
[[self getRootVC] presentViewController:imagePickerController animated:YES completion:nil];
});