From ed36dc492d16cb66e530484395b90c6071c5e806 Mon Sep 17 00:00:00 2001 From: nerdic-coder Date: Wed, 8 May 2019 16:32:53 +0300 Subject: [PATCH] feat(FileOpener): Added method showOpenWithDialog --- .../plugins/file-opener/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/@ionic-native/plugins/file-opener/index.ts b/src/@ionic-native/plugins/file-opener/index.ts index 441f18439..afa247105 100644 --- a/src/@ionic-native/plugins/file-opener/index.ts +++ b/src/@ionic-native/plugins/file-opener/index.ts @@ -18,6 +18,10 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; * .then(() => console.log('File is opened')) * .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({ @@ -71,4 +75,19 @@ export class FileOpener extends IonicNativePlugin { appIsInstalled(packageId: string): Promise { 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} + */ + @Cordova({ + callbackStyle: 'object', + successName: 'success', + errorName: 'error' + }) + showOpenWithDialog(filePath: string, fileMIMEType: string): Promise { + return; + } }