feat(FileOpener): Added method showOpenWithDialog

This commit is contained in:
nerdic-coder 2019-05-08 16:32:53 +03:00
parent 19ddf3fb93
commit ed36dc492d

View File

@ -18,6 +18,10 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
* .then(() => console.log('File is opened')) * .then(() => console.log('File is opened'))
* .catch(e => console.log('Error opening file', e)); * .catch(e => console.log('Error opening file', e));
* *
* this.fileOpener.showOpenWithDialog('path/to/file.pdf', 'application/pdf')
* .then(() => console.log('File is opened'))
* .catch(e => console.log('Error opening file', e));
*
* ``` * ```
*/ */
@Plugin({ @Plugin({
@ -71,4 +75,19 @@ export class FileOpener extends IonicNativePlugin {
appIsInstalled(packageId: string): Promise<any> { appIsInstalled(packageId: string): Promise<any> {
return; return;
} }
/**
* Opens with system modal to open file with an already installed app.
* @param {string} filePath File Path
* @param {string} fileMIMEType File MIME Type
* @returns {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'success',
errorName: 'error'
})
showOpenWithDialog(filePath: string, fileMIMEType: string): Promise<any> {
return;
}
} }