fix(chooser): Update for support android 11+ (#4436)

BREAKING: Updated plugin source https://github.com/MaximBelov/cordova-plugin-chooser
This commit is contained in:
MaximBelov 2022-12-31 10:02:04 +02:00 committed by GitHub
parent 3b1d0593da
commit ba37646fc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,24 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
export interface ChooserOptions {
mimeTypes?: string;
maxFileSize?: number;
}
export interface ChooserResult {
data?: Uint8Array;
dataURI?: string;
mediaType: string;
path: string;
/**
* without extension
*/
name: string;
uri: string;
/**
* with extension
*/
displayName: string;
mimeType: string;
extension: string;
size: number;
}
/**
@ -47,32 +59,23 @@ export interface ChooserResult {
pluginName: 'Chooser',
plugin: 'cordova-plugin-chooser',
pluginRef: 'chooser',
repo: 'https://github.com/cyph/cordova-plugin-chooser',
repo: 'https://github.com/MaximBelov/cordova-plugin-chooser',
platforms: ['Android', 'iOS'],
install: 'ionic cordova plugin add http://github.com/MaximBelov/cordova-plugin-chooser.git',
})
@Injectable()
export class Chooser extends AwesomeCordovaNativePlugin {
/**
* Displays native prompt for user to select a file.
*
* @param {string} [accept] Optional MIME type filter (e.g. 'image/gif,video/*').
* @returns {Promise<any>} Promise containing selected file's raw binary data,
* base64-encoded data: URI, MIME type, display name, and original URI.
* @param {Object} options
* @param {string} options.mimeTypes Optional MIME type filter (e.g. 'image/gif,video/*').
* @param {string} options.maxFileSize Optional Max file size.
* @returns {Promise<any>} Promise containing selected file's
* data: MIME type, display name, and original URI.
*/
@Cordova()
getFile(accept?: string): Promise<ChooserResult | undefined> {
return;
}
/**
* Displays native prompt for user to select a file.
*
* @param {string} [accept] Optional MIME type filter (e.g. 'image/gif,video/*').
* @returns {Promise<any>} Promise containing selected file's MIME type, display name, and original URI.
* If user cancels, promise will be resolved as undefined.
* If error occurs, promise will be rejected.
*/
@Cordova()
getFileMetadata(accept?: string): Promise<ChooserResult | undefined> {
getFile(options?: ChooserOptions): Promise<ChooserResult | undefined> {
return;
}
}