mirror of
https://github.com/status-im/react-native-image-crop-picker.git
synced 2025-02-23 10:58:16 +00:00
Add smart album version
This commit is contained in:
parent
31d90cc6eb
commit
acbd0963ac
@ -174,6 +174,23 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
|
|||||||
imagePickerController.showsNumberOfSelectedAssets = YES;
|
imagePickerController.showsNumberOfSelectedAssets = YES;
|
||||||
imagePickerController.mediaType = QBImagePickerMediaTypeImage;
|
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(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[self getRootVC] presentViewController:imagePickerController animated:YES completion:nil];
|
[[self getRootVC] presentViewController:imagePickerController animated:YES completion:nil];
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user