diff --git a/src/index.ts b/src/index.ts index 4231e2337..25439d2ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,7 @@ import { Facebook } from './plugins/facebook'; import { File } from './plugins/file'; import { FileChooser } from './plugins/file-chooser'; import { FileOpener } from './plugins/file-opener'; +import { FilePath } from './plugins/filepath'; import { Transfer } from './plugins/filetransfer'; import { Flashlight } from './plugins/flashlight'; import { Geofence } from './plugins/geofence'; @@ -153,6 +154,7 @@ export * from './plugins/file'; export * from './plugins/file-chooser'; export * from './plugins/file-opener'; export * from './plugins/filetransfer'; +export * from './plugins/filepath'; export * from './plugins/flashlight'; export * from './plugins/geofence'; export * from './plugins/geolocation'; @@ -262,6 +264,7 @@ window['IonicNative'] = { File, FileChooser, FileOpener, + FilePath, Flashlight, Geofence, Geolocation, diff --git a/src/plugins/filepath.ts b/src/plugins/filepath.ts new file mode 100644 index 000000000..958570827 --- /dev/null +++ b/src/plugins/filepath.ts @@ -0,0 +1,34 @@ +import { Plugin, Cordova } from './plugin'; + +declare var window: any; + +/** + * @name FilePath + * @description + * + * This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library. + * + * @usage + * ``` + * import {FilePath} from 'ionic-native'; + * + * FilePath.resolveNativePath(path) + * .then(filePath => console.log(filePath); + * .catch(err => console.log(err); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-filepath', + pluginRef: 'window.FilePath', + repo: 'https://github.com/hiddentao/cordova-plugin-filepath', + platforms: ['Android'] +}) +export class FilePath { + /** + * Resolve native path for given content URL/path. + * @param {String} path Content URL/path. + */ + @Cordova() + static resolveNativePath(path: string): Promise {return; } +}