2017-03-20 16:38:14 -04:00
|
|
|
import { Injectable } from '@angular/core';
|
2018-04-08 21:32:20 +02:00
|
|
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
2016-10-18 12:05:19 +02:00
|
|
|
|
2017-05-14 00:55:16 -04:00
|
|
|
declare const window: any;
|
2016-10-18 12:05:19 +02:00
|
|
|
|
|
|
|
|
/**
|
2017-03-20 16:38:14 -04:00
|
|
|
* @name File Path
|
2016-10-18 12:05:19 +02:00
|
|
|
* @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
|
2017-04-30 20:36:22 +02:00
|
|
|
* ```typescript
|
2018-10-10 16:13:45 -05:00
|
|
|
* import { FilePath } from '@ionic-native/file-path/ngx';
|
2016-10-18 12:05:19 +02:00
|
|
|
*
|
2017-03-20 16:38:14 -04:00
|
|
|
* constructor(private filePath: FilePath) { }
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* this.filePath.resolveNativePath(path)
|
2017-04-14 15:04:46 +02:00
|
|
|
* .then(filePath => console.log(filePath))
|
|
|
|
|
* .catch(err => console.log(err));
|
2016-10-18 12:05:19 +02:00
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
@Plugin({
|
2016-10-27 12:48:50 -05:00
|
|
|
pluginName: 'FilePath',
|
2016-10-18 12:05:19 +02:00
|
|
|
plugin: 'cordova-plugin-filepath',
|
|
|
|
|
pluginRef: 'window.FilePath',
|
|
|
|
|
repo: 'https://github.com/hiddentao/cordova-plugin-filepath',
|
|
|
|
|
platforms: ['Android']
|
|
|
|
|
})
|
2017-03-20 16:38:14 -04:00
|
|
|
@Injectable()
|
2017-04-27 00:36:12 -04:00
|
|
|
export class FilePath extends IonicNativePlugin {
|
2016-10-18 12:05:19 +02:00
|
|
|
/**
|
|
|
|
|
* Resolve native path for given content URL/path.
|
2018-04-08 21:32:20 +02:00
|
|
|
* @param {string} path Content URL/path.
|
2016-11-29 16:40:50 -06:00
|
|
|
* @returns {Promise<string>}
|
2016-10-18 12:05:19 +02:00
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2018-04-08 21:32:20 +02:00
|
|
|
resolveNativePath(path: string): Promise<string> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-10-18 12:05:19 +02:00
|
|
|
}
|