2017-11-02 16:21:51 +00:00
|
|
|
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2017-11-02 16:38:18 +00:00
|
|
|
* import { DocumentPicker } from '@ionic-native/document-picker';
|
2017-11-02 16:21:51 +00:00
|
|
|
*
|
|
|
|
* constructor(private docPicker: DocumentPicker) { }
|
|
|
|
*
|
|
|
|
* ...
|
|
|
|
*
|
2017-11-02 16:38:18 +00:00
|
|
|
* this.docPicker.getFile('all')
|
2017-11-02 16:21:51 +00:00
|
|
|
* .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
|
2017-11-02 16:38:18 +00:00
|
|
|
* @param {string} filters files between 'image', 'pdf' or 'all'
|
2017-11-02 16:21:51 +00:00
|
|
|
* @returns {Promise<string>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2017-11-02 16:38:18 +00:00
|
|
|
getFile(options?: string): Promise<string> { return; }
|
2017-11-02 16:21:51 +00:00
|
|
|
|
|
|
|
}
|