@@ -157,6 +157,20 @@ export class ImagePicker {
157157 }
158158 }
159159
160+ get mimeTypes ( ) {
161+ let length = this . mediaType === "*/*" ? 2 : 1 ;
162+ let mimeTypes = Array . create ( java . lang . String , length ) ;
163+
164+ if ( this . mediaType === "*/*" ) {
165+ mimeTypes [ 0 ] = "image/*" ;
166+ mimeTypes [ 1 ] = "video/*" ;
167+ }
168+ else {
169+ mimeTypes [ 0 ] = this . mediaType ;
170+ }
171+ return mimeTypes ;
172+ }
173+
160174 authorize ( ) : Promise < void > {
161175 if ( ( < any > android ) . os . Build . VERSION . SDK_INT >= 23 ) {
162176 return permissions . requestPermission ( [ ( < any > android ) . Manifest . permission . READ_EXTERNAL_STORAGE ] ) ;
@@ -227,19 +241,9 @@ export class ImagePicker {
227241 let intent = new Intent ( ) ;
228242 intent . setType ( this . mediaType ) ;
229243
230- let length = this . mediaType === "*/*" ? 2 : 1 ;
231- let mimeTypes = Array . create ( java . lang . String , length ) ;
232-
233- if ( this . mediaType === "*/*" ) {
234- mimeTypes [ 0 ] = "image/*" ;
235- mimeTypes [ 1 ] = "video/*" ;
236- }
237- else {
238- mimeTypes [ 0 ] = this . mediaType ;
239- }
240-
241244 // not in platform-declaration typings
242- intent . putExtra ( ( android . content . Intent as any ) . EXTRA_MIME_TYPES , mimeTypes ) ;
245+ intent . putExtra ( ( android . content . Intent as any ) . EXTRA_MIME_TYPES , this . mimeTypes ) ;
246+
243247 // TODO: Use (<any>android).content.Intent.EXTRA_ALLOW_MULTIPLE
244248 if ( this . mode === 'multiple' ) {
245249 intent . putExtra ( "android.intent.extra.ALLOW_MULTIPLE" , true ) ;
0 commit comments