mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c3bb41387 | ||
|
|
a9f6cd42e4 | ||
|
|
8cd648db5c | ||
|
|
f3407e5582 | ||
|
|
d845519361 | ||
|
|
26db2cfcf9 | ||
|
|
d0c0413140 | ||
|
|
234165c294 | ||
|
|
9bf4ee3fac | ||
|
|
f8df8769c9 | ||
|
|
510cea67b7 | ||
|
|
55d6d11721 | ||
|
|
97ba9b4fe1 | ||
|
|
96369db3a9 | ||
|
|
961cff185d | ||
|
|
9a733c3b4a | ||
|
|
95ac7e1855 | ||
|
|
6683aa450c | ||
|
|
d0cb3049e5 | ||
|
|
8036d6392d | ||
|
|
8602fde936 | ||
|
|
0f8c3ce376 | ||
|
|
5880491c0e | ||
|
|
62c7a60aee | ||
|
|
6fdeeaf6f2 | ||
|
|
16ff420bfa | ||
|
|
0009cbf3a0 | ||
|
|
74971feb98 | ||
|
|
683b808f27 | ||
|
|
f11be169b0 | ||
|
|
3a4dc73229 | ||
|
|
b851de9cc8 | ||
|
|
b8c8a1aa8d | ||
|
|
8f1e729f0e | ||
|
|
b4583271b8 | ||
|
|
50c03b2a49 | ||
|
|
27fdce7af2 | ||
|
|
3500d80b9c | ||
|
|
f599b0418d | ||
|
|
384dfc263d | ||
|
|
12280dda2b | ||
|
|
5d091d21fb | ||
|
|
b83c1bf767 | ||
|
|
6ebd2703ee | ||
|
|
3dfea7d02d | ||
|
|
44b7e301b5 | ||
|
|
906401b236 | ||
|
|
ffdbab7b26 | ||
|
|
5144345c9e | ||
|
|
47f48bae8d | ||
|
|
754c5ecbcb | ||
|
|
86097b0ce6 | ||
|
|
d46067764b |
110
CHANGELOG.md
110
CHANGELOG.md
@@ -1,3 +1,111 @@
|
||||
<a name="2.9.0"></a>
|
||||
# [2.9.0](https://github.com/driftyco/ionic-native/compare/v2.8.1...v2.9.0) (2017-03-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **background-geolocation:** configure returns an observable ([961cff1](https://github.com/driftyco/ionic-native/commit/961cff1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-mode:** added moveToBackground and moveToForeground ([#1181](https://github.com/driftyco/ionic-native/issues/1181)) ([95ac7e1](https://github.com/driftyco/ionic-native/commit/95ac7e1))
|
||||
|
||||
|
||||
|
||||
<a name="2.8.1"></a>
|
||||
## [2.8.1](https://github.com/driftyco/ionic-native/compare/v2.8.0...v2.8.1) (2017-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bluetooth-serial:** add missing disconnect method ([74971fe](https://github.com/driftyco/ionic-native/commit/74971fe)), closes [#1151](https://github.com/driftyco/ionic-native/issues/1151)
|
||||
* **fingerprint-aio:** add useBackup property ([#1158](https://github.com/driftyco/ionic-native/issues/1158)) ([6fdeeaf](https://github.com/driftyco/ionic-native/commit/6fdeeaf))
|
||||
* **health:** fix return type ([0f8c3ce](https://github.com/driftyco/ionic-native/commit/0f8c3ce))
|
||||
* **paypal:** sku param is optional ([#1161](https://github.com/driftyco/ionic-native/issues/1161)) ([62c7a60](https://github.com/driftyco/ionic-native/commit/62c7a60))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **firebase:** add new setScreenName method ([0009cbf](https://github.com/driftyco/ionic-native/commit/0009cbf)), closes [#1149](https://github.com/driftyco/ionic-native/issues/1149)
|
||||
|
||||
|
||||
|
||||
<a name="2.8.0"></a>
|
||||
# [2.8.0](https://github.com/driftyco/ionic-native/compare/v2.7.0...v2.8.0) (2017-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file:** fix return types ([b458327](https://github.com/driftyco/ionic-native/commit/b458327)), closes [#1139](https://github.com/driftyco/ionic-native/issues/1139)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **app-preferences:** added cordova-plugin-app-preferences support ([#1084](https://github.com/driftyco/ionic-native/issues/1084)) ([12280dd](https://github.com/driftyco/ionic-native/commit/12280dd))
|
||||
* **health:** add wrapper for cordova-plugin-health ([#1039](https://github.com/driftyco/ionic-native/issues/1039)) ([3500d80](https://github.com/driftyco/ionic-native/commit/3500d80))
|
||||
* **photo-library:** added cordova-plugin-photo-library ([#1102](https://github.com/driftyco/ionic-native/issues/1102)) ([384dfc2](https://github.com/driftyco/ionic-native/commit/384dfc2))
|
||||
|
||||
|
||||
|
||||
<a name="2.7.0"></a>
|
||||
# [2.7.0](https://github.com/driftyco/ionic-native/compare/v2.6.0...v2.7.0) (2017-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** dont check if method exists when overriding ([754c5ec](https://github.com/driftyco/ionic-native/commit/754c5ec)), closes [#1043](https://github.com/driftyco/ionic-native/issues/1043)
|
||||
* **file:** fix writeExistingFile ([47f48ba](https://github.com/driftyco/ionic-native/commit/47f48ba)), closes [#1044](https://github.com/driftyco/ionic-native/issues/1044)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-mode:** add missing functions ([906401b](https://github.com/driftyco/ionic-native/commit/906401b)), closes [#1078](https://github.com/driftyco/ionic-native/issues/1078)
|
||||
* **background-mode:** replace event listeners with on method ([ffdbab7](https://github.com/driftyco/ionic-native/commit/ffdbab7))
|
||||
* **diagnostic:** add new methods ([5144345](https://github.com/driftyco/ionic-native/commit/5144345)), closes [#1045](https://github.com/driftyco/ionic-native/issues/1045)
|
||||
|
||||
|
||||
|
||||
<a name="2.6.0"></a>
|
||||
# [2.6.0](https://github.com/driftyco/ionic-native/compare/v2.5.1...v2.6.0) (2017-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **apprate:** add missing Windows Store option ([#1072](https://github.com/driftyco/ionic-native/issues/1072)) ([439ccee](https://github.com/driftyco/ionic-native/commit/439ccee))
|
||||
* **background-geolocation:** configure returns a promise ([fc87992](https://github.com/driftyco/ionic-native/commit/fc87992)), closes [#1118](https://github.com/driftyco/ionic-native/issues/1118)
|
||||
* **contacts:** allow passing asterisk as contact field type ([9c5b593](https://github.com/driftyco/ionic-native/commit/9c5b593)), closes [#1093](https://github.com/driftyco/ionic-native/issues/1093)
|
||||
* **contacts:** allow passing asterisk as contact field type ([2639486](https://github.com/driftyco/ionic-native/commit/2639486))
|
||||
* **facebook:** fixes issue when not supplying default params ([#1088](https://github.com/driftyco/ionic-native/issues/1088)) ([85a3a40](https://github.com/driftyco/ionic-native/commit/85a3a40))
|
||||
* **file:** add missing exports ([#1101](https://github.com/driftyco/ionic-native/issues/1101)) ([23b97f6](https://github.com/driftyco/ionic-native/commit/23b97f6))
|
||||
* **file:** platform Browser will raise a an DOMException ([#1082](https://github.com/driftyco/ionic-native/issues/1082)) ([2fba915](https://github.com/driftyco/ionic-native/commit/2fba915))
|
||||
* **file:** remove FileError from return type ([#1086](https://github.com/driftyco/ionic-native/issues/1086)) ([c1748bb](https://github.com/driftyco/ionic-native/commit/c1748bb))
|
||||
* **imagepicker:** add outputType option ([#1098](https://github.com/driftyco/ionic-native/issues/1098)) ([b4b7cfa](https://github.com/driftyco/ionic-native/commit/b4b7cfa))
|
||||
* **media:** add missing pauseRecord and resumeRecord methods ([#1122](https://github.com/driftyco/ionic-native/issues/1122)) ([234ed6e](https://github.com/driftyco/ionic-native/commit/234ed6e))
|
||||
* **plugin:** revert changes to support stable version ([#1116](https://github.com/driftyco/ionic-native/issues/1116)) ([104532e](https://github.com/driftyco/ionic-native/commit/104532e)), closes [#1001](https://github.com/driftyco/ionic-native/issues/1001)
|
||||
* **push:** add the missing option clearBadge ([#1087](https://github.com/driftyco/ionic-native/issues/1087)) ([70847d1](https://github.com/driftyco/ionic-native/commit/70847d1))
|
||||
* **serial:** Serial.requestPermission() options are optional ([#1128](https://github.com/driftyco/ionic-native/issues/1128)) ([da72500](https://github.com/driftyco/ionic-native/commit/da72500))
|
||||
* **zip:** progress callback is optional ([#1049](https://github.com/driftyco/ionic-native/issues/1049)) ([83f57b9](https://github.com/driftyco/ionic-native/commit/83f57b9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **alipay:** add alipay support. ([#1097](https://github.com/driftyco/ionic-native/issues/1097)) ([2eea3df](https://github.com/driftyco/ionic-native/commit/2eea3df))
|
||||
* **app-update:** add cordova-plugin-app-update support ([#1105](https://github.com/driftyco/ionic-native/issues/1105)) ([21d4088](https://github.com/driftyco/ionic-native/commit/21d4088))
|
||||
* **appodeal:** adds Appodeal SDK wrappers for iOS and Android ([#1031](https://github.com/driftyco/ionic-native/issues/1031)) ([fd8107b](https://github.com/driftyco/ionic-native/commit/fd8107b))
|
||||
* **background-fetch:** Adding Background Fetch requested in [#990](https://github.com/driftyco/ionic-native/issues/990) ([#1013](https://github.com/driftyco/ionic-native/issues/1013)) ([57e2691](https://github.com/driftyco/ionic-native/commit/57e2691))
|
||||
* **browser-tab:** add browser tab plugin ([#1126](https://github.com/driftyco/ionic-native/issues/1126)) ([8de3793](https://github.com/driftyco/ionic-native/commit/8de3793)), closes [#1115](https://github.com/driftyco/ionic-native/issues/1115)
|
||||
* **couchbase-lite:** add CouchbaseLite cordova plugin ([#1025](https://github.com/driftyco/ionic-native/issues/1025)) ([09a7dcf](https://github.com/driftyco/ionic-native/commit/09a7dcf))
|
||||
* **file:** add system paths ([f0e2195](https://github.com/driftyco/ionic-native/commit/f0e2195))
|
||||
* **google-maps:** add constant for map type ([318ad3f](https://github.com/driftyco/ionic-native/commit/318ad3f))
|
||||
* **gyroscope:** add Gyroscope plugin ([#1004](https://github.com/driftyco/ionic-native/issues/1004)) ([0378b1d](https://github.com/driftyco/ionic-native/commit/0378b1d))
|
||||
* **inappbrowser:** add interface for IAB options ([#1065](https://github.com/driftyco/ionic-native/issues/1065)) ([f4b8236](https://github.com/driftyco/ionic-native/commit/f4b8236))
|
||||
* **local-notifications:** support for icon background color ([#1079](https://github.com/driftyco/ionic-native/issues/1079)) ([2a32624](https://github.com/driftyco/ionic-native/commit/2a32624))
|
||||
* **text-to-speech:** Add stop method ([#1063](https://github.com/driftyco/ionic-native/issues/1063)) ([4f86320](https://github.com/driftyco/ionic-native/commit/4f86320))
|
||||
* **unique-device-add:** add UniqueDeviceId plugin ([#1064](https://github.com/driftyco/ionic-native/issues/1064)) ([60db10c](https://github.com/driftyco/ionic-native/commit/60db10c))
|
||||
|
||||
|
||||
|
||||
<a name="2.5.1"></a>
|
||||
## [2.5.1](https://github.com/driftyco/ionic-native/compare/v2.5.0...v2.5.1) (2017-02-07)
|
||||
|
||||
@@ -217,7 +325,7 @@
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* device: device property no longer exists
|
||||
* **device:** device property no longer exists
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[](https://circleci.com/gh/driftyco/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://circleci.com/gh/ionic-team/ionic-native) [](http://commitizen.github.io/cz-cli/)
|
||||
[](https://www.npmjs.com/package/ionic-native)
|
||||
|
||||
[](https://nodei.co/npm/ionic-native/)
|
||||
@@ -81,7 +81,7 @@ npm install ionic-native --save
|
||||
|
||||
|
||||
## Plugin Missing?
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
|
||||
|
||||
# Credits
|
||||
|
||||
5915
package-lock.json
generated
Normal file
5915
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.5.1",
|
||||
"version": "2.9.0",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/es5/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
@@ -9,7 +9,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"rxjs": "5.0.0-beta.12"
|
||||
"rxjs": "5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^13.3.0",
|
||||
@@ -42,7 +42,7 @@
|
||||
"tsify": "~3.0.0",
|
||||
"tslint": "^3.15.1",
|
||||
"tslint-ionic-rules": "0.0.7",
|
||||
"typescript": "~2.0.10",
|
||||
"typescript": "2.0.9",
|
||||
"watchify": "~3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
12
src/index.ts
12
src/index.ts
@@ -10,6 +10,7 @@ import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||
import { AppAvailability } from './plugins/appavailability';
|
||||
import { Appodeal } from './plugins/appodeal';
|
||||
import { AppRate } from './plugins/apprate';
|
||||
import { AppPreferences } from './plugins/apppreferences';
|
||||
import { AppUpdate } from './plugins/app-update';
|
||||
import { AppVersion } from './plugins/appversion';
|
||||
import { Badge } from './plugins/badge';
|
||||
@@ -64,6 +65,7 @@ import { GoogleMap } from './plugins/googlemap';
|
||||
import { GoogleAnalytics } from './plugins/googleanalytics';
|
||||
import { Gyroscope } from './plugins/gyroscope';
|
||||
import { HeaderColor } from './plugins/headercolor';
|
||||
import { Health } from './plugins/health';
|
||||
import { Hotspot } from './plugins/hotspot';
|
||||
import { HTTP } from './plugins/http';
|
||||
import { Httpd } from './plugins/httpd';
|
||||
@@ -96,6 +98,8 @@ import { OneSignal } from './plugins/onesignal';
|
||||
import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PayPal } from './plugins/pay-pal';
|
||||
import { Pedometer } from './plugins/pedometer';
|
||||
import { PhotoLibrary } from './plugins/photo-library';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { Pinterest } from './plugins/pinterest';
|
||||
import { PowerManagement } from './plugins/power-management';
|
||||
@@ -138,6 +142,7 @@ export * from './plugins/admob';
|
||||
export * from './plugins/alipay';
|
||||
export * from './plugins/android-fingerprint-auth';
|
||||
export * from './plugins/appavailability';
|
||||
export * from './plugins/apppreferences';
|
||||
export * from './plugins/appodeal';
|
||||
export * from './plugins/apprate';
|
||||
export * from './plugins/app-update';
|
||||
@@ -194,6 +199,7 @@ export * from './plugins/googleanalytics';
|
||||
export * from './plugins/googlemap';
|
||||
export * from './plugins/gyroscope';
|
||||
export * from './plugins/headercolor';
|
||||
export * from './plugins/health';
|
||||
export * from './plugins/hotspot';
|
||||
export * from './plugins/http';
|
||||
export * from './plugins/httpd';
|
||||
@@ -224,6 +230,8 @@ export * from './plugins/network';
|
||||
export * from './plugins/nfc';
|
||||
export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/pedometer';
|
||||
export * from './plugins/photo-library';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
export * from './plugins/pinterest';
|
||||
@@ -270,6 +278,7 @@ window['IonicNative'] = {
|
||||
Alipay,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
AppPreferences,
|
||||
Appodeal,
|
||||
AppRate,
|
||||
AppUpdate,
|
||||
@@ -325,6 +334,7 @@ window['IonicNative'] = {
|
||||
GoogleAnalytics,
|
||||
Gyroscope,
|
||||
HeaderColor,
|
||||
Health,
|
||||
Hotspot,
|
||||
HTTP,
|
||||
Httpd,
|
||||
@@ -353,6 +363,8 @@ window['IonicNative'] = {
|
||||
NavigationBar,
|
||||
Network,
|
||||
PayPal,
|
||||
Pedometer,
|
||||
PhotoLibrary,
|
||||
NFC,
|
||||
Printer,
|
||||
Push,
|
||||
|
||||
133
src/plugins/apppreferences.ts
Normal file
133
src/plugins/apppreferences.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name AppPreferences
|
||||
* @description
|
||||
* This plugin allows you to read and write app preferences
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { AppPreferences } from 'ionic-native';
|
||||
*
|
||||
* AppPreferences.fetch('key').then((res) => { console.log(res); });
|
||||
*
|
||||
*```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppPreferences',
|
||||
plugin: 'cordova-plugin-app-preferences', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: 'plugins.appPreferences', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: 'https://github.com/apla/me.apla.cordova.app-preferences', // the github repository URL for the plugin
|
||||
})
|
||||
export class AppPreferences {
|
||||
|
||||
/**
|
||||
* Get a preference value
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static fetch(dict: string, key?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a preference value
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @param {string} value Value
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static store(dict: string, key: string, value?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove value from preferences
|
||||
*
|
||||
* @param {string} dict Dictionary for key (OPTIONAL)
|
||||
* @param {string} key Key
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static remove(dict: string, key?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Clear preferences
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static clearAll(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show native preferences interface
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static show(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show native preferences interface
|
||||
*
|
||||
* @param {boolean} subscribe true value to subscribe, false - unsubscribe
|
||||
* @return {Observable<any>} Returns an observable
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
static watch(subscribe: boolean): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Return named configuration context
|
||||
* In iOS you'll get a suite configuration, on Android — named file
|
||||
* Supports: Android, iOS
|
||||
* @param {string} suiteName suite name
|
||||
* @returns {Object} Custom object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static suite(suiteName: string): Object { return; }
|
||||
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static iosSuite(suiteName: string): Object { return; }
|
||||
|
||||
/**
|
||||
* Return cloud synchronized configuration context
|
||||
* Currently supports Windows and iOS/macOS
|
||||
* @returns {Object} Custom object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
static cloudSync(): Object { return; }
|
||||
|
||||
/**
|
||||
* Return default configuration context
|
||||
* Currently supports Windows and iOS/macOS
|
||||
* @returns {Object} Custom Object, bound to that suite
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows', 'Windows Phone 8']
|
||||
})
|
||||
static defaults(): Object { return; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
@@ -362,15 +363,14 @@ export class BackgroundGeolocation {
|
||||
/**
|
||||
* Configure the plugin.
|
||||
*
|
||||
* @param {Function} callback callback will be called when background location is determined.
|
||||
* @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
|
||||
* @param {Config} options An object of type Config
|
||||
* @return {Promise<any>}
|
||||
* @param options {BackgroundGeolocationConfig} options An object of type Config
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
callbackOrder: 'reverse',
|
||||
observable: true
|
||||
})
|
||||
static configure(options: BackgroundGeolocationConfig): Promise<any> { return; }
|
||||
static configure(options: BackgroundGeolocationConfig): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Turn ON the background-geolocation system.
|
||||
@@ -398,6 +398,7 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Force the plugin to enter "moving" or "stationary" state
|
||||
* @param isMoving {boolean}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -407,6 +408,7 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Setup configuration
|
||||
* @param options {BackgroundGeolocationConfig}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -497,6 +499,7 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Delete stored location by given locationId.
|
||||
* @param locationId {number}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -523,7 +526,7 @@ export class BackgroundGeolocation {
|
||||
* BackgroundGeolocation.Mode.FOREGROUND
|
||||
* BackgroundGeolocation.Mode.BACKGROUND
|
||||
**
|
||||
* @param {number} See above.
|
||||
* @param modeId {number}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -535,7 +538,7 @@ export class BackgroundGeolocation {
|
||||
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
|
||||
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
|
||||
*
|
||||
* @param {number} Limits the number of entries
|
||||
* @param limit {number} Limits the number of entries
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Cordova, CordovaFunctionOverride, Plugin } from './plugin';
|
||||
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
@@ -113,24 +112,77 @@ export class BackgroundMode {
|
||||
static configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Called when background mode is activated.
|
||||
* @returns {Observable<any>} returns an observable that emits when background mode is activated
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
static onactivate(): Observable<any> { return; };
|
||||
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* @param event {string} Event name
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'un',
|
||||
clearWithArgs: true
|
||||
})
|
||||
static on(event: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Called when background mode is deactivated.
|
||||
* @returns {Observable<any>} returns an observable that emits when background mode is deactivated
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
static ondeactivate(): Observable<any> { return; };
|
||||
* Android allows to programmatically move from foreground to background.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static moveToBackground(): void {}
|
||||
|
||||
/**
|
||||
* Called when background mode fails
|
||||
* @returns {Observable<any>} returns an observable that emits when background mode fails
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
static onfailure(): Observable<any> { return; };
|
||||
* Android allows to programmatically move from background to foreground.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static moveToForeground(): void {}
|
||||
|
||||
/**
|
||||
* Override the back button on Android to go to background instead of closing the app.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static overrideBackButton(): void {}
|
||||
|
||||
/**
|
||||
* Exclude the app from the recent task list works on Android 5.0+.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static excludeFromTaskList(): void {}
|
||||
|
||||
/**
|
||||
* The method works async instead of isActive() or isEnabled().
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static isScreenOff(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Turn screen on
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static wakeUp(): void {}
|
||||
|
||||
/**
|
||||
* Turn screen on and show app even locked
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
static unlock(): void {}
|
||||
|
||||
}
|
||||
|
||||
@@ -423,4 +423,15 @@ export class BLE {
|
||||
@Cordova()
|
||||
static enable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Read the RSSI value on the device connection.
|
||||
*
|
||||
* @param {string} deviceId UUID or MAC address of the peripheral
|
||||
*
|
||||
*@returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static readRSSI(
|
||||
deviceId: string,
|
||||
): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -60,6 +60,13 @@ export class BluetoothSerial {
|
||||
})
|
||||
static connectInsecure(macAddress: string): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Disconnect from the connected device
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static disconnect(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Writes data to the serial port
|
||||
* @param {any} data ArrayBuffer of data
|
||||
|
||||
@@ -1,24 +1,50 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface CameraPreviewRect {
|
||||
|
||||
x: number;
|
||||
|
||||
y: number;
|
||||
|
||||
width: number;
|
||||
|
||||
height: number;
|
||||
export interface CameraPreviewDimensions {
|
||||
/** The width of the camera preview, default to window.screen.width */
|
||||
width?: number;
|
||||
|
||||
/** The height of the camera preview, default to window.screen.height */
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export interface CameraPreviewSize {
|
||||
export interface CameraPreviewOptions {
|
||||
/** The left edge in pixels, default 0 */
|
||||
x?: number;
|
||||
|
||||
maxWidth: number;
|
||||
/** The top edge in pixels, default 0 */
|
||||
y?: number;
|
||||
|
||||
maxHeight: number;
|
||||
/** The width in pixels, default window.screen.width */
|
||||
width?: number;
|
||||
|
||||
/** The height in pixels, default window.screen.height */
|
||||
height?: number;
|
||||
|
||||
/** Choose the camera to use 'front' or 'rear', default 'front' */
|
||||
camera?: string;
|
||||
|
||||
/** Tap to take a photo, default true (picture quality by default : 85) */
|
||||
tapPhoto?: boolean;
|
||||
|
||||
/** Preview box drag across the screen, default 'false' */
|
||||
previewDrag?: boolean;
|
||||
|
||||
/** Preview box to the back of the webview (true => back, false => front) , default false */
|
||||
toBack?: boolean;
|
||||
|
||||
/** Alpha channel of the preview box, float, [0,1], default 1 */
|
||||
alpha?: number;
|
||||
}
|
||||
|
||||
export interface PictureOptions {
|
||||
/** The width in pixels, default 0 */
|
||||
width?: number;
|
||||
/** The height in pixels, default 0 */
|
||||
height?: number;
|
||||
/** The picture quality, 0 - 100, default 85 */
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,45 +52,52 @@ export interface CameraPreviewSize {
|
||||
* @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).
|
||||
*
|
||||
* Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git`. For more info, please see the [Cordova Camera Preview docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CameraPreview, CameraPreviewRect } from 'ionic-native';
|
||||
* ```typescript
|
||||
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions, } from 'ionic-native';
|
||||
*
|
||||
* // camera options (Size and location)
|
||||
* let cameraRect: CameraPreviewRect = {
|
||||
* x: 100,
|
||||
* y: 100,
|
||||
* width: 200,
|
||||
* height: 200
|
||||
* // camera options (Size and location). In the following example, the preview uses the rear camera and display the preview in the back of the webview
|
||||
* public cameraPreviewOpts: CameraPreviewOptions = {
|
||||
* x: 0,
|
||||
* y: 0,
|
||||
* width: window.screen.width,
|
||||
* height: window.screen.height,
|
||||
* camera: 'rear',
|
||||
* tapPhoto: true,
|
||||
* previewDrag: true,
|
||||
* toBack: true,
|
||||
* alpha: 1
|
||||
* };
|
||||
*
|
||||
*
|
||||
* // start camera
|
||||
* CameraPreview.startCamera(
|
||||
* cameraRect, // position and size of preview
|
||||
* 'front', // default camera
|
||||
* true, // tap to take picture
|
||||
* false, // disable drag
|
||||
* false, // keep preview in front. Set to true (back of the screen) to apply overlaying elements
|
||||
* 1 // set the preview alpha
|
||||
* );
|
||||
*
|
||||
* // Set the handler to run every time we take a picture
|
||||
* CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
|
||||
* console.log(result);
|
||||
* // do something with the result
|
||||
* });
|
||||
* CameraPreview.startCamera(this.cameraPreviewOpts).then(
|
||||
* (res) => {
|
||||
* console.log(res)
|
||||
* },
|
||||
* (err) => {
|
||||
* console.log(err)
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // picture options
|
||||
* public pictureOpts: PictureOptions = {
|
||||
* width: 1280,
|
||||
* height: 1280,
|
||||
* quality: 85
|
||||
* }
|
||||
*
|
||||
* // take a picture
|
||||
* CameraPreview.takePicture({
|
||||
* maxWidth: 640,
|
||||
* maxHeight: 640
|
||||
* CameraPreview.takePicture(this.pictureOpts).then((imageData) => {
|
||||
* this.picture = 'data:image/jpeg;base64,' + imageData;
|
||||
* }, (err) => {
|
||||
* console.log(err);
|
||||
* this.picture = 'assets/img/test.jpg';
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Switch camera
|
||||
* CameraPreview.switchCamera();
|
||||
*
|
||||
@@ -77,96 +110,119 @@ export interface CameraPreviewSize {
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* CameraPreviewRect
|
||||
* CameraPreviewSize
|
||||
* CameraPreviewOptions
|
||||
* PictureOptions
|
||||
* CameraPreviewDimensions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CameraPreview',
|
||||
plugin: 'cordova-plugin-camera-preview',
|
||||
pluginRef: 'cordova.plugins.camerapreview',
|
||||
pluginRef: '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
|
||||
* Starts the camera preview instance. (iOS & Android)
|
||||
* @param {CameraPreviewOptions} options
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }
|
||||
static startCamera(options: CameraPreviewOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stops the camera preview instance.
|
||||
* Stops the camera preview instance. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static stopCamera(): void { }
|
||||
static stopCamera(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Take the picture, the parameter size is optional
|
||||
* @param {CameraPreviewSize} optional - size of the picture to take
|
||||
* Switch from the rear camera and front camera, if available. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static takePicture(size?: CameraPreviewSize): void { }
|
||||
static switchCamera(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Register a callback function that receives the original picture and the image captured from the preview box.
|
||||
* @returns {Observable<any>}
|
||||
* Hide the camera preview box. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static setOnPictureTakenHandler(): Observable<any> { return; }
|
||||
static hide(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Switch from the rear camera and front camera, if available.
|
||||
* Show the camera preview box. (iOS & Android)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 0,
|
||||
errorIndex: 1
|
||||
})
|
||||
static switchCamera(): void { }
|
||||
static show(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the camera preview box.
|
||||
* Take the picture (base64), the parameter size is optional (iOS & Android)
|
||||
* @param {PictureOptions} optional - size and quality of the picture to take
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static show(): void { }
|
||||
static takePicture(opts?: PictureOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Hide the camera preview box.
|
||||
*
|
||||
* Set camera color effect. (iOS partial & Android)
|
||||
* @static
|
||||
* @param {string} effect name : 'none' (iOS & Android), 'aqua' (Android), 'blackboard' (Android), 'mono' (iOS & Android), 'negative' (iOS & Android), 'posterize' (iOS & Android), 'sepia' (iOS & Android), 'solarize' (Android) or 'whiteboard' (Android)
|
||||
*
|
||||
* @memberOf CameraPreview
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static hide(): void { }
|
||||
static setColorEffect(effect: string): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Disables the camera preview
|
||||
* Set the zoom (Android)
|
||||
* @param Zoom value (integer)
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static disable(): void { }
|
||||
static setZoom(zoom?: number): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Set camera color effect.
|
||||
* Set the preview Size (Android)
|
||||
* @param dimensions
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static setColorEffect(effect: string): void { }
|
||||
static setPreviewSize(dimensions?: CameraPreviewDimensions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
* Set the flashmode (iOS partial & Android)
|
||||
* @param flashMode 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static setFlashMode(flashMode?: string): Promise<any> { return; }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
|
||||
*
|
||||
* Diagnostic.getBluetoothState()
|
||||
* .then((state) => {
|
||||
* if (state == Diagnostic.bluetoothStates.POWERED_ON){
|
||||
* if (state == Diagnostic.bluetoothState.POWERED_ON){
|
||||
* // do something
|
||||
* } else {
|
||||
* // do something else
|
||||
@@ -109,6 +109,15 @@ export class Diagnostic {
|
||||
POWERING_ON: 'powering_on'
|
||||
};
|
||||
|
||||
@CordovaProperty
|
||||
static NFCState: {
|
||||
UNKNOWN: string;
|
||||
POWERED_OFF: string;
|
||||
POWERED_ON: string;
|
||||
POWERING_ON: string;
|
||||
POWERING_OFF: string;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
@@ -190,6 +199,9 @@ export class Diagnostic {
|
||||
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
|
||||
static setBluetoothState(state: boolean): Promise<any> { return; }
|
||||
|
||||
|
||||
// ANDROID AND IOS ONLY
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @returns {Promise<boolean>}
|
||||
@@ -367,6 +379,9 @@ export class Diagnostic {
|
||||
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||
static registerLocationStateChangeHandler(handler: Function): void { }
|
||||
|
||||
|
||||
// ANDROID ONLY
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -493,6 +508,96 @@ export class Diagnostic {
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use external storage.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isExternalStorageAuthorized(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* CReturns the external storage authorization status for the application.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getExternalStorageAuthorizationStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests external storage authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static requestExternalStorageAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Returns details of external SD card(s): absolute path, is writable, free space.
|
||||
*
|
||||
* The intention of this method is to return the location and details of removable external SD cards.
|
||||
* This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails)
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static getExternalSdCardDetails(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToWirelessSettings(): void { }
|
||||
|
||||
/**
|
||||
* Displays NFC settings to allow user to enable NFC.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
switchToNFCSettings(): void { }
|
||||
|
||||
/**
|
||||
* Checks if NFC hardware is present on device.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCPresent(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the device setting for NFC is switched on.
|
||||
* Note: this operation does not require NFC permission in the manifest.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCEnabled(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
|
||||
* Note: this operation does not require NFC permission in the manifest.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
static isNFCAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Registers a function to be called when a change in NFC state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param hander {Function} callback function to be called when NFC state changes
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
registerNFCStateChangeHandler(handler: Function): void { }
|
||||
|
||||
|
||||
|
||||
// IOS ONLY
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
* @returns {Promise<boolean>}
|
||||
@@ -573,4 +678,40 @@ export class Diagnostic {
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static getBackgroundRefreshStatus(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Requests Bluetooth authorization for the application.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization)
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestBluetoothAuthorization(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if motion tracking is available on the current device.
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isMotionAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if it's possible to determine the outcome of a motion authorization request on the current device.
|
||||
* There's no direct way to determine if authorization was granted or denied, so the Pedometer API must be used to indirectly determine this:
|
||||
* therefore, if the device supports motion tracking but not Pedometer Event Tracking, the outcome of requesting motion detection cannot be determined.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static isMotionRequestOutcomeAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Requests and checks motion authorization for the application: there is no way to independently request only or check only, so both must be done in one operation.
|
||||
*
|
||||
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestandcheckmotionauthorization)
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
static requestAndCheckMotionAuthorization(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -171,7 +171,6 @@ export interface Flags {
|
||||
}
|
||||
|
||||
export interface WriteOptions {
|
||||
create?: boolean;
|
||||
replace?: boolean;
|
||||
append?: boolean;
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
@@ -481,13 +480,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dir Name of directory to check
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
static checkDir(path: string, dir: string): Promise<boolean> | Promise<FileError> {
|
||||
static checkDir(path: string, dir: string): Promise<boolean> {
|
||||
if ((/^\//.test(dir))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let fullpath = path + dir;
|
||||
@@ -505,13 +504,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} dirName Name of directory to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<DirectoryEntry> | Promise<FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
*/
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> | Promise<FileError> {
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@@ -533,13 +532,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path The path to the directory
|
||||
* @param {string} dirName The directory name
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -558,15 +557,15 @@ export class File {
|
||||
* @param {string} dirName The source directory name
|
||||
* @param {string} newPath The destionation path to the directory
|
||||
* @param {string} newDirName The destination directory name
|
||||
* @returns {Promise<DirectoryEntry|Entry> | Promise<FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
*/
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> | Promise<FileError> {
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -588,13 +587,13 @@ export class File {
|
||||
* @param {string} dirName Name of directory to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
*/
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> | Promise<FileError> {
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -661,13 +660,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file to check
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
static checkFile(path: string, file: string): Promise<boolean> | Promise<FileError> {
|
||||
static checkFile(path: string, file: string): Promise<boolean> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveLocalFilesystemUrl(path + file)
|
||||
@@ -690,13 +689,13 @@ export class File {
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to create
|
||||
* @param {boolean} replace If true, replaces file with same name. If false returns error
|
||||
* @returns {Promise<FileEntry> | Promise<FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
*/
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> | Promise<FileError> {
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
let options: Flags = {
|
||||
@@ -718,13 +717,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} fileName Name of file to remove
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -799,7 +798,7 @@ export class File {
|
||||
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
|
||||
*/
|
||||
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
|
||||
return File.writeFile(path, fileName, text, { create: false });
|
||||
return File.writeFile(path, fileName, text, { replace: true });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -807,13 +806,13 @@ export class File {
|
||||
*
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
*/
|
||||
static readAsText(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsText(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -848,13 +847,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
*/
|
||||
static readAsDataURL(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsDataURL(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -890,13 +889,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<string> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
*/
|
||||
static readAsBinaryString(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
static readAsBinaryString(path: string, file: string): Promise<string> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -931,13 +930,13 @@ export class File {
|
||||
|
||||
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
|
||||
* @param {string} file Name of file, relative to path.
|
||||
* @returns {Promise<ArrayBuffer> | Promise<FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
* @returns {Promise<ArrayBuffer>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
*/
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> | Promise<FileError> {
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return File.resolveDirectoryUrl(path)
|
||||
@@ -974,15 +973,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to move
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
*/
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
@@ -1004,15 +1003,15 @@ export class File {
|
||||
* @param {string} fileName Name of file to copy
|
||||
* @param {string} newPath Base FileSystem of new location
|
||||
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
|
||||
* @returns {Promise<Entry> | Promise<FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
* @returns {Promise<Entry>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
*/
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file name cannot start with \/';
|
||||
return Promise.reject<FileError>(err);
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
|
||||
@@ -13,8 +13,8 @@ declare var window: any;
|
||||
* import {FilePath} from 'ionic-native';
|
||||
*
|
||||
* FilePath.resolveNativePath(path)
|
||||
* .then(filePath => console.log(filePath);
|
||||
* .catch(err => console.log(err);
|
||||
* .then(filePath => console.log(filePath))
|
||||
* .catch(err => console.log(err));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,11 @@ export interface FingerprintOptions {
|
||||
* Secret password. Only for android
|
||||
*/
|
||||
clientSecret?: string;
|
||||
|
||||
/**
|
||||
* Disable 'use backup' option. Only for android (optional)
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,7 +31,8 @@ export interface FingerprintOptions {
|
||||
*
|
||||
* FingerprintAIO.show({
|
||||
* clientId: "Fingerprint-Demo",
|
||||
* clientSecret: "password" //Only necessary for Android
|
||||
* clientSecret: "password", //Only necessary for Android
|
||||
* disableBackup:true //Only for Android(optional)
|
||||
* })
|
||||
* .then((result: any) => console.log(any))
|
||||
* .catch((error: any) => console.log(error));
|
||||
|
||||
@@ -111,6 +111,14 @@ export class Firebase {
|
||||
@Cordova()
|
||||
static logEvent(type: string, data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set the name of the current screen in Analytics
|
||||
* @param name {string} Screen name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static setScreenName(name: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set a user id for use in Analytics
|
||||
* @param userId {string}
|
||||
|
||||
@@ -37,6 +37,9 @@ export const GoogleMapsAnimation = {
|
||||
DROP: 'DROP'
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const GoogleMapsMapTypeId = {
|
||||
HYBRID: 'MAP_TYPE_HYBRID',
|
||||
NONE: 'MAP_TYPE_NONE',
|
||||
@@ -97,7 +100,7 @@ export const GoogleMapsMapTypeId = {
|
||||
* map.moveCamera(position); // works on iOS and Android
|
||||
* });
|
||||
*
|
||||
*
|
||||
*
|
||||
* // create new marker
|
||||
* let markerOptions: GoogleMapsMarkerOptions = {
|
||||
* position: ionic,
|
||||
@@ -109,7 +112,6 @@ export const GoogleMapsMapTypeId = {
|
||||
* marker.showInfoWindow();
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
|
||||
303
src/plugins/health.ts
Normal file
303
src/plugins/health.ts
Normal file
@@ -0,0 +1,303 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
export interface HealthQueryOptions {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* Optional limit the number of values returned. Defaults to 1000
|
||||
*/
|
||||
limit?: number;
|
||||
|
||||
/**
|
||||
* Optional indicator to sort values ascending or descending
|
||||
*/
|
||||
ascending?: boolean;
|
||||
|
||||
/**
|
||||
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
|
||||
* In the latter case the query object must contain the field filtered: true.
|
||||
*/
|
||||
filtered?: boolean;
|
||||
}
|
||||
|
||||
export interface HealthQueryOptionsAggregated {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* if specified, aggregation is grouped an array of "buckets" (windows of time),
|
||||
* supported values are: 'hour', 'day', 'week', 'month', 'year'.
|
||||
*/
|
||||
bucket: string;
|
||||
}
|
||||
|
||||
export interface HealthStoreOptions {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
dataType: string;
|
||||
|
||||
/**
|
||||
* Value of corresponding Datatype (see "Overview of valid datatypes")
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/*
|
||||
* The source that produced this data. In iOS this is ignored and
|
||||
* set automatically to the name of your app.
|
||||
*/
|
||||
sourceName: string;
|
||||
|
||||
/*
|
||||
* The complete package of the source that produced this data.
|
||||
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
|
||||
* set automatically to the bunde id of the app.
|
||||
*/
|
||||
sourceBundleId: string;
|
||||
}
|
||||
|
||||
export interface HealthData {
|
||||
/**
|
||||
* Start date from which to get data
|
||||
*/
|
||||
startDate: Date;
|
||||
|
||||
/**
|
||||
* End date from which to get data
|
||||
*/
|
||||
endDate: Date;
|
||||
|
||||
/**
|
||||
* Value of corresponding Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* Unit of corresponding value of Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types)
|
||||
*/
|
||||
unit: string;
|
||||
|
||||
/**
|
||||
* The source that produced this data. In iOS this is ignored and
|
||||
* set automatically to the name of your app.
|
||||
*/
|
||||
sourceName: string;
|
||||
|
||||
/**
|
||||
* The complete package of the source that produced this data.
|
||||
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
|
||||
* set automatically to the bunde id of the app.
|
||||
*/
|
||||
sourceBundleId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Health
|
||||
* @description
|
||||
* A plugin that abstracts fitness and health repositories like Apple HealthKit or Google Fit.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Health } from 'ionic-native';
|
||||
*
|
||||
* ```
|
||||
* See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples.
|
||||
* @interfaces
|
||||
* HealthQueryOptions
|
||||
* HealthQueryOptionsAggregated
|
||||
* HealthStoreOptions
|
||||
* HealthData
|
||||
*/
|
||||
|
||||
@Plugin({
|
||||
pluginName: 'Health',
|
||||
plugin: 'cordova-plugin-health',
|
||||
pluginRef: 'navigator.health',
|
||||
repo: 'https://github.com/dariosalvi78/cordova-plugin-health'
|
||||
})
|
||||
export class Health {
|
||||
|
||||
/**
|
||||
* Tells if either Google Fit or HealthKit are available.
|
||||
*
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static isAvailable(): Promise<boolean> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if recent Google Play Services and Google Fit are installed. If the play services are not installed,
|
||||
* or are obsolete, it will show a pop-up suggesting to download them. If Google Fit is not installed,
|
||||
* it will open the Play Store at the location of the Google Fit app.
|
||||
* The plugin does not wait until the missing packages are installed, it will return immediately.
|
||||
* If both Play Services and Google Fit are available, this function just returns without any visible effect.
|
||||
*
|
||||
* This function is only available on Android.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static promptInstallFit(): Promise<any> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Requests read and write access to a set of data types. It is recommendable to always explain why the app
|
||||
* needs access to the data before asking the user to authorize it.
|
||||
* This function must be called before using the query and store functions, even if the authorization has already
|
||||
* been given at some point in the past.
|
||||
*
|
||||
* Quirks of requestAuthorization()
|
||||
|
||||
* In Android, it will try to get authorization from the Google Fit APIs.
|
||||
* It is necessary that the app's package name and the signing key are registered in the Google API console.
|
||||
* In Android, be aware that if the activity is destroyed (e.g. after a rotation) or is put in background,
|
||||
* the connection to Google Fit may be lost without any callback. Going through the authorization will ensure that
|
||||
* the app is connected again.
|
||||
* In Android 6 and over, this function will also ask for some dynamic permissions if needed
|
||||
* (e.g. in the case of "distance", it will need access to ACCESS_FINE_LOCATION).
|
||||
*
|
||||
* @param {Array<String>} datatypes a list of data types you want to be granted access to
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static requestAuthorization(datatypes: Array<string>): Promise<any> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the app has authorization to read/write a set of datatypes.
|
||||
* This function is similar to requestAuthorization() and has similar quirks.
|
||||
*
|
||||
* @param {Array<String>} datatypes a list of data types you want to be granted access to
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isAuthorized(datatypes: Array<string>): Promise<any> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all the data points of a certain data type within a certain time window.
|
||||
* Warning: if the time span is big, it can generate long arrays!
|
||||
*
|
||||
* Quirks of query()
|
||||
*
|
||||
* In iOS, the amount of datapoints is limited to 1000 by default.
|
||||
* You can override this by adding a limit: xxx to your query object.
|
||||
* In iOS, datapoints are ordered in an descending fashion (from newer to older).
|
||||
* You can revert this behaviour by adding ascending: true to your query object.
|
||||
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
|
||||
* In the latter case the query object must contain the field filtered: true.
|
||||
* In Google Fit, calories.basal is returned as an average per day, and usually is not available in all days.
|
||||
* In Google Fit, calories.active is computed by subtracting the basal calories from the total.
|
||||
* As basal energy expenditure, an average is computed from the week before endDate.
|
||||
* While Google Fit calculates basal and active calories automatically,
|
||||
* HealthKit needs an explicit input from some app.
|
||||
* When querying for activities, Google Fit is able to determine some activities automatically
|
||||
* (still, walking, running, biking, in vehicle), while HealthKit only relies on the input of
|
||||
* the user or of some external app.
|
||||
* When querying for activities, calories and distance are also provided in HealthKit (units are kcal and meters) and
|
||||
* never in Google Fit.
|
||||
* When querying for nutrition, Google Fit always returns all the nutrition elements it has,
|
||||
* while HealthKit returns only those that are stored as correlation. To be sure to get all stored the quantities
|
||||
* (regardless of they are stored as correlation or not), it's better to query single nutrients.
|
||||
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
|
||||
* Automatic conversion is not trivial and depends on the actual substance.
|
||||
*
|
||||
* @param queryOptions {HealthQueryOptions}
|
||||
* @return {Promise<HealthData>}
|
||||
*/
|
||||
@Cordova()
|
||||
static query(queryOptions: HealthQueryOptions): Promise<HealthData> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets aggregated data in a certain time window. Usually the sum is returned for the given quantity.
|
||||
*
|
||||
* Quirks of queryAggregated()
|
||||
* In Android, to query for steps as filtered by the Google Fit app, the flag filtered:
|
||||
* true must be added into the query object.
|
||||
* When querying for activities, calories and distance are provided
|
||||
* when available in HealthKit and never in Google Fit.
|
||||
* In Android, the start and end dates returned are the date of the first and the last available samples.
|
||||
* If no samples are found, start and end may not be set.
|
||||
* When bucketing, buckets will include the whole hour / day / month / week / year where start and end times
|
||||
* fall into. For example, if your start time is 2016-10-21 10:53:34,
|
||||
* the first daily bucket will start at 2016-10-21 00:00:00.
|
||||
* Weeks start on Monday.
|
||||
* When querying for nutrition, HealthKit returns only those that are stored as correlation.
|
||||
* To be sure to get all the stored quantities, it's better to query single nutrients.
|
||||
* nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit.
|
||||
*
|
||||
* @param queryOptionsAggregated {HealthQueryOptionsAggregated}
|
||||
* @return {Promise<HealthData[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
static queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData[]> {
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stores a data point.
|
||||
*
|
||||
* Quirks of store()
|
||||
*
|
||||
* Google Fit doesn't allow you to overwrite data points that overlap with others already stored of the same type (see here). At the moment there is no support for update nor delete.
|
||||
* In iOS you cannot store the total calories, you need to specify either basal or active. If you use total calories, the active ones will be stored.
|
||||
* In Android you can only store active calories, as the basal are estimated automatically. If you store total calories, these will be treated as active.
|
||||
* In iOS distance is assumed to be of type WalkingRunning, if you want to explicitly set it to Cycling you need to add the field cycling: true.
|
||||
* In iOS storing the sleep activities is not supported at the moment.
|
||||
* Storing of nutrients is not supported at the moment.
|
||||
* @param storeOptions
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static store(storeOptions: HealthStoreOptions): Promise<any> {
|
||||
return;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -566,7 +566,7 @@ export class IBeacon {
|
||||
|
||||
|
||||
/**
|
||||
* See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
|
||||
* See the documentation of {@code requestWhenInUseAuthorization} for further details.
|
||||
*
|
||||
* @returns {Promise<void>} Returns a promise which is resolved when the native layer
|
||||
* shows the request dialog.
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
declare var cordova: any;
|
||||
|
||||
export interface InAppBrowserOptions {
|
||||
/** Set to yes or no to ruen the InAppBrowser's location bar on or off. */
|
||||
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
|
||||
location?: 'yes' | 'no';
|
||||
/** Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
|
||||
* Omit or set to no (default) to have the browser open and load normally. */
|
||||
|
||||
@@ -10,6 +10,9 @@ export interface MusicControlsOptions {
|
||||
hasPrev: boolean;
|
||||
hasNext: boolean;
|
||||
hasClose: boolean;
|
||||
album:string;
|
||||
duration: number;
|
||||
elapsed:number;
|
||||
ticker: string;
|
||||
}
|
||||
|
||||
@@ -38,6 +41,11 @@ export interface MusicControlsOptions {
|
||||
* hasNext : false, // show next button, optional, default: true
|
||||
* hasClose : true, // show close button, optional, default: false
|
||||
*
|
||||
* // iOS only, optional
|
||||
* album : 'Absolution' // optional, default: ''
|
||||
* duration : 60, // optional, default: 0
|
||||
* elapsed : 10, // optional, default: 0
|
||||
*
|
||||
* // Android only, optional
|
||||
* // text displayed in the status bar when the notification (and the ticker) are updated
|
||||
* ticker : 'Now playing "Time is Running Out"'
|
||||
@@ -129,7 +137,13 @@ export class MusicControls {
|
||||
* Toggle play/pause:
|
||||
* @param isPlaying {boolean}
|
||||
*/
|
||||
@Cordova({sync: true})
|
||||
@Cordova()
|
||||
static updateIsPlaying(isPlaying: boolean): void {}
|
||||
|
||||
/**
|
||||
* Toggle dismissable:
|
||||
* @param dismissable {boolean}
|
||||
*/
|
||||
@Cordova()
|
||||
static updateDismissable(dismissable: boolean): void {}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from 'ionic-native';
|
||||
*
|
||||
* NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.address + " in " + result.countryCode))
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.street + " in " + result.countryCode))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* NativeGeocoder.forwardGeocode("Berlin")
|
||||
|
||||
@@ -220,7 +220,7 @@ export class PayPalItem {
|
||||
* @param {String} currency: ISO standard currency code.
|
||||
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
constructor(name: string, quantity: number, price: string, currency: string, sku: string) {
|
||||
constructor(name: string, quantity: number, price: string, currency: string, sku?: string) {
|
||||
this.name = name;
|
||||
this.quantity = quantity;
|
||||
this.price = price;
|
||||
@@ -246,7 +246,7 @@ export class PayPalItem {
|
||||
/**
|
||||
* The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
sku: string;
|
||||
sku?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
103
src/plugins/pedometer.ts
Normal file
103
src/plugins/pedometer.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* Interface of a pedometer data object which is returned by watching for new data or by recieving historical data
|
||||
*/
|
||||
|
||||
export interface IPedometerData {
|
||||
startDate?: number;
|
||||
endDate?: number;
|
||||
numberOfSteps: number;
|
||||
distance: number;
|
||||
floorsAscended: number;
|
||||
floorsDescended: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Pedometer
|
||||
* @description
|
||||
* Fetch pedestrian-related pedometer data,
|
||||
* such as step counts and other information about the distance travelled.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Pedometer } from 'ionic-native';
|
||||
*
|
||||
* Pedometer.isDistanceAvailable()
|
||||
* .then((available: boolean) => console.log(available))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* Pedometer.startPedometerUpdates()
|
||||
* .subscribe((data: IPedometerData) => {
|
||||
* console.log(data);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pedometer',
|
||||
plugin: 'cordova-plugin-pedometer',
|
||||
pluginRef: 'pedometer',
|
||||
repo: 'https://github.com/leecrossley/cordova-plugin-pedometer',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Pedometer {
|
||||
|
||||
/**
|
||||
* Checks if step counting is available. Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isStepCountingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Distance estimation indicates the ability to use step information to supply the approximate distance travelled by the user.
|
||||
* This capability is not supported on all devices, even with iOS 8.
|
||||
* Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isDistanceAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Floor counting indicates the ability to count the number of floors the user walks up or down using stairs.
|
||||
* This capability is not supported on all devices, even with iOS 8.
|
||||
* Only works on iOS.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
|
||||
*/
|
||||
@Cordova()
|
||||
static isFloorCountingAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Starts the delivery of recent pedestrian-related data to your Cordova app.
|
||||
*
|
||||
* When the app is suspended, the delivery of updates stops temporarily.
|
||||
* Upon returning to foreground or background execution, the pedometer object begins updates again.
|
||||
* @return {Observable<IPedometerData>} Returns a Observable that recieves repeatly data from pedometer in background.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stopPedometerUpdates'
|
||||
})
|
||||
static startPedometerUpdates(): Observable<IPedometerData> { return; }
|
||||
|
||||
/**
|
||||
* Stops the delivery of recent pedestrian data updates to your Cordova app.
|
||||
* @return {Promise<boolean>} Returns a promise that resolves when pedometer watching was stopped
|
||||
*/
|
||||
@Cordova()
|
||||
static stopPedometerUpdates(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Retrieves the data between the specified start and end dates.
|
||||
* The startDate and endDate options are required and can be constructed in any valid JavaScript way
|
||||
* (e.g. new Date(2015, 4, 1, 15, 20, 00) is also valid, as is milliseconds).
|
||||
* Only works on iOS.
|
||||
* @param {any} options start date and en date where you want to get pedometer data
|
||||
* @return {Promise<IPedometerData>} Returns a promise that resolves when pedometer data found
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static queryData(options: { startDate: Date, endDate: Date }): Promise<IPedometerData> { return; }
|
||||
}
|
||||
207
src/plugins/photo-library.ts
Normal file
207
src/plugins/photo-library.ts
Normal file
@@ -0,0 +1,207 @@
|
||||
import { Plugin, Cordova, CordovaFiniteObservable } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name PhotoLibrary
|
||||
* @description
|
||||
* The PhotoLibrary plugin allows access to photos from device by url. So you can use plain img tag to display photos and their thumbnails, and different 3rd party libraries as well.
|
||||
* Saving photos and videos to the library is also supported.
|
||||
* cdvphotolibrary urls should be trusted by Angular. See plugin homepage to learn how.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { PhotoLibrary } from 'ionic-native';
|
||||
*
|
||||
* PhotoLibrary.requestAuthorization().then(() => {
|
||||
* PhotoLibrary.getLibrary().subscribe({
|
||||
* next: library => {
|
||||
* library.forEach(function(libraryItem) {
|
||||
* console.log(libraryItem.id); // ID of the photo
|
||||
* console.log(libraryItem.photoURL); // Cross-platform access to photo
|
||||
* console.log(libraryItem.thumbnailURL);// Cross-platform access to thumbnail
|
||||
* console.log(libraryItem.fileName);
|
||||
* console.log(libraryItem.width);
|
||||
* console.log(libraryItem.height);
|
||||
* console.log(libraryItem.creationDate);
|
||||
* console.log(libraryItem.latitude);
|
||||
* console.log(libraryItem.longitude);
|
||||
* console.log(libraryItem.albumIds); // array of ids of appropriate AlbumItem, only of includeAlbumsData was used
|
||||
* });
|
||||
* },
|
||||
* error: err => {},
|
||||
* complete: () => { console.log("could not get photos"); }
|
||||
* });
|
||||
* })
|
||||
* .catch(err => console.log("permissions weren't granted"));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PhotoLibrary',
|
||||
plugin: 'cordova-plugin-photo-library',
|
||||
pluginRef: 'cordova.plugins.photoLibrary',
|
||||
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
|
||||
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"'
|
||||
})
|
||||
export class PhotoLibrary {
|
||||
|
||||
/**
|
||||
* Retrieves library items. Library item contains photo metadata like width and height, as well as photoURL and thumbnailURL.
|
||||
* @param options {GetLibraryOptions} Optional, like thumbnail size and chunks settings.
|
||||
* @return {Observable<LibraryItem[]>} Returns library items. If appropriate option was set, will be returned by chunks.
|
||||
*/
|
||||
@CordovaFiniteObservable({
|
||||
callbackOrder: 'reverse',
|
||||
resultFinalPredicate: (result: {isLastChunk: boolean}) => { return result.isLastChunk; },
|
||||
resultTransform: (result: {library: LibraryItem[]}) => { return result.library; },
|
||||
})
|
||||
static getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> { return; }
|
||||
|
||||
/**
|
||||
* Asks user permission to access photo library.
|
||||
* @param options {RequestAuthorizationOptions} Optional, like whether only read access needed or read/write.
|
||||
* @return { Promise<void>} Returns a promise that resolves when permissions are granted, and fails when not.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
})
|
||||
static requestAuthorization(options?: RequestAuthorizationOptions): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Returns list of photo albums on device.
|
||||
* @return {Promise<AlbumItem[]>} Resolves to list of albums.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
})
|
||||
static getAlbums(): Promise<AlbumItem[]> { return; }
|
||||
|
||||
/**
|
||||
* Provides means to request URL of thumbnail, with specified size or quality.
|
||||
* @param photo {string | LibraryItem} Id of photo, or LibraryItem.
|
||||
* @param options {GetThumbnailOptions} Options, like thumbnail size or quality.
|
||||
* @return {Promise<string>} Resolves to URL of cdvphotolibrary schema.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getThumbnailURL(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Provides means to request photo URL by id.
|
||||
* @param photo {string | LibraryItem} Id or LibraryItem.
|
||||
* @param options {GetPhotoOptions} Optional options.
|
||||
* @return {Promise<string>} Resolves to URL of cdvphotolibrary schema.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getPhotoURL(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* Returns thumbnail as Blob.
|
||||
* @param photo {string | LibraryItem} Id or LibraryItem.
|
||||
* @param options {GetThumbnailOptions} Options, like thumbnail size or quality.
|
||||
* @return {Promise<Blob>} Resolves requested thumbnail as blob.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getThumbnail(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<Blob> { return; }
|
||||
|
||||
/**
|
||||
* Returns photo as Blob.
|
||||
* @param photo {string | LibraryItem} Id or LibraryItem.
|
||||
* @param options {GetPhotoOptions} Optional options.
|
||||
* @return {Promise<Blob>} Resolves requested photo as blob.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getPhoto(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<Blob> { return; }
|
||||
|
||||
/**
|
||||
* Saves image to specified album. Album will be created if not exists.
|
||||
* LibraryItem that represents saved image is returned.
|
||||
* @param url {string} URL of a file, or DataURL.
|
||||
* @param album {AlbumItem | string} Name of an album or AlbumItem object.
|
||||
* @param options {GetThumbnailOptions} Options, like thumbnail size for resulting LibraryItem.
|
||||
* @return {Promise<LibraryItem>} Resolves to LibraryItem that represents saved image.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static saveImage(url: string, album: AlbumItem | string, options?: GetThumbnailOptions): Promise<LibraryItem> { return; }
|
||||
|
||||
/**
|
||||
* Saves video to specified album. Album will be created if not exists.
|
||||
* @param url {string} URL of a file, or DataURL.
|
||||
* @param album {AlbumItem | string} Name of an album or AlbumItem object.
|
||||
* @return {Promise<void>} Resolves when save operation completes.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static saveVideo(url: string, album: AlbumItem | string): Promise<void> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface LibraryItem {
|
||||
/**
|
||||
* Local id of the photo
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* URL of cdvphotolibrary schema.
|
||||
*/
|
||||
photoURL: string;
|
||||
/**
|
||||
* URL of cdvphotolibrary schema.
|
||||
*/
|
||||
thumbnailURL: string;
|
||||
fileName: string;
|
||||
width: number;
|
||||
height: number;
|
||||
creationDate: Date;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
albumIds?: string[];
|
||||
}
|
||||
|
||||
export interface AlbumItem {
|
||||
/**
|
||||
* Local id of the album
|
||||
*/
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface GetLibraryOptions {
|
||||
thumbnailWidth?: number;
|
||||
thumbnailHeight?: number;
|
||||
quality?: number;
|
||||
itemsInChunk?: number;
|
||||
chunkTimeSec?: number;
|
||||
useOriginalFileNames?: boolean;
|
||||
includeAlbumData?: boolean;
|
||||
}
|
||||
|
||||
export interface RequestAuthorizationOptions {
|
||||
read?: boolean;
|
||||
write?: boolean;
|
||||
}
|
||||
|
||||
export interface GetThumbnailOptions {
|
||||
thumbnailWidth?: number;
|
||||
thumbnailHeight?: number;
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
export interface GetPhotoOptions {
|
||||
}
|
||||
@@ -378,14 +378,6 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
|
||||
return;
|
||||
}
|
||||
|
||||
let method = pluginInstance[methodName];
|
||||
if (!method) {
|
||||
observer.error({
|
||||
error: 'no_such_method'
|
||||
});
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
pluginInstance[methodName] = observer.next.bind(observer);
|
||||
});
|
||||
}
|
||||
@@ -560,3 +552,52 @@ export function CordovaFunctionOverride(opts: any = {}) {
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CordovaFiniteObservableOptions extends CordovaOptions {
|
||||
/**
|
||||
* Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete.
|
||||
*/
|
||||
resultFinalPredicate?: (result: any) => boolean;
|
||||
/**
|
||||
* Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result.
|
||||
*/
|
||||
resultTransform?: (result: any) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes.
|
||||
*
|
||||
*/
|
||||
export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) {
|
||||
if (opts.observable === false) {
|
||||
throw new Error('CordovaFiniteObservable decorator can only be used on methods that returns observable. Please provide correct option.');
|
||||
}
|
||||
opts.observable = true;
|
||||
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
let wrappedObservable: Observable<any> = wrap(this, methodName, opts).apply(this, args);
|
||||
return new Observable<any>((observer) => {
|
||||
let wrappedSubscription = wrappedObservable.subscribe({
|
||||
next: (x) => {
|
||||
observer.next(opts.resultTransform ? opts.resultTransform(x) : x);
|
||||
if (opts.resultFinalPredicate && opts.resultFinalPredicate(x)) {
|
||||
observer.complete();
|
||||
}
|
||||
},
|
||||
error: (err) => { observer.error(err); },
|
||||
complete: () => { observer.complete(); }
|
||||
});
|
||||
return () => {
|
||||
wrappedSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export class SafariViewController {
|
||||
* Hides Safari View Controller
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(): void { }
|
||||
static hide(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
|
||||
|
||||
@@ -21,7 +21,7 @@ declare var sqlitePlugin;
|
||||
* })
|
||||
* .then((db: SQLite) => {
|
||||
*
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {});
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', []).then(() => {}).catch(() => {});
|
||||
*
|
||||
* })
|
||||
* .catch(error => console.error('Error opening database', error));
|
||||
@@ -33,7 +33,7 @@ declare var sqlitePlugin;
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', []).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql: ', err);
|
||||
|
||||
@@ -52,7 +52,6 @@ export interface StripeCardTokenParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Stripe
|
||||
* @description
|
||||
* A plugin that allows you to use Stripe's Native SDKs for Android and iOS.
|
||||
|
||||
Reference in New Issue
Block a user