60 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-03-17 14:33:21 +01:00
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface IOSFilePickerPosition {
x: number;
y: number;
width: number;
height: number;
2018-04-13 12:41:45 +02:00
}
2018-03-17 14:33:21 +01:00
/**
* @name iOS File Picker
2018-03-17 14:33:21 +01:00
* @description
*
* Opens the file picker on iOS for the user to select a file, returns a file URI.
*
* @usage
* ```typescript
2018-10-10 16:13:45 -05:00
* import { IOSFilePicker } from '@ionic-native/file-picker/ngx';
2018-03-17 14:33:21 +01:00
*
* constructor(private filePicker: IOSFilePicker) { }
*
* ...
*
* this.filePicker.pickFile()
* .then(uri => console.log(uri))
* .catch(err => console.log('Error', err));
*
* ```
* @interfaces
* IOSFilePickerPosition
2018-03-17 14:33:21 +01:00
*/
@Plugin({
pluginName: 'iOS File Picker',
plugin: 'cordova-plugin-filepicker',
2018-04-04 14:17:47 +09:30
pluginRef: 'FilePicker',
2018-03-17 14:33:21 +01:00
repo: 'https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin',
platforms: ['iOS']
})
@Injectable({
providedIn: 'root'
})
2018-03-17 14:33:21 +01:00
export class IOSFilePicker extends IonicNativePlugin {
/**
* Open a file
* @params {string | string[]} [utis]
* @params {IOSFilePickerPosition} [position] Set the position of the rectangle where the file picker should show up.
2018-03-17 14:33:21 +01:00
* @returns {Promise<string>}
*/
@Cordova({
callbackOrder: 'reverse'
})
pickFile(
utis?: string | string[],
position?: IOSFilePickerPosition
): Promise<string> {
2018-03-17 14:33:21 +01:00
return;
}
}