File tree Expand file tree Collapse file tree 3 files changed +65
-4
lines changed Expand file tree Collapse file tree 3 files changed +65
-4
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import * as application from "tns-core-modules/application";
2
2
import * as imageAssetModule from "tns-core-modules/image-asset" ;
3
3
import * as permissions from "nativescript-permissions" ;
4
4
5
+ import { ImagePickerMediaType , Options } from "./imagepicker.common" ;
6
+ export * from "./imagepicker.common" ;
7
+
5
8
class UriHelper {
6
9
public static _calculateFileUri ( uri : android . net . Uri ) {
7
10
let DocumentsContract = ( < any > android . provider ) . DocumentsContract ;
@@ -133,9 +136,9 @@ class UriHelper {
133
136
}
134
137
135
138
export class ImagePicker {
136
- private _options ;
139
+ private _options : Options ;
137
140
138
- constructor ( options ) {
141
+ constructor ( options : Options ) {
139
142
this . _options = options ;
140
143
}
141
144
@@ -226,6 +229,6 @@ export class ImagePicker {
226
229
}
227
230
}
228
231
229
- export function create ( options ?) : ImagePicker {
232
+ export function create ( options ?: Options ) : ImagePicker {
230
233
return new ImagePicker ( options ) ;
231
234
}
Original file line number Diff line number Diff line change
1
+ export enum ImagePickerMediaType {
2
+ Any = 0 ,
3
+ Image = 1 ,
4
+ Video = 2
5
+ }
6
+
7
+ /**
8
+ * Provide options for the image picker.
9
+ */
10
+ export interface Options {
11
+ /**
12
+ * Set the picker mode. Supported modes: "single" or "multiple" (default).
13
+ */
14
+ mode ?: string ;
15
+
16
+ /**
17
+ * Set the minumum number of selected assets in iOS
18
+ */
19
+ minimumNumberOfSelection ?: number ;
20
+
21
+ /**
22
+ * Set the maximum number of selected assets in iOS
23
+ */
24
+ maximumNumberOfSelection ?: number ;
25
+
26
+ /**
27
+ * Display the number of selected assets in iOS
28
+ */
29
+ showsNumberOfSelectedAssets ?: boolean ;
30
+
31
+ /**
32
+ * Display prompt text when selecting assets in iOS
33
+ */
34
+ prompt ?: string ;
35
+
36
+ /**
37
+ * Set the number of columns in Portrait in iOS
38
+ */
39
+ numberOfColumnsInPortrait ?: number ;
40
+
41
+ /**
42
+ * Set the number of columns in Landscape in iOS
43
+ */
44
+ numberOfColumnsInLandscape ?: number ;
45
+
46
+ /**
47
+ * Set the media type (image/video/any) to pick
48
+ */
49
+ mediaType ?: ImagePickerMediaType ;
50
+
51
+ android ?: {
52
+ /**
53
+ * Provide a reason for permission request to access external storage on api levels above 23.
54
+ */
55
+ read_external_storage ?: string ;
56
+ } ;
57
+ }
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 imageAssetModule from "tns-core-modules/image-asset" ;
3
- import { Options , ImagePickerMediaType } from "." ;
3
+ import { Options , ImagePickerMediaType } from "./imagepicker.common " ;
4
4
import { View } from "tns-core-modules/ui/core/view/view" ;
5
5
import * as utils from "tns-core-modules/utils/utils" ;
6
+ export * from "./imagepicker.common" ;
6
7
7
8
const defaultAssetCollectionSubtypes : NSArray < any > = NSArray . arrayWithArray ( < any > [
8
9
PHAssetCollectionSubtype . SmartAlbumRecentlyAdded ,
You can’t perform that action at this time.
0 commit comments