From d1f5d2adb9f52b006f398084c4106e23e024de63 Mon Sep 17 00:00:00 2001 From: fco Date: Mon, 17 Oct 2016 20:36:16 +0200 Subject: [PATCH] feat(filepath): add cordova-plugin-filepath --- src/index.ts | 3 +++ src/plugins/filepath.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/plugins/filepath.ts diff --git a/src/index.ts b/src/index.ts index 4231e23373..25439d2ec6 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 0000000000..9585708274 --- /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; } +}