From d2939a5dfc54af3a5d8709f34d085e89620e87f4 Mon Sep 17 00:00:00 2001 From: Naveen Agarwal Date: Mon, 5 Oct 2020 16:25:43 +0530 Subject: [PATCH 1/2] feat(multiple-document-picker): add plugin --- package-lock.json | 15 ++++++ package.json | 1 + .../plugins/multiple-document-picker/index.ts | 47 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/@ionic-native/plugins/multiple-document-picker/index.ts diff --git a/package-lock.json b/package-lock.json index 51be506ccd..ac112b86c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -851,6 +851,21 @@ "kuler": "^2.0.0" } }, + "@ionic-native/core": { + "version": "5.28.0", + "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-5.28.0.tgz", + "integrity": "sha512-YmR70U+bIk1e4V36bke8HCol2XwuplAr4OTok4Jdx6MaAfJ1xR1AWt2PiQOIgM8bAq8qkVlbgsYi2rEOzKVc7A==", + "requires": { + "@types/cordova": "^0.0.34" + }, + "dependencies": { + "@types/cordova": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", + "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" + } + } + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", diff --git a/package.json b/package.json index dcd189cafd..37aeb29594 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ } }, "dependencies": { + "@ionic-native/core": "^5.28.0", "tslib": "^1.13.0" }, "husky": { diff --git a/src/@ionic-native/plugins/multiple-document-picker/index.ts b/src/@ionic-native/plugins/multiple-document-picker/index.ts new file mode 100644 index 0000000000..1ec7387758 --- /dev/null +++ b/src/@ionic-native/plugins/multiple-document-picker/index.ts @@ -0,0 +1,47 @@ +/** + * This is a wrapper for MultipleDocumentsPicker plugin + * + */ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; + +/** + * @name Multiple Documents Picker + * @description + * This plugin allows users to pick multiple documents/images at once + * + * @usage + * ```typescript + * import { MultipleDocumentsPicker } from '@ionic-native/multiple-document-picker/ngx'; + * + * + * constructor(private multipleDocumentsPicker: MultipleDocumentsPicker) { } + * + * ... + * + * + * this.multipleDocumentsPicker.pick(1) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'MultipleDocumentsPicker', + plugin: 'cordova-plugin-multiple-documents-picker', + pluginRef: 'multipleDocumentsPicker', + repo: 'https://github.com/akeotech/cordova-plugin-multiple-documents-picker', + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class MultipleDocumentsPicker extends IonicNativePlugin { + /** + * This function allow user to show native file picker + * @param type {number} To pick type of files: for images send 1, for all files send 2 + * @return {Promise} Returns a promise that resolves when something happens + */ + @Cordova() + pick(type: number): Promise { + return; // We add return; here to avoid any IDE / Compiler errors + } +} From b57b06cb0ba1072e8823360be08e2c4cf4f4e7e3 Mon Sep 17 00:00:00 2001 From: Naveen Agarwal Date: Mon, 19 Oct 2020 15:57:11 +0530 Subject: [PATCH 2/2] removed package json related changes --- package-lock.json | 15 --------------- package.json | 1 - 2 files changed, 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index ac112b86c0..51be506ccd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -851,21 +851,6 @@ "kuler": "^2.0.0" } }, - "@ionic-native/core": { - "version": "5.28.0", - "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-5.28.0.tgz", - "integrity": "sha512-YmR70U+bIk1e4V36bke8HCol2XwuplAr4OTok4Jdx6MaAfJ1xR1AWt2PiQOIgM8bAq8qkVlbgsYi2rEOzKVc7A==", - "requires": { - "@types/cordova": "^0.0.34" - }, - "dependencies": { - "@types/cordova": { - "version": "0.0.34", - "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", - "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" - } - } - }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", diff --git a/package.json b/package.json index 37aeb29594..dcd189cafd 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,6 @@ } }, "dependencies": { - "@ionic-native/core": "^5.28.0", "tslib": "^1.13.0" }, "husky": {