merge
This commit is contained in:
commit
bde47eb37b
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
.idea
|
||||
dist/
|
||||
scripts/ionic-native-bower
|
||||
|
226
CHANGELOG.md
226
CHANGELOG.md
@ -1,3 +1,203 @@
|
||||
<a name="1.3.17"></a>
|
||||
## [1.3.17](https://github.com/driftyco/ionic-native/compare/v1.3.16...v1.3.17) (2016-08-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add the reject function at the expected errorIndex position in the args array ([#436](https://github.com/driftyco/ionic-native/issues/436)) ([4e87ac7](https://github.com/driftyco/ionic-native/commit/4e87ac7))
|
||||
* **camera-preview:** changes implementation to match Cordova plugin ([#441](https://github.com/driftyco/ionic-native/issues/441)) ([55ba65a](https://github.com/driftyco/ionic-native/commit/55ba65a))
|
||||
* **file:** fixes exclusive option ([#459](https://github.com/driftyco/ionic-native/issues/459)) ([14e41a3](https://github.com/driftyco/ionic-native/commit/14e41a3)), closes [#459](https://github.com/driftyco/ionic-native/issues/459)
|
||||
* **file:** initialize writeFile options ([#468](https://github.com/driftyco/ionic-native/issues/468)) ([16628a4](https://github.com/driftyco/ionic-native/commit/16628a4))
|
||||
* **nativeaudio:** fix plugin reference ([2510c5f](https://github.com/driftyco/ionic-native/commit/2510c5f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **instagram:** add instagram sharing plugin ([#453](https://github.com/driftyco/ionic-native/issues/453)) ([f3e698f](https://github.com/driftyco/ionic-native/commit/f3e698f)), closes [#307](https://github.com/driftyco/ionic-native/issues/307)
|
||||
* **VideoEditor:** add video editor plugin. ([#457](https://github.com/driftyco/ionic-native/issues/457)) ([7a53013](https://github.com/driftyco/ionic-native/commit/7a53013)), closes [#316](https://github.com/driftyco/ionic-native/issues/316)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.16"></a>
|
||||
## [1.3.16](https://github.com/driftyco/ionic-native/compare/v1.3.15...v1.3.16) (2016-08-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **photo-viewer:** method is static ([8bc499f](https://github.com/driftyco/ionic-native/commit/8bc499f))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.15"></a>
|
||||
## [1.3.15](https://github.com/driftyco/ionic-native/compare/v1.3.14...v1.3.15) (2016-08-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **google-analytics:** add missing functions ([689bfd9](https://github.com/driftyco/ionic-native/commit/689bfd9))
|
||||
* **TTS:** add tts plugin ([#431](https://github.com/driftyco/ionic-native/issues/431)) ([dcf3ab2](https://github.com/driftyco/ionic-native/commit/dcf3ab2)), closes [#311](https://github.com/driftyco/ionic-native/issues/311)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.14"></a>
|
||||
## [1.3.14](https://github.com/driftyco/ionic-native/compare/v1.3.13...v1.3.14) (2016-08-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **datepicker:** date now accepts Date, string, or number ([#428](https://github.com/driftyco/ionic-native/issues/428)) ([aaddd9e](https://github.com/driftyco/ionic-native/commit/aaddd9e)), closes [#354](https://github.com/driftyco/ionic-native/issues/354)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **native-audio:** Add native audio plugin ([#427](https://github.com/driftyco/ionic-native/issues/427)) ([8cd6686](https://github.com/driftyco/ionic-native/commit/8cd6686)), closes [#315](https://github.com/driftyco/ionic-native/issues/315)
|
||||
* **shake:** add Shake plugin ([#426](https://github.com/driftyco/ionic-native/issues/426)) ([203d4c7](https://github.com/driftyco/ionic-native/commit/203d4c7)), closes [#313](https://github.com/driftyco/ionic-native/issues/313)
|
||||
* **zip:** add zip plugin ([#430](https://github.com/driftyco/ionic-native/issues/430)) ([e34f94e](https://github.com/driftyco/ionic-native/commit/e34f94e)), closes [#421](https://github.com/driftyco/ionic-native/issues/421)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.13"></a>
|
||||
## [1.3.13](https://github.com/driftyco/ionic-native/compare/v1.3.12...v1.3.13) (2016-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **inappbrowser:** fix event listener ([4b08d85](https://github.com/driftyco/ionic-native/commit/4b08d85))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.12"></a>
|
||||
## [1.3.12](https://github.com/driftyco/ionic-native/compare/v1.3.10...v1.3.12) (2016-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **backgroundGeolocation:** update config and move to sync. Fixes [#331](https://github.com/driftyco/ionic-native/issues/331) ([4e20681](https://github.com/driftyco/ionic-native/commit/4e20681)), closes [#331](https://github.com/driftyco/ionic-native/issues/331)
|
||||
* **camera:** camera options should be optional. Fixes [#413](https://github.com/driftyco/ionic-native/issues/413) ([#417](https://github.com/driftyco/ionic-native/issues/417)) ([c60c3b7](https://github.com/driftyco/ionic-native/commit/c60c3b7)), closes [#413](https://github.com/driftyco/ionic-native/issues/413) [#417](https://github.com/driftyco/ionic-native/issues/417)
|
||||
* **inappbrowser:** fix event listener ([618d866](https://github.com/driftyco/ionic-native/commit/618d866))
|
||||
* **index:** export Geolocation interfaces. ([#404](https://github.com/driftyco/ionic-native/issues/404)) ([0c486b0](https://github.com/driftyco/ionic-native/commit/0c486b0))
|
||||
* **ng1:** Copy object properly. Fixes [#357](https://github.com/driftyco/ionic-native/issues/357) ([9ca38cd](https://github.com/driftyco/ionic-native/commit/9ca38cd)), closes [#357](https://github.com/driftyco/ionic-native/issues/357)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **file:** alternate file implementation ([#283](https://github.com/driftyco/ionic-native/issues/283)) ([6ed32ef](https://github.com/driftyco/ionic-native/commit/6ed32ef))
|
||||
* **GoogleAnalytics:** Add campaign measurement tracking ([#405](https://github.com/driftyco/ionic-native/issues/405)) ([cf3f0f6](https://github.com/driftyco/ionic-native/commit/cf3f0f6))
|
||||
* **GoogleMaps:** Allow specify enableHighAccuracy option that attempt to get your location with highest accuracy ([#410](https://github.com/driftyco/ionic-native/issues/410)) ([43e8a6d](https://github.com/driftyco/ionic-native/commit/43e8a6d))
|
||||
* **ibeacon:** using option otherPromise instead of sync ([#388](https://github.com/driftyco/ionic-native/issues/388)) ([306cb5d](https://github.com/driftyco/ionic-native/commit/306cb5d))
|
||||
* **inappbrowser:** implement instance based wrapper ([#305](https://github.com/driftyco/ionic-native/issues/305)) ([4b8ab4a](https://github.com/driftyco/ionic-native/commit/4b8ab4a))
|
||||
* **keyboard:** enable hideKeyboardAccessoryBar function ([#398](https://github.com/driftyco/ionic-native/issues/398)) ([7a84262](https://github.com/driftyco/ionic-native/commit/7a84262)), closes [#394](https://github.com/driftyco/ionic-native/issues/394)
|
||||
* **photo-viewer:** add wrapper for plugin ([#359](https://github.com/driftyco/ionic-native/issues/359)) ([154c029](https://github.com/driftyco/ionic-native/commit/154c029))
|
||||
* **video-player:** Added video player plugin ([#391](https://github.com/driftyco/ionic-native/issues/391)) ([cabeeb8](https://github.com/driftyco/ionic-native/commit/cabeeb8)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.10"></a>
|
||||
## [1.3.10](https://github.com/driftyco/ionic-native/compare/v1.3.9...v1.3.10) (2016-08-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **brightness:** use correct pluginRef ([e20c411](https://github.com/driftyco/ionic-native/commit/e20c411))
|
||||
* **diagnostics:** Corrects isEnabled functions to isAvailable ([#373](https://github.com/driftyco/ionic-native/issues/373)) ([ccf7fb5](https://github.com/driftyco/ionic-native/commit/ccf7fb5))
|
||||
* **ng1:** use $q promises instead of the native Promise ([#378](https://github.com/driftyco/ionic-native/issues/378)) ([817a434](https://github.com/driftyco/ionic-native/commit/817a434))
|
||||
* **one-signal:** return Observable instead of promise ([#352](https://github.com/driftyco/ionic-native/issues/352)) ([08fe04e](https://github.com/driftyco/ionic-native/commit/08fe04e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **crop:** add crop plugin ([#284](https://github.com/driftyco/ionic-native/issues/284)) ([41c9adf](https://github.com/driftyco/ionic-native/commit/41c9adf))
|
||||
* **screen-orientation:** Added Screen Orientation Plugin [#342](https://github.com/driftyco/ionic-native/issues/342) ([#366](https://github.com/driftyco/ionic-native/issues/366)) ([bd9366b](https://github.com/driftyco/ionic-native/commit/bd9366b)), closes [#342](https://github.com/driftyco/ionic-native/issues/342)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.9"></a>
|
||||
## [1.3.9](https://github.com/driftyco/ionic-native/compare/v1.3.8...v1.3.9) (2016-07-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file:** readAsText() and adds readAsDataURL() in File plugin ([#346](https://github.com/driftyco/ionic-native/issues/346)) ([77d31cd](https://github.com/driftyco/ionic-native/commit/77d31cd))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **android-fingerprint-auth:** add wrapper for plugin ([df326f7](https://github.com/driftyco/ionic-native/commit/df326f7)), closes [#334](https://github.com/driftyco/ionic-native/issues/334)
|
||||
* **secure-storage:** Add Secure Storage Wrapper ([#347](https://github.com/driftyco/ionic-native/issues/347)) ([075842d](https://github.com/driftyco/ionic-native/commit/075842d))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.8"></a>
|
||||
## [1.3.8](https://github.com/driftyco/ionic-native/compare/v1.3.7...v1.3.8) (2016-07-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **base64togallery:** update plugin wrapper to match latest version ([d4bee49](https://github.com/driftyco/ionic-native/commit/d4bee49)), closes [#335](https://github.com/driftyco/ionic-native/issues/335)
|
||||
* **sqlite:** fix method attribute typo ([#324](https://github.com/driftyco/ionic-native/issues/324)) ([006bc70](https://github.com/driftyco/ionic-native/commit/006bc70)), closes [#324](https://github.com/driftyco/ionic-native/issues/324)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **facebook:** add FacebookLoginResponse interface ([8b27bed](https://github.com/driftyco/ionic-native/commit/8b27bed))
|
||||
* **otherPromise:** can work better with plugins that return promises ([#304](https://github.com/driftyco/ionic-native/issues/304)) ([0aee6c8](https://github.com/driftyco/ionic-native/commit/0aee6c8))
|
||||
* **social-sharing:** add canShareViaEmail ([#333](https://github.com/driftyco/ionic-native/issues/333)) ([5807dd7](https://github.com/driftyco/ionic-native/commit/5807dd7))
|
||||
* **twitter-connect:** add twitter connect plugin ([979838f](https://github.com/driftyco/ionic-native/commit/979838f)), closes [#308](https://github.com/driftyco/ionic-native/issues/308)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.7"></a>
|
||||
## [1.3.7](https://github.com/driftyco/ionic-native/compare/v1.3.6...v1.3.7) (2016-07-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **contacts:** missing name property, types ([#320](https://github.com/driftyco/ionic-native/issues/320)) ([074d166](https://github.com/driftyco/ionic-native/commit/074d166))
|
||||
* **geolocation:** handle errors on watchPosition ([1b161d8](https://github.com/driftyco/ionic-native/commit/1b161d8)), closes [#322](https://github.com/driftyco/ionic-native/issues/322)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **sim:** Add sim plugin ([#317](https://github.com/driftyco/ionic-native/issues/317)) ([4f85110](https://github.com/driftyco/ionic-native/commit/4f85110))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.6"></a>
|
||||
## [1.3.6](https://github.com/driftyco/ionic-native/compare/v1.3.5...v1.3.6) (2016-07-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** able to pass array of LatLng to GoogleMapsLatLngBounds constructor ([de14b0e](https://github.com/driftyco/ionic-native/commit/de14b0e)), closes [#298](https://github.com/driftyco/ionic-native/issues/298)
|
||||
* **launch-navigator:** fix the navigate function wrapper to match latest plugin API ([6f625f9](https://github.com/driftyco/ionic-native/commit/6f625f9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **camera-preview:** add wrapper for camera-preview ([#301](https://github.com/driftyco/ionic-native/issues/301)) ([3a1a3ce](https://github.com/driftyco/ionic-native/commit/3a1a3ce))
|
||||
* **launch-navigator:** add new methods and constants to match latest plugin API ([29de6b3](https://github.com/driftyco/ionic-native/commit/29de6b3))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.5"></a>
|
||||
## [1.3.5](https://github.com/driftyco/ionic-native/compare/v1.3.4...v1.3.5) (2016-07-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ibeacon:** minor fixes ([b5a2ffc](https://github.com/driftyco/ionic-native/commit/b5a2ffc))
|
||||
* **safari-view-controller:** fix wrappers ([b4b3ec0](https://github.com/driftyco/ionic-native/commit/b4b3ec0))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **googlemaps:** add Geocoder class ([#292](https://github.com/driftyco/ionic-native/issues/292)) ([2996da6](https://github.com/driftyco/ionic-native/commit/2996da6)), closes [#280](https://github.com/driftyco/ionic-native/issues/280)
|
||||
* **media-capture:** add media capture plugin ([#293](https://github.com/driftyco/ionic-native/issues/293)) ([daa6d4c](https://github.com/driftyco/ionic-native/commit/daa6d4c)), closes [#272](https://github.com/driftyco/ionic-native/issues/272)
|
||||
* **nativestorage:** add NativeStorage plugin wrapper ([af5d4ad](https://github.com/driftyco/ionic-native/commit/af5d4ad))
|
||||
* **pin-dialog:** add pin dialog plugin ([#291](https://github.com/driftyco/ionic-native/issues/291)) ([2fe37c4](https://github.com/driftyco/ionic-native/commit/2fe37c4))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.4"></a>
|
||||
## [1.3.4](https://github.com/driftyco/ionic-native/compare/v1.3.3...v1.3.4) (2016-07-14)
|
||||
|
||||
@ -46,28 +246,12 @@
|
||||
|
||||
|
||||
<a name="1.3.1"></a>
|
||||
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.3.0...v1.3.1) (2016-06-26)
|
||||
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232)
|
||||
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
|
||||
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.3.0) (2016-06-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180)
|
||||
* **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212)
|
||||
* **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6))
|
||||
@ -76,6 +260,7 @@
|
||||
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
|
||||
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
|
||||
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
|
||||
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
|
||||
|
||||
|
||||
### Features
|
||||
@ -83,6 +268,13 @@
|
||||
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
|
||||
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
|
||||
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
|
||||
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
|
||||
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.4"></a>
|
||||
## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)
|
||||
|
||||
|
||||
|
||||
|
93
DEVELOPER.md
93
DEVELOPER.md
@ -5,6 +5,16 @@ This is a short guide on creating new plugin wrappers for Ionic Native.
|
||||
|
||||
## Creating Plugin Wrappers
|
||||
|
||||
First, let's start by creating a new plugin wrapper from template.
|
||||
|
||||
```
|
||||
// Call this command, and replace PluginName with the name of the plugin you wish to add
|
||||
// Make sure to capitalize the first letter, or use CamelCase if necessary.
|
||||
|
||||
gulp plugin:create -n PluginName
|
||||
```
|
||||
|
||||
|
||||
Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity):
|
||||
|
||||
```
|
||||
@ -92,14 +102,95 @@ The `@Cordova` decorator has a few more options now.
|
||||
|
||||
`clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed.
|
||||
|
||||
### Updating index.ts
|
||||
|
||||
For new plugins, you will need to update `/src/index.ts` to properly export your plugin and make it available for use.
|
||||
|
||||
1. Import the plugin class into `index.ts`:
|
||||
|
||||
`import {PluginClassName} from ./plugins/filenameForPlugin`
|
||||
|
||||
No need to put the `.ts` extension on the filename.
|
||||
|
||||
2. Add the plugin class name to the list in the `export` object:
|
||||
|
||||
```
|
||||
export {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
YourPluginClassName,
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
3. Add the plugin class name to the `window['IonicNative']` object:
|
||||
|
||||
```
|
||||
window['IonicNative'] = {
|
||||
ActionSheet: ActionSheet,
|
||||
AdMob: AdMob,
|
||||
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||
YourPluginClassName: YourPluginClassName,
|
||||
...
|
||||
```
|
||||
|
||||
4. If your plugin exports any other objects outside of the plugin class, add an export statement for the file:
|
||||
|
||||
`export * from './plugins/filenameForPlugin';`
|
||||
|
||||
No need to put the `.ts` extension on the filename.
|
||||
|
||||
For example, `googlemaps.ts` exports a const outside of the plugin's main `GoogleMap` class:
|
||||
|
||||
```
|
||||
export const GoogleMapsAnimation = {
|
||||
BOUNCE: 'BOUNCE',
|
||||
DROP: 'DROP'
|
||||
};
|
||||
```
|
||||
|
||||
To properly export `GoogleMapsAnimation`, `index.ts` is updated with:
|
||||
|
||||
`export * from './plugins/googlemaps';`
|
||||
|
||||
### Testing your changes
|
||||
|
||||
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
|
||||
|
||||
### Cleaning the code
|
||||
|
||||
You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
|
||||
You need to run `npm run lint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
|
||||
|
||||
### 'Wrapping' Up
|
||||
|
||||
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.
|
||||
|
||||
## Commit Message Format
|
||||
|
||||
We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the our change log. (Ok you got us, it's basically Angular's commit message format).
|
||||
|
||||
`type(scope): subject`
|
||||
|
||||
#### Type
|
||||
Must be one of the following:
|
||||
|
||||
* **fix**: A bug fix
|
||||
* **feat**: A new feature
|
||||
* **docs**: Documentation only changes
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **perf**: A code change that improves performance
|
||||
* **test**: Adding missing tests
|
||||
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
|
||||
|
||||
#### Scope
|
||||
The scope could be anything specifying place of the commit change. For example, the name of the plugin being changed
|
||||
|
||||
#### Subject
|
||||
The subject contains succinct description of the change:
|
||||
|
||||
* use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
* do not capitalize first letter
|
||||
* do not place a period (.) at the end
|
||||
* entire length of the commit message must not go over 50 characters
|
37
README.md
37
README.md
@ -31,10 +31,47 @@ let watch = Geolocation.watchPosition().subscribe(pos => {
|
||||
watch.unsubscribe();
|
||||
```
|
||||
|
||||
### Angular 1
|
||||
|
||||
Ionic Native works as a stand-in for [ngCordova](http://ngcordova.com/). In many cases, the usage is identical, but we import `ionic.native` instead of `ngCordova` as our module.
|
||||
|
||||
As a rule of thumb: take the ES6 class name of the plugin and add `$cordova` to get the service name. For example, `Geolocation` would be `$cordovaGeolocation`, and `Camera` will be `$cordovaCamera`:
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ionic', 'ionic.native'])
|
||||
|
||||
.controller('MyCtrl', function($scope, $cordovaCamera) {
|
||||
$scope.takePicture = function() {
|
||||
$cordovaCamera.getPicture(opts).then(function(p) {
|
||||
}, function(err) {
|
||||
});
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
For services that return observables, the Angular 1 digest cycle must be done manually (currently):
|
||||
|
||||
```javascript
|
||||
angular.module('myApp', ['ionic', 'ionic.native'])
|
||||
|
||||
.controller('MyCtrl', function($scope, $cordovaGeolocation) {
|
||||
$scope.takePicture = function() {
|
||||
$cordovaGeolocation.watchPosition(opts).subscribe(function(p) {
|
||||
$scope.$apply(function() {
|
||||
$scope.position = p.coords;
|
||||
});
|
||||
}, function(err) {
|
||||
});
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
### Runtime Diagnostics
|
||||
|
||||
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
Run following commmand to install ionic-native in your project.
|
||||
|
50
TEMPLATE
Normal file
50
TEMPLATE
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This is a template for new plugin wrappers
|
||||
*
|
||||
* TODO:
|
||||
* - Add/Change information below
|
||||
* - Document usage (importing, executing main functionality)
|
||||
* - Remove any imports that you are not using
|
||||
* - Add this file to /src/index.ts (follow style of other plugins)
|
||||
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
|
||||
* - Remove this note
|
||||
*
|
||||
*/
|
||||
import {Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty} from './plugin';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name PluginName
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {PluginName} from 'ionic-native';
|
||||
*
|
||||
* PluginName.functionName('Hello', 123)
|
||||
* .then((something: any) => doSomething(something))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: '', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: '', // the github repository URL for the plugin
|
||||
install: '' // OPTIONAL install command, in case the plugin requires variables
|
||||
})
|
||||
export class PluginName {
|
||||
|
||||
/**
|
||||
* This function does something
|
||||
* @param arg1 {string} Some param to configure something
|
||||
* @param arg2 {number} Another param to configure something
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
static functionName(arg1: string, arg2: number): Promise<any> {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
}
|
21
gulpfile.js
21
gulpfile.js
@ -2,7 +2,9 @@ var gulp = require('gulp');
|
||||
var minimist = require('minimist');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require("gulp-rename");
|
||||
var tslint = require('gulp-tslint');
|
||||
var tslint = require('ionic-gulp-tslint');
|
||||
var decamelize = require('decamelize');
|
||||
var replace = require('gulp-replace');
|
||||
|
||||
var flagConfig = {
|
||||
string: ['port', 'version', 'ngVersion', 'animations'],
|
||||
@ -25,8 +27,17 @@ gulp.task("minify:dist", function(){
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
|
||||
gulp.task("tslint", function(){
|
||||
gulp.src("src/**/*.ts")
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report('verbose'));
|
||||
gulp.task('lint', function() {
|
||||
tslint({src: 'src/**/*.ts'});
|
||||
});
|
||||
|
||||
gulp.task('plugin:create', function(){
|
||||
if(flags.n && flags.n !== ''){
|
||||
return gulp.src('./TEMPLATE')
|
||||
.pipe(replace('PluginName', flags.n))
|
||||
.pipe(rename(decamelize(flags.n, '-') + '.ts'))
|
||||
.pipe(gulp.dest('./src/plugins/'));
|
||||
} else {
|
||||
console.log("Usage is: gulp plugin:create -n PluginName");
|
||||
}
|
||||
});
|
||||
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "1.3.4",
|
||||
"version": "1.3.17",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
@ -16,13 +16,16 @@
|
||||
"conventional-github-releaser": "^1.1.3",
|
||||
"cpr": "^1.0.0",
|
||||
"cz-conventional-changelog": "^1.1.6",
|
||||
"decamelize": "^1.2.0",
|
||||
"dgeni": "^0.4.2",
|
||||
"dgeni-packages": "^0.10.18",
|
||||
"glob": "^6.0.4",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-tslint": "^5.0.0",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"ionic-gulp-tslint": "^1.0.0",
|
||||
"lodash": "3.10.1",
|
||||
"minimist": "^1.1.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
@ -30,18 +33,19 @@
|
||||
"q": "1.4.1",
|
||||
"semver": "^5.0.1",
|
||||
"tslint": "^3.8.1",
|
||||
"tslint-eslint-rules": "^1.3.0",
|
||||
"tslint-ionic-rules": "0.0.5",
|
||||
"typescript": "^1.8.10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"tslint": "./node_modules/.bin/gulp tslint",
|
||||
"lint": "./node_modules/.bin/gulp lint",
|
||||
"watch": "./node_modules/.bin/tsc -w",
|
||||
"build": "npm run tslint && npm run build:js && npm run build:bundle && npm run build:minify",
|
||||
"build": "npm run lint && npm run build:js && npm run build:bundle && npm run build:minify",
|
||||
"build:js": "./node_modules/.bin/tsc",
|
||||
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
|
||||
"build:minify": "./node_modules/.bin/gulp minify:dist",
|
||||
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
|
||||
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"plugin:create": "gulp plugin:create"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
26
scripts/bower.json
Normal file
26
scripts/bower.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": [
|
||||
"ionic.native.js"
|
||||
],
|
||||
"authors": [
|
||||
"Max Lynch <max@ionic.io>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
"native",
|
||||
"html5",
|
||||
"hybrid",
|
||||
"mobile"
|
||||
],
|
||||
"homepage": "https://github.com/driftyco/ionic-native-bower",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
28
scripts/bower.sh
Normal file
28
scripts/bower.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
# readJsonProp(jsonFile, property)
|
||||
# - restriction: property needs to be on an own line!
|
||||
function readJsonProp {
|
||||
echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1)
|
||||
}
|
||||
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
|
||||
echo "BOWERING IONIC-NATIVE VERSION $VERSION. FOR GREAT JUSTICE..."
|
||||
|
||||
DIR="scripts/ionic-native-bower"
|
||||
rm -rf $DIR
|
||||
mkdir $DIR
|
||||
cp dist/ionic.native.js dist/ionic.native.min.js $DIR
|
||||
cd $DIR
|
||||
git init
|
||||
git remote add origin git@github.com:driftyco/ionic-native-bower.git
|
||||
cp ../bower.json .
|
||||
git add .
|
||||
git commit -m "Bower release"
|
||||
git tag -f -m v$VERSION v$VERSION
|
||||
git push -f --tags origin master
|
||||
|
||||
echo "BOWERING COMPLETED SOMEWHAT SUCCESSFULLY"
|
71
src/index.ts
71
src/index.ts
@ -6,6 +6,7 @@ declare var window;
|
||||
|
||||
import { ActionSheet } from './plugins/actionsheet';
|
||||
import { AdMob } from './plugins/admob';
|
||||
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||
import { AppAvailability } from './plugins/appavailability';
|
||||
import { AppRate } from './plugins/apprate';
|
||||
import { AppVersion } from './plugins/appversion';
|
||||
@ -20,9 +21,11 @@ import {BLE} from './plugins/ble';
|
||||
import { BluetoothSerial } from './plugins/bluetoothserial';
|
||||
import { Calendar } from './plugins/calendar';
|
||||
import { Camera } from './plugins/camera';
|
||||
import { CameraPreview } from './plugins/camera-preview';
|
||||
import { CardIO } from './plugins/card-io';
|
||||
import { Clipboard } from './plugins/clipboard';
|
||||
import { Contacts } from './plugins/contacts';
|
||||
import { Crop } from './plugins/crop';
|
||||
import { DatePicker } from './plugins/datepicker';
|
||||
import { DBMeter } from './plugins/dbmeter';
|
||||
import { Deeplinks } from './plugins/deeplinks';
|
||||
@ -33,10 +36,12 @@ import {DeviceOrientation} from './plugins/deviceorientation';
|
||||
import { Diagnostic } from './plugins/diagnostic';
|
||||
import { Dialogs } from './plugins/dialogs';
|
||||
import { EmailComposer } from './plugins/emailcomposer';
|
||||
import { EstimoteBeacons } from './plugins/estimote-beacons';
|
||||
import { Facebook } from './plugins/facebook';
|
||||
import { File } from './plugins/file';
|
||||
import { Transfer } from './plugins/filetransfer';
|
||||
import { Flashlight } from './plugins/flashlight';
|
||||
import { Geofence } from './plugins/geofence';
|
||||
import { Geolocation } from './plugins/geolocation';
|
||||
import { Globalization } from './plugins/globalization';
|
||||
import { GooglePlus } from './plugins/google-plus';
|
||||
@ -46,20 +51,31 @@ import {Hotspot} from './plugins/hotspot';
|
||||
import { Httpd } from './plugins/httpd';
|
||||
import { IBeacon } from './plugins/ibeacon';
|
||||
import { ImagePicker } from './plugins/imagepicker';
|
||||
import { ImageResizer } from './plugins/imageresizer';
|
||||
import { InAppBrowser } from './plugins/inappbrowser';
|
||||
import { InAppPurchase } from './plugins/inapppurchase';
|
||||
import { Insomnia } from './plugins/insomnia';
|
||||
import { Instagram } from './plugins/instagram';
|
||||
import { IsDebug } from './plugins/is-debug';
|
||||
import { Keyboard } from './plugins/keyboard';
|
||||
import { LaunchNavigator } from './plugins/launchnavigator';
|
||||
import { LocalNotifications } from './plugins/localnotifications';
|
||||
import { MediaCapture } from './plugins/media-capture';
|
||||
import { NativeAudio } from './plugins/native-audio';
|
||||
import { NativeStorage } from './plugins/nativestorage';
|
||||
import { MediaPlugin } from './plugins/media';
|
||||
import { Network } from './plugins/network';
|
||||
import { OneSignal } from './plugins/onesignal';
|
||||
import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { Printer } from './plugins/printer';
|
||||
import { Push } from './plugins/push';
|
||||
import { SafariViewController } from './plugins/safari-view-controller';
|
||||
import { Screenshot } from './plugins/screenshot';
|
||||
import { SecureStorage } from './plugins/securestorage';
|
||||
import { Shake } from './plugins/shake';
|
||||
import { Sim } from './plugins/sim';
|
||||
import { SMS } from './plugins/sms';
|
||||
import { SocialSharing } from './plugins/socialsharing';
|
||||
import { SpinnerDialog } from './plugins/spinnerdialog';
|
||||
@ -69,8 +85,13 @@ import {StatusBar} from './plugins/statusbar';
|
||||
import { ThreeDeeTouch } from './plugins/3dtouch';
|
||||
import { Toast } from './plugins/toast';
|
||||
import { TouchID } from './plugins/touchid';
|
||||
import { TextToSpeech } from './plugins/text-to-speech';
|
||||
import { TwitterConnect } from './plugins/twitter-connect';
|
||||
import { Vibration } from './plugins/vibration';
|
||||
import { VideoEditor } from './plugins/video-editor';
|
||||
import { VideoPlayer } from './plugins/video-player';
|
||||
import { WebIntent } from './plugins/webintent';
|
||||
import { Zip } from './plugins/zip';
|
||||
export * from './plugins/3dtouch';
|
||||
export * from './plugins/background-geolocation';
|
||||
export * from './plugins/backgroundmode';
|
||||
@ -83,24 +104,33 @@ export * from './plugins/datepicker';
|
||||
export * from './plugins/device';
|
||||
export * from './plugins/devicemotion';
|
||||
export * from './plugins/deviceorientation';
|
||||
export * from './plugins/facebook';
|
||||
export * from './plugins/file';
|
||||
export * from './plugins/filetransfer';
|
||||
export * from './plugins/geolocation';
|
||||
export * from './plugins/googlemaps';
|
||||
export * from './plugins/httpd';
|
||||
export * from './plugins/ibeacon';
|
||||
export * from './plugins/imagepicker';
|
||||
export * from './plugins/imageresizer';
|
||||
export * from './plugins/inappbrowser';
|
||||
export * from './plugins/launchnavigator';
|
||||
export * from './plugins/localnotifications';
|
||||
export * from './plugins/media';
|
||||
export * from './plugins/media-capture';
|
||||
export * from './plugins/printer';
|
||||
export * from './plugins/push';
|
||||
export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/sms';
|
||||
export * from './plugins/spinnerdialog';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/video-editor';
|
||||
export * from './plugins/video-player';
|
||||
export {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
AppRate,
|
||||
AppVersion,
|
||||
@ -111,36 +141,48 @@ export {
|
||||
Brightness,
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
CameraPreview,
|
||||
Clipboard,
|
||||
Crop,
|
||||
DBMeter,
|
||||
Deeplinks,
|
||||
DeviceAccounts,
|
||||
Dialogs,
|
||||
Diagnostic,
|
||||
EmailComposer,
|
||||
Facebook,
|
||||
EstimoteBeacons,
|
||||
File,
|
||||
Flashlight,
|
||||
Geolocation,
|
||||
Geofence,
|
||||
Globalization,
|
||||
GooglePlus,
|
||||
GoogleAnalytics,
|
||||
Hotspot,
|
||||
InAppPurchase,
|
||||
Insomnia,
|
||||
Instagram,
|
||||
Keyboard,
|
||||
NativeAudio,
|
||||
NativeStorage,
|
||||
Network,
|
||||
OneSignal,
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
Screenshot,
|
||||
SecureStorage,
|
||||
Shake,
|
||||
SocialSharing,
|
||||
Sim,
|
||||
Splashscreen,
|
||||
SQLite,
|
||||
StatusBar,
|
||||
TouchID,
|
||||
Transfer,
|
||||
TextToSpeech,
|
||||
Vibration,
|
||||
WebIntent
|
||||
WebIntent,
|
||||
Zip
|
||||
}
|
||||
|
||||
export * from './plugins/plugin';
|
||||
@ -149,6 +191,7 @@ export * from './plugins/plugin';
|
||||
window['IonicNative'] = {
|
||||
ActionSheet: ActionSheet,
|
||||
AdMob: AdMob,
|
||||
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||
AppAvailability: AppAvailability,
|
||||
AppRate: AppRate,
|
||||
AppVersion: AppVersion,
|
||||
@ -163,9 +206,11 @@ window['IonicNative'] = {
|
||||
BluetoothSerial: BluetoothSerial,
|
||||
Calendar: Calendar,
|
||||
Camera: Camera,
|
||||
CameraPreview: CameraPreview,
|
||||
CardIO: CardIO,
|
||||
Clipboard: Clipboard,
|
||||
Contacts: Contacts,
|
||||
Crop: Crop,
|
||||
DatePicker: DatePicker,
|
||||
DBMeter: DBMeter,
|
||||
Deeplinks: Deeplinks,
|
||||
@ -176,9 +221,11 @@ window['IonicNative'] = {
|
||||
Dialogs: Dialogs,
|
||||
Diagnostic: Diagnostic,
|
||||
EmailComposer: EmailComposer,
|
||||
EstimoteBeacons: EstimoteBeacons,
|
||||
Facebook: Facebook,
|
||||
File: File,
|
||||
Flashlight: Flashlight,
|
||||
Geofence: Geofence,
|
||||
Geolocation: Geolocation,
|
||||
Globalization: Globalization,
|
||||
GooglePlus: GooglePlus,
|
||||
@ -188,19 +235,30 @@ window['IonicNative'] = {
|
||||
Httpd: Httpd,
|
||||
IBeacon: IBeacon,
|
||||
ImagePicker: ImagePicker,
|
||||
ImageResizer: ImageResizer,
|
||||
InAppBrowser: InAppBrowser,
|
||||
InAppPurchase: InAppPurchase,
|
||||
Instagram: Instagram,
|
||||
IsDebug: IsDebug,
|
||||
Keyboard: Keyboard,
|
||||
LaunchNavigator: LaunchNavigator,
|
||||
LocalNotifications: LocalNotifications,
|
||||
MediaCapture: MediaCapture,
|
||||
MediaPlugin: MediaPlugin,
|
||||
NativeAudio: NativeAudio,
|
||||
NativeStorage: NativeStorage,
|
||||
Network: Network,
|
||||
Printer: Printer,
|
||||
Push: Push,
|
||||
OneSignal: OneSignal,
|
||||
PhotoViewer: PhotoViewer,
|
||||
ScreenOrientation: ScreenOrientation,
|
||||
PinDialog: PinDialog,
|
||||
SafariViewController: SafariViewController,
|
||||
Screenshot: Screenshot,
|
||||
SecureStorage: SecureStorage,
|
||||
Shake: Shake,
|
||||
Sim: Sim,
|
||||
SMS: SMS,
|
||||
SocialSharing: SocialSharing,
|
||||
SpinnerDialog: SpinnerDialog,
|
||||
@ -211,8 +269,13 @@ window['IonicNative'] = {
|
||||
Toast: Toast,
|
||||
TouchID: TouchID,
|
||||
Transfer: Transfer,
|
||||
TextToSpeech: TextToSpeech,
|
||||
TwitterConnect: TwitterConnect,
|
||||
VideoEditor: VideoEditor,
|
||||
VideoPlayer: VideoPlayer,
|
||||
Vibration: Vibration,
|
||||
WebIntent: WebIntent
|
||||
WebIntent: WebIntent,
|
||||
Zip: Zip
|
||||
};
|
||||
|
||||
initAngular1(window['IonicNative']);
|
||||
|
@ -3,7 +3,7 @@ declare var window;
|
||||
/**
|
||||
* Initialize the ionic.native Angular module if we're running in ng1.
|
||||
* This iterates through the list of registered plugins and dynamically
|
||||
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovStatusBar.
|
||||
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
|
||||
*/
|
||||
export function initAngular1(plugins) {
|
||||
if (window.angular) {
|
||||
@ -15,11 +15,8 @@ export function initAngular1(plugins) {
|
||||
|
||||
(function(serviceName, cls, name) {
|
||||
window.angular.module('ionic.native').service(serviceName, [function() {
|
||||
let funcs = {};
|
||||
for (var k in cls) {
|
||||
funcs[k] = cls[k];
|
||||
}
|
||||
funcs['name'] = name;
|
||||
var funcs = window.angular.copy(cls);
|
||||
funcs.prototype['name'] = name;
|
||||
return funcs;
|
||||
}]);
|
||||
})(serviceName, cls, name);
|
||||
|
@ -1,6 +1,9 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var window: any;
|
||||
|
||||
/**
|
||||
* @name 3DTouch
|
||||
* @description
|
||||
@ -13,7 +16,7 @@ declare var window: any;
|
||||
* import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
|
||||
* ...
|
||||
*
|
||||
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
|
||||
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
|
||||
*
|
||||
* ThreeDeeTouch.watchForceTouches()
|
||||
* .subscribe(
|
||||
@ -54,7 +57,7 @@ declare var window: any;
|
||||
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
|
||||
* (payload) => {
|
||||
* // returns an object that is the button you presed
|
||||
* console.log(`Pressed the ${payload.title} button`)
|
||||
* console.log('Pressed the ${payload.title} button')
|
||||
* console.log(payload.type)
|
||||
*
|
||||
* }
|
||||
@ -103,8 +106,9 @@ export class ThreeDeeTouch {
|
||||
*/
|
||||
static onHomeIconPressed(): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
||||
else {
|
||||
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
|
||||
window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
||||
} else {
|
||||
observer.error('3dTouch plugin is not available.');
|
||||
observer.complete();
|
||||
}
|
||||
@ -127,13 +131,16 @@ export class ThreeDeeTouch {
|
||||
sync: true
|
||||
})
|
||||
static disableLinkPreview(): void { }
|
||||
|
||||
}
|
||||
|
||||
export interface ThreeDeeTouchQuickAction {
|
||||
type?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
iconType?: string;
|
||||
}
|
||||
|
||||
export interface ThreeDeeTouchForceTouch {
|
||||
force: number;
|
||||
timestamp: number;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Action Sheet
|
||||
@ -8,17 +9,18 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { ActionSheet } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||
* ActionSheet.show({
|
||||
* 'title': 'What do you want with this image?',
|
||||
* 'buttonLabels': buttonLabels,
|
||||
* 'addCancelButtonWithLabel': 'Cancel',
|
||||
* 'addDestructiveButtonWithLabel' : 'Delete'
|
||||
* }).then(buttonIndex => {
|
||||
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
|
||||
* }).then((buttonIndex: number) => {
|
||||
* console.log('Button pressed: ' + buttonIndex);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
@ -71,4 +73,5 @@ export class ActionSheet {
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(options?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
|
77
src/plugins/android-fingerprint-auth.ts
Normal file
77
src/plugins/android-fingerprint-auth.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
/**
|
||||
* @name Android Fingerprint Auth
|
||||
* @description
|
||||
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AndroidFingerprintAuth } from 'ionic-native';
|
||||
*
|
||||
* AndroidFingerprintAuth.isAvailable()
|
||||
* .then((result)=> {
|
||||
* if(result.isAvailable){
|
||||
* // it is available
|
||||
*
|
||||
* AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
|
||||
* .then(result => {
|
||||
* if(result.withFingerprint) {
|
||||
* console.log('Successfully authenticated with fingerprint!');
|
||||
* } else if(result.withPassword) {
|
||||
* console.log('Successfully authenticated with backup password!');
|
||||
* } else console.log('Didn\'t authenticate!');
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* } else {
|
||||
* // fingerprint auth isn't available
|
||||
* }
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-android-fingerprint-auth',
|
||||
pluginRef: 'FingerprintAuth',
|
||||
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
|
||||
})
|
||||
export class AndroidFingerprintAuth {
|
||||
/**
|
||||
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
|
||||
* @param params {any}
|
||||
*/
|
||||
@Cordova()
|
||||
static show(params: {
|
||||
/**
|
||||
* Used as the alias for your key in the Android Key Store.
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Used to encrypt the token returned upon successful fingerprint authentication.
|
||||
*/
|
||||
clientSecret: string;
|
||||
/**
|
||||
* Set to true to remove the "USE BACKUP" button
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
/**
|
||||
* Change the language. (en_US or es)
|
||||
*/
|
||||
locale?: string
|
||||
}): Promise<{
|
||||
/**
|
||||
* Base64 encoded string
|
||||
*/
|
||||
withFingerprint: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
withPassword: boolean;
|
||||
}> {return; }
|
||||
|
||||
/**
|
||||
* Check if service is available
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name App Availability
|
||||
@ -8,11 +8,11 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { AppAvailability } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* var app;
|
||||
* let app;
|
||||
*
|
||||
* if (device.platform === 'iOS') {
|
||||
* app = 'twitter://';
|
||||
@ -22,8 +22,8 @@ import {Plugin, Cordova} from './plugin';
|
||||
*
|
||||
* AppAvailability.check(app)
|
||||
* .then(
|
||||
* yes => console.log(app + " is available"),
|
||||
* no => console.log(app + " is NOT available")
|
||||
* (yes: string) => console.log(app + ' is available'),
|
||||
* (no: string) => console.log(app + ' is NOT available')
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
@ -10,14 +11,14 @@ declare var window;
|
||||
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { AppRate } from 'ionic-native';
|
||||
*
|
||||
* AppRate.preferences.storeAppURL = {
|
||||
* ios: '<my_app_id>',
|
||||
* android: 'market://details?id=<package_name>',
|
||||
* };
|
||||
*
|
||||
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';
|
||||
* AppRate.preferences.storeAppURL.android = 'market://details?id=<package_name>';
|
||||
* AppRate.preferences.storeAppURL.blackberry = 'appworld://content/[App Id]/';
|
||||
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
|
||||
* AppRate.promptForRating();
|
||||
* ```
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name App Version
|
||||
@ -8,7 +8,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { AppVersion } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
declare var window;
|
||||
|
||||
@ -88,7 +87,7 @@ export interface Config {
|
||||
* When enabled, the plugin will emit sounds for life-cycle events of
|
||||
* background-geolocation! See debugging sounds table.
|
||||
*/
|
||||
debug: boolean;
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum distance (measured in meters) a device must move horizontally
|
||||
@ -99,7 +98,9 @@ export interface Config {
|
||||
/**
|
||||
* IOS, ANDROID ONLY
|
||||
* Enable this in order to force a stop() when the application terminated
|
||||
* (e.g. on iOS, double-tap home button, swipe away the app).
|
||||
* (e.g. on iOS, double-tap home button, swipe away the app).o
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
|
||||
@ -110,7 +111,7 @@ export interface Config {
|
||||
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||
* for more information
|
||||
*/
|
||||
locationTimeout?: number;
|
||||
interval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
@ -141,7 +142,7 @@ export interface Config {
|
||||
* ANDROID ONLY
|
||||
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
|
||||
*/
|
||||
locationService?: number;
|
||||
locationProvider?: number;
|
||||
|
||||
/**
|
||||
* IOS ONLY
|
||||
@ -161,11 +162,10 @@ export interface Config {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // When device is ready :
|
||||
* platform.ready().then(() => {
|
||||
*
|
||||
@ -178,17 +178,18 @@ export interface Config {
|
||||
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
||||
* };
|
||||
*
|
||||
* BackgroundGeolocation.configure(config)
|
||||
* .then((location) => {
|
||||
* console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||
*
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
* BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
* })
|
||||
* .catch((error) => {
|
||||
* BackgroundGeolocation.configure((location) => {
|
||||
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
|
||||
|
||||
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
BackgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
|
||||
* }, (error) => {
|
||||
* console.log('BackgroundGeolocation error');
|
||||
* }, {
|
||||
* //options
|
||||
* });
|
||||
*
|
||||
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
|
||||
@ -219,9 +220,9 @@ export class BackgroundGeolocation {
|
||||
* Options a json object of type Config
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
sync: true
|
||||
})
|
||||
static configure(options: Config): Promise<Location> { return; }
|
||||
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Background Mode
|
||||
@ -6,7 +6,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Cordova plugin to prevent the app from going to sleep while in background.
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
||||
*@usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from 'ionic-native';
|
||||
*
|
||||
* BackgroundMode.enable();
|
||||
@ -85,12 +85,13 @@ export class BackgroundMode {
|
||||
/**
|
||||
* Sets a callback for a specific event
|
||||
* Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
|
||||
* @param eventName The name of the event. Available events: activate, deactivate, failure
|
||||
* @param {string} eventName The name of the event. Available events: activate, deactivate, failure
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static on(eventName: string, callback: any): void { }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Badge
|
||||
@ -8,7 +8,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Badge } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -74,4 +74,5 @@ export class Badge {
|
||||
*/
|
||||
@Cordova()
|
||||
static registerPermission(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Barcode Scanner
|
||||
@ -8,7 +8,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { BarcodeScanner } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -38,6 +38,7 @@ export class BarcodeScanner {
|
||||
};
|
||||
/**
|
||||
* Open the barcode scanner.
|
||||
* @param options {Object} Optional options to pass to the scanner
|
||||
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
@ -48,8 +49,8 @@ export class BarcodeScanner {
|
||||
/**
|
||||
* Encodes data into a barcode.
|
||||
* NOTE: not well supported on Android
|
||||
* @param type
|
||||
* @param data
|
||||
* @param type {string} Type of encoding
|
||||
* @param data {any} Data to encode
|
||||
*/
|
||||
@Cordova()
|
||||
static encode(type: string, data: any): Promise<any> { return; }
|
||||
|
@ -1,15 +1,15 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
/**
|
||||
* @name Base64 To Gallery
|
||||
* @description This plugin allows you to save base64 data as a png image into the device
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Base64ToGallery } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
|
||||
* res => console.log("Saved image to gallery ", res),
|
||||
* err => console.log("Error saving image to gallery ", err)
|
||||
* res => console.log('Saved image to gallery ', res),
|
||||
* err => console.log('Error saving image to gallery ', err)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@ -24,11 +24,11 @@ export class Base64ToGallery {
|
||||
/**
|
||||
* Converts a base64 string to an image file in the device gallery
|
||||
* @param {string} data The actual base64 string that you want to save
|
||||
* @param {sstring} prefix Prefix the file with a string. Default is 'img_'. Optional.
|
||||
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @returns {Promise} returns a promise that resolves when the image is saved.
|
||||
*/
|
||||
@Cordova()
|
||||
static base64ToGallery(data: string , prefix?: string ): Promise<any> {
|
||||
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@ -7,14 +7,13 @@ import {Observable} from 'rxjs/Observable';
|
||||
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { BatteryStatus } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // watch change in battery status
|
||||
* let subscription = BatteryStatus.onChange().subscribe(
|
||||
* status => {
|
||||
* (status: StatusObject) => {
|
||||
* console.log(status.level, status.isPlugged);
|
||||
* }
|
||||
* );
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
*
|
||||
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "Battery Demo",
|
||||
* "id": "20:FF:D0:FF:D1:C0",
|
||||
@ -34,7 +34,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
* ```
|
||||
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "Battery Demo",
|
||||
* "id": "20:FF:D0:FF:D1:C0",
|
||||
@ -93,7 +93,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
*
|
||||
* ### Android
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "demo",
|
||||
* "id": "00:1A:7D:DA:71:13",
|
||||
@ -108,7 +108,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
*
|
||||
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* "name": "demo",
|
||||
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
|
||||
@ -137,7 +137,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
*
|
||||
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* // ASCII only
|
||||
* function stringToBytes(string) {
|
||||
* var array = new Uint8Array(string.length);
|
||||
|
@ -1,16 +1,19 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name Bluetooth Serial
|
||||
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { BluetoothSerial } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Write a string
|
||||
* Bluetooth.write("hello world").then(success, failure);
|
||||
* BluetoothSerial.write("hello world").then(success, failure);
|
||||
*
|
||||
* // Array of int or bytes
|
||||
* Bluetooth.write([186, 220, 222]).then(success, failure);
|
||||
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
|
||||
*
|
||||
* // Typed Array
|
||||
* var data = new Uint8Array(4);
|
||||
@ -18,10 +21,10 @@ import {Observable} from 'rxjs/Observable';
|
||||
* data[1] = 0x42;
|
||||
* data[2] = 0x43;
|
||||
* data[3] = 0x44;
|
||||
* Bluetooth.write(data).then(success, failure);
|
||||
* BluetoothSerial.write(data).then(success, failure);
|
||||
*
|
||||
* // Array Buffer
|
||||
* Bluetooth.write(data.buffer).then(success, failure);
|
||||
* BluetoothSerial.write(data.buffer).then(success, failure);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@ -218,4 +221,5 @@ export class BluetoothSerial {
|
||||
sync: true
|
||||
})
|
||||
static setDiscoverable(discoverableDuration: number): void { }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Brightness
|
||||
@ -8,9 +8,10 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Brightness } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let brightnessValue: number = 0.8;
|
||||
* Brightness.setBrightness(brightnessValue);
|
||||
* ```
|
||||
@ -18,7 +19,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-brightness',
|
||||
pluginRef: 'plugins.brightness',
|
||||
pluginRef: 'cordova.plugins.brightness',
|
||||
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@ -47,4 +48,5 @@ export class Brightness {
|
||||
*/
|
||||
@Cordova()
|
||||
static setKeepScreenOn(value: boolean): void { }
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CalendarOptions {
|
||||
firstReminderMinutes?: number;
|
||||
secondReminderMinutes?: number;
|
||||
@ -11,11 +15,6 @@ export interface CalendarOptions {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface Calendar {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Calendar
|
||||
* @description
|
||||
@ -23,7 +22,18 @@ export interface Calendar {
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Calendar} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Calendar.createCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
@ -86,23 +96,8 @@ export class Calendar {
|
||||
/**
|
||||
* Create a calendar. (iOS only)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Calendar} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Calendar.createCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param {string | Object} nameOrOptions either a string name or a options object.
|
||||
* options:
|
||||
* calendarName: string the name of the calendar
|
||||
* calendarColor: string the hex color of the calendar
|
||||
* @return Returns a Promise
|
||||
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
|
||||
* @return {Promise} Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static createCalendar(
|
||||
@ -111,15 +106,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Delete a calendar. (iOS only)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* Calendar.deleteCalendar('MyCalendar').then(
|
||||
* (msg) => { console.log(msg); },
|
||||
* (err) => { console.log(err); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param {string} name Name of the calendar to delete.
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@ -157,7 +143,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Silently create an event.
|
||||
*
|
||||
* @param {string} [title] The event title
|
||||
* @param {string} [location] The event location
|
||||
* @param {string} [notes] The event notes
|
||||
@ -267,7 +252,6 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Find an event with additional options.
|
||||
*
|
||||
* @param {string} [title] The event title
|
||||
* @param {string} [location] The event location
|
||||
* @param {string} [notes] The event notes
|
||||
@ -412,8 +396,10 @@ export class Calendar {
|
||||
|
||||
/**
|
||||
* Open the calendar at the specified date.
|
||||
* @return {Date} date
|
||||
* @param {Date} date The date you want to open the calendar on
|
||||
* @return {Promise<any>} Promise returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
static openCalendar(date: Date): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
124
src/plugins/camera-preview.ts
Normal file
124
src/plugins/camera-preview.ts
Normal file
@ -0,0 +1,124 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface CameraPreviewRect {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface CameraPreviewSize {
|
||||
maxWidth: number;
|
||||
maxHeight: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name CameraPreview
|
||||
* @description
|
||||
* Showing camera preview in HTML
|
||||
*
|
||||
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-camera-preview',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Starts the camera preview instance.
|
||||
* @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
|
||||
* @param {string} which camera to use - 'front' | 'back'
|
||||
* @param {boolean} enable tap to take picture
|
||||
* @param {boolean} enable preview box drag across the screen
|
||||
* @param {boolean} send preview box to the back of the webview
|
||||
* @param {number} alpha of the preview box
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Stops the camera preview instance.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static stopCamera(): void { };
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
* @param {CameraPreviewSize} optional - size of the picture to take
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static takePicture(size: CameraPreviewSize): void { };
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; };
|
||||
|
||||
/**
|
||||
* Switch from the rear camera and front camera, if available.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static switchCamera(): void { };
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static show(): void { };
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static hide(): void { };
|
||||
|
||||
/**
|
||||
* Set the default mode for the Flash.
|
||||
*/
|
||||
// @Cordova({
|
||||
// sync: true
|
||||
// })
|
||||
// static setFlashMode(mode: number): void { };
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static setColorEffect(effect: string): void { };
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static FlashMode = {
|
||||
OFF: 0,
|
||||
ON: 1,
|
||||
AUTO: 2
|
||||
};
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface CameraOptions {
|
||||
@ -93,14 +93,16 @@ export interface CameraPopoverOptions {
|
||||
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Camera } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Camera.getPicture(options).then((imageData) => {
|
||||
* // imageData is either a base64 encoded string or a file URI
|
||||
* // If it's base64:
|
||||
* let base64Image = "data:image/jpeg;base64," + imageData;
|
||||
* let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
* }, (err) => {
|
||||
* // Handle error
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@ -111,31 +113,11 @@ export interface CameraPopoverOptions {
|
||||
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
|
||||
})
|
||||
export class Camera {
|
||||
/**
|
||||
* Take a picture or video, or load one from the library.
|
||||
* @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc.
|
||||
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPicture(options: CameraOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
|
||||
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static cleanup() { };
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static DestinationType = {
|
||||
public static DestinationType = {
|
||||
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
|
||||
DATA_URL: 0,
|
||||
/** Return file uri (content://media/external/images/media/2 for Android) */
|
||||
@ -148,7 +130,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static EncodingType = {
|
||||
public static EncodingType = {
|
||||
/** Return JPEG encoded image */
|
||||
JPEG: 0,
|
||||
/** Return PNG encoded image */
|
||||
@ -158,7 +140,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static MediaType = {
|
||||
public static MediaType = {
|
||||
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
|
||||
PICTURE: 0,
|
||||
/** Allow selection of video only, ONLY RETURNS URL */
|
||||
@ -171,7 +153,7 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static PictureSourceType = {
|
||||
public static PictureSourceType = {
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
PHOTOLIBRARY: 0,
|
||||
/** Take picture from camera */
|
||||
@ -185,7 +167,7 @@ export class Camera {
|
||||
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
|
||||
* @enum {number}
|
||||
*/
|
||||
static PopoverArrowDirection = {
|
||||
public static PopoverArrowDirection = {
|
||||
ARROW_UP: 1,
|
||||
ARROW_DOWN: 2,
|
||||
ARROW_LEFT: 4,
|
||||
@ -197,13 +179,31 @@ export class Camera {
|
||||
* @private
|
||||
* @enum {number}
|
||||
*/
|
||||
static Direction = {
|
||||
public static Direction = {
|
||||
/** Use the back-facing camera */
|
||||
BACK: 0,
|
||||
/** Use the front-facing camera */
|
||||
FRONT: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Take a picture or video, or load one from the library.
|
||||
* @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
|
||||
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPicture(options?: CameraOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
|
||||
* Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static cleanup() { };
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name CardIO
|
||||
@ -7,7 +8,6 @@ import {Plugin, Cordova} from './plugin';
|
||||
* ```
|
||||
* import { CardIO } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* CardIO.canScan()
|
||||
* .then(
|
||||
@ -51,6 +51,7 @@ export class CardIO {
|
||||
*/
|
||||
@Cordova()
|
||||
static version(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface CardIOOptions {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Clipboard
|
||||
@ -9,19 +10,18 @@ import {Plugin, Cordova} from './plugin';
|
||||
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Clipboard } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Clipboard.copy("Hello world");
|
||||
* Clipboard.copy('Hello world');
|
||||
*
|
||||
* Clipboard.paste().then(
|
||||
* (resolve: string) => {
|
||||
* alert(resolve);
|
||||
* },
|
||||
* (reject: string) => {
|
||||
* alert("Error: " + reject);
|
||||
* alert('Error: ' + reject);
|
||||
* }
|
||||
* );
|
||||
* );
|
||||
|
@ -1,13 +1,16 @@
|
||||
import {Plugin, Cordova, InstanceProperty, CordovaInstance} from './plugin';
|
||||
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
export interface IContactProperties {
|
||||
/** A globally unique identifier. */
|
||||
id?: string;
|
||||
/** The name of this Contact, suitable for display to end users. */
|
||||
displayName?: string;
|
||||
/** An object containing all components of a persons name. */
|
||||
name?: ContactName;
|
||||
name?: IContactName;
|
||||
/** A casual name by which to address the contact. */
|
||||
nickname?: string;
|
||||
/** An array of all the contact's phone numbers. */
|
||||
@ -15,11 +18,11 @@ export interface IContactProperties {
|
||||
/** An array of all the contact's email addresses. */
|
||||
emails?: IContactField[];
|
||||
/** An array of all the contact's addresses. */
|
||||
addresses?: ContactAddress[];
|
||||
addresses?: IContactAddress[];
|
||||
/** An array of all the contact's IM addresses. */
|
||||
ims?: IContactField[];
|
||||
/** An array of all the contact's organizations. */
|
||||
organizations?: ContactOrganization[];
|
||||
organizations?: IContactOrganization[];
|
||||
/** The birthday of the contact. */
|
||||
birthday?: Date;
|
||||
/** A note about the contact. */
|
||||
@ -32,28 +35,30 @@ export interface IContactProperties {
|
||||
urls?: IContactField[];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class Contact {
|
||||
export class Contact implements IContactProperties {
|
||||
private _objectInstance: any;
|
||||
@InstanceProperty get id(): string { return; }
|
||||
@InstanceProperty get displayName(): string { return; }
|
||||
@InstanceProperty get nickname(): ContactName {return; }
|
||||
@InstanceProperty get phoneNumbers(): string {return; }
|
||||
@InstanceProperty get name(): IContactName {return; }
|
||||
@InstanceProperty get nickname(): string { return; }
|
||||
@InstanceProperty get phoneNumbers(): IContactField[] { return; }
|
||||
@InstanceProperty get emails(): IContactField[] { return; }
|
||||
@InstanceProperty get addresses(): ContactAddress[] {return; }
|
||||
@InstanceProperty get addresses(): IContactAddress[] { return; }
|
||||
@InstanceProperty get ims(): IContactField[] { return; }
|
||||
@InstanceProperty get organizations(): ContactOrganization[] {return; }
|
||||
@InstanceProperty get organizations(): IContactOrganization[] { return; }
|
||||
@InstanceProperty get birthday(): Date { return; }
|
||||
@InstanceProperty get note(): string { return; }
|
||||
@InstanceProperty get photos(): IContactField[] { return; }
|
||||
@InstanceProperty get categories(): IContactField[] { return; }
|
||||
@InstanceProperty get urls(): IContactField[] { return; }
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
}
|
||||
|
||||
clone(): Contact {
|
||||
let newContact = new Contact();
|
||||
for (let prop in this) {
|
||||
@ -62,17 +67,21 @@ export class Contact {
|
||||
}
|
||||
return newContact;
|
||||
}
|
||||
|
||||
@CordovaInstance()
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
save(): Promise<any> { return; }
|
||||
}
|
||||
|
||||
interface IContactError {
|
||||
/** Error code */
|
||||
code: number;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
|
||||
declare var ContactError: {
|
||||
new (code: number): IContactError;
|
||||
UNKNOWN_ERROR: number;
|
||||
@ -83,6 +92,7 @@ declare var ContactError: {
|
||||
NOT_SUPPORTED_ERROR: number;
|
||||
PERMISSION_DENIED_ERROR: number
|
||||
};
|
||||
|
||||
export interface IContactName {
|
||||
/** The complete name of the contact. */
|
||||
formatted?: string;
|
||||
@ -103,9 +113,11 @@ export interface IContactName {
|
||||
*/
|
||||
export class ContactName implements IContactName {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
|
||||
this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
|
||||
}
|
||||
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
@InstanceProperty get familyName(): string { return; }
|
||||
@InstanceProperty get givenName(): string { return; }
|
||||
@ -128,9 +140,11 @@ export interface IContactField {
|
||||
*/
|
||||
export class ContactField implements IContactField {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(type?: string, value?: string, pref?: boolean) {
|
||||
this._objectInstance = new window.ContactField(type, value, pref);
|
||||
}
|
||||
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get value(): string { return; }
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
@ -160,6 +174,7 @@ export interface IContactAddress {
|
||||
*/
|
||||
export class ContactAddress implements IContactAddress {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(pref?: boolean,
|
||||
type?: string,
|
||||
formatted?: string,
|
||||
@ -170,6 +185,7 @@ export class ContactAddress implements IContactAddress {
|
||||
country?: string) {
|
||||
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
|
||||
}
|
||||
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
@ -223,9 +239,11 @@ export interface IContactFindOptions {
|
||||
*/
|
||||
export class ContactFindOptions implements IContactFindOptions {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactFindOptions();
|
||||
}
|
||||
|
||||
@InstanceProperty get filter(): string { return; }
|
||||
@InstanceProperty get multiple(): boolean { return; }
|
||||
@InstanceProperty get desiredFields(): any { return; }
|
||||
@ -239,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Contact } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* let contact = new Contact();
|
||||
* contact.displayName = "Mr. Ionitron";
|
||||
* contact.displayName = 'Mr. Ionitron';
|
||||
* contact.save().then(
|
||||
* () => console.log("Contact saved!", contact),
|
||||
* (error: any) => console.error("Error saving contact.", error)
|
||||
* () => console.log('Contact saved!', contact),
|
||||
* (error: any) => console.error('Error saving contact.', error)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
@ -263,6 +280,7 @@ export class Contacts {
|
||||
static create(): Contact {
|
||||
return new Contact();
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for contacts in the Contacts list.
|
||||
* @param fields {string[]} Contact fields to be used as a search qualifier.
|
||||
@ -282,10 +300,12 @@ export class Contacts {
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields: string[], options?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Select a single Contact.
|
||||
* @return Returns a Promise that resolves with the selected Contact
|
||||
*/
|
||||
@Cordova()
|
||||
static pickContact(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
34
src/plugins/crop.ts
Normal file
34
src/plugins/crop.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
/**
|
||||
* @name Crop
|
||||
* @description Crops images
|
||||
* @usage
|
||||
* ```
|
||||
* import {Crop} from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* Crop.crop('path/to/image.jpg', {quality: 75})
|
||||
* .then(
|
||||
* newImage => console.log("new image path is: " + newImage),
|
||||
* error => console.error("Error cropping image", error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-crop',
|
||||
pluginRef: 'plugins',
|
||||
repo: 'https://github.com/jeduan/cordova-plugin-crop'
|
||||
})
|
||||
export class Crop {
|
||||
/**
|
||||
* Crops an image
|
||||
* @param pathToImage
|
||||
* @param options
|
||||
* @return {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static crop(pathToImage: string, options?: {quality: number}): Promise<string> {return; }
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface DatePickerOptions {
|
||||
/**
|
||||
@ -12,7 +13,7 @@ export interface DatePickerOptions {
|
||||
* Platforms: iOS, Android, Windows
|
||||
* Selected date
|
||||
*/
|
||||
date: Date;
|
||||
date: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms: iOS, Android, Windows
|
||||
@ -20,7 +21,7 @@ export interface DatePickerOptions {
|
||||
* Type: Date | empty String
|
||||
* Default: empty String
|
||||
*/
|
||||
minDate?: Date;
|
||||
minDate?: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms?: iOS, Android, Windows
|
||||
@ -28,7 +29,7 @@ export interface DatePickerOptions {
|
||||
* Type?: Date | empty String
|
||||
* Default?: empty String
|
||||
*/
|
||||
maxDate?: Date;
|
||||
maxDate?: Date | string | number;
|
||||
|
||||
/**
|
||||
* Platforms?: Android
|
||||
@ -73,7 +74,7 @@ export interface DatePickerOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { DatePicker } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -81,8 +82,8 @@ export interface DatePickerOptions {
|
||||
* date: new Date(),
|
||||
* mode: 'date'
|
||||
* }).then(
|
||||
* date => console.log("Got date: ", date),
|
||||
* err => console.log("Error occurred while getting date:", err)
|
||||
* date => console.log('Got date: ', date),
|
||||
* err => console.log('Error occurred while getting date: ', err)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
|
@ -1,14 +1,15 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @name DB Meter
|
||||
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { DBMeter } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Start listening
|
||||
* let subscription = DBMeter.start().subscribe(
|
||||
* data => console.log(data)
|
||||
@ -24,8 +25,8 @@ import {Observable} from 'rxjs/Observable';
|
||||
*
|
||||
* // Delete DBMeter instance from memory
|
||||
* DBMeter.delete().then(
|
||||
* () => console.log("Deleted DB Meter instance"),
|
||||
* error => console.log("Error occurred while deleting DB Meter instance")
|
||||
* () => console.log('Deleted DB Meter instance'),
|
||||
* error => console.log('Error occurred while deleting DB Meter instance')
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface DeeplinkMatch {
|
||||
/**
|
||||
* The route info for the matched route
|
||||
@ -26,7 +27,7 @@ export interface DeeplinkMatch {
|
||||
* and Universal App Links.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { IonicDeeplinks } from 'ionic-native';
|
||||
*
|
||||
* ```
|
||||
@ -76,4 +77,5 @@ export class Deeplinks {
|
||||
observable: true
|
||||
})
|
||||
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, CordovaProperty} from './plugin';
|
||||
import { CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: {
|
||||
device: Device
|
||||
@ -32,11 +33,10 @@ export interface Device {
|
||||
* Access information about the underlying device and platform.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Device } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* console.log('Device UUID is: ' + Device.device.uuid);
|
||||
* ```
|
||||
*/
|
||||
@ -54,4 +54,5 @@ export class Device {
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get device() { return window.device; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
||||
pluginRef: 'plugins.DeviceAccounts',
|
||||
@ -30,4 +32,5 @@ export class DeviceAccounts {
|
||||
*/
|
||||
@Cordova()
|
||||
static getEmail(): Promise<any> { return; }
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface AccelerationData {
|
||||
|
||||
/**
|
||||
@ -40,19 +41,18 @@ export interface AccelerometerOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { DeviceMotion } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Get the device current acceleration
|
||||
* DeviceMotion.getCurrentAcceleration().then(
|
||||
* acceleration => console.log(acceleration),
|
||||
* error => console.log(error)
|
||||
* (acceleration: AccelerationData) => console.log(acceleration),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch device acceleration
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
|
||||
* console.log(acceleration);
|
||||
* });
|
||||
*
|
||||
@ -73,9 +73,7 @@ export class DeviceMotion {
|
||||
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentAcceleration(): Promise<AccelerationData> {
|
||||
return;
|
||||
}
|
||||
static getCurrentAcceleration(): Promise<AccelerationData> { return; }
|
||||
|
||||
/**
|
||||
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
||||
@ -87,7 +85,6 @@ export class DeviceMotion {
|
||||
observable: true,
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> {
|
||||
return;
|
||||
}
|
||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface CompassHeading {
|
||||
|
||||
/**
|
||||
@ -45,20 +46,20 @@ export interface CompassOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* import {DeviceOrientation} from 'ionic-native';
|
||||
*
|
||||
* ```typescript
|
||||
* // CompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* DeviceOrientation.getCurrentHeading().then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* (data: CompassHeading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||
* data => console.log(data)
|
||||
* (data: CompassHeading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Stop watching heading change
|
||||
|
@ -1,46 +1,184 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
|
||||
/**
|
||||
* @name Diagnostic
|
||||
* @description
|
||||
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Diagnostic } from 'ionic-native';
|
||||
*
|
||||
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
|
||||
* let errorCallback = (e) => console.error(e);
|
||||
*
|
||||
* Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
|
||||
*
|
||||
* Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
|
||||
*
|
||||
*
|
||||
* Diagnostic.getBluetoothState()
|
||||
* .then((state) => {
|
||||
* if(state == Diagnostic.bluetoothStates.POWERED_ON){
|
||||
* // do something
|
||||
* } else {
|
||||
* // do something else
|
||||
* }
|
||||
* }).catch(e => console.error(e));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova.plugins.diagnostic',
|
||||
pluginRef: 'cordova.plugins.diagnostic',
|
||||
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
||||
})
|
||||
export class Diagnostic {
|
||||
|
||||
static permission = {
|
||||
'READ_CALENDAR': 'READ_CALENDAR',
|
||||
'WRITE_CALENDAR': 'WRITE_CALENDAR',
|
||||
'CAMERA': 'CAMERA',
|
||||
'READ_CONTACTS': 'READ_CONTACTS',
|
||||
'WRITE_CONTACTS': 'WRITE_CONTACTS',
|
||||
'GET_ACCOUNTS': 'GET_ACCOUNTS',
|
||||
'ACCESS_FINE_LOCATION': 'ACCESS_FINE_LOCATION',
|
||||
'ACCESS_COARSE_LOCATION': 'ACCESS_COARSE_LOCATION',
|
||||
'RECORD_AUDIO': 'RECORD_AUDIO',
|
||||
'READ_PHONE_STATE': 'READ_PHONE_STATE',
|
||||
'CALL_PHONE': 'CALL_PHONE',
|
||||
'ADD_VOICEMAIL': 'ADD_VOICEMAIL',
|
||||
'USE_SIP': 'USE_SIP',
|
||||
'PROCESS_OUTGOING_CALLS': 'PROCESS_OUTGOING_CALLS',
|
||||
'READ_CALL_LOG': 'READ_CALL_LOG',
|
||||
'WRITE_CALL_LOG': 'WRITE_CALL_LOG',
|
||||
'SEND_SMS': 'SEND_SMS',
|
||||
'RECEIVE_SMS': 'RECEIVE_SMS',
|
||||
'READ_SMS': 'READ_SMS',
|
||||
'RECEIVE_WAP_PUSH': 'RECEIVE_WAP_PUSH',
|
||||
'RECEIVE_MMS': 'RECEIVE_MMS',
|
||||
'WRITE_EXTERNAL_STORAGE': 'WRITE_EXTERNAL_STORAGE',
|
||||
'READ_EXTERNAL_STORAGE': 'READ_EXTERNAL_STORAGE',
|
||||
'BODY_SENSORS': 'BODY_SENSORS'
|
||||
};
|
||||
|
||||
static permissionStatus = {
|
||||
'NOT_REQUESTED': 'not_determined',
|
||||
'DENIED': 'denied',
|
||||
'RESTRICTED': 'restricted',
|
||||
'GRANTED': 'authorized',
|
||||
'GRANTED_WHEN_IN_USE': 'authorized_when_in_use'
|
||||
};
|
||||
|
||||
static locationAuthorizationMode = {
|
||||
'ALWAYS': 'always',
|
||||
'WHEN_IN_USE': 'when_in_use'
|
||||
};
|
||||
|
||||
static permissionGroups = {
|
||||
'GRANTED': 'GRANTED',
|
||||
'DENIED': 'DENIED',
|
||||
'NOT_REQUESTED': 'NOT_REQUESTED',
|
||||
'DENIED_ALWAYS': 'DENIED_ALWAYS'
|
||||
};
|
||||
|
||||
static locationMode = {
|
||||
'HIGH_ACCURACY': 'high_accuracy',
|
||||
'DEVICE_ONLY': 'device_only',
|
||||
'BATTERY_SAVING': 'battery_saving',
|
||||
'LOCATION_OFF': 'location_off'
|
||||
};
|
||||
|
||||
static bluetoothState = {
|
||||
'UNKNOWN': 'unknown',
|
||||
'RESETTING': 'resetting', // iOS
|
||||
'UNSUPPORTED': 'unsupported', // iOS
|
||||
'UNAUTHORIZED': 'unauthorized', // iOS
|
||||
'POWERED_OFF': 'powered_off',
|
||||
'POWERED_ON': 'powered_on',
|
||||
'POWERING_OFF': 'powering_off',
|
||||
'POWERING_ON': 'powering_on'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationEnabled(): Promise<any> {return; }
|
||||
static isLocationAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
|
||||
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiEnabled(): Promise<any> {return; }
|
||||
static isWifiAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
|
||||
* application is authorized to use it.
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraEnabled(): Promise<any> {return; }
|
||||
static isCameraAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
*/
|
||||
@Cordova()
|
||||
static isBluetoothEnabled(): Promise<any> {return; }
|
||||
static isBluetoothAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*
|
||||
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
@Cordova()
|
||||
static requestLocationAuthorization(mode?: string): Promise<any> {return; }
|
||||
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
|
||||
static switchToLocationSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
|
||||
static switchToMobileDataSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
|
||||
static switchToBluetoothSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
@Cordova({sync: true, platforms: ['Android', 'Windows 10']})
|
||||
static switchToWifiSettings(): void { }
|
||||
|
||||
/**
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'Windows 10']})
|
||||
static isWifiEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables WiFi on the device.
|
||||
* Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
|
||||
* @param state {boolean}
|
||||
*/
|
||||
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
|
||||
static setWifiState(state: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enables/disables Bluetooth on the device.
|
||||
* Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
|
||||
* @param state {boolean}
|
||||
*/
|
||||
@Cordova({callbackOrder: 'reverse', platforms: ['Android', 'Windows 10']})
|
||||
static setBluetoothState(state: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isLocationEnabled(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
@ -49,49 +187,309 @@ export class Diagnostic {
|
||||
@Cordova()
|
||||
static isLocationAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getLocationAuthorizationStatus(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*
|
||||
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if camera hardware is present on device.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isCameraPresent(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the camera.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isCameraAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns the camera authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getCameraAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests camera authorization for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static requestCameraAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the microphone.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isMicrophoneAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the microphone authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests microphone authorization for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static requestMicrophoneAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use contacts (address book).
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isContactsAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the contacts authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getContactsAuthroizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests contacts authorization for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static requestContactsAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the calendar.
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static isCalendarAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Returns the calendar authorization status for the application.
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
*
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getCalendarAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests calendar authorization for the application.
|
||||
*
|
||||
* Notes for iOS:
|
||||
* - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
|
||||
* - This relates to Calendar Events (not Calendar Reminders)
|
||||
*
|
||||
* Notes for Android:
|
||||
* - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
||||
* - This requests permission for `READ_CALENDAR` run-time permission
|
||||
* - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
|
||||
*
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static requestCalendarAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens settings page for this app.
|
||||
* On Android, this opens the "App Info" page in the Settings app.
|
||||
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static switchToSettings(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Returns the state of Bluetooth on the device.
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS']})
|
||||
static getBluetoothState(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Bluetooth state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS'], sync: true})
|
||||
static registerBluetoothStateChangeHandler(handler: Function): void { }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in Location state occurs.
|
||||
* @param handler
|
||||
*/
|
||||
@Cordova({platforms: ['Android', 'iOS'], sync: true})
|
||||
static registerLocationStateChangeHandler(handler: Function): void { }
|
||||
|
||||
/**
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware. Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static isGpsLocationAvailable(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Device only = GPS hardware only (high accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({platforms: ['Android']})
|
||||
static isGpsLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static isNetworkLocationAvailable(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({platforms: ['Android']})
|
||||
static isNetworkLocationEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
|
||||
* Returns the current location mode setting for the device.
|
||||
*/
|
||||
@Cordova()
|
||||
static isRemoteNotificationsEnabled(): Promise<any> {return; }
|
||||
@Cordova({platforms: ['Android']})
|
||||
static getLocationMode(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for a given permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permission
|
||||
*/
|
||||
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
|
||||
static getPermissionAuthorizationStatus(permission: any): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
*/
|
||||
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
|
||||
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
|
||||
* @param permission
|
||||
*/
|
||||
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
|
||||
static requestRuntimePermission(permission: any): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
* Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
* @param permissions
|
||||
*/
|
||||
@Cordova({platforms: ['Android'], callbackOrder: 'reverse'})
|
||||
static requestRuntimePermissions(permissions: any[]): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the device setting for Bluetooth is switched on.
|
||||
* This requires `BLUETOOTH` permission on Android
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static isBluetoothEnabled(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities.
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static hasBluetoothSupport(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static hasBluetoothLESupport(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||
*/
|
||||
@Cordova({platforms: ['Android']})
|
||||
static hasBluetoothLEPeripheralSupport(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static isCameraRollAuthorized(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Returns the authorization status for the application to use the Camera Roll in Photos app.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static getCameraRollAuthorizationStatus(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Requests camera roll authorization for the application. Should only be called if authorization status is NOT_REQUESTED. Calling it when in any other state will have no effect.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static requestCameraRollAuthorization(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static isRemoteNotificationsEnabled(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
|
||||
*/
|
||||
@Cordova()
|
||||
static isRegisteredForRemoteNotifications(): Promise<any> {return; }
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static isRegisteredForRemoteNotifications(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Indicates the current setting of notification types for the app in the Settings app.
|
||||
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static getRemoteNotificationTypes(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use reminders.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static isRemindersAuthorized(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Returns the reminders authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static getRemindersAuthorizationStatus(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Requests reminders authorization for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static requestRemindersAuthorization(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized for background refresh.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static isBackgroundRefreshAuthorized(): Promise<boolean> {return; }
|
||||
|
||||
/**
|
||||
* Returns the background refresh authorization status for the application.
|
||||
*/
|
||||
@Cordova({platforms: ['iOS']})
|
||||
static getBackgroundRefreshStatus(): Promise<any> {return; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface PromptCallback {
|
||||
|
||||
@ -11,7 +12,6 @@ export interface PromptCallback {
|
||||
* The text entered in the prompt dialog box. (String)
|
||||
*/
|
||||
input1: string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ export interface PromptCallback {
|
||||
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Dialogs } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
|
@ -1,5 +1,8 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
/**
|
||||
* @name Email Composer
|
||||
* @description
|
||||
@ -7,13 +10,14 @@ declare var cordova: any;
|
||||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
|
||||
*
|
||||
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
|
||||
* A good alternative to this plugin is the social sharing plugin.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { EmailComposer } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* EmailComposer.isAvailable().then((available) =>{
|
||||
* EmailComposer.isAvailable().then((available: boolean) =>{
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* }
|
||||
@ -55,8 +59,23 @@ export class EmailComposer {
|
||||
*/
|
||||
static isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
|
||||
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
|
||||
if (app) {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cordova.plugins.email.isAvailable((isAvailable) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -83,6 +102,7 @@ export class EmailComposer {
|
||||
static open(email: Email, scope?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface Email {
|
||||
app?: string;
|
||||
to?: string | Array<string>;
|
||||
|
482
src/plugins/estimote-beacons.ts
Normal file
482
src/plugins/estimote-beacons.ts
Normal file
@ -0,0 +1,482 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name EstimoteBeacons
|
||||
*
|
||||
* @description
|
||||
* This plugin enables communication between a phone and Estimote Beacons peripherals.
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-estimote',
|
||||
pluginRef: 'estimote.beacons',
|
||||
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
export class EstimoteBeacons {
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityUnknown = 0;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityImmediate = 1;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityNear = 2;
|
||||
|
||||
/** Proximity value */
|
||||
static ProximityFar = 3;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorUnknown = 0;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorMintCocktail = 1;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorIcyMarshmallow = 2;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorBlueberryPie = 3;
|
||||
/**
|
||||
* Beacon colour.
|
||||
*/
|
||||
static BeaconColorSweetBeetroot = 4;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorCandyFloss = 5;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorLemonTart = 6;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorVanillaJello = 7;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorLiquoriceSwirl = 8;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorWhite = 9;
|
||||
|
||||
/** Beacon colour */
|
||||
static BeaconColorTransparent = 10;
|
||||
|
||||
/** Region state */
|
||||
static RegionStateUnknown = 'unknown';
|
||||
|
||||
/** Region state */
|
||||
static RegionStateOutside = 'outside';
|
||||
|
||||
/** Region state */
|
||||
static RegionStateInside = 'inside';
|
||||
|
||||
/**
|
||||
* Ask the user for permission to use location services
|
||||
* while the app is in the foreground.
|
||||
* You need to call this function or requestAlwaysAuthorization
|
||||
* on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.requestWhenInUseAuthorization().then(
|
||||
* () => { console.log('on success'); },
|
||||
* () => { console.log('on error'); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static requestWhenInUseAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Ask the user for permission to use location services
|
||||
* whenever the app is running.
|
||||
* You need to call this function or requestWhenInUseAuthorization
|
||||
* on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.requestAlwaysAuthorization().then(
|
||||
* () => { console.log('on success'); },
|
||||
* () => { console.log('on error'); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static requestAlwaysAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get the current location authorization status.
|
||||
* Implemented on iOS 8+.
|
||||
* Does nothing on other platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.authorizationStatus().then(
|
||||
* (result) => { console.log('Location authorization status: ' + result); },
|
||||
* (errorMessage) => { console.log('Error: ' + errorMessage); }
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static authorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start advertising as a beacon.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||
* .then(() => { console.log('Beacon started'); });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param uuid {string} UUID string the beacon should advertise (mandatory).
|
||||
* @param major {number} Major value to advertise (mandatory).
|
||||
* @param minor {number} Minor value to advertise (mandatory).
|
||||
* @param regionId {string} Identifier of the region used to advertise (mandatory).
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova({
|
||||
clearFunction: 'stopAdvertisingAsBeacon'
|
||||
})
|
||||
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop advertising as a beacon.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
|
||||
* .then(() => { console.log('Beacon started'); });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopAdvertisingAsBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable analytics.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
|
||||
* ```
|
||||
* @param enable {number} Boolean value to turn analytics on or off (mandatory).
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static enableAnalytics(enable: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if analytics is enabled.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); });
|
||||
* ```
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static isAnalyticsEnabled(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Test if App ID and App Token is set.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); });
|
||||
* ```
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static isAuthorized(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set App ID and App Token.
|
||||
*
|
||||
* @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
|
||||
* ```
|
||||
* @param appID {string} The App ID (mandatory).
|
||||
* @param appToken {string} The App Token (mandatory).
|
||||
* @return Returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
|
||||
* Available on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||
* console.log(JSON.stringify(beacons));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @return Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopEstimoteBeaconDiscovery'
|
||||
})
|
||||
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop CoreBluetooth scan. Available on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
|
||||
* console.log(JSON.stringify(beacons));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return Returns an Observable that notifies of each beacon discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopRangingBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
|
||||
* console.log(JSON.stringify(info));
|
||||
* });
|
||||
* setTimeout(() => {
|
||||
* EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
|
||||
* }, 5000);
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.startRangingBeaconsInRegion}.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopRangingSecureBeaconsInRegion',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static startRangingSecureBeaconsInRegion(region: BeaconRegion): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop ranging secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopRangingSecureBeaconsInRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
|
||||
* console.log('Region state: ' + JSON.stringify(state));
|
||||
* });
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
|
||||
* are inside a region when the user turns display on, see
|
||||
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
|
||||
* for further details (optional, defaults to false, iOS only).
|
||||
* @return Returns an Observable that notifies of each region state discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopMonitoringForRegion',
|
||||
clearWithArgs: true,
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop monitoring beacons. Available on iOS and Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* let region: BeaconRegion = {} // Empty region matches all beacons.
|
||||
* EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
|
||||
* ```
|
||||
* @param region {BeaconRegion} Dictionary with region properties (mandatory).
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start monitoring secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* EstimoteBeacons.startMonitoringForRegion.
|
||||
* To use secure beacons set the App ID and App Token using
|
||||
* {@link EstimoteBeacons.setupAppIDAndAppToken}.
|
||||
* @see {@link EstimoteBeacons.startMonitoringForRegion}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopSecureMonitoringForRegion',
|
||||
clearWithArgs: true,
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startSecureMonitoringForRegion(region: BeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Stop monitoring secure beacons. Available on iOS.
|
||||
* This function has the same parameters/behaviour as
|
||||
* {@link EstimoteBeacons.stopMonitoringForRegion}.
|
||||
*/
|
||||
@Cordova()
|
||||
static stopSecureMonitoringForRegion(region: BeaconRegion): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Connect to Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00);
|
||||
* ```
|
||||
* ```
|
||||
* EstimoteBeacons.connectToBeacon({
|
||||
* proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000',
|
||||
* major: 1,
|
||||
* minor: 1
|
||||
* });
|
||||
* ```
|
||||
* @param beacon {Beacon} Beacon to connect to.
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static connectToBeacon(beacon: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* EstimoteBeacons.disconnectConnectedBeacon();
|
||||
* ```
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnectConnectedBeacon(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write proximity UUID to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes constant ESTIMOTE_PROXIMITY_UUID
|
||||
* EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
|
||||
*
|
||||
* @param uuid {string} String to write as new UUID
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write major to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMajor(1);
|
||||
*
|
||||
* @param major {number} number to write as new major
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMajor(major: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Write minor to connected Estimote Beacon. Available on Android.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* // Example that writes 1
|
||||
* EstimoteBeacons.writeConnectedMinor(1);
|
||||
*
|
||||
* @param minor {number} number to write as new minor
|
||||
* @return returns a Promise.
|
||||
*/
|
||||
@Cordova()
|
||||
static writeConnectedMinor(minor: number): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface BeaconRegion {
|
||||
state?: string;
|
||||
major: number;
|
||||
minor: number;
|
||||
identifier?: string;
|
||||
uuid: string;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Facebook
|
||||
@ -69,7 +69,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* For tracking events, see `logEvent` and `logPurchase`.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Facebook } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -98,7 +98,7 @@ export class Facebook {
|
||||
/**
|
||||
* Login to Facebook to authenticate this app.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* {
|
||||
* status: "connected",
|
||||
* authResponse: {
|
||||
@ -113,10 +113,10 @@ export class Facebook {
|
||||
* ```
|
||||
*
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
* @return {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static login(permissions: string[]): Promise<any> { return; }
|
||||
static login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
|
||||
|
||||
/**
|
||||
* Logout of Facebook.
|
||||
@ -245,4 +245,17 @@ export class Facebook {
|
||||
url: string,
|
||||
picture: string
|
||||
}): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface FacebookLoginResponse {
|
||||
status: string;
|
||||
authResponse: {
|
||||
session_key: boolean;
|
||||
accessToken: string;
|
||||
expiresIn: number;
|
||||
sig: string;
|
||||
secret: string;
|
||||
userID: string;
|
||||
};
|
||||
}
|
||||
|
1221
src/plugins/file.ts
1221
src/plugins/file.ts
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
import {Plugin, CordovaInstance} from './plugin';
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var FileTransfer;
|
||||
|
||||
@ -106,19 +107,49 @@ export interface FileTransferError {
|
||||
|
||||
/**
|
||||
* @name Transfer
|
||||
* @description This plugin allows you to upload and download files.
|
||||
* Example:
|
||||
* Create instance:
|
||||
*
|
||||
* @description
|
||||
* This plugin allows you to upload and download files.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Transfer } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Create instance:
|
||||
* const fileTransfer = new Transfer();
|
||||
*
|
||||
* Upload a file:
|
||||
* // Upload a file:
|
||||
* fileTransfer.upload(..).then(..).catch(..);
|
||||
*
|
||||
* Download a file:
|
||||
* // Download a file:
|
||||
* fileTransfer.download(..).then(..).catch(..);
|
||||
*
|
||||
* Abort active transfer:
|
||||
* // Abort active transfer:
|
||||
* fileTransfer.abort();
|
||||
*
|
||||
* E.g
|
||||
*
|
||||
* upload(){
|
||||
* const fileTransfer = new Transfer();
|
||||
* var options: any;
|
||||
*
|
||||
* options = {
|
||||
* fileKey: 'file',
|
||||
* fileName: 'name.jpg',
|
||||
* headers: {}
|
||||
* .....
|
||||
* }
|
||||
* fileTransfer.upload("<file path>", "<api endpoint>", options)
|
||||
* .then((data) => {
|
||||
* // success
|
||||
* }, (err) => {
|
||||
* // error
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
@ -127,11 +158,23 @@ export interface FileTransferError {
|
||||
})
|
||||
export class Transfer {
|
||||
|
||||
public static FILE_NOT_FOUND_ERR: number = 1;
|
||||
public static INVALID_URL_ERR: number = 2;
|
||||
public static CONNECTION_ERR: number = 3;
|
||||
public static ABORT_ERR: number = 4;
|
||||
public static NOT_MODIFIED_ERR: number = 4;
|
||||
/**
|
||||
* Error code rejected from upload with FileTransferError
|
||||
* Defined in FileTransferError.
|
||||
* FILE_NOT_FOUND_ERR: 1 Return when file was not found
|
||||
* INVALID_URL_ERR: 2, Return when url was invalid
|
||||
* CONNECTION_ERR: 3, Return on connection error
|
||||
* ABORT_ERR: 4, Return on aborting
|
||||
* NOT_MODIFIED_ERR: 5 Return on "304 Not Modified" HTTP response
|
||||
* @enum {number}
|
||||
*/
|
||||
public static FileTransferErrorCode = {
|
||||
FILE_NOT_FOUND_ERR: 1,
|
||||
INVALID_URL_ERR: 2,
|
||||
CONNECTION_ERR: 3,
|
||||
ABORT_ERR: 4,
|
||||
NOT_MODIFIED_ERR: 5
|
||||
};
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
@ -145,7 +188,7 @@ export class Transfer {
|
||||
* @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
|
||||
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
|
||||
* @param {FileUploadOptions} options Optional parameters.
|
||||
* @param {boolean} trustAllHosts: Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
|
||||
* @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Flashlight
|
||||
@ -7,7 +8,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Flashlight } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -21,7 +22,6 @@ import {Plugin, Cordova} from './plugin';
|
||||
})
|
||||
export class Flashlight {
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the flashlight is available
|
||||
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
|
||||
@ -53,7 +53,7 @@ export class Flashlight {
|
||||
|
||||
/**
|
||||
* Checks if the flashlight is turned on.
|
||||
* Returns a boolean
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
|
164
src/plugins/geofence.ts
Normal file
164
src/plugins/geofence.ts
Normal file
@ -0,0 +1,164 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
/**
|
||||
* @name Geofence
|
||||
* @description Monitors circular geofences around latitude/longitude coordinates, and sends a notification to the user when the boundary of a geofence is crossed. Notifications can be sent when the user enters and/or exits a geofence.
|
||||
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
|
||||
* @usage
|
||||
* ```
|
||||
* import { Geofence } from 'ionic-native';
|
||||
* import { Platform } from 'ionic-angular'
|
||||
* ...
|
||||
*
|
||||
* constructor(private platform: Platform) {
|
||||
* this.platform.ready().then(() => {
|
||||
// initialize the plugin
|
||||
* Geofence.initialize().then(
|
||||
* // resolved promise does not return a value
|
||||
* () => console.log('Geofence Plugin Ready'),
|
||||
* (err) => console.log(err)
|
||||
* )
|
||||
* })
|
||||
* }
|
||||
*
|
||||
* private addGeofence() {
|
||||
* //options describing geofence
|
||||
* let fence = {
|
||||
* id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb", //any unique ID
|
||||
* latitude: 37.285951, //center of geofence radius
|
||||
* longitude: -121.936650,
|
||||
* radius: 100, //radius to edge of geofence
|
||||
* transitionType: 3, //see 'Transition Types' below
|
||||
* notification: { //notification settings
|
||||
* id: 1, //any unique ID
|
||||
* title: "You crossed a fence", //notification title
|
||||
* text: "You just arrived to Gliwice city center.", //notification body
|
||||
* openAppOnClick: true //open app when notification is tapped
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Geofence.addOrUpdate(fence).then(
|
||||
* () => console.log('Geofence added'),
|
||||
* (err) => console.log('Geofence failed to add')
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* ### Transition Types ###
|
||||
* Transition type specifies whether the geofence should trigger when the user enters and/or leaves the geofence.
|
||||
*
|
||||
* #### Supported values ####
|
||||
* - 1: Enter
|
||||
* - 2: Leave
|
||||
* - 3: Both
|
||||
*
|
||||
* ### Defining a Geofence ###
|
||||
* Geofences are defined by an object that is passed to `addOrUpdate()`. Object properties are:
|
||||
* - id: Any unique ID for the geofence. This ID is used to remove and update a geofence
|
||||
* - latitude: Latitude coordinate of the center of the geofence radius
|
||||
* - longitude: Latitude coordinate of the center of the geofence radius
|
||||
* - radius: Radius from the center to the edge of the geofence
|
||||
* - transitionType: Type of geofence transition to monitor for. See 'Transition Types' above
|
||||
* - notification: Object. Options for defining the notification sent when a geofence is crossed
|
||||
* - id: Any unique ID
|
||||
* - title: Notification title
|
||||
* - text: Notification body
|
||||
* - openAppOnClick: Boolean. Whether to open the app when the notification is tapped by the user
|
||||
*
|
||||
* ### Troubleshooting ###
|
||||
* #### I get compile errors when I run `ionic build ios` or `ionic run ios`. ####
|
||||
* This could be caused by the Cordova project directory in `/platforms/ios` not being named correctly.
|
||||
* Try running `ionic platform rm <platform>` then run `ionic platform add <platform>` to recreate the
|
||||
* platform directories.
|
||||
*/
|
||||
declare var window: any;
|
||||
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-geofence',
|
||||
pluginRef: 'geofence',
|
||||
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||
})
|
||||
|
||||
export class Geofence {
|
||||
|
||||
public static TransitionType = {
|
||||
ENTER: 1,
|
||||
EXIT: 2,
|
||||
BOTH: 3
|
||||
};
|
||||
|
||||
public static onTrasitionReceived: Function;
|
||||
|
||||
/**
|
||||
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static initialize(): Promise<void> { return };
|
||||
|
||||
/**
|
||||
* Adds a new geofence or array of geofences. For geofence object, see above.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return };
|
||||
|
||||
/**
|
||||
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
|
||||
* geofence was created.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(geofenceId: string | Array<string>): Promise<void> { return };
|
||||
|
||||
/**
|
||||
* Removes all geofences.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static removeAll(): Promise<void> { return };
|
||||
|
||||
/**
|
||||
* Returns an array of geofences currently being monitored.
|
||||
*
|
||||
* @return {Promise<Array<string>>}
|
||||
*/
|
||||
@Cordova()
|
||||
static getWatched(): Promise<string> { return };
|
||||
|
||||
/**
|
||||
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||
* Commenting out. Not yet implemented in plugin.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
static onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
return () => window.geofence.onTransitionReceived = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user clicks a geofence notification. iOS and Android only.
|
||||
* Commenting out. Not yet implemented in plugin.
|
||||
*
|
||||
* @return {Promise<Object>}
|
||||
*/
|
||||
static onNotificationClicked(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
return () => window.geofence.onNotificationClicked = () => {};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
export interface Coordinates {
|
||||
@ -101,11 +102,10 @@ export interface GeolocationOptions {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Geolocation } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Geolocation.getCurrentPosition().then((resp) => {
|
||||
* // resp.coords.latitude
|
||||
* // resp.coords.longitude
|
||||
@ -139,7 +139,7 @@ export class Geolocation {
|
||||
* Watch the current device's position. Clear the watch by unsubscribing from
|
||||
* Observable changes.
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* var subscription = Geolocation.watchPosition().subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
* });
|
||||
@ -154,8 +154,7 @@ export class Geolocation {
|
||||
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
|
||||
return new Observable<Geoposition>(
|
||||
(observer: any) => {
|
||||
let cb = (data: Geoposition) => observer.next(data);
|
||||
let watchId = navigator.geolocation.watchPosition(cb, options);
|
||||
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.error.bind(observer), options);
|
||||
return () => navigator.geolocation.clearWatch(watchId);
|
||||
}
|
||||
);
|
||||
|
@ -1,14 +1,13 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Globalization
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Globalization } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@ -56,7 +55,6 @@ export class Globalization {
|
||||
})
|
||||
static stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Returns a pattern string to format and parse dates according to the client's user preferences.
|
||||
* @param options Object with the format length and selector
|
||||
@ -67,7 +65,6 @@ export class Globalization {
|
||||
})
|
||||
static getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
||||
* @param options Object with type (narrow or wide) and item (month or days).
|
||||
|
@ -1,10 +1,13 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Google Plus
|
||||
* @description
|
||||
* @usage
|
||||
* ```
|
||||
* ```typescript
|
||||
* import { GooglePlus } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
@ -31,9 +32,10 @@ export class GoogleAnalytics {
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
|
||||
*
|
||||
* @param {string} title Screen title
|
||||
* @param {string} campaignUrl Campaign url for measuring referrals
|
||||
*/
|
||||
@Cordova()
|
||||
static trackView(title: string): Promise<any> { return; }
|
||||
static trackView(title: string, campaignUrl?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track an event
|
||||
@ -105,13 +107,34 @@ export class GoogleAnalytics {
|
||||
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
|
||||
* @param {string} id
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserId(id: string): Promise<any> { return; }
|
||||
@Cordova({sync: true})
|
||||
static setUserId(id: string): void { }
|
||||
|
||||
/**
|
||||
* Sets the app version
|
||||
* @param appVersion
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAppVersion(appVersion: string): void { }
|
||||
|
||||
/**
|
||||
* Set a anonymize Ip address
|
||||
* @param anonymize
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAnonymizeIp(anonymize: boolean): void { }
|
||||
|
||||
/**
|
||||
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
|
||||
* @param allow
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static setAllowIDFACollection(allow: boolean): void { }
|
||||
|
||||
/**
|
||||
* Enable verbose logging
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({sync: true})
|
||||
static debugMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { Cordova, CordovaInstance, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Created by Ibrahim on 3/29/2016.
|
||||
*/
|
||||
declare var plugin: any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* You can listen to these events where appropriate
|
||||
@ -48,9 +51,11 @@ export const GoogleMapsAnimation = {
|
||||
* ...
|
||||
*
|
||||
* // somewhere in your component
|
||||
* let map = new GoogleMap('elementID');
|
||||
* let map = new GoogleMap('elementID', {
|
||||
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
|
||||
});
|
||||
*
|
||||
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!"));
|
||||
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@ -62,8 +67,9 @@ export class GoogleMap {
|
||||
_objectInstance: any;
|
||||
|
||||
/**
|
||||
* Checks if a map object has been created.
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the plugin is available.
|
||||
* Checks if a map object has been created and is available.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> {
|
||||
@ -74,23 +80,31 @@ export class GoogleMap {
|
||||
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event.
|
||||
*
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
on(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
let cb = data => observer.next(data);
|
||||
this._objectInstance.on(event, cb);
|
||||
this._objectInstance.on(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.off(event);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to a map event only once.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
one(event: any): Promise<any> {
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.one(event, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setDebuggable(isDebuggable: boolean): void {
|
||||
}
|
||||
@ -100,7 +114,9 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position of the camera
|
||||
* Get the position of the camera.
|
||||
*
|
||||
* @return {Promise<CameraPosition>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCameraPosition(): Promise<CameraPosition> {
|
||||
@ -108,15 +124,19 @@ export class GoogleMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location of the user
|
||||
* Get the location of the user.
|
||||
*
|
||||
* @return {Promise<MyLocation>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getMyLocation(): Promise<MyLocation> {
|
||||
getMyLocation(options?: MyLocationOptions): Promise<MyLocation> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the visible region
|
||||
* Get the visible region.
|
||||
*
|
||||
* @return {Promise<VisibleRegion>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVisibleRegion(): Promise<VisibleRegion> {
|
||||
@ -184,8 +204,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsMarker>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addMarker(options, (marker: any) => {
|
||||
if (marker) resolve(new GoogleMapsMarker(marker));
|
||||
else reject();
|
||||
if (marker) {
|
||||
resolve(new GoogleMapsMarker(marker));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -195,8 +218,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsCircle>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addCircle(options, (circle: any) => {
|
||||
if (circle) resolve(new GoogleMapsCircle(circle));
|
||||
else reject();
|
||||
if (circle) {
|
||||
resolve(new GoogleMapsCircle(circle));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -206,8 +232,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsPolygon>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addPolygon(options, (polygon: any) => {
|
||||
if (polygon) resolve(new GoogleMapsPolygon(polygon));
|
||||
else reject();
|
||||
if (polygon) {
|
||||
resolve(new GoogleMapsPolygon(polygon));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -217,8 +246,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsPolyline>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addPolyline(options, (polyline: any) => {
|
||||
if (polyline) resolve(new GoogleMapsPolyline(polyline));
|
||||
else reject();
|
||||
if (polyline) {
|
||||
resolve(new GoogleMapsPolyline(polyline));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -228,8 +260,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsTileOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
|
||||
if (tileOverlay) resolve(new GoogleMapsTileOverlay(tileOverlay));
|
||||
else reject();
|
||||
if (tileOverlay) {
|
||||
resolve(new GoogleMapsTileOverlay(tileOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -239,8 +274,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsGroundOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
|
||||
if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay));
|
||||
else reject();
|
||||
if (groundOverlay) {
|
||||
resolve(new GoogleMapsGroundOverlay(groundOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -250,8 +288,11 @@ export class GoogleMap {
|
||||
return new Promise<GoogleMapsKmlOverlay>(
|
||||
(resolve, reject) => {
|
||||
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
|
||||
if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay));
|
||||
else reject();
|
||||
if (kmlOverlay) {
|
||||
resolve(new GoogleMapsKmlOverlay(kmlOverlay));
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@ -341,6 +382,13 @@ export interface MyLocation {
|
||||
bearing?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface MyLocationOptions {
|
||||
enableHighAccuracy?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -389,11 +437,8 @@ export class GoogleMapsMarker {
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
let cb = (data: any) => {
|
||||
observer.next(data);
|
||||
};
|
||||
this._objectInstance.addEventListener(event, cb);
|
||||
return () => this._objectInstance.removeEventListener(event, cb);
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -537,9 +582,8 @@ export class GoogleMapsCircle {
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
let cb = data => observer.next(data);
|
||||
this._objectInstance.addEventListener(event, cb);
|
||||
return () => this._objectInstance.removeEventListener(event, cb);
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -629,9 +673,8 @@ export class GoogleMapsPolyline {
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
let cb = data => observer.next(data);
|
||||
this._objectInstance.addEventListener(event, cb);
|
||||
return () => this._objectInstance.removeEventListener(event, cb);
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -721,9 +764,8 @@ export class GoogleMapsPolygon {
|
||||
addEventListener(event: any): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
let cb = data => observer.next(data);
|
||||
this._objectInstance.addEventListener(event, cb);
|
||||
return () => this._objectInstance.removeEventListener(event, cb);
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -951,8 +993,9 @@ export class GoogleMapsKmlOverlay {
|
||||
export class GoogleMapsLatLngBounds {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(public southwest: GoogleMapsLatLng, public northeast: GoogleMapsLatLng) {
|
||||
this._objectInstance = new plugin.google.maps.LatLngBounds([southwest, northeast]);
|
||||
constructor(public southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], public northeast?: GoogleMapsLatLng) {
|
||||
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
|
||||
this._objectInstance = new plugin.google.maps.LatLngBounds(args);
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
@ -1005,3 +1048,52 @@ export class GoogleMapsLatLng {
|
||||
return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GeocoderRequest {
|
||||
address?: string;
|
||||
position?: { lat: number; lng: number };
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface GeocoderResult {
|
||||
adminArea?: string;
|
||||
country?: string;
|
||||
countryCode?: string;
|
||||
extra?: {
|
||||
featureName?: string;
|
||||
lines?: Array<string>;
|
||||
permises?: string;
|
||||
phone?: string;
|
||||
url?: string
|
||||
};
|
||||
locale?: string;
|
||||
locality?: string;
|
||||
position?: { lat: number; lng: number };
|
||||
postalCode?: string;
|
||||
subAdminArea?: string;
|
||||
subLocality?: string;
|
||||
subThoroughfare?: string;
|
||||
thoroughfare?: string;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class Geocoder {
|
||||
/**
|
||||
* Converts position to address and vice versa
|
||||
* @param {GeocoderRequest} request Request object with either an address or a position
|
||||
* @returns {Promise<GeocoderResult[]>}
|
||||
*/
|
||||
static geocode(request: GeocoderRequest): Promise<GeocoderResult[]> {
|
||||
return new Promise<GeocoderResult[]>((resolve, reject) => {
|
||||
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
|
||||
reject({ error: 'plugin_not_installed' });
|
||||
} else {
|
||||
plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Hotspot
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Hotspot, Network } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* Hotspot.scanWifi().then((networks: Array<Network>) => {
|
||||
* console.log(networks);
|
||||
* });
|
||||
* ...
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
@ -1,10 +1,26 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @name Httpd
|
||||
* @description
|
||||
* Embedded httpd for Cordova apps. Light weight HTTP server.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Httpd, HttpdOptions} from 'ionic-native';
|
||||
*
|
||||
* let options: HttpdOptions = {
|
||||
* www_root: 'httpd_root', // relative path to app's www directory
|
||||
* port: 80,
|
||||
* localhost_only: false
|
||||
* };
|
||||
*
|
||||
* Httpd.startServer(options).subscribe((data) => {
|
||||
* console.log('Server is live');
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
||||
@ -23,7 +39,7 @@ export class Httpd {
|
||||
observable: true,
|
||||
clearFunction: 'stopServer'
|
||||
})
|
||||
static startServer(options: any): Observable<string> {return; }
|
||||
static startServer(options?: any): Observable<string> { return; }
|
||||
|
||||
/**
|
||||
* Gets the URL of the running server
|
||||
@ -38,7 +54,9 @@ export class Httpd {
|
||||
*/
|
||||
@Cordova()
|
||||
static getLocalPath(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* These options are used for the Httpd.startServer() function.
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface Beacon {
|
||||
@ -47,6 +48,7 @@ export interface Beacon {
|
||||
accuracy: number;
|
||||
|
||||
}
|
||||
|
||||
export interface BeaconRegion {
|
||||
/**
|
||||
* A unique identifier for this region.
|
||||
@ -65,7 +67,7 @@ export interface BeaconRegion {
|
||||
major?: number;
|
||||
|
||||
/**
|
||||
* The beacon's major identifier number. Optional, of nothing is supplied
|
||||
* The beacon's minor identifier number. Optional, of nothing is supplied
|
||||
* the plugin will treat it as a wildcard.
|
||||
*/
|
||||
minor?: number;
|
||||
@ -76,6 +78,7 @@ export interface BeaconRegion {
|
||||
*/
|
||||
notifyEntryStateOnDisplay?: boolean;
|
||||
}
|
||||
|
||||
export interface CircularRegion {
|
||||
/**
|
||||
* A unique identifier for this region.
|
||||
@ -97,6 +100,7 @@ export interface CircularRegion {
|
||||
*/
|
||||
radius: number;
|
||||
}
|
||||
|
||||
export type Region = BeaconRegion | CircularRegion;
|
||||
|
||||
export interface PluginResult {
|
||||
@ -125,7 +129,13 @@ export interface PluginResult {
|
||||
* The state of the phone in relation to the region. Inside/outside for example.
|
||||
*/
|
||||
state: 'CLRegionStateInside' | 'CLRegionStateOutside';
|
||||
|
||||
/**
|
||||
* Error message, used only with monitoringDidFailForRegionWithError delegate.
|
||||
*/
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface Delegate {
|
||||
/**
|
||||
* An observable that publishes information about the location permission authorization status.
|
||||
@ -221,7 +231,7 @@ export interface Delegate {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { IBeacon } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -233,13 +243,13 @@ export interface Delegate {
|
||||
* // Subscribe to some of the delegate's event handlers
|
||||
* delegate.didRangeBeaconsInRegion()
|
||||
* .subscribe(
|
||||
* data => {console.log('didRangeBeaconsInRegion: ', data)},
|
||||
* error => console.error
|
||||
* data => console.log('didRangeBeaconsInRegion: ', data),
|
||||
* error => console.error();
|
||||
* );
|
||||
* delegate.didStartMonitoringForRegion()
|
||||
* .subscribe(
|
||||
* data => {console.log('didStartMonitoringForRegion: ', data)},
|
||||
* error => console.error
|
||||
* data => console.log('didStartMonitoringForRegion: ', data),
|
||||
* error => console.error();
|
||||
* );
|
||||
* delegate.didEnterRegion()
|
||||
* .subscribe(
|
||||
@ -265,7 +275,6 @@ export interface Delegate {
|
||||
})
|
||||
export class IBeacon {
|
||||
|
||||
|
||||
/**
|
||||
* Instances of this class are delegates between the {@link LocationManager} and
|
||||
* the code that consumes the messages generated on in the native layer.
|
||||
@ -372,8 +381,8 @@ export class IBeacon {
|
||||
*
|
||||
* @return Returns the BeaconRegion that was created
|
||||
*/
|
||||
static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay);
|
||||
static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
|
||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -410,7 +419,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the request and started to send events.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static onDomDelegateReady(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -418,7 +427,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether bluetooth is active.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isBluetoothEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@ -427,7 +436,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -436,7 +445,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when Bluetooth
|
||||
* could be enabled. If not, the promise will be rejected with an error.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableBluetooth(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -456,7 +465,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
@ -473,7 +482,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -489,7 +498,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestStateForRegion(region: Region): Promise<void> { return; }
|
||||
|
||||
|
||||
@ -507,7 +516,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the monitoring request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -524,7 +533,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop monitoring.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -533,7 +542,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with the
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@ -545,7 +554,7 @@ export class IBeacon {
|
||||
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
|
||||
* @returns Returns a promise that is resolved when the request dialog is shown.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestWhenInUseAuthorization(): Promise<void> { return; }
|
||||
|
||||
|
||||
@ -555,7 +564,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved when the native layer
|
||||
* shows the request dialog.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static requestAlwaysAuthorization(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -563,7 +572,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being monitored by the native layer.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getMonitoredRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
@ -571,7 +580,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with an {Array}
|
||||
* of {Region} instances that are being ranged by the native layer.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static getRangedRegions(): Promise<Region[]> { return; }
|
||||
|
||||
/**
|
||||
@ -579,7 +588,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether ranging is available or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isRangingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@ -591,7 +600,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether the region type is supported or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@ -611,7 +620,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the advertising request.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -622,7 +631,7 @@ export class IBeacon {
|
||||
* @return Returns a promise which is resolved as soon as the
|
||||
* native layer acknowledged the dispatch of the request to stop advertising.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static stopAdvertising(region: Region): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -630,7 +639,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is available or not.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertisingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@ -638,7 +647,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved with a {Boolean}
|
||||
* indicating whether advertising is active.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static isAdvertising(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
@ -648,7 +657,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -659,7 +668,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to enabled.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -669,7 +678,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the flag to disabled.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static disableDebugNotifications(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -679,7 +688,7 @@ export class IBeacon {
|
||||
* @returns Returns a promise which is resolved as soon as the
|
||||
* native layer has set the logging level accordingly.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static enableDebugLogs(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
@ -692,7 +701,7 @@ export class IBeacon {
|
||||
* message received by the native layer for appending. The returned message
|
||||
* is expected to be equivalent to the one provided in the original call.
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova({otherPromise: true})
|
||||
static appendToDeviceLog(message: string): Promise<void> { return; }
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface ImagePickerOptions {
|
||||
// max images to be selected, defaults to 15. If this is set to 1, upon
|
||||
@ -26,7 +27,7 @@ export interface ImagePickerOptions {
|
||||
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { ImagePicker } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -35,8 +36,7 @@ export interface ImagePickerOptions {
|
||||
* for (var i = 0; i < results.length; i++) {
|
||||
* console.log('Image URI: ' + results[i]);
|
||||
* }
|
||||
* }, (err) => {
|
||||
* });
|
||||
* }, (err) => { });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@ -55,4 +55,5 @@ export class ImagePicker {
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
77
src/plugins/imageresizer.ts
Normal file
77
src/plugins/imageresizer.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
export interface ImageResizerOptions {
|
||||
/**
|
||||
* The URI for the image on the device to get scaled
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* The width of the new image
|
||||
*/
|
||||
width: number;
|
||||
|
||||
/**
|
||||
* The height of the new image
|
||||
*/
|
||||
height: number;
|
||||
|
||||
/**
|
||||
* The name of the folder the image should be put
|
||||
* (Android only)
|
||||
*/
|
||||
folderName?: string;
|
||||
|
||||
/**
|
||||
*
|
||||
* Quality given as Number for the quality of the new image
|
||||
* (Android and iOS only)
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* A custom name for the file. Default name is a timestamp
|
||||
* (Android and Windows only)
|
||||
*/
|
||||
fileName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ImageResizer
|
||||
* @description
|
||||
* Cordova Plugin For Image Resize
|
||||
*
|
||||
* Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command:
|
||||
* `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git`
|
||||
*
|
||||
* For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ImageResizer, ImageResizerOptions } from 'ionic-native';
|
||||
*
|
||||
* let options = {
|
||||
* uri: uri,
|
||||
* folderName: 'Protonet',
|
||||
* quality: 90,
|
||||
* width: 1280,
|
||||
* height: 1280
|
||||
* } as ImageResizerOptions;
|
||||
*
|
||||
* ImageResizer
|
||||
* .resize(options)
|
||||
* .then(
|
||||
* (filePath: string) => { console.log('FilePath', filePath); },
|
||||
* () => { console.log('Error occured'); }
|
||||
* )
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
|
||||
pluginRef: 'ImageResizer',
|
||||
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
|
||||
})
|
||||
export class ImageResizer {
|
||||
@Cordova()
|
||||
static resize(options: ImageResizerOptions): Promise<any> { return; }
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Plugin, CordovaInstance } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
@ -10,66 +12,36 @@ export interface InAppBrowserEvent extends Event {
|
||||
/** the error message, only in the case of loaderror. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface InAppBrowserRef {
|
||||
/**
|
||||
* Adds a listener for an event from the InAppBrowser.
|
||||
* @param type the event to listen for
|
||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
||||
* exit: event fires when the InAppBrowser window is closed.
|
||||
* @param callback the function that executes when the event fires. The function is
|
||||
* passed an InAppBrowserEvent object as a parameter.
|
||||
* @name InAppBrowser
|
||||
* @description Launches in app Browser
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {InAppBrowser} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let browser = new InAppBrowser('https://ionic.io', '_system');
|
||||
* browser.executeScript(...);
|
||||
* browser.insertCSS(...);
|
||||
* browser.close();
|
||||
* ```
|
||||
*/
|
||||
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
||||
|
||||
/**
|
||||
* Removes a listener for an event from the InAppBrowser.
|
||||
* @param type The event to stop listening for.
|
||||
* loadstart: event fires when the InAppBrowser starts to load a URL.
|
||||
* loadstop: event fires when the InAppBrowser finishes loading a URL.
|
||||
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
|
||||
* exit: event fires when the InAppBrowser window is closed.
|
||||
* @param callback the function that executes when the event fires. The function is
|
||||
* passed an InAppBrowserEvent object as a parameter.
|
||||
*/
|
||||
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void);
|
||||
|
||||
/** Closes the InAppBrowser window. */
|
||||
close();
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
show();
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
* @param callback The function that executes after the JavaScript code is injected.
|
||||
* If the injected script is of type code, the callback executes with
|
||||
* a single parameter, which is the return value of the script, wrapped in an Array.
|
||||
* For multi-line scripts, this is the return value of the last statement,
|
||||
* or the last expression evaluated.
|
||||
*/
|
||||
executeScript(script: {file?: string, code?: string}, callback?: (result?: any) => void);
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
* @param callback The function that executes after the CSS is injected.
|
||||
*/
|
||||
insertCSS(css: {file?: string, code?: string}, callback?: () => void);
|
||||
}
|
||||
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-inappbrowser',
|
||||
pluginRef: 'cordova.InAppBrowser'
|
||||
pluginRef: 'cordova.InAppBrowser',
|
||||
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
|
||||
})
|
||||
export class InAppBrowser {
|
||||
|
||||
static open(url: string, target?: string, options?: string): void {
|
||||
console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
|
||||
}
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
/**
|
||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||
* @param url The URL to load.
|
||||
@ -78,8 +50,54 @@ export class InAppBrowser {
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static open(url: string, target?: string, options?: string): InAppBrowserRef { return; }
|
||||
constructor(url: string, target?: string, options?: string) {
|
||||
try {
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the InAppBrowser window.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
* @param css Details of the script to run, specifying either a file or code key.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCss(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event Event name
|
||||
* @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
on(event: string): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>((observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
});
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Insomnia
|
||||
@ -6,9 +7,10 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Prevent the screen of the mobile device from falling asleep.
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Insomnia } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Insomnia.keepAwake()
|
||||
* .then(
|
||||
* () => console.log('success'),
|
||||
@ -44,4 +46,5 @@ export class Insomnia {
|
||||
*/
|
||||
@Cordova()
|
||||
static allowSleepAgain(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
57
src/plugins/instagram.ts
Normal file
57
src/plugins/instagram.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
/**
|
||||
* @name Instagram
|
||||
* @description Share a photo with the instagram app
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Instagram} from 'ionic-native';
|
||||
*
|
||||
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
|
||||
* .then(() => console.log('Shared!'))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-instagram-plugin',
|
||||
pluginRef: 'Instagram',
|
||||
repo: 'https://github.com/vstirbu/InstagramPlugin'
|
||||
})
|
||||
export class Instagram {
|
||||
|
||||
/**
|
||||
* Detect if the Instagram application is installed on the device.
|
||||
*
|
||||
* @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
static isInstalled(): Promise<boolean|string> { return; }
|
||||
|
||||
/**
|
||||
* Share an image on Instagram
|
||||
* Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.
|
||||
*
|
||||
* @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
|
||||
* @param caption The caption of the image
|
||||
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Share a library asset or video
|
||||
* @param assetLocalIdentifier A local fileURI
|
||||
* @return {Promise<any>} Returns a promise that resolves if the image was shared
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
|
||||
|
||||
}
|
35
src/plugins/is-debug.ts
Normal file
35
src/plugins/is-debug.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
/**
|
||||
* @name IsDebug
|
||||
* @description
|
||||
* Detect if the app is running in debug mode or not.
|
||||
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {IsDebug} from 'ionic-native';
|
||||
*
|
||||
* IsDebug.getIsDebug()
|
||||
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-is-debug',
|
||||
pluginRef: 'cordova.plugins.IsDebug',
|
||||
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
|
||||
})
|
||||
export class IsDebug {
|
||||
|
||||
/**
|
||||
* Determine if an app was installed via xcode / eclipse / the ionic CLI etc
|
||||
* @return {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
|
||||
*/
|
||||
@Cordova()
|
||||
static getIsDebug(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @name Keyboard
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Keyboard } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
@ -23,9 +24,8 @@ export class Keyboard {
|
||||
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
||||
* @param hide {boolean}
|
||||
*/
|
||||
static hideKeyboardAccessoryBar(hide: boolean): void {
|
||||
console.log('hideKeyboardAccessoryBar method has been removed temporarily.');
|
||||
}
|
||||
@Cordova({sync: true})
|
||||
static hideKeyboardAccessoryBar(hide: boolean): void { }
|
||||
|
||||
/**
|
||||
* Force keyboard to be shown.
|
||||
|
@ -1,49 +1,61 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export interface LaunchNavigatorOptions {
|
||||
|
||||
/**
|
||||
* iOS, Android, Windows
|
||||
* If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false.
|
||||
* name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection.
|
||||
*/
|
||||
disableAutoGeolocation?: boolean;
|
||||
app?: string;
|
||||
|
||||
/**
|
||||
* nickname to display in app for destination. e.g. "Bob's House".
|
||||
*/
|
||||
destinationName?: string;
|
||||
|
||||
/**
|
||||
* Start point of the navigation
|
||||
*/
|
||||
start?: string | number[];
|
||||
|
||||
/**
|
||||
* nickname to display in app for start . e.g. "My House".
|
||||
*/
|
||||
startName?: string;
|
||||
|
||||
/**
|
||||
* iOS, Android, Windows
|
||||
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
|
||||
*/
|
||||
transportMode?: string;
|
||||
|
||||
/**
|
||||
* iOS
|
||||
* If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps.
|
||||
*/
|
||||
preferGoogleMaps?: boolean;
|
||||
|
||||
/**
|
||||
* iOS
|
||||
* If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app.
|
||||
*/
|
||||
urlScheme?: string;
|
||||
|
||||
/**
|
||||
* iOS
|
||||
* If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified.
|
||||
*/
|
||||
backButtonText?: string;
|
||||
|
||||
/**
|
||||
* iOS
|
||||
* If true, debug log output will be generated by the plugin. Defaults to false.
|
||||
*/
|
||||
enableDebug?: boolean;
|
||||
|
||||
/**
|
||||
* Android
|
||||
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified.
|
||||
* a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}`
|
||||
*/
|
||||
navigationMode?: string;
|
||||
extras?: any;
|
||||
|
||||
/**
|
||||
* (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants.
|
||||
*/
|
||||
launchMode?: string;
|
||||
|
||||
/**
|
||||
* text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified.
|
||||
*/
|
||||
appSelectionDialogHeader?: string;
|
||||
|
||||
/**
|
||||
* text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified.
|
||||
*/
|
||||
appSelectionCancelButton?: string;
|
||||
|
||||
successCallback?: Function;
|
||||
|
||||
errorCallback?: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,15 +64,20 @@ export interface LaunchNavigatorOptions {
|
||||
* Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* import {LaunchNavigator} from 'ionic-native';
|
||||
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
|
||||
*
|
||||
* ```typescript
|
||||
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
|
||||
*
|
||||
* let options: LaunchNavigatorOptions = {
|
||||
* start: 'London, ON',
|
||||
* app: LaunchNavigator.APPS.UBER
|
||||
* };
|
||||
*
|
||||
* LaunchNavigator.navigate("Toronto, ON", "London, ON")
|
||||
* LaunchNavigator.navigate('Toronto, ON', options)
|
||||
* .then(
|
||||
* success => console.log("Launched navigator"),
|
||||
* error => console.log("Error launching navigator", error)
|
||||
* success => console.log('Launched navigator'),
|
||||
* error => console.log('Error launching navigator', error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@ -73,19 +90,109 @@ export class LaunchNavigator {
|
||||
|
||||
/**
|
||||
* Launches navigator app
|
||||
* @param destination Location name or coordinates
|
||||
* @param start Location name or coordinates
|
||||
* @param options
|
||||
* @param destination {string|number[]} Location name or coordinates (as string or array)
|
||||
* @param options {LaunchNavigatorOptions}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static navigate(
|
||||
destination: any,
|
||||
start: any = null,
|
||||
destination: string | number[],
|
||||
options?: LaunchNavigatorOptions
|
||||
): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Determines if the given app is installed and available on the current device.
|
||||
* @param app {string}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAppAvailable(app: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns a list indicating which apps are installed and available on the current device.
|
||||
*/
|
||||
@Cordova()
|
||||
static availableApps(): Promise<string[]> { return; }
|
||||
|
||||
/**
|
||||
* Returns the display name of the specified app.
|
||||
* @param app {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppDisplayName(app: string): string { return; }
|
||||
|
||||
/**
|
||||
* Returns list of supported apps on a given platform.
|
||||
* @param platform {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getAppsForPlatform(platform: string): string[] { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of transport mode.
|
||||
* @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS`
|
||||
* @param platform {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsTransportMode(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Returns the list of transport modes supported by an app on a given platform.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static getTransportModes(app: string, platform: string): string[] { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of launch mode.
|
||||
* Note that currently only Google Maps on Android does.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of start location.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static supportsStart(app: string, platform: string): boolean { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static supportsStartName(app: string, platform: string): boolean { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static supportsDestName(app: string, platform: string): boolean { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||
|
||||
static APP: any = {
|
||||
USER_SELECT: 'user_select',
|
||||
APPLE_MAPS: 'apple_maps',
|
||||
GOOGLE_MAPS: 'google_maps',
|
||||
WAZE: 'waze',
|
||||
CITYMAPPER: 'citymapper',
|
||||
NAVIGON: 'navigon',
|
||||
TRANSIT_APP: 'transit_app',
|
||||
YANDEX: 'yandex',
|
||||
UBER: 'uber',
|
||||
TOMTOM: 'tomtom',
|
||||
BING_MAPS: 'bing_maps',
|
||||
SYGIC: 'sygic',
|
||||
HERE_MAPS: 'here_maps',
|
||||
MOOVIT: 'moovit'
|
||||
};
|
||||
|
||||
static TRANSPORT_MODE: any = {
|
||||
DRIVING: 'driving',
|
||||
WALKING: 'walking',
|
||||
BICYCLING: 'bicycling',
|
||||
TRANSIT: 'transit'
|
||||
};
|
||||
}
|
||||
|
@ -1,20 +1,21 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Local Notifications
|
||||
* @description
|
||||
* This plugin allows you to display local notifications on the device
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { LocalNotifications } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Schedule a single notification
|
||||
* LocalNotifications.schedule({
|
||||
* id: 1,
|
||||
* text: "Single Notification",
|
||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
|
||||
* text: 'Single Notification',
|
||||
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
|
||||
* data: { secret: key }
|
||||
* });
|
||||
*
|
||||
@ -22,22 +23,22 @@ import {Plugin, Cordova} from './plugin';
|
||||
* // Schedule multiple notifications
|
||||
* LocalNotifications.schedule([{
|
||||
* id: 1,
|
||||
* text: "Multi Notification 1",
|
||||
* text: 'Multi Notification 1',
|
||||
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
|
||||
* data: { secret:key }
|
||||
* },{
|
||||
* id: 2,
|
||||
* title: "Local Notification Example",
|
||||
* text: "Multi Notification 2",
|
||||
* icon: "http://example.com/icon.png"
|
||||
* title: 'Local Notification Example',
|
||||
* text: 'Multi Notification 2',
|
||||
* icon: 'http://example.com/icon.png'
|
||||
* }]);
|
||||
*
|
||||
*
|
||||
* // Schedule delayed notification
|
||||
* LocalNotifications.schedule({
|
||||
* text: "Delayed Notification",
|
||||
* text: 'Delayed Notification',
|
||||
* at: new Date(new Date().getTime() + 3600),
|
||||
* led: "FF0000",
|
||||
* led: 'FF0000',
|
||||
* sound: null
|
||||
* });
|
||||
* ```
|
||||
|
221
src/plugins/media-capture.ts
Normal file
221
src/plugins/media-capture.ts
Normal file
@ -0,0 +1,221 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
/**
|
||||
* @name Media Capture
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MediaCapture } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let options: CaptureImageOptions = { limit: 3 };
|
||||
* MediaCapture.captureImage(options)
|
||||
* .then(
|
||||
* (data: MediaFile[]) => console.log(data),
|
||||
* (err: CaptureError) => console.error(err)
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-media-capture',
|
||||
pluginRef: 'navigator.device.capture',
|
||||
repo: 'https://github.com/apache/cordova-plugin-media-capture'
|
||||
})
|
||||
export class MediaCapture {
|
||||
/**
|
||||
* The audio recording formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedImageModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedImageModes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The recording image sizes and formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedAudioModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedAudioModes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The recording video resolutions and formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedVideoModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedVideoModes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the audio recorder application and return information about captured audio clip files.
|
||||
* @param options
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static captureAudio(options?: CaptureAudioOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||
|
||||
/**
|
||||
* Start the camera application and return information about captured image files.
|
||||
* @param options
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static captureImage(options?: CaptureImageOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||
|
||||
/**
|
||||
* Start the video recorder application and return information about captured video clip files.
|
||||
* @param options
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static captureVideo(options?: CaptureVideoOptions): Promise<MediaFile[] | CaptureError> { return; }
|
||||
|
||||
/**
|
||||
* is fired if the capture call is successful
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'pendingcaptureresult'
|
||||
})
|
||||
static onPendingCaptureResult(): Observable<MediaFile[]> { return; }
|
||||
|
||||
/**
|
||||
* is fired if the capture call is unsuccessful
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'pendingcaptureerror'
|
||||
})
|
||||
static onPendingCaptureError(): Observable<CaptureError> { return; }
|
||||
|
||||
}
|
||||
/**
|
||||
* Encapsulates properties of a media capture file.
|
||||
*/
|
||||
export interface MediaFile {
|
||||
/**
|
||||
* The name of the file, without path information.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The full path of the file, including the name.
|
||||
*/
|
||||
fullPath: string;
|
||||
/**
|
||||
* The file's mime type
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The date and time when the file was last modified.
|
||||
*/
|
||||
lastModifiedDate: Date;
|
||||
/**
|
||||
* The size of the file, in bytes.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* Retrieves the format information of the media file.
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
*/
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||
}
|
||||
/**
|
||||
* Encapsulates format information about a media file.
|
||||
*/
|
||||
export interface MediaFileData {
|
||||
/**
|
||||
* The actual format of the audio and video content.
|
||||
*/
|
||||
codecs: string;
|
||||
/**
|
||||
* The average bitrate of the content. The value is zero for images.
|
||||
*/
|
||||
bitrate: number;
|
||||
/**
|
||||
* The height of the image or video in pixels. The value is zero for audio clips.
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* The width of the image or video in pixels. The value is zero for audio clips.
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* The length of the video or sound clip in seconds. The value is zero for images.
|
||||
*/
|
||||
duration: number;
|
||||
}
|
||||
/**
|
||||
* Encapsulates the error code resulting from a failed media capture operation.
|
||||
*/
|
||||
export interface CaptureError {
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* Encapsulates audio capture configuration options.
|
||||
*/
|
||||
export interface CaptureAudioOptions {
|
||||
/**
|
||||
* Maximum number of audio clips. Defaults to 1.
|
||||
* On iOS you can only record one file.
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Maximum duration of an audio sound clip, in seconds. This does not work on Android devices.
|
||||
*/
|
||||
duration?: number;
|
||||
}
|
||||
/**
|
||||
* Encapsulates image capture configuration options.
|
||||
*/
|
||||
export interface CaptureImageOptions {
|
||||
/**
|
||||
* Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation.
|
||||
*/
|
||||
limit?: number;
|
||||
}
|
||||
/**
|
||||
* Encapsulates video capture configuration options.
|
||||
*/
|
||||
export interface CaptureVideoOptions {
|
||||
/**
|
||||
* Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation.
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Maximum duration per video clip. This will be ignored on BlackBerry.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* Quality of the video. This parameter can only be used with Android.
|
||||
*/
|
||||
quality?: number;
|
||||
}
|
||||
/**
|
||||
* Encapsulates a set of media capture parameters that a device supports.
|
||||
*/
|
||||
export interface ConfigurationData {
|
||||
/**
|
||||
* The ASCII-encoded lowercase string representing the media type.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The height of the image or video in pixels. The value is zero for sound clips.
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* The width of the image or video in pixels. The value is zero for sound clips.
|
||||
*/
|
||||
width: number;
|
||||
}
|
@ -1,26 +1,34 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var Media: any;
|
||||
|
||||
export interface MediaError {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MediaPlugin
|
||||
* @description
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { MediaPlugin } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
||||
* var file = new MediaPlugin("path/to/file.mp3");
|
||||
* var file = new MediaPlugin('path/to/file.mp3');
|
||||
*
|
||||
* // Catch the Success & Error Output
|
||||
* // Platform Quirks
|
||||
* // iOS calls success on completion of playback only
|
||||
* // Android calls success on completion of playback AND on release()
|
||||
* file.init.then(() => {
|
||||
* console.log("Playback Finished");
|
||||
* console.log('Playback Finished');
|
||||
* }, (err) => {
|
||||
* console.log("somthing went wrong! error code: "+err.code+" message: "+err.message);
|
||||
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
|
||||
* });
|
||||
*
|
||||
* // play the file
|
||||
@ -52,7 +60,7 @@ declare var Media: any;
|
||||
* file.release();
|
||||
*
|
||||
* // Recording to a file
|
||||
* var newFile = new MediaPlugin("path/to/file.mp3");
|
||||
* var newFile = new MediaPlugin('path/to/file.mp3');
|
||||
* newFile.startRecord();
|
||||
*
|
||||
* newFile.stopRecord();
|
||||
@ -75,6 +83,12 @@ export class MediaPlugin {
|
||||
static MEDIA_PAUSED: number = 3;
|
||||
static MEDIA_STOPPED: number = 4;
|
||||
|
||||
// error codes
|
||||
static MEDIA_ERR_ABORTED: number = 1;
|
||||
static MEDIA_ERR_NETWORK: number = 2;
|
||||
static MEDIA_ERR_DECODE: number = 3;
|
||||
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
|
||||
|
||||
// Properties
|
||||
private _objectInstance: any;
|
||||
status: Observable<any>;
|
||||
@ -185,15 +199,4 @@ export class MediaPlugin {
|
||||
})
|
||||
stop(): void { }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export class MediaError {
|
||||
static get MEDIA_ERR_ABORTED () {return 1; }
|
||||
static get MEDIA_ERR_NETWORK () {return 2; }
|
||||
static get MEDIA_ERR_DECODE () {return 3; }
|
||||
static get MEDIA_ERR_NONE_SUPPORTED () {return 4; }
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
91
src/plugins/native-audio.ts
Normal file
91
src/plugins/native-audio.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name NativeAudio
|
||||
* @description Native Audio Playback
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {NativeAudio} from 'ionic-native';
|
||||
*
|
||||
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
|
||||
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
|
||||
*
|
||||
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
|
||||
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
|
||||
*
|
||||
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
|
||||
*
|
||||
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
|
||||
*
|
||||
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-nativeaudio',
|
||||
pluginRef: 'plugins.NativeAudio',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
|
||||
})
|
||||
export class NativeAudio {
|
||||
/**
|
||||
* Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static preloadSimple(id: string, assetPath: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
|
||||
* @param volume {number} the volume of the preloaded sound (0.1 to 1.0)
|
||||
* @param voices {number} the number of multichannel voices available
|
||||
* @param delay {number}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Plays an audio asset
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param completeCallback {Function} callback to be invoked when audio is done playing
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static play(id: string, completeCallback: Function): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Stops playing an audio
|
||||
* @param id {string} unique ID for the audio file
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(id: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Loops an audio asset infinitely, this only works for complex assets
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static loop(id: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Unloads an audio file from memory
|
||||
* @param id {string} unique ID for the audio file
|
||||
*/
|
||||
@Cordova()
|
||||
static unload(id: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Changes the volume for preloaded complex assets.
|
||||
* @param id {string} unique ID for the audio file
|
||||
* @param volume {number} the volume of the audio asset (0.1 to 1.0)
|
||||
*/
|
||||
@Cordova()
|
||||
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
|
||||
|
||||
}
|
59
src/plugins/nativestorage.ts
Normal file
59
src/plugins/nativestorage.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name NativeStorage
|
||||
* @description Native storage of variables in Android and iOS
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { NativeStorage } from 'ionic-native';
|
||||
*
|
||||
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
|
||||
* .then(
|
||||
* () => console.log('Stored item!'),
|
||||
* error => console.error('Error storing item', error)
|
||||
* );
|
||||
*
|
||||
* NativeStorage.getItem('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.error(error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-nativestorage',
|
||||
pluginRef: 'NativeStorage',
|
||||
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
|
||||
})
|
||||
export class NativeStorage {
|
||||
/**
|
||||
* Stores a value
|
||||
* @param reference {string}
|
||||
* @param value
|
||||
*/
|
||||
@Cordova()
|
||||
static setItem(reference: string, value: any): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Gets a stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@Cordova()
|
||||
static getItem(reference: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Removes a single stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@Cordova()
|
||||
static remove(reference: string): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Removes all stored values.
|
||||
*/
|
||||
@Cordova()
|
||||
static clear(): Promise<any> {return; }
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
/**
|
||||
@ -9,12 +10,12 @@ declare var navigator: any;
|
||||
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Network } from 'ionic-native';
|
||||
*
|
||||
* // watch network for a disconnect
|
||||
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
|
||||
* console.log('network was disconnected :-( ')
|
||||
* console.log('network was disconnected :-(');
|
||||
* });
|
||||
*
|
||||
* // stop disconnect watch
|
||||
@ -23,7 +24,7 @@ declare var navigator: any;
|
||||
*
|
||||
* // watch network for a connection
|
||||
* let connectSubscription = Network.onConnect().subscribe(() => {
|
||||
* console.log('network connected!');
*
|
||||
* console.log('network connected!');
|
||||
* // We just got a connection but we need to wait briefly
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
* // prior to doing any api requests as well.
|
||||
@ -53,7 +54,7 @@ export class Network {
|
||||
* Return the network connection type
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get connection(): String { return navigator.connection.type; }
|
||||
static get connection(): string { return navigator.connection.type; }
|
||||
|
||||
/**
|
||||
* Get notified when the device goes offline
|
||||
|
@ -1,4 +1,6 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
* @name OneSignal
|
||||
@ -9,15 +11,14 @@ import {Plugin, Cordova} from './plugin';
|
||||
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { OneSignal } from 'ionic-native';
|
||||
*
|
||||
* let notificationOpenedCallback(jsonData: any) {
|
||||
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
|
||||
* {googleProjectNumber: '703322744261'})
|
||||
* .subscribe(jsonData => {
|
||||
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
|
||||
* };
|
||||
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
|
||||
* {googleProjectNumber: "703322744261"},
|
||||
* notificationOpenedCallback);
|
||||
* });
|
||||
*
|
||||
* OneSignal.enableInAppAlertNotification(true);
|
||||
* ```
|
||||
@ -26,8 +27,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'onesignal-cordova-plugin',
|
||||
pluginRef: 'plugins.OneSignal',
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
|
||||
})
|
||||
export class OneSignal {
|
||||
|
||||
@ -36,14 +36,14 @@ export class OneSignal {
|
||||
*
|
||||
* @param {appId} Your AppId from your OneSignal app
|
||||
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
||||
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
|
||||
* @returns {Observable} when a notification is received. Handle your notification action here.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ observable: true })
|
||||
static init(appId: string,
|
||||
options: {
|
||||
googleProjectNumber: string,
|
||||
autoRegister: boolean
|
||||
}): Promise<any> { return; }
|
||||
}): Observable<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@ -250,4 +250,5 @@ export class OneSignal {
|
||||
logLevel: number,
|
||||
visualLevel: number
|
||||
}): void { }
|
||||
|
||||
}
|
||||
|
28
src/plugins/photo-viewer.ts
Normal file
28
src/plugins/photo-viewer.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @name Photo Viewer
|
||||
* @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PhotoViewer } from 'ionic-native';
|
||||
*
|
||||
* PhotoViewer.show('https://mysite.com/path/to/image.jpg');
|
||||
*
|
||||
* PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'com-sarriaroman-photoviewer',
|
||||
pluginRef: 'PhotoViewer',
|
||||
repo: 'https://github.com/sarriaroman/photoviewer'
|
||||
})
|
||||
export class PhotoViewer {
|
||||
/**
|
||||
* Shows an image in full screen
|
||||
* @param url {string} URL or path to image
|
||||
* @param title {string}
|
||||
* @param options {any}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
static show(url: string, title?: string, options?: {share?: boolean; }): void { }
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Pin Dialog
|
||||
* @description
|
||||
@ -7,7 +9,6 @@ import {Plugin, Cordova} from './plugin';
|
||||
* ```typescript
|
||||
* import { PinDialog } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
|
||||
* .then(
|
||||
@ -34,4 +35,5 @@ export class PinDialog {
|
||||
successIndex: 1
|
||||
})
|
||||
static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { get } from '../util';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
declare var $q;
|
||||
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -22,8 +22,11 @@ export const getPlugin = function(pluginRef: string): any {
|
||||
*/
|
||||
export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
let pluginName = pluginObj.name, plugin = pluginObj.plugin;
|
||||
if (method) console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
else console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
} else {
|
||||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
|
||||
}
|
||||
console.warn('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\'');
|
||||
};
|
||||
|
||||
@ -33,8 +36,11 @@ export const pluginWarn = function(pluginObj: any, method: string) {
|
||||
* @param method
|
||||
*/
|
||||
export const cordovaWarn = function(pluginName: string, method: string) {
|
||||
if (method) console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
else console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
} else {
|
||||
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
|
||||
}
|
||||
};
|
||||
function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||
// If the plugin method expects myMethod(success, err, options)
|
||||
@ -42,10 +48,24 @@ function setIndex (args: any[], opts: any= {}, resolve?: Function, reject?: Func
|
||||
// Get those arguments in the order [resolve, reject, ...restOfArgs]
|
||||
args.unshift(reject);
|
||||
args.unshift(resolve);
|
||||
} else if (opts.callbackStyle === 'node') {
|
||||
args.push((err, result) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
// If we've specified a success/error index
|
||||
args.splice(opts.successIndex, 0, resolve);
|
||||
args.splice(opts.errorIndex, 0, reject);
|
||||
|
||||
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
|
||||
if (opts.errorIndex > args.length) {
|
||||
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
|
||||
} else {
|
||||
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
|
||||
}
|
||||
} else {
|
||||
// Otherwise, let's tack them on to the end of the argument list
|
||||
// which is 90% of cases
|
||||
@ -82,15 +102,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
}
|
||||
|
||||
function getPromise(cb) {
|
||||
if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else if (window.angular) {
|
||||
if (window.angular) {
|
||||
let $q = window.angular.injector(['ng']).get('$q');
|
||||
return $q((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
|
||||
}
|
||||
@ -112,6 +132,16 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any=
|
||||
return p;
|
||||
}
|
||||
|
||||
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
|
||||
return getPromise((resolve, reject) => {
|
||||
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
if (pluginResult && pluginResult.error) {
|
||||
reject(pluginResult.error);
|
||||
}
|
||||
pluginResult.then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return new Observable(observer => {
|
||||
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
@ -159,6 +189,11 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
|
||||
}
|
||||
};
|
||||
});
|
||||
} else if (opts.otherPromise) {
|
||||
return getPromise((resolve, reject) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
result.then(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
return getPromise((resolve, reject) => {
|
||||
callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
@ -174,9 +209,8 @@ function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
|
||||
*/
|
||||
function wrapEventObservable(event: string): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
let callback = (status: any) => observer.next(status);
|
||||
window.addEventListener(event, callback, false);
|
||||
return () => window.removeEventListener(event, callback, false);
|
||||
window.addEventListener(event, observer.next.bind(observer), false);
|
||||
return () => window.removeEventListener(event, observer.next.bind(observer), false);
|
||||
});
|
||||
}
|
||||
|
||||
@ -189,19 +223,18 @@ function wrapEventObservable (event: string): Observable<any> {
|
||||
*/
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
return (...args) => {
|
||||
|
||||
if (opts.sync)
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
return callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
|
||||
else if (opts.observable)
|
||||
} else if (opts.observable) {
|
||||
return wrapObservable(pluginObj, methodName, args, opts);
|
||||
|
||||
else if (opts.eventObservable && opts.event)
|
||||
} else if (opts.eventObservable && opts.event) {
|
||||
return wrapEventObservable(opts.event);
|
||||
|
||||
else
|
||||
} else if (opts.otherPromise) {
|
||||
return wrapOtherPromise(pluginObj, methodName, args, opts);
|
||||
} else {
|
||||
return wrapPromise(pluginObj, methodName, args, opts);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@ -211,7 +244,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {}
|
||||
* Class decorator specifying Plugin metadata. Required for all plugins.
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* @Plugin({
|
||||
* name: 'MyPlugin',
|
||||
* plugin: 'cordova-plugin-myplugin',
|
||||
|
@ -1,4 +1,6 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var cordova: any;
|
||||
|
||||
export interface PrintOptions {
|
||||
@ -38,8 +40,26 @@ export interface PrintOptions {
|
||||
*/
|
||||
bounds?: number[] | any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name Printer
|
||||
* @description Prints documents or HTML rendered content
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Printer, PrintOptions} from 'ionic-native';
|
||||
*
|
||||
* Printer.isAvailable().then(onSuccess, onError);
|
||||
*
|
||||
* let options: PrintOptions = {
|
||||
* name: 'MyDocument',
|
||||
* printerId: 'printer007',
|
||||
* duplex: true,
|
||||
* landscape: true,
|
||||
* grayscale: true
|
||||
* };
|
||||
*
|
||||
* Printer.print(content, options).then(onSuccess, onError);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'de.appplant.cordova.plugin.printer',
|
||||
pluginRef: 'cordova.plugins.printer',
|
||||
@ -61,4 +81,5 @@ export class Printer {
|
||||
*/
|
||||
@Cordova()
|
||||
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
|
||||
|
||||
@ -64,19 +65,19 @@ export interface PushNotification {
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
||||
on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||
/**
|
||||
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
||||
on(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||
/**
|
||||
* The event error will trigger when an internal error occurs and the cache is aborted.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event: "error", callback: (response: Error) => any): void;
|
||||
on(event: 'error', callback: (response: Error) => any): void;
|
||||
/**
|
||||
*
|
||||
* @param event Name of the event to listen to. See below(above) for all the event names.
|
||||
@ -86,9 +87,9 @@ export interface PushNotification {
|
||||
*/
|
||||
on(event: string, callback: (response: EventResponse) => any): void;
|
||||
|
||||
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
|
||||
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
|
||||
off(event: "error", callback: (response: Error) => any): void;
|
||||
off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
|
||||
off(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
|
||||
off(event: 'error', callback: (response: Error) => any): void;
|
||||
/**
|
||||
* As stated in the example, you will have to store your event handler if you are planning to remove it.
|
||||
* @param event Name of the event type. The possible event names are the same as for the push.on function.
|
||||
@ -278,11 +279,8 @@ declare var PushNotification: {
|
||||
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { Push } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@ -298,10 +296,10 @@ export class Push {
|
||||
* ```
|
||||
* var push = Push.init({
|
||||
* android: {
|
||||
* senderID: "12345679"
|
||||
* senderID: '12345679'
|
||||
* },
|
||||
* ios: {
|
||||
* alert: "true",
|
||||
* alert: 'true',
|
||||
* badge: true,
|
||||
* sound: 'false'
|
||||
* },
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name SafariViewController
|
||||
@ -7,11 +8,10 @@ import {Plugin, Cordova} from './plugin';
|
||||
* ```
|
||||
* import { SafariViewController } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* SafariViewController.isAvailable()
|
||||
* .then(
|
||||
* (available) => {
|
||||
* (available: boolean) => {
|
||||
* if(available){
|
||||
*
|
||||
* SafariViewController.show({
|
||||
@ -24,9 +24,9 @@ import {Plugin, Cordova} from './plugin';
|
||||
* })
|
||||
* .then(
|
||||
* (result: any) => {
|
||||
* if(result.event === 'opened') console.log("Opened");
|
||||
* else if(result.event === 'loaded') console.log("Loaded");
|
||||
* else if(result.event === 'closed') console.log("Closed");
|
||||
* if(result.event === 'opened') console.log('Opened');
|
||||
* else if(result.event === 'loaded') console.log('Loaded');
|
||||
* else if(result.event === 'closed') console.log('Closed');
|
||||
* },
|
||||
* (error: any) => console.error(error)
|
||||
* );
|
||||
@ -41,7 +41,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-safariviewcontroller',
|
||||
pluginRef: 'SafariViewController',
|
||||
platforms: ['iOS'],
|
||||
platforms: ['iOS', 'Android'],
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller'
|
||||
})
|
||||
export class SafariViewController {
|
||||
@ -56,17 +56,13 @@ export class SafariViewController {
|
||||
* Shows Safari View Controller
|
||||
* @param options
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
@Cordova()
|
||||
static show(options?: SafariViewControllerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Hides Safari View Controller
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
@Cordova()
|
||||
static hide(): void { }
|
||||
|
||||
/**
|
||||
@ -87,6 +83,7 @@ export class SafariViewController {
|
||||
*/
|
||||
@Cordova()
|
||||
static mayLaunchUrl(url: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface SafariViewControllerOptions {
|
||||
|
68
src/plugins/screen-orientation.ts
Normal file
68
src/plugins/screen-orientation.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Screen Orientation
|
||||
* @description
|
||||
* Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
|
||||
* This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ScreenOrientation } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // set to either landscape
|
||||
* ScreenOrientation.lockOrientation('landscape');
|
||||
*
|
||||
* // allow user rotate
|
||||
* ScreenOrientation.unlockOrientation();
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
*
|
||||
* Accepted orientation values:
|
||||
*
|
||||
* | Value | Description |
|
||||
* |-------------------------------|------------------------------------------------------------------------------|
|
||||
* | portrait-primary | The orientation is in the primary portrait mode. |
|
||||
* | portrait-secondary | The orientation is in the secondary portrait mode. |
|
||||
* | landscape-primary | The orientation is in the primary landscape mode. |
|
||||
* | landscape-secondary | The orientation is in the secondary landscape mode. |
|
||||
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
|
||||
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-screen-orientation',
|
||||
pluginRef: 'window.screen',
|
||||
repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
export class ScreenOrientation {
|
||||
|
||||
/**
|
||||
* Lock the orientation to the passed value.
|
||||
* See below for accepted values
|
||||
* @param {orientation} The orientation which should be locked. Accepted values see table below.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static lockOrientation(orientation: string): void { }
|
||||
|
||||
/**
|
||||
* Unlock and allow all orientations.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static unlockOrientation(): void { }
|
||||
|
||||
/*
|
||||
* Get the current orientation of the device.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get orientation() {
|
||||
return window.screen.orientation;
|
||||
}
|
||||
}
|
@ -1,5 +1,21 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
import { Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
/**
|
||||
* @name Screenshot
|
||||
* @description Captures a screen shot
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Screenshot} from 'ionic-native';
|
||||
*
|
||||
* // Take a screenshot and save to file
|
||||
* Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
|
||||
*
|
||||
* // Take a screenshot and get temporary file URI
|
||||
* Screenshot.URI(80).then(onSuccess, onError);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
|
||||
pluginRef: 'navigator.screenshot',
|
||||
|
90
src/plugins/securestorage.ts
Normal file
90
src/plugins/securestorage.ts
Normal file
@ -0,0 +1,90 @@
|
||||
import { CordovaInstance, Plugin } from './plugin';
|
||||
declare var cordova: any;
|
||||
/**
|
||||
* @name Secure Storage
|
||||
* @description
|
||||
* This plugin gets, sets and removes key,value pairs from a device's secure storage.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage).
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SecureStorage } from 'ionic-native';
|
||||
*
|
||||
* let secureStorage: SecureStorage = new SecureStorage();
|
||||
* secureStorage.create('my_store_name')
|
||||
* .then(
|
||||
* () => console.log('Storage is ready!'),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.get('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.set('myitem', 'myvalue')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
*
|
||||
* secureStorage.remove('myitem')
|
||||
* .then(
|
||||
* data => console.log(data),
|
||||
* error => console.log(error)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-secure-storage',
|
||||
pluginRef: 'plugins.securestorage',
|
||||
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||
})
|
||||
export class SecureStorage {
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Creates a namespaced storage.
|
||||
* @param store {string}
|
||||
*/
|
||||
create(store: string): Promise<any> {
|
||||
return new Promise((res, rej) => {
|
||||
this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
get(reference: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stores a value
|
||||
* @param reference {string}
|
||||
* @param value {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
set(reference: string, value: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Removes a single stored item
|
||||
* @param reference {string}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
remove(reference: string): Promise<any> { return; }
|
||||
}
|
35
src/plugins/shake.ts
Normal file
35
src/plugins/shake.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
/**
|
||||
* @name Shake
|
||||
* @description Handles shake gesture
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import {Shake} from 'ionic-native';
|
||||
*
|
||||
* let watch = Shake.startWatch(60).subscribe(() => {
|
||||
* // do something
|
||||
* });
|
||||
*
|
||||
* watch.unsubscribe();
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-shake',
|
||||
pluginRef: 'shake',
|
||||
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
|
||||
})
|
||||
export class Shake {
|
||||
/**
|
||||
* Watch for shake gesture
|
||||
* @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopWatch',
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startWatch(sensitivity?: number): Observable<any> {return; }
|
||||
|
||||
}
|
36
src/plugins/sim.ts
Normal file
36
src/plugins/sim.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Sim
|
||||
* @description
|
||||
* Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Sim } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* Sim.getSimInfo().then(
|
||||
* (info) => console.log('Sim info: ', info),
|
||||
* (err) => console.log('Unable to get sim info: ', err)
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-sim',
|
||||
pluginRef: 'plugins.sim',
|
||||
repo: 'https://github.com/pbakondy/cordova-plugin-sim',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
export class Sim {
|
||||
/**
|
||||
* Returns info from the SIM card.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@Cordova()
|
||||
static getSimInfo(): Promise<any> { return; }
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* Options for sending an SMS
|
||||
@ -30,14 +31,12 @@ export interface SmsOptionsAndroid {
|
||||
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { SMS } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* SMS.send('416123456', 'Hello world!');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
@ -1,35 +1,45 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Social Sharing
|
||||
* @description
|
||||
* Share text, files, images, and links via social networks, sms, and email.
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { SocialSharing } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
* // TODO add usage info
|
||||
* // Check if sharing via email is supported
|
||||
* SocialSharing.canShareViaEmail().then(() => {
|
||||
* // Sharing via email is possible
|
||||
* }).catch(() => {
|
||||
* // Sharing via email is not possible
|
||||
* });
|
||||
*
|
||||
* // Share via email
|
||||
* SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
|
||||
* // Success!
|
||||
* }).catch(() => {
|
||||
* // Error!
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-x-socialsharing',
|
||||
pluginRef: 'window.plugins.socialsharing',
|
||||
pluginRef: 'plugins.socialsharing',
|
||||
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
|
||||
platforms: ['iOS', 'Android', 'Windows Phone']
|
||||
})
|
||||
export class SocialSharing {
|
||||
|
||||
|
||||
/**
|
||||
* Shares using the share sheet
|
||||
* @param message {string} The message you would like to share.
|
||||
* @param subject {string} The subject
|
||||
* @param file {string|Array<string>} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
|
||||
* @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
|
||||
* @param url {string} A URL to share
|
||||
*/
|
||||
@Cordova()
|
||||
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): Promise<any> {return; }
|
||||
static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
|
||||
@ -38,7 +48,7 @@ export class SocialSharing {
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareWithOptions (options: { message?: string, subject?: string, file?: string|Array<string>, url?: string, chooserTitle?: string }): Promise<any> {return; }
|
||||
static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if you can share via a specific app.
|
||||
@ -128,18 +138,25 @@ export class SocialSharing {
|
||||
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Share via Email
|
||||
* @param message {string}
|
||||
* @param subject {string}
|
||||
* @param to {Array<string>}
|
||||
* @param cc {Array<string>}
|
||||
* @param bcc {Array<string>}
|
||||
* @param files {string|Array<string>} URL or local path to file(s) to attach
|
||||
* Checks if you can share via email
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareViaEmail(message: string, subject: string, to: Array<string>, cc: Array<string>, bcc: Array<string>, files: string|Array<string>): Promise<any> {return; }
|
||||
static canShareViaEmail(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Share via Email
|
||||
* @param message {string}
|
||||
* @param subject {string}
|
||||
* @param to {string[]}
|
||||
* @param cc {string[]}
|
||||
* @param bcc {string[]}
|
||||
* @param files {string|string[]} URL or local path to file(s) to attach
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Spinner Dialog
|
||||
* @description
|
||||
* @usage
|
||||
* ```js
|
||||
* ```typescript
|
||||
* import { SpinnerDialog } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* SpinnerDialog.show();
|
||||
*
|
||||
* SpinnerDialog.hide();
|
||||
@ -22,7 +22,6 @@ import {Plugin, Cordova} from './plugin';
|
||||
})
|
||||
export class SpinnerDialog {
|
||||
|
||||
|
||||
/**
|
||||
* Shows the spinner dialog
|
||||
* @param title {string} Spinner title (shows on Android only)
|
||||
|
@ -1,14 +1,14 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Splashscreen
|
||||
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Splashscreen } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Splashscreen.show();
|
||||
*
|
||||
* Splashscreen.hide();
|
||||
|
@ -1,5 +1,8 @@
|
||||
import {CordovaInstance, Plugin, Cordova} from './plugin';
|
||||
import { Cordova, CordovaInstance, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var sqlitePlugin;
|
||||
|
||||
/**
|
||||
* @name SQLite
|
||||
*
|
||||
@ -8,21 +11,21 @@ declare var sqlitePlugin;
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* console.error('Unable to execute sql: ', err);
|
||||
* });
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* console.error('Unable to open database: ', err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
@ -49,11 +52,11 @@ export class SQLite {
|
||||
* @param config the config for opening the database.
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
@ -109,7 +112,7 @@ export class SQLite {
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||
* // Access the items through resultSet.rows
|
||||
* // resultSet.rows.item(i)
|
||||
@ -120,7 +123,7 @@ export class SQLite {
|
||||
executeSql(statement: string, params: any): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
addSatement (sql, values): Promise<any> {return; }
|
||||
addStatement(sql, values): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
sqlBatch(sqlStatements: any): Promise<any> { return; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova, CordovaProperty} from './plugin';
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
@ -10,12 +11,11 @@ declare var window;
|
||||
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { StatusBar } from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* StatuBar.overlaysWebView(true); // let status var overlay webview
|
||||
* StatusBar.overlaysWebView(true); // let status var overlay webview
|
||||
*
|
||||
* StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
|
||||
* ```
|
||||
@ -117,4 +117,5 @@ export class StatusBar {
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get isVisible() { return window.StatusBar.isVisible; }
|
||||
|
||||
}
|
||||
|
47
src/plugins/text-to-speech.ts
Normal file
47
src/plugins/text-to-speech.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
export interface TTSOptions {
|
||||
/** text to speak */
|
||||
text: string;
|
||||
/** a string like 'en-US', 'zh-CN', etc */
|
||||
locale?: string;
|
||||
/** speed rate, 0 ~ 1 */
|
||||
rate?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name TTS
|
||||
* @description
|
||||
* Text to Speech plugin
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {TTS} from 'ionic-native';
|
||||
*
|
||||
* TTS.speak('Hello World')
|
||||
* .then(() => console.log('Success'))
|
||||
* .catch((reason: any) => console.log(reason));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-tts',
|
||||
pluginRef: 'TTS',
|
||||
repo: 'https://github.com/vilic/cordova-plugin-tts'
|
||||
})
|
||||
export class TextToSpeech {
|
||||
|
||||
/**
|
||||
* This function speaks
|
||||
* @param options {string | TTSOptions} Text to speak or TTSOptions
|
||||
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static speak(options: string | TTSOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
export interface ToastOptions {
|
||||
/**
|
||||
* Message to display
|
||||
@ -42,12 +43,11 @@ export interface ToastOptions {
|
||||
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
|
||||
*
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Toast } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* Toast.show("I'm a toast", "5000", "center").subscribe(
|
||||
* Toast.show("I'm a toast", '5000', 'center').subscribe(
|
||||
* toast => {
|
||||
* console.log(toast);
|
||||
* }
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name TouchID
|
||||
@ -7,6 +8,29 @@ import {Plugin, Cordova} from './plugin';
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
||||
*
|
||||
* @usage
|
||||
* ### Import Touch ID Plugin into Project
|
||||
* ```typescript
|
||||
* import { TouchID } from 'ionic-native';
|
||||
* ```
|
||||
* ### Check for Touch ID Availability
|
||||
* ```typescript
|
||||
* TouchID.isAvailable()
|
||||
* .then(
|
||||
* res => console.log('TouchID is available!'),
|
||||
* err => console.error('TouchID is not available', err)
|
||||
* );
|
||||
* ```
|
||||
* ### Invoke Touch ID w/ Custom Message
|
||||
*
|
||||
* ```typescript
|
||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||
* .then(
|
||||
* res => console.log('Ok', res),
|
||||
* err => console.error('Error', err)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ### Error Codes
|
||||
*
|
||||
* The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
|
||||
@ -19,25 +43,6 @@ import {Plugin, Cordova} from './plugin';
|
||||
* - `-4` - The scan was cancelled by the system (Home button for example)
|
||||
* - `-6` - TouchID is not Available
|
||||
* - `-8` - TouchID is locked out from too many tries
|
||||
* @usage
|
||||
* ```js
|
||||
* import {TouchID} from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* TouchID.isAvailable()
|
||||
* .then(
|
||||
* res => console.log("TouchID is available!"),
|
||||
* err => console.error("TouchID isn't available", err)
|
||||
* );
|
||||
*
|
||||
* TouchID.verifyFingerprint('Scan your fingerprint please')
|
||||
* .then(
|
||||
* res => console.log("Ok", res),
|
||||
* err => console.error("Error", err)
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-touch-id',
|
||||
@ -48,7 +53,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
export class TouchID {
|
||||
|
||||
/**
|
||||
* Whether TouchID is available or not.
|
||||
* Checks Whether TouchID is available or not.
|
||||
*
|
||||
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
|
||||
*/
|
||||
@ -82,4 +87,5 @@ export class TouchID {
|
||||
*/
|
||||
@Cordova()
|
||||
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
73
src/plugins/twitter-connect.ts
Normal file
73
src/plugins/twitter-connect.ts
Normal file
@ -0,0 +1,73 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Twitter Connect
|
||||
* @description
|
||||
* Plugin to use Twitter Single Sign On
|
||||
* Uses Twitter's Fabric SDK
|
||||
* ```typescript
|
||||
* import {TwitterConnect} from 'ionic-native';
|
||||
*
|
||||
* function onSuccess(response) {
|
||||
* console.log(response);
|
||||
*
|
||||
* // Will console log something like:
|
||||
* // {
|
||||
* // userName: 'myuser',
|
||||
* // userId: '12358102',
|
||||
* // secret: 'tokenSecret'
|
||||
* // token: 'accessTokenHere'
|
||||
* // }
|
||||
* }
|
||||
*
|
||||
* TwitterConnect.login().then(onSuccess, onError);
|
||||
*
|
||||
* TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'twitter-connect-plugin',
|
||||
pluginRef: 'TwitterConnect',
|
||||
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
|
||||
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
|
||||
})
|
||||
export class TwitterConnect {
|
||||
/**
|
||||
* Logs in
|
||||
* @return {Promise<TwitterConnectResponse>} returns a promise that resolves if logged in and rejects if failed to login
|
||||
*/
|
||||
@Cordova()
|
||||
static login(): Promise<TwitterConnectResponse> {return; }
|
||||
/**
|
||||
* Logs out
|
||||
* @return {Promise<any>} returns a promise that resolves if logged out and rejects if failed to logout
|
||||
*/
|
||||
@Cordova()
|
||||
static logout(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Returns user's profile information
|
||||
* @return {Promise<any>} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails
|
||||
*/
|
||||
@Cordova()
|
||||
static showUser(): Promise<any> {return; }
|
||||
}
|
||||
export interface TwitterConnectResponse {
|
||||
/**
|
||||
* Twitter Username
|
||||
*/
|
||||
userName: string;
|
||||
/**
|
||||
* Twitter User ID
|
||||
*/
|
||||
userId: string;
|
||||
/**
|
||||
* Twitter OAuth Secret
|
||||
*/
|
||||
secret: string;
|
||||
/**
|
||||
* Twitter OAuth Token
|
||||
*/
|
||||
token: string;
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Vibration
|
||||
* @description Vibrates the device
|
||||
* @usage
|
||||
* ```ts
|
||||
* ```typescript
|
||||
* import { Vibration } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Vibrate the device for a second
|
||||
* // Duration is ignored on iOS.
|
||||
* Vibration.vibrate(1000);
|
||||
*
|
||||
* // Vibrate 2 seconds
|
||||
|
200
src/plugins/video-editor.ts
Normal file
200
src/plugins/video-editor.ts
Normal file
@ -0,0 +1,200 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
export interface TranscodeOptions {
|
||||
|
||||
/** The path to the video on the device. */
|
||||
fileUri: string;
|
||||
|
||||
/** The file name for the transcoded video */
|
||||
outputFileName: string;
|
||||
|
||||
/** Instructions on how to encode the video. Android is always mp4 */
|
||||
outputFileType?: number;
|
||||
|
||||
/** Should the video be processed with quailty or speed in mind. iOS only */
|
||||
optimizeForNetworkUse?: number;
|
||||
|
||||
/** Save the new video the library. Not supported in windows. Defaults to true */
|
||||
saveToLibrary?: boolean;
|
||||
|
||||
/** Delete the original video. Android only. Defaults to false */
|
||||
deleteInputFile?: boolean;
|
||||
|
||||
/** iOS only. Defaults to true */
|
||||
maintainAspectRatio?: boolean;
|
||||
|
||||
/** Width of the result */
|
||||
width?: number;
|
||||
|
||||
/** Height of the result */
|
||||
height?: number;
|
||||
|
||||
/** Bitrate in bits. Defaults to 1 megabit (1000000). */
|
||||
videoBitrate?: number;
|
||||
|
||||
/** Frames per second of the result. Android only. Defaults to 24. */
|
||||
fps?: number;
|
||||
|
||||
/** Number of audio channels. iOS only. Defaults to 2. */
|
||||
audioChannels?: number;
|
||||
|
||||
/** Sample rate for the audio. iOS only. Defaults to 44100*/
|
||||
audioSampleRate?: number;
|
||||
|
||||
/** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */
|
||||
audioBitrate?: number;
|
||||
|
||||
/** Not supported in windows, progress on the transcode. info will be a number from 0 to 100 */
|
||||
progress?: (info: number) => void;
|
||||
}
|
||||
|
||||
export interface TrimOptions {
|
||||
|
||||
/** Path to input video. */
|
||||
fileUri: string;
|
||||
|
||||
/** Time to start trimming in seconds */
|
||||
trimStart: number;
|
||||
|
||||
/** Time to end trimming in seconds */
|
||||
trimEnd: number;
|
||||
|
||||
/** Output file name */
|
||||
outputFileName: string;
|
||||
|
||||
/** Progress on transcode. info will be a number from 0 to 100 */
|
||||
progress?: (info: any) => void;
|
||||
|
||||
}
|
||||
|
||||
export interface CreateThumbnailOptions {
|
||||
|
||||
/** The path to the video on the device */
|
||||
fileUri: string;
|
||||
|
||||
/** The file name for the JPEG image */
|
||||
outputFileName: string;
|
||||
|
||||
/** Location in the video to create the thumbnail (in seconds) */
|
||||
atTime?: number;
|
||||
|
||||
/** Width of the thumbnail. */
|
||||
width?: number;
|
||||
|
||||
/** Height of the thumbnail. */
|
||||
height?: number;
|
||||
|
||||
/** Quality of the thumbnail (between 1 and 100). */
|
||||
quality?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface GetVideoInfoOptions {
|
||||
|
||||
/** The path to the video on the device. */
|
||||
fileUri: string;
|
||||
|
||||
}
|
||||
|
||||
export interface VideoInfo {
|
||||
|
||||
/** Width of the video in pixels. */
|
||||
width: number;
|
||||
|
||||
/** Height of the video in pixels. */
|
||||
height: number;
|
||||
|
||||
/** Orientation of the video. Will be either portrait or landscape. */
|
||||
orientation: 'portrait' | 'landscape';
|
||||
|
||||
/** Duration of the video in seconds. */
|
||||
duration: number;
|
||||
|
||||
/** Size of the video in bytes. */
|
||||
size: number;
|
||||
|
||||
/** Bitrate of the video in bits per second. */
|
||||
bitrate: number;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name VideoEditor
|
||||
* @description Edit videos using native device APIs
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {VideoEditor} from 'ionic-native';
|
||||
*
|
||||
* VideoEditor.transcodeVideo({
|
||||
* fileUri: '/path/to/input.mov',
|
||||
* outputFileName: 'output.mp4',
|
||||
* outputFileType: VideoEditor.OutputFileType.MPEG4
|
||||
* })
|
||||
* .then((fileUri: string) => console.log('video transcode success', fileUri))
|
||||
* .catch((error: any) => console.log('video transcode error', error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-video-editor',
|
||||
pluginRef: 'VideoEditor',
|
||||
repo: 'https://github.com/jbavari/cordova-plugin-video-editor',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
export class VideoEditor {
|
||||
|
||||
static OptimizeForNetworkUse = {
|
||||
NO: 0,
|
||||
YES: 1
|
||||
};
|
||||
|
||||
static OutputFileType = {
|
||||
M4V: 0,
|
||||
MPEG4: 1,
|
||||
M4A: 2,
|
||||
QUICK_TIME: 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Transcode a video
|
||||
* @param options {TranscodeOptions} Options
|
||||
* @return {Promise<string>} Returns a promise that resolves to the path of the transcoded video
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static transcodeVideo(options: TranscodeOptions): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Trim a video
|
||||
* @param options {TrimOptions} Options
|
||||
* @return {Promise<string>} Returns a promise that resolves to the path of the trimmed video
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static trim(options: TrimOptions): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Create a JPEG thumbnail from a video
|
||||
* @param options {CreateThumbnailOptions} Options
|
||||
* @return {Promise<string>} Returns a promise that resolves to the path to the jpeg image on the device
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static createThumbnail(options: CreateThumbnailOptions): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Get info on a video (width, height, orientation, duration, size, & bitrate)
|
||||
* @param options {GetVideoInfoOptions} Options
|
||||
* @return {Promise<VideoInfo>} Returns a promise that resolves to an object containing info on the video
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getVideoInfo(options: GetVideoInfoOptions): Promise<VideoInfo> { return; }
|
||||
|
||||
}
|
62
src/plugins/video-player.ts
Normal file
62
src/plugins/video-player.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
/**
|
||||
* Options for the video playback using the `play` function.
|
||||
*/
|
||||
export interface VideoOptions {
|
||||
/**
|
||||
* Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%.
|
||||
* For example: for a volume of 30% set the value to 0.3.
|
||||
*/
|
||||
volume?: number;
|
||||
/**
|
||||
* There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
|
||||
* These strings are the only ones which can be passed as option.
|
||||
*/
|
||||
scalingMode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name VideoPlayer
|
||||
* @description
|
||||
* A Codova plugin that simply allows you to immediately play a video in fullscreen mode.
|
||||
*
|
||||
* Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { VideoPlayer } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Playing a video.
|
||||
* VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
|
||||
* console.log('video completed');
|
||||
* }).catch(err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-videoplayer',
|
||||
pluginRef: 'VideoPlayer',
|
||||
repo: 'https://github.com/moust/cordova-plugin-videoplayer',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class VideoPlayer {
|
||||
|
||||
/**
|
||||
* Plays the video from the passed url.
|
||||
* @param fileUrl {string} File url to the video.
|
||||
* @param options {VideoOptions?} Optional video playback settings. See options above.
|
||||
* @returns {Promise<any>} Resolves promise when the video was played successfully.
|
||||
*/
|
||||
@Cordova()
|
||||
static play(fileUrl: string, options?: VideoOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stops the video playback immediatly.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static close(): void { }
|
||||
}
|
@ -1,10 +1,20 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name WebIntent
|
||||
* @description
|
||||
* @usage
|
||||
* For usage information please refer to the plugin's Github repo.
|
||||
*
|
||||
* ```typescript
|
||||
* import {WebIntent} from 'ionic-native';
|
||||
*
|
||||
* WebIntent.startActivity(options).then(onSuccess, onError);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'https://github.com/Initsogar/cordova-webintent.git',
|
||||
|
39
src/plugins/zip.ts
Normal file
39
src/plugins/zip.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Zip
|
||||
* @description
|
||||
* A Cordova plugin to unzip files in Android and iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import {Zip} from 'ionic-native';
|
||||
*
|
||||
* Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
|
||||
* .then((result) => {
|
||||
* if(result === 0) console.log('SUCCESS');
|
||||
* if(result === -1) console.log('FAILED');
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-zip',
|
||||
pluginRef: 'zip',
|
||||
repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
|
||||
})
|
||||
export class Zip {
|
||||
/**
|
||||
* Extracts files from a ZIP archive
|
||||
* @param sourceZip {string} Source ZIP file
|
||||
* @param destUrl {string} Destination folder
|
||||
* @param onProgress {Function} optional callback to be called on progress update
|
||||
* @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 4
|
||||
})
|
||||
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
|
||||
|
||||
}
|
61
tslint.json
61
tslint.json
@ -1,62 +1,3 @@
|
||||
{
|
||||
"rulesDirectory": "node_modules/tslint-eslint-rules/dist/rules",
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"no-duplicate-variable": true,
|
||||
"no-eval": true,
|
||||
"no-internal-module": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-var-keyword": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"ban-keywords"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-inner-declarations": [
|
||||
true,
|
||||
"functions"
|
||||
]
|
||||
}
|
||||
"extends": "tslint-ionic-rules"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user