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";
22import * as imageAssetModule from "tns-core-modules/image-asset" ;
33import * as permissions from "nativescript-permissions" ;
44
5+ import { ImagePickerMediaType , Options } from "./imagepicker.common" ;
6+ export * from "./imagepicker.common" ;
7+
58class UriHelper {
69 public static _calculateFileUri ( uri : android . net . Uri ) {
710 let DocumentsContract = ( < any > android . provider ) . DocumentsContract ;
@@ -133,9 +136,9 @@ class UriHelper {
133136}
134137
135138export class ImagePicker {
136- private _options ;
139+ private _options : Options ;
137140
138- constructor ( options ) {
141+ constructor ( options : Options ) {
139142 this . _options = options ;
140143 }
141144
@@ -226,6 +229,6 @@ export class ImagePicker {
226229 }
227230}
228231
229- export function create ( options ?) : ImagePicker {
232+ export function create ( options ?: Options ) : ImagePicker {
230233 return new ImagePicker ( options ) ;
231234}
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 11import * as data_observable from "tns-core-modules/data/observable" ;
22import * as imageAssetModule from "tns-core-modules/image-asset" ;
3- import { Options , ImagePickerMediaType } from "." ;
3+ import { Options , ImagePickerMediaType } from "./imagepicker.common " ;
44import { View } from "tns-core-modules/ui/core/view/view" ;
55import * as utils from "tns-core-modules/utils/utils" ;
6+ export * from "./imagepicker.common" ;
67
78const defaultAssetCollectionSubtypes : NSArray < any > = NSArray . arrayWithArray ( < any > [
89 PHAssetCollectionSubtype . SmartAlbumRecentlyAdded ,
You can’t perform that action at this time.
0 commit comments