mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-16 00:11:10 +08:00
feat(DocumentPicker) adds DocumentPicker ios plugin
feat(DocumentPicker) adds DocumentPicker ios plugin
This commit is contained in:
commit
33789b2d39
45
src/@ionic-native/plugins/document-picker/index.ts
Normal file
45
src/@ionic-native/plugins/document-picker/index.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name iOS 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 { IOSDocumentPicker } from '@ionic-native/document-picker';
|
||||||
|
*
|
||||||
|
* constructor(private docPicker: IOSDocumentPicker) { }
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* this.docPicker.getFile('all')
|
||||||
|
* .then(uri => console.log(uri))
|
||||||
|
* .catch(e => console.log(e));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'IOSDocumentPicker',
|
||||||
|
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 {string} filters files between 'image', 'pdf' or 'all'
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
getFile(options?: string): Promise<string> { return; }
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user