From bfbbc2ee124f89a819f240f3d079e3f85d07db69 Mon Sep 17 00:00:00 2001 From: Jonathan Tavares Date: Thu, 2 Nov 2017 16:21:51 +0000 Subject: [PATCH 1/3] feat(DocumentPicker) adds DocumentPicker ios plugin --- .../plugins/document-picker/index.ts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/@ionic-native/plugins/document-picker/index.ts diff --git a/src/@ionic-native/plugins/document-picker/index.ts b/src/@ionic-native/plugins/document-picker/index.ts new file mode 100644 index 000000000..560c4afb5 --- /dev/null +++ b/src/@ionic-native/plugins/document-picker/index.ts @@ -0,0 +1,57 @@ + +import { Injectable } from '@angular/core'; +import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; + +/** + * Filter options + */ +export enum DocumentPickerOptions { + /** Show only PDF files */ + PDF = 'pdf', + /** show only image files */ + IMAGE = 'image', + /** show all files */ + ALL = 'all' +} + + +/** + * @name DocumentPicker + * @description + * + * Opens the file picker on iOS for the user to select a file, returns a file URI. + * Allows the user to upload files from icloud + * + * @usage + * ```typescript + * import { DocumentPicker, DocumentPickerOptions } from '@ionic-native/document-picker'; + * + * constructor(private docPicker: DocumentPicker) { } + * + * ... + * + * this.docPicker.getFile(DocumentPickerOptions.ALL) + * .then(uri => console.log(uri)) + * .catch(e => console.log(e)); + * + * ``` + */ +@Plugin({ + pluginName: 'DocumentPicker', + plugin: 'cordova-plugin-documentpicker.DocumentPicker', + pluginRef: 'DocumentPicker', + repo: 'https://github.com/iampossible/Cordova-DocPicker', + platforms: ['iOS'] +}) +@Injectable() +export class DocumentPicker extends IonicNativePlugin { + + /** + * Open a file + * @param {DocumentPickerOptions} filters files between 'image', 'pdf' or 'all' + * @returns {Promise} + */ + @Cordova() + getFile(options?: DocumentPickerOptions | string): Promise { return; } + +} From e9580b46ef3c022f134f86e213ee8b6352c48766 Mon Sep 17 00:00:00 2001 From: Jonathan Tavares Date: Thu, 2 Nov 2017 16:38:18 +0000 Subject: [PATCH 2/3] fix(DocumentPicker) uses String instead of DocumentPickerOptions --- .../plugins/document-picker/index.ts | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/@ionic-native/plugins/document-picker/index.ts b/src/@ionic-native/plugins/document-picker/index.ts index 560c4afb5..d2c028a71 100644 --- a/src/@ionic-native/plugins/document-picker/index.ts +++ b/src/@ionic-native/plugins/document-picker/index.ts @@ -2,18 +2,6 @@ import { Injectable } from '@angular/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; -/** - * Filter options - */ -export enum DocumentPickerOptions { - /** Show only PDF files */ - PDF = 'pdf', - /** show only image files */ - IMAGE = 'image', - /** show all files */ - ALL = 'all' -} - /** * @name DocumentPicker @@ -24,13 +12,13 @@ export enum DocumentPickerOptions { * * @usage * ```typescript - * import { DocumentPicker, DocumentPickerOptions } from '@ionic-native/document-picker'; + * import { DocumentPicker } from '@ionic-native/document-picker'; * * constructor(private docPicker: DocumentPicker) { } * * ... * - * this.docPicker.getFile(DocumentPickerOptions.ALL) + * this.docPicker.getFile('all') * .then(uri => console.log(uri)) * .catch(e => console.log(e)); * @@ -48,10 +36,10 @@ export class DocumentPicker extends IonicNativePlugin { /** * Open a file - * @param {DocumentPickerOptions} filters files between 'image', 'pdf' or 'all' + * @param {string} filters files between 'image', 'pdf' or 'all' * @returns {Promise} */ @Cordova() - getFile(options?: DocumentPickerOptions | string): Promise { return; } + getFile(options?: string): Promise { return; } } From 67ea61a3cbc46cd833cb1a40b1173cd31628e489 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Sat, 17 Mar 2018 11:45:12 +0100 Subject: [PATCH 3/3] rename plugin --- src/@ionic-native/plugins/document-picker/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/document-picker/index.ts b/src/@ionic-native/plugins/document-picker/index.ts index d2c028a71..f9f636f6d 100644 --- a/src/@ionic-native/plugins/document-picker/index.ts +++ b/src/@ionic-native/plugins/document-picker/index.ts @@ -4,7 +4,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; /** - * @name DocumentPicker + * @name iOS DocumentPicker * @description * * Opens the file picker on iOS for the user to select a file, returns a file URI. @@ -12,9 +12,9 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * * @usage * ```typescript - * import { DocumentPicker } from '@ionic-native/document-picker'; + * import { IOSDocumentPicker } from '@ionic-native/document-picker'; * - * constructor(private docPicker: DocumentPicker) { } + * constructor(private docPicker: IOSDocumentPicker) { } * * ... * @@ -25,7 +25,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * ``` */ @Plugin({ - pluginName: 'DocumentPicker', + pluginName: 'IOSDocumentPicker', plugin: 'cordova-plugin-documentpicker.DocumentPicker', pluginRef: 'DocumentPicker', repo: 'https://github.com/iampossible/Cordova-DocPicker',