File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import * as data_observable from "tns-core-modules/data/observable" ;
2
2
import * as frame from "tns-core-modules/ui/frame" ;
3
3
import * as imageAssetModule from "tns-core-modules/image-asset" ;
4
- import { Options } from "." ;
4
+ import { Options , ImagePickerMediaType } from "." ;
5
5
6
6
const defaultAssetCollectionSubtypes : NSArray < any > = NSArray . arrayWithArray ( < any > [
7
7
PHAssetCollectionSubtype . SmartAlbumRecentlyAdded ,
@@ -27,7 +27,7 @@ export class ImagePicker extends data_observable.Observable {
27
27
28
28
let imagePickerController = QBImagePickerController . alloc ( ) . init ( ) ;
29
29
imagePickerController . assetCollectionSubtypes = defaultAssetCollectionSubtypes ;
30
- imagePickerController . mediaType = QBImagePickerMediaType . Image ;
30
+ imagePickerController . mediaType = options . mediaType ? < QBImagePickerMediaType > options . mediaType . valueOf ( ) : QBImagePickerMediaType . Any ;
31
31
imagePickerController . delegate = this . _imagePickerControllerDelegate ;
32
32
imagePickerController . allowsMultipleSelection = options . mode === 'multiple' ;
33
33
imagePickerController . minimumNumberOfSelection = options . minimumNumberOfSelection || 0 ;
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ export class ImagePicker {
16
16
present ( ) : Promise < ImageAsset [ ] > ;
17
17
}
18
18
19
+ export declare const enum ImagePickerMediaType {
20
+ Any = 0 ,
21
+ Image = 1 ,
22
+ Video = 2
23
+ }
24
+
19
25
/**
20
26
* Provide options for the image picker.
21
27
*/
@@ -49,12 +55,17 @@ interface Options {
49
55
* Set the number of columns in Portrait in iOS
50
56
*/
51
57
numberOfColumnsInPortrait ?: number ;
52
-
58
+
53
59
/**
54
60
* Set the number of columns in Landscape in iOS
55
61
*/
56
62
numberOfColumnsInLandscape ?: number ;
57
63
64
+ /**
65
+ * Set the media type (image/video/both) to pick in iOS
66
+ */
67
+ mediaType ?: ImagePickerMediaType ;
68
+
58
69
android ?: {
59
70
/**
60
71
* Provide a reason for permission request to access external storage on api levels above 23.
You can’t perform that action at this time.
0 commit comments