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