mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-23 02:12:56 +08:00
fix(chooser): Update for support android 11+ (#4436)
BREAKING: Updated plugin source https://github.com/MaximBelov/cordova-plugin-chooser
This commit is contained in:
parent
3b1d0593da
commit
ba37646fc4
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user