mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f368b61be | ||
|
|
af4d5e8968 | ||
|
|
0378b1d7fd | ||
|
|
57e2691889 | ||
|
|
09a7dcf594 | ||
|
|
fd8107b79a | ||
|
|
4f86320696 | ||
|
|
39f1971471 | ||
|
|
60db10c1d3 | ||
|
|
2a32624d9d | ||
|
|
2fba915b88 | ||
|
|
318ad3f4e0 | ||
|
|
c1748bbc28 | ||
|
|
06fa7452dd | ||
|
|
2eea3df2c4 | ||
|
|
13484f9843 | ||
|
|
91ee5bde5f | ||
|
|
21d40888d8 | ||
|
|
f0e219570e | ||
|
|
104532e1d7 | ||
|
|
97cf22eedb | ||
|
|
9c5b593d6b | ||
|
|
26394865fc | ||
|
|
07c867d98e | ||
|
|
fc879926b2 | ||
|
|
281e37ee04 | ||
|
|
8de37939fb | ||
|
|
448ec7a72b | ||
|
|
da72500c4b | ||
|
|
0c466d9739 | ||
|
|
8e0027b974 | ||
|
|
234ed6e9e7 | ||
|
|
4426e59176 | ||
|
|
f22874342a | ||
|
|
6bcd5d3183 | ||
|
|
407659a3ef | ||
|
|
5ef669ae91 | ||
|
|
4a39ebd873 | ||
|
|
23b97f6b4a | ||
|
|
093c8a8231 | ||
|
|
85a3a40795 | ||
|
|
b4b7cfa473 | ||
|
|
884ce54181 | ||
|
|
70847d1b2b | ||
|
|
ff26f2a019 | ||
|
|
f4b8236c8d | ||
|
|
03ff0a58cf | ||
|
|
c7a888e2de | ||
|
|
439cceea23 | ||
|
|
83f57b9820 | ||
|
|
78fcdc8d80 | ||
|
|
53f7056b16 | ||
|
|
b7701cdb16 | ||
|
|
94a4519f2b | ||
|
|
6fe52b610b | ||
|
|
434a6c8ad3 | ||
|
|
97489ba573 | ||
|
|
f525a25b49 | ||
|
|
add49e8b4d | ||
|
|
4ab87d8abb | ||
|
|
69ff7afb48 | ||
|
|
62a30c7d8f | ||
|
|
dc37d8f71c | ||
|
|
8864d1360a | ||
|
|
613141998a | ||
|
|
c2fbb4fb64 | ||
|
|
f0cf86076c | ||
|
|
a03afcf0fa | ||
|
|
3abe0bb97d | ||
|
|
a5b4632ceb | ||
|
|
1c78f77c0f | ||
|
|
cb7d3ef3e0 | ||
|
|
5e83a09056 | ||
|
|
b85393de89 | ||
|
|
68c535fd79 | ||
|
|
1c09ee1fbc | ||
|
|
8b921165bb | ||
|
|
0c837de499 | ||
|
|
a44500d206 | ||
|
|
e063613c8c | ||
|
|
416071a5a1 | ||
|
|
93fdb7eabb | ||
|
|
466437a683 | ||
|
|
a34723b53c | ||
|
|
b9bd5100a2 | ||
|
|
51bafccf38 |
69
CHANGELOG.md
69
CHANGELOG.md
@@ -1,3 +1,72 @@
|
||||
<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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **pin-dialog:** add missing errorIndex ([b7701cd](https://github.com/driftyco/ionic-native/commit/b7701cd))
|
||||
|
||||
|
||||
|
||||
<a name="2.5.0"></a>
|
||||
# [2.5.0](https://github.com/driftyco/ionic-native/compare/v2.4.1...v2.5.0) (2017-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **file-transfer:** fix return type of upload method ([a5b4632](https://github.com/driftyco/ionic-native/commit/a5b4632)), closes [#1002](https://github.com/driftyco/ionic-native/issues/1002)
|
||||
* **pinterest:** fix PinterestPin interface ([a03afcf](https://github.com/driftyco/ionic-native/commit/a03afcf))
|
||||
* **safari-view-controller:** fix issue caused by calling show without options ([dc37d8f](https://github.com/driftyco/ionic-native/commit/dc37d8f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **background-geolocation:** add missing properties for Android ([f0cf860](https://github.com/driftyco/ionic-native/commit/f0cf860))
|
||||
* **barcodescanner:** add option disableSuccessBeep ([#1035](https://github.com/driftyco/ionic-native/issues/1035)) ([97489ba](https://github.com/driftyco/ionic-native/commit/97489ba))
|
||||
* **inappbrowser:** add hide function ([#1018](https://github.com/driftyco/ionic-native/issues/1018)) ([4ab87d8](https://github.com/driftyco/ionic-native/commit/4ab87d8))
|
||||
|
||||
|
||||
|
||||
<a name="2.4.1"></a>
|
||||
## [2.4.1](https://github.com/driftyco/ionic-native/compare/v2.4.0...v2.4.1) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **screen-orientation:** lockOrientation returns a promise ([1c09ee1](https://github.com/driftyco/ionic-native/commit/1c09ee1)), closes [#939](https://github.com/driftyco/ionic-native/issues/939)
|
||||
|
||||
|
||||
|
||||
<a name="2.4.0"></a>
|
||||
# [2.4.0](https://github.com/driftyco/ionic-native/compare/v2.3.3...v2.4.0) (2017-01-24)
|
||||
|
||||
|
||||
|
||||
<a name="2.3.3"></a>
|
||||
## [2.3.3](https://github.com/driftyco/ionic-native/compare/v2.3.2...v2.3.3) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **google-maps:** fix event listeners ([416071a](https://github.com/driftyco/ionic-native/commit/416071a)), closes [#999](https://github.com/driftyco/ionic-native/issues/999)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **pinterest:** add pinterest plugin ([466437a](https://github.com/driftyco/ionic-native/commit/466437a))
|
||||
|
||||
|
||||
|
||||
<a name="2.3.2"></a>
|
||||
## [2.3.2](https://github.com/driftyco/ionic-native/compare/v2.3.1...v2.3.2) (2017-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **googlemaps:** fix GoogleMapsLaLngBounds ([c3127d3](https://github.com/driftyco/ionic-native/commit/c3127d3)), closes [#972](https://github.com/driftyco/ionic-native/issues/972)
|
||||
|
||||
|
||||
|
||||
<a name="2.3.1"></a>
|
||||
## [2.3.1](https://github.com/driftyco/ionic-native/compare/v2.3.0...v2.3.1) (2017-01-22)
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Let us know or submit a PR! Take a look at [the Developer Guide](https://github.
|
||||
|
||||
# Credits
|
||||
|
||||
Ibrahim Hadeed - [@ihadeed](http://github.com/ihadeed)
|
||||
Ibby Hadeed - [@ihadeed](http://github.com/ihadeed)
|
||||
|
||||
Tim Lancina - [@timlancina](http://twitter.com/timlancina)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.3.1",
|
||||
"version": "2.5.1",
|
||||
"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",
|
||||
|
||||
28
src/index.ts
28
src/index.ts
@@ -3,14 +3,17 @@ import { initAngular1 } from './ng1';
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
|
||||
declare var window;
|
||||
|
||||
import { ActionSheet } from './plugins/actionsheet';
|
||||
import { AdMob } from './plugins/admob';
|
||||
import { Alipay } from './plugins/alipay';
|
||||
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||
import { AppAvailability } from './plugins/appavailability';
|
||||
import { Appodeal } from './plugins/appodeal';
|
||||
import { AppRate } from './plugins/apprate';
|
||||
import { AppUpdate } from './plugins/app-update';
|
||||
import { AppVersion } from './plugins/appversion';
|
||||
import { Badge } from './plugins/badge';
|
||||
import { BackgroundFetch } from './plugins/background-fetch';
|
||||
import { BackgroundGeolocation } from './plugins/background-geolocation';
|
||||
import { BackgroundMode } from './plugins/backgroundmode';
|
||||
import { Backlight } from './plugins/backlight';
|
||||
@@ -18,6 +21,7 @@ import { BarcodeScanner } from './plugins/barcodescanner';
|
||||
import { Base64ToGallery } from './plugins/base64togallery';
|
||||
import { BatteryStatus } from './plugins/batterystatus';
|
||||
import { Brightness } from './plugins/brightness';
|
||||
import { BrowserTab } from './plugins/browser-tab';
|
||||
import { BLE } from './plugins/ble';
|
||||
import { BluetoothSerial } from './plugins/bluetoothserial';
|
||||
import { Broadcaster } from './plugins/broadcaster';
|
||||
@@ -29,6 +33,7 @@ import { CardIO } from './plugins/card-io';
|
||||
import { Clipboard } from './plugins/clipboard';
|
||||
import { CodePush } from './plugins/code-push';
|
||||
import { Contacts } from './plugins/contacts';
|
||||
import { CouchbaseLite } from './plugins/couchbase-lite';
|
||||
import { Crop } from './plugins/crop';
|
||||
import { DatePicker } from './plugins/datepicker';
|
||||
import { DBMeter } from './plugins/dbmeter';
|
||||
@@ -57,6 +62,7 @@ import { Globalization } from './plugins/globalization';
|
||||
import { GooglePlus } from './plugins/google-plus';
|
||||
import { GoogleMap } from './plugins/googlemap';
|
||||
import { GoogleAnalytics } from './plugins/googleanalytics';
|
||||
import { Gyroscope } from './plugins/gyroscope';
|
||||
import { HeaderColor } from './plugins/headercolor';
|
||||
import { Hotspot } from './plugins/hotspot';
|
||||
import { HTTP } from './plugins/http';
|
||||
@@ -91,6 +97,7 @@ import { PhotoViewer } from './plugins/photo-viewer';
|
||||
import { ScreenOrientation } from './plugins/screen-orientation';
|
||||
import { PayPal } from './plugins/pay-pal';
|
||||
import { PinDialog } from './plugins/pin-dialog';
|
||||
import { Pinterest } from './plugins/pinterest';
|
||||
import { PowerManagement } from './plugins/power-management';
|
||||
import { Printer } from './plugins/printer';
|
||||
import { Push } from './plugins/push';
|
||||
@@ -117,6 +124,7 @@ import { TouchID } from './plugins/touchid';
|
||||
import { TextToSpeech } from './plugins/text-to-speech';
|
||||
import { ThemeableBrowser } from './plugins/themeable-browser';
|
||||
import { TwitterConnect } from './plugins/twitter-connect';
|
||||
import { UniqueDeviceID } from './plugins/unique-device-id';
|
||||
import { Vibration } from './plugins/vibration';
|
||||
import { VideoEditor } from './plugins/video-editor';
|
||||
import { VideoPlayer } from './plugins/video-player';
|
||||
@@ -127,10 +135,14 @@ import { Zip } from './plugins/zip';
|
||||
export * from './plugins/3dtouch';
|
||||
export * from './plugins/actionsheet';
|
||||
export * from './plugins/admob';
|
||||
export * from './plugins/alipay';
|
||||
export * from './plugins/android-fingerprint-auth';
|
||||
export * from './plugins/appavailability';
|
||||
export * from './plugins/appodeal';
|
||||
export * from './plugins/apprate';
|
||||
export * from './plugins/app-update';
|
||||
export * from './plugins/appversion';
|
||||
export * from './plugins/background-fetch';
|
||||
export * from './plugins/background-geolocation';
|
||||
export * from './plugins/backgroundmode';
|
||||
export * from './plugins/backlight';
|
||||
@@ -141,6 +153,7 @@ export * from './plugins/batterystatus';
|
||||
export * from './plugins/ble';
|
||||
export * from './plugins/bluetoothserial';
|
||||
export * from './plugins/brightness';
|
||||
export * from './plugins/browser-tab';
|
||||
export * from './plugins/broadcaster';
|
||||
export * from './plugins/calendar';
|
||||
export * from './plugins/call-number';
|
||||
@@ -150,6 +163,7 @@ export * from './plugins/card-io';
|
||||
export * from './plugins/clipboard';
|
||||
export * from './plugins/code-push';
|
||||
export * from './plugins/contacts';
|
||||
export * from './plugins/couchbase-lite';
|
||||
export * from './plugins/crop';
|
||||
export * from './plugins/datepicker';
|
||||
export * from './plugins/dbmeter';
|
||||
@@ -178,6 +192,7 @@ export * from './plugins/globalization';
|
||||
export * from './plugins/google-plus';
|
||||
export * from './plugins/googleanalytics';
|
||||
export * from './plugins/googlemap';
|
||||
export * from './plugins/gyroscope';
|
||||
export * from './plugins/headercolor';
|
||||
export * from './plugins/hotspot';
|
||||
export * from './plugins/http';
|
||||
@@ -211,6 +226,7 @@ export * from './plugins/onesignal';
|
||||
export * from './plugins/pay-pal';
|
||||
export * from './plugins/photo-viewer';
|
||||
export * from './plugins/pin-dialog';
|
||||
export * from './plugins/pinterest';
|
||||
export * from './plugins/plugin';
|
||||
export * from './plugins/power-management';
|
||||
export * from './plugins/printer';
|
||||
@@ -238,6 +254,7 @@ export * from './plugins/themeable-browser';
|
||||
export * from './plugins/toast';
|
||||
export * from './plugins/touchid';
|
||||
export * from './plugins/twitter-connect';
|
||||
export * from './plugins/unique-device-id';
|
||||
export * from './plugins/vibration';
|
||||
export * from './plugins/video-editor';
|
||||
export * from './plugins/video-player';
|
||||
@@ -250,18 +267,23 @@ export * from './plugins/zip';
|
||||
window['IonicNative'] = {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
Alipay,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
Appodeal,
|
||||
AppRate,
|
||||
AppUpdate,
|
||||
AppVersion,
|
||||
Badge,
|
||||
BackgroundGeolocation,
|
||||
BackgroundFetch,
|
||||
BackgroundMode,
|
||||
Backlight,
|
||||
BarcodeScanner,
|
||||
Base64ToGallery,
|
||||
BatteryStatus,
|
||||
Brightness,
|
||||
BrowserTab,
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
Broadcaster,
|
||||
@@ -273,6 +295,7 @@ window['IonicNative'] = {
|
||||
Clipboard,
|
||||
CodePush,
|
||||
Contacts,
|
||||
CouchbaseLite,
|
||||
Crop,
|
||||
DatePicker,
|
||||
DBMeter,
|
||||
@@ -300,6 +323,7 @@ window['IonicNative'] = {
|
||||
GooglePlus,
|
||||
GoogleMap,
|
||||
GoogleAnalytics,
|
||||
Gyroscope,
|
||||
HeaderColor,
|
||||
Hotspot,
|
||||
HTTP,
|
||||
@@ -336,6 +360,7 @@ window['IonicNative'] = {
|
||||
PhotoViewer,
|
||||
ScreenOrientation,
|
||||
PinDialog,
|
||||
Pinterest,
|
||||
PowerManagement,
|
||||
Rollbar,
|
||||
SafariViewController,
|
||||
@@ -361,6 +386,7 @@ window['IonicNative'] = {
|
||||
TextToSpeech,
|
||||
ThemeableBrowser,
|
||||
TwitterConnect,
|
||||
UniqueDeviceID,
|
||||
VideoEditor,
|
||||
VideoPlayer,
|
||||
Vibration,
|
||||
|
||||
111
src/plugins/alipay.ts
Normal file
111
src/plugins/alipay.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
/**
|
||||
* @link https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.wlOhAE&treeId=193&articleId=105465&docType=1
|
||||
*
|
||||
* All values need be urlencoded.
|
||||
*/
|
||||
export interface AlipayOrder {
|
||||
/**
|
||||
* appId assigned by Alipay
|
||||
*/
|
||||
app_id: string;
|
||||
|
||||
/**
|
||||
* Api name.
|
||||
* Should be: alipay.trade.app.pay
|
||||
*/
|
||||
method: string;
|
||||
|
||||
/**
|
||||
* Data format
|
||||
* Default: "JSON"
|
||||
*/
|
||||
format?: string;
|
||||
|
||||
/**
|
||||
* Charset
|
||||
* Possible values: "UTF-8", "GBK"
|
||||
* Default: "UTF-8"
|
||||
*/
|
||||
charset: string;
|
||||
|
||||
/**
|
||||
* Sign method
|
||||
* Default: 'RSA'
|
||||
*/
|
||||
sign_type: string;
|
||||
|
||||
/**
|
||||
* Sign value. Should be got from server side.
|
||||
* Default: 'RSA'
|
||||
*/
|
||||
sign: string;
|
||||
|
||||
/**
|
||||
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
|
||||
*/
|
||||
timestamp: string;
|
||||
|
||||
/**
|
||||
* Api version. Fixed value '1.0'
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* Notify url.
|
||||
*/
|
||||
notify_url: string;
|
||||
|
||||
/**
|
||||
* biz content. formated in json. see alipay doc for detail.
|
||||
*/
|
||||
biz_content: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Alipay
|
||||
* @description
|
||||
* This plugin is used for Alipay APP support. Integrated with the latest SDK.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Alipay } from 'ionic-native';
|
||||
*
|
||||
* // Should get from server side with sign.
|
||||
* let alipayOrder = {
|
||||
...
|
||||
* };
|
||||
*
|
||||
* Alipay.pay(alipayOrder)
|
||||
* .then(result => {
|
||||
* console.log(result); // Success
|
||||
* })
|
||||
* .catch(error => {
|
||||
* console.log(error); // Failed
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* AlipayOrder
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Alipay',
|
||||
plugin: 'cordova-alipay-base',
|
||||
pluginRef: 'Alipay.Base',
|
||||
repo: 'https://github.com/xueron/cordova-alipay-base',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
})
|
||||
export class Alipay {
|
||||
/**
|
||||
* Open Alipay to perform App pay
|
||||
* @param order { AlipayOrder } alipay options
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
static pay(order: AlipayOrder): Promise<any> { return; }
|
||||
}
|
||||
|
||||
49
src/plugins/app-update.ts
Normal file
49
src/plugins/app-update.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name AppUpdate
|
||||
* @description
|
||||
* This plugin does self-update for android
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* You should first host an XML file on your server with the following data in it:
|
||||
* ```xml
|
||||
* <update>
|
||||
* <version>302048</version>
|
||||
* <name>APK Name</name>
|
||||
* <url>https://your-remote-api.com/YourApp.apk</url>
|
||||
* </update>
|
||||
* ```
|
||||
*
|
||||
* Then use the following code:
|
||||
*
|
||||
* ```
|
||||
* import { AppUpdate } from 'ionic-native';
|
||||
*
|
||||
* let updateUrl = 'http://your-remote-api.com/update.xml';
|
||||
*
|
||||
* AppUpdate.checkAppUpdate(updateUrl);
|
||||
* ```
|
||||
*
|
||||
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppUpdate',
|
||||
plugin: 'cordova-plugin-app-update',
|
||||
pluginRef: 'AppUpdate',
|
||||
repo: 'https://github.com/vaenow/cordova-plugin-app-update',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class AppUpdate {
|
||||
/**
|
||||
* Check and update
|
||||
* @param updateUrl {string} update api url
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static checkAppUpdate(updateUrl: string): Promise<any> { return; }
|
||||
}
|
||||
|
||||
443
src/plugins/appodeal.ts
Normal file
443
src/plugins/appodeal.ts
Normal file
@@ -0,0 +1,443 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name Appodeal
|
||||
* @description
|
||||
* Plugin to serve ads through native Appodeal SDKs
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Appodeal } from 'ionic-native';
|
||||
*
|
||||
* let appKey = '<your app key>';
|
||||
* Appodeal.initialize(appKey, Appodeal.AD_TYPES.REWARDED_VIDEO);
|
||||
* Appodeal.show(Appodeal.AD_TYPES.REWARDED_VIDEO);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Appodeal',
|
||||
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
|
||||
pluginRef: 'Appodeal',
|
||||
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
|
||||
platforms: [ 'ios', 'android' ]
|
||||
})
|
||||
export class Appodeal {
|
||||
// available types of advertisements
|
||||
static readonly AD_TYPES = {
|
||||
INTERSTITIAL: 1,
|
||||
SKIPPABLE_VIDEO: 2,
|
||||
BANNER: 4,
|
||||
BANNER_BOTTOM: 8,
|
||||
BANNER_TOP: 16,
|
||||
REWARDED_VIDEO: 128,
|
||||
NON_SKIPPABLE_VIDEO: 256
|
||||
};
|
||||
|
||||
/**
|
||||
* initialize Appodeal SDK
|
||||
* @param {string} appKey
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static initialize(appKey: string, adType: number): void {};
|
||||
|
||||
/**
|
||||
* check if SDK has been initialized
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isInitialized(): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* show ad of specified type
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static show(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* show ad of specified type with placement options
|
||||
* @param {number} adType
|
||||
* @param {any} placement
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static showWithPlacement(
|
||||
adType: number,
|
||||
placement: any
|
||||
): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* hide ad of specified type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static hide(adType: number): void {};
|
||||
|
||||
/**
|
||||
* confirm use of ads of specified type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static confirm(adType: number): void {};
|
||||
|
||||
/**
|
||||
* check if ad of specified type has been loaded
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isLoaded(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
* check if ad of specified
|
||||
* @param {number} adType
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
static isPrecache(adType: number): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} adType
|
||||
* @param autoCache
|
||||
*/
|
||||
@Cordova()
|
||||
static setAutoCache(adType: number, autoCache: any): void {};
|
||||
|
||||
/**
|
||||
* forcefully cache an ad by type
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static cache(adType: number): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {boolean} set
|
||||
*/
|
||||
@Cordova()
|
||||
static setOnLoadedTriggerBoth(set: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable Smart Banners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static setSmartBanners(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable banner backgrounds
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static setBannerBackground(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable banner animations
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static setBannerAnimation(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Cordova()
|
||||
static set728x90Banners(value: any): void {};
|
||||
|
||||
/**
|
||||
* enable or disable logging
|
||||
* @param {boolean} logging
|
||||
*/
|
||||
@Cordova()
|
||||
static setLogging(logging: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable or disable testing mode
|
||||
* @param {boolean} testing
|
||||
*/
|
||||
@Cordova()
|
||||
static setTesting(testing: boolean): void {};
|
||||
|
||||
/**
|
||||
* reset device ID
|
||||
*/
|
||||
@Cordova()
|
||||
static resetUUID(): void {};
|
||||
|
||||
/**
|
||||
* get version of Appdeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
static getVersion(): Promise<any> { return; };
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} network
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static disableNetwork(network?: string, adType?: number): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} network
|
||||
* @param {number} adType
|
||||
*/
|
||||
@Cordova()
|
||||
static disableNetworkType(network?: string, adType?: number): void {};
|
||||
|
||||
/**
|
||||
* disable Location permissions for Appodeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
static disableLocationPermissionCheck(): void {};
|
||||
|
||||
/**
|
||||
* disable Storage permissions for Appodeal SDK
|
||||
*/
|
||||
@Cordova()
|
||||
static disableWriteExternalStoragePermissionCheck(): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static enableInterstitialCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static enableSkippableVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static enableNonSkippableVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static enableBannerCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
* enable event listeners
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
@Cordova()
|
||||
static enableRewardedVideoCallbacks(enabled: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name - name of rule
|
||||
* @param {boolean} value
|
||||
*/
|
||||
@Cordova()
|
||||
static setCustomBooleanRule(name: string, value: boolean): void {};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name - name of rule
|
||||
* @param {number} value
|
||||
*/
|
||||
@Cordova()
|
||||
static setCustomIntegerRule(name: string, value: number): void {};
|
||||
|
||||
/**
|
||||
* set rule with float value
|
||||
* @param {string} name
|
||||
* @param {number} value
|
||||
*/
|
||||
@Cordova()
|
||||
static setCustomDoubleRule(name: string, value: number): void {};
|
||||
|
||||
/**
|
||||
* set rule with string value
|
||||
* @param {string} name - name of rule
|
||||
* @param {string} value
|
||||
*/
|
||||
@Cordova()
|
||||
static setCustomStringRule(name: string, value: string): void {};
|
||||
|
||||
/**
|
||||
* set ID preference in Appodeal for current user
|
||||
* @param id
|
||||
*/
|
||||
@Cordova()
|
||||
static setUserId(id: any): void {};
|
||||
|
||||
/**
|
||||
* set Email preference in Appodeal for current user
|
||||
* @param email
|
||||
*/
|
||||
@Cordova()
|
||||
static setEmail(email: any): void {};
|
||||
|
||||
/**
|
||||
* set Birthday preference in Appodeal for current user
|
||||
* @param birthday
|
||||
*/
|
||||
@Cordova()
|
||||
static setBirthday(birthday: any): void {};
|
||||
|
||||
/**
|
||||
* et Age preference in Appodeal for current user
|
||||
* @param age
|
||||
*/
|
||||
@Cordova()
|
||||
static setAge(age: any): void {};
|
||||
|
||||
/**
|
||||
* set Gender preference in Appodeal for current user
|
||||
* @param gender
|
||||
*/
|
||||
@Cordova()
|
||||
static setGender(gender: any): void {};
|
||||
|
||||
/**
|
||||
* set Occupation preference in Appodeal for current user
|
||||
* @param occupation
|
||||
*/
|
||||
@Cordova()
|
||||
static setOccupation(occupation: any): void {};
|
||||
|
||||
/**
|
||||
* set Relation preference in Appodeal for current user
|
||||
* @param relation
|
||||
*/
|
||||
@Cordova()
|
||||
static setRelation(relation: any): void {};
|
||||
|
||||
/**
|
||||
* set Smoking preference in Appodeal for current user
|
||||
* @param smoking
|
||||
*/
|
||||
@Cordova()
|
||||
static setSmoking(smoking: any): void {};
|
||||
|
||||
/**
|
||||
* set Alcohol preference in Appodeal for current user
|
||||
* @param alcohol
|
||||
*/
|
||||
@Cordova()
|
||||
static setAlcohol(alcohol: any): void {};
|
||||
|
||||
/**
|
||||
* set Interests preference in Appodeal for current user
|
||||
* @param interests
|
||||
*/
|
||||
@Cordova()
|
||||
static setInterests(interests: any): void {};
|
||||
|
||||
/*********************
|
||||
* event Observables *
|
||||
*********************/
|
||||
|
||||
static onInterstitialLoaded(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onInterstitialLoaded');
|
||||
}
|
||||
|
||||
static onInterstitialFailedToLoad(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onInterstitialFailedToLoad');
|
||||
}
|
||||
|
||||
static onInterstitialShown(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onInterstitialShown');
|
||||
}
|
||||
|
||||
static onInterstitialClicked(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onInterstitialClicked');
|
||||
}
|
||||
|
||||
static onInterstitialClosed(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onInterstitialClosed');
|
||||
}
|
||||
|
||||
static onSkippableVideoLoaded(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onSkippableVideoLoaded');
|
||||
}
|
||||
|
||||
static onSkippableVideoFailedToLoad(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onSkippableVideoFailedToLoad');
|
||||
}
|
||||
|
||||
static onSkippableVideoShown(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onSkippableVideoShown');
|
||||
}
|
||||
|
||||
static onSkippableVideoFinished(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onSkippableVideoFinished');
|
||||
}
|
||||
|
||||
static onSkippableVideoClosed(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onSkippableVideoClosed');
|
||||
}
|
||||
|
||||
static onRewardedVideoLoaded(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onRewardedVideoLoaded');
|
||||
}
|
||||
|
||||
static onRewardedVideoFailedToLoad(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onRewardedVideoFailedToLoad');
|
||||
}
|
||||
|
||||
static onRewardedVideoShown(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onRewardedVideoShown');
|
||||
}
|
||||
|
||||
static onRewardedVideoFinished(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onRewardedVideoFinished');
|
||||
}
|
||||
|
||||
static onRewardedVideoClosed(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onRewardedVideoClosed');
|
||||
}
|
||||
|
||||
static onNonSkippableVideoLoaded(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onNonSkippableVideoLoaded');
|
||||
}
|
||||
|
||||
static onNonSkippableVideoFailedToLoad(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onNonSkippableVideoFailedToLoad');
|
||||
}
|
||||
|
||||
static onNonSkippableVideoShown(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onNonSkippableVideoShown');
|
||||
}
|
||||
|
||||
static onNonSkippableVideoFinished(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onNonSkippableVideoFinished');
|
||||
}
|
||||
|
||||
static onNonSkippableVideoClosed(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onNonSkippableVideoClosed');
|
||||
}
|
||||
|
||||
static onBannerClicked(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onBannerClicked');
|
||||
}
|
||||
|
||||
static onBannerFailedToLoad(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onBannerFailedToLoad');
|
||||
}
|
||||
|
||||
static onBannerLoaded(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onBannerLoaded');
|
||||
}
|
||||
|
||||
static onBannerShown(): Observable<any> {
|
||||
return Observable.fromEvent(document, 'onBannerShown');
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,11 @@ export interface AppRateStoreAppUrls {
|
||||
*/
|
||||
android?: string;
|
||||
|
||||
/**
|
||||
* application URL in Windows Store
|
||||
*/
|
||||
windows?: string;
|
||||
|
||||
/**
|
||||
* application URL in AppWorld
|
||||
*/
|
||||
@@ -103,6 +108,7 @@ export interface AppRateStoreAppUrls {
|
||||
* AppRate.preferences.storeAppURL = {
|
||||
* ios: '<my_app_id>',
|
||||
* android: 'market://details?id=<package_name>',
|
||||
* windows: 'ms-windows-store://review/?ProductId=<Store_ID>'
|
||||
* };
|
||||
*
|
||||
* AppRate.promptForRating(false);
|
||||
@@ -119,7 +125,7 @@ export interface AppRateStoreAppUrls {
|
||||
plugin: 'cordova-plugin-apprate',
|
||||
pluginRef: 'AppRate',
|
||||
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS', 'Windows (experimental)']
|
||||
})
|
||||
export class AppRate {
|
||||
|
||||
|
||||
107
src/plugins/background-fetch.ts
Normal file
107
src/plugins/background-fetch.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import {Cordova, Plugin} from './plugin';
|
||||
|
||||
declare var window;
|
||||
|
||||
|
||||
export interface BackgroundFetchConfig {
|
||||
|
||||
/**
|
||||
* Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name BackgroundFetch
|
||||
* @description
|
||||
* iOS Background Fetch Implementation. See: https://developer.apple.com/reference/uikit/uiapplication#1657399
|
||||
* iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example).
|
||||
* For more detail, please see https://github.com/transistorsoft/cordova-plugin-background-fetch
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundFetch } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // When device is ready :
|
||||
* platform.ready().then(() => {
|
||||
*
|
||||
* let config = {
|
||||
* stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
|
||||
* };
|
||||
*
|
||||
* BackgroundFetch.configure(() => {
|
||||
console.log('[js] BackgroundFetch initiated');
|
||||
|
||||
// perform some ajax request to server here
|
||||
|
||||
You MUST called #finish so that native-side can signal completion of the background-thread to the os.
|
||||
BackgroundFetch.finish();
|
||||
|
||||
* }, (error) => {
|
||||
* console.log('- BackgroundFetch failed', error);
|
||||
* }, config);
|
||||
*
|
||||
* });
|
||||
*
|
||||
* // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
|
||||
* BackgroundFetch.start();
|
||||
*
|
||||
* // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
|
||||
* BackgroundFetch.stop();
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* BackgroundFetchConfig
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundFetch',
|
||||
plugin: 'cordova-plugin-background-fetch',
|
||||
pluginRef: 'BackgroundFetch',
|
||||
repo: 'https://github.com/transistorsoft/cordova-plugin-background-fetch',
|
||||
platforms: ['iOS']
|
||||
})
|
||||
export class BackgroundFetch {
|
||||
|
||||
|
||||
/**
|
||||
* Configures the plugin's fetch callbackFn
|
||||
*
|
||||
* @param {Function} callbackFn This callback will fire each time an iOS background-fetch event occurs (typically every 15 min).
|
||||
* @param {Function} errorCallback The failureFn will be called if the device doesn't support background-fetch.
|
||||
* @param {BackgroundFetchConfig} config Configuration for plugin
|
||||
* @return Location object, which tries to mimic w3c Coordinates interface.
|
||||
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
|
||||
* Callback to be executed every time a geolocation is recorded in the background.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
static configure(callbackFn: Function, errorCallback: Function, config: BackgroundFetchConfig): any { return; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start the background-fetch API.
|
||||
* Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static start(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stop(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* You MUST call this method in your fetch callbackFn provided to #configure in order to signal to iOS that your fetch action is complete. iOS provides only 30s of background-time for a fetch-event -- if you exceed this 30s, iOS will kill your app.
|
||||
*/
|
||||
@Cordova()
|
||||
static finish() { }
|
||||
}
|
||||
@@ -126,10 +126,14 @@ export interface BackgroundGeolocationConfig {
|
||||
|
||||
/**
|
||||
* ANDROID, WP8 ONLY
|
||||
* The minimum time interval between location updates in seconds.
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_DISTANCE_FILTER_PROVIDER:
|
||||
* The minimum time interval between location updates in milliseconds.
|
||||
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
|
||||
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||
* for more information
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER:
|
||||
* Rate in milliseconds at which your app prefers to receive location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getInterval())
|
||||
*/
|
||||
interval?: number;
|
||||
|
||||
@@ -225,6 +229,28 @@ export interface BackgroundGeolocationConfig {
|
||||
* Defaults to 10000
|
||||
*/
|
||||
maxLocations?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* Fastest rate in milliseconds at which your app can handle location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval())
|
||||
*/
|
||||
fastestInterval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life.
|
||||
*/
|
||||
activitiesInterval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* stop() is forced, when the STILL activity is detected (default is true)
|
||||
*/
|
||||
stopOnStillActivity?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,14 +365,12 @@ export class BackgroundGeolocation {
|
||||
* @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 Location object, which tries to mimic w3c Coordinates interface.
|
||||
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
|
||||
* Callback to be executed every time a geolocation is recorded in the background.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static configure(callback: Function, errorCallback: Function, options: BackgroundGeolocationConfig): any { return; }
|
||||
static configure(options: BackgroundGeolocationConfig): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Turn ON the background-geolocation system.
|
||||
@@ -365,17 +389,21 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Inform the native plugin that you're finished, the background-task may be completed
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static finish() { }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
static finish(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Force the plugin to enter "moving" or "stationary" state
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static changePace(isMoving: boolean) { }
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
static changePace(isMoving: boolean): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Setup configuration
|
||||
@@ -388,27 +416,30 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Returns current stationaryLocation if available. null if not
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<Location>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
static getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
|
||||
|
||||
/**
|
||||
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
|
||||
* your #success callback will be executed with #location param containing #radius of region
|
||||
* NOTE: IOS, WP only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Windows Phone']
|
||||
})
|
||||
static onStationary(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if location is enabled on the device
|
||||
* @returns {Promise<number>} Returns a promise with int argument that takes values 0, 1 (true).
|
||||
* NOTE: ANDROID only
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static isLocationEnabled(): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
@@ -427,18 +458,21 @@ export class BackgroundGeolocation {
|
||||
* Method can be used to detect user changes in location services settings.
|
||||
* If user enable or disable location services then success callback will be executed.
|
||||
* In case or error (SettingNotFoundException) fail callback will be executed.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static watchLocationMode(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Stop watching for location mode changes.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static stopWatchingLocationMode() { }
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static stopWatchingLocationMode(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Method will return all stored locations.
|
||||
@@ -447,10 +481,11 @@ export class BackgroundGeolocation {
|
||||
* by the system
|
||||
* or
|
||||
* - option.debug is true
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static getLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -462,18 +497,20 @@ export class BackgroundGeolocation {
|
||||
|
||||
/**
|
||||
* Delete stored location by given locationId.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static deleteLocation(locationId: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Delete all stored locations.
|
||||
* NOTE: ANDROID only
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
static deleteAllLocations(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
@@ -485,13 +522,13 @@ export class BackgroundGeolocation {
|
||||
*
|
||||
* BackgroundGeolocation.Mode.FOREGROUND
|
||||
* BackgroundGeolocation.Mode.BACKGROUND
|
||||
*
|
||||
* NOTE: iOS only
|
||||
*
|
||||
**
|
||||
* @param {number} See above.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static switchMode(modeId: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
*
|
||||
*
|
||||
* Badge.set(10);
|
||||
* Badge.increase();
|
||||
* Badge.increase(1);
|
||||
* Badge.clear();
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,11 @@ export interface BarcodeScannerOptions {
|
||||
*/
|
||||
disableAnimations?: boolean;
|
||||
|
||||
/**
|
||||
* Disable success beep. Supported on iOS only.
|
||||
*/
|
||||
disableSuccessBeep?: boolean;
|
||||
|
||||
/**
|
||||
* Prompt text. Supported on Android only.
|
||||
*/
|
||||
|
||||
57
src/plugins/browser-tab.ts
Normal file
57
src/plugins/browser-tab.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name BrowserTab
|
||||
* @description
|
||||
* This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { BrowserTab } from 'ionic-native';
|
||||
*
|
||||
* BrowserTab.isAvailable()
|
||||
* .then((isAvailable: boolean) => {
|
||||
*
|
||||
* if (isAvailable) {
|
||||
*
|
||||
* BrowserTab.openUrl('https://ionic.io');
|
||||
*
|
||||
* } else {
|
||||
* // open url with InAppBrowser instead
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BrowserTab',
|
||||
plugin: 'cordova-plugin-browsertab',
|
||||
pluginRef: 'cordova.plugins.browsertab',
|
||||
repo: 'https://github.com/google/cordova-plugin-browsertab',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class BrowserTab {
|
||||
|
||||
/**
|
||||
* Check if BrowserTab option is available
|
||||
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens the provided URL using a browser tab
|
||||
* @param {string} url The URL you want to open
|
||||
* @return {Promise<any>} Returns a promise that resolves when check open was successful
|
||||
*/
|
||||
@Cordova()
|
||||
static openUrl(url: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Closes browser tab
|
||||
* @return {Promise<any>} Returns a promise that resolves when close was finished
|
||||
*/
|
||||
@Cordova()
|
||||
static close(): Promise<any> { return; }
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin'
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
export type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
35
src/plugins/couchbase-lite.ts
Normal file
35
src/plugins/couchbase-lite.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Couchbase Lite
|
||||
* @description
|
||||
* Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { CouchbaseLite } from 'ionic-native';
|
||||
*
|
||||
* CouchbaseLite.getURL()
|
||||
* .then((url: any) => console.log(url))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CouchbaseLite',
|
||||
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
pluginRef: 'cblite',
|
||||
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
|
||||
})
|
||||
export class CouchbaseLite {
|
||||
|
||||
/**
|
||||
* Get the database url
|
||||
* @return {Promise<any>} Returns a promise that resolves with the local database url
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
static getURL(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -41,17 +41,17 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DeviceMotion } from 'ionic-native';
|
||||
* import { DeviceMotion, DeviceMotionAccelerationData } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Get the device current acceleration
|
||||
* DeviceMotion.getCurrentAcceleration().then(
|
||||
* (acceleration: AccelerationData) => console.log(acceleration),
|
||||
* (acceleration: DeviceMotionAccelerationData) => console.log(acceleration),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch device acceleration
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
|
||||
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
|
||||
* console.log(acceleration);
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -46,19 +46,19 @@ export interface DeviceOrientationCompassOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* // CompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
|
||||
* // DeviceOrientationCompassHeading is an interface for compass
|
||||
* import { DeviceOrientation, DeviceOrientationCompassHeading } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* DeviceOrientation.getCurrentHeading().then(
|
||||
* (data: CompassHeading) => console.log(data),
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = DeviceOrientation.watchHeading().subscribe(
|
||||
* (data: CompassHeading) => console.log(data)
|
||||
* (data: DeviceOrientationCompassHeading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Stop watching heading change
|
||||
|
||||
@@ -232,7 +232,10 @@ export class Facebook {
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
successIndex: 3,
|
||||
errorIndex: 4
|
||||
})
|
||||
static logEvent(
|
||||
name: string,
|
||||
params?: Object,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Plugin, Cordova } from './plugin';
|
||||
* import {FileChooser} from 'ionic-native';
|
||||
*
|
||||
* FileChooser.open()
|
||||
* .then(uri => console.log(uri));
|
||||
* .then(uri => console.log(uri))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Plugin, pluginWarn } from './plugin';
|
||||
import {CordovaProperty, Plugin, pluginWarn} from './plugin';
|
||||
|
||||
declare var window: any;
|
||||
declare var cordova: any;
|
||||
@@ -267,7 +267,7 @@ export interface FileWriter extends FileSaver {
|
||||
* Write the supplied data to the file at position.
|
||||
* @param {Blob} data The blob to write.
|
||||
*/
|
||||
write(data: Blob | string): void;
|
||||
write(data: ArrayBuffer | Blob | string): void;
|
||||
/**
|
||||
* The file position at which the next write will occur.
|
||||
* @param offset If nonnegative, an absolute byte offset into the file.
|
||||
@@ -283,7 +283,7 @@ export interface FileWriter extends FileSaver {
|
||||
}
|
||||
|
||||
/* FileWriter states */
|
||||
declare var FileWriter: {
|
||||
export declare var FileWriter: {
|
||||
INIT: number;
|
||||
WRITING: number;
|
||||
DONE: number
|
||||
@@ -308,7 +308,7 @@ export interface FileReader {
|
||||
readAsArrayBuffer(fe: File | Blob): void;
|
||||
}
|
||||
|
||||
declare var FileReader: {
|
||||
export declare var FileReader: {
|
||||
EMPTY: number;
|
||||
LOADING: number;
|
||||
DONE: number;
|
||||
@@ -322,7 +322,7 @@ export interface FileError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
declare var FileError: {
|
||||
export declare var FileError: {
|
||||
new (code: number): FileError;
|
||||
NOT_FOUND_ERR: number;
|
||||
SECURITY_ERR: number;
|
||||
@@ -350,9 +350,9 @@ declare var FileError: {
|
||||
* ```
|
||||
* import { File } from 'ionic-native';
|
||||
*
|
||||
* declare var cordova: any;
|
||||
* const fs:string = cordova.file.dataDirectory;
|
||||
* File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
|
||||
* const dataDirectory: string = File.dataDirectory;
|
||||
*
|
||||
* File.checkDir(dataDirectory, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
|
||||
* ```
|
||||
*
|
||||
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
|
||||
@@ -367,6 +367,80 @@ declare var FileError: {
|
||||
repo: 'https://github.com/apache/cordova-plugin-file'
|
||||
})
|
||||
export class File {
|
||||
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static applicationDirectory: string;
|
||||
|
||||
/**
|
||||
* Read-only directory where the application is installed.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static applicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Where to put app-specific data files.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static dataDirectory: string;
|
||||
|
||||
/**
|
||||
* Cached files that should survive app restarts.
|
||||
* Apps should not rely on the OS to delete files in here.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static cacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application space on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static externalApplicationStorageDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: Where to put app-specific data files on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static externalDataDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the application cache on external storage.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static externalCacheDirectory: string;
|
||||
|
||||
/**
|
||||
* Android: the external storage (SD card) root.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static externalRootDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Temp directory that the OS can clear at will.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static tempDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
|
||||
*/
|
||||
@CordovaProperty
|
||||
static syncedDataDirectory: string;
|
||||
|
||||
/**
|
||||
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
|
||||
*/
|
||||
@CordovaProperty
|
||||
static documentsDirectory: string;
|
||||
|
||||
/**
|
||||
* BlackBerry10: Files globally available to all apps
|
||||
*/
|
||||
@CordovaProperty
|
||||
static sharedDirectory: string;
|
||||
|
||||
static cordovaFileError: {} = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
2: 'SECURITY_ERR',
|
||||
@@ -407,9 +481,9 @@ 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|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
|
||||
*/
|
||||
static checkDir(path: string, dir: string): Promise<boolean|FileError> {
|
||||
static checkDir(path: string, dir: string): Promise<boolean> | Promise<FileError> {
|
||||
if ((/^\//.test(dir))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
@@ -431,9 +505,9 @@ 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|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry> | Promise<FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
|
||||
*/
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry|FileError> {
|
||||
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> | Promise<FileError> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
@@ -459,9 +533,9 @@ export class File {
|
||||
*
|
||||
* @param {string} path The path to the directory
|
||||
* @param {string} dirName The directory name
|
||||
* @returns {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult|FileError> {
|
||||
static removeDir(path: string, dirName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
if ((/^\//.test(dirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
@@ -484,9 +558,9 @@ 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|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
|
||||
* @returns {Promise<DirectoryEntry|Entry> | Promise<FileError>} 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|FileError> {
|
||||
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> | Promise<FileError> {
|
||||
newDirName = newDirName || dirName;
|
||||
|
||||
if ((/^\//.test(newDirName))) {
|
||||
@@ -514,9 +588,9 @@ 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|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||
* @returns {Promise<Entry> | Promise<FileError>} 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|FileError> {
|
||||
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> | Promise<FileError> {
|
||||
if ((/^\//.test(newDirName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'directory cannot start with \/';
|
||||
@@ -587,9 +661,9 @@ 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|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
* @returns {Promise<boolean> | Promise<FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
|
||||
*/
|
||||
static checkFile(path: string, file: string): Promise<boolean|FileError> {
|
||||
static checkFile(path: string, file: string): Promise<boolean> | Promise<FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file cannot start with \/';
|
||||
@@ -616,9 +690,9 @@ 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|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
* @returns {Promise<FileEntry> | Promise<FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
|
||||
*/
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry|FileError> {
|
||||
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> | Promise<FileError> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -644,9 +718,9 @@ 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|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
* @returns {Promise<RemoveResult> | Promise<FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
|
||||
*/
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult|FileError> {
|
||||
static removeFile(path: string, fileName: string): Promise<RemoveResult> | Promise<FileError> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -671,7 +745,7 @@ export class File {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
static writeFile(path: string, fileName: string,
|
||||
text: string | Blob, options: WriteOptions = {}): Promise<any> {
|
||||
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
|
||||
if ((/^\//.test(fileName))) {
|
||||
const err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -700,7 +774,7 @@ export class File {
|
||||
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
|
||||
*/
|
||||
private static writeFileEntry(fe: FileEntry, text: string | Blob, options: WriteOptions) {
|
||||
private static writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
|
||||
return File.createWriter(fe)
|
||||
.then((writer) => {
|
||||
if (options.append) {
|
||||
@@ -733,9 +807,9 @@ 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|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
|
||||
* @returns {Promise<string> | Promise<FileError>} 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|FileError> {
|
||||
static readAsText(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -774,9 +848,9 @@ 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|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
|
||||
* @returns {Promise<string> | Promise<FileError>} 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|FileError> {
|
||||
static readAsDataURL(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -816,9 +890,9 @@ 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|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
|
||||
* @returns {Promise<string> | Promise<FileError>} 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|FileError> {
|
||||
static readAsBinaryString(path: string, file: string): Promise<string> | Promise<FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -857,9 +931,9 @@ 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|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
|
||||
* @returns {Promise<ArrayBuffer> | Promise<FileError>} 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|FileError> {
|
||||
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> | Promise<FileError> {
|
||||
if ((/^\//.test(file))) {
|
||||
let err = new FileError(5);
|
||||
err.message = 'file-name cannot start with \/';
|
||||
@@ -900,9 +974,9 @@ 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|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
|
||||
* @returns {Promise<Entry> | Promise<FileError>} 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|FileError> {
|
||||
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
@@ -930,9 +1004,9 @@ 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|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
|
||||
* @returns {Promise<Entry> | Promise<FileError>} 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|FileError> {
|
||||
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> | Promise<FileError> {
|
||||
newFileName = newFileName || fileName;
|
||||
|
||||
if ((/^\//.test(newFileName))) {
|
||||
@@ -953,14 +1027,13 @@ export class File {
|
||||
});
|
||||
}
|
||||
|
||||
// these private methods help avoid cascading error handling
|
||||
// in the public ones, primarily simply wrapping callback
|
||||
// operations to return Promises that can then be chained.
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static fillErrorMessage(err: FileError): void {
|
||||
err.message = File.cordovaFileError[err.code];
|
||||
try {
|
||||
err.message = File.cordovaFileError[err.code];
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1133,7 +1206,7 @@ export class File {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private static write(writer: FileWriter, gu: string | Blob): Promise<any> {
|
||||
private static write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise<any> {
|
||||
if (gu instanceof Blob) {
|
||||
return this.writeFileInChunks(writer, gu);
|
||||
}
|
||||
|
||||
@@ -173,6 +173,10 @@ export interface FileTransferError {
|
||||
* cd files
|
||||
* ls
|
||||
* ```
|
||||
*
|
||||
* To store files in a different/publicly accessible directory, please refer to the following link
|
||||
* https://github.com/apache/cordova-plugin-file#where-to-store-files
|
||||
*
|
||||
* @interfaces
|
||||
* FileUploadOptions
|
||||
* FileUploadResult
|
||||
@@ -223,7 +227,7 @@ export class Transfer {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult | FileTransferError> {
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,15 @@ export class Firebase {
|
||||
})
|
||||
static grantPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check permission to recieve push notifications
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static hasPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set icon badge number. Set to 0 to clear the badge.
|
||||
* @param badgeNumber {number}
|
||||
|
||||
@@ -167,7 +167,7 @@ export class Geolocation {
|
||||
*
|
||||
* ```typescript
|
||||
* var subscription = Geolocation.watchPosition()
|
||||
* .filter((p) => p.code === undefined) //Filter Out Errors
|
||||
* .filter((p) => p.coords !== undefined) //Filter Out Errors
|
||||
* .subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
* });
|
||||
|
||||
@@ -125,7 +125,7 @@ export class GoogleAnalytics {
|
||||
/**
|
||||
* Add a Custom Dimension
|
||||
* https://developers.google.com/analytics/devguides/platform/customdimsmets
|
||||
* @param key {string}
|
||||
* @param key {number}
|
||||
* @param value {string}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var plugin: any;
|
||||
|
||||
@@ -36,6 +37,15 @@ export const GoogleMapsAnimation = {
|
||||
DROP: 'DROP'
|
||||
};
|
||||
|
||||
export const GoogleMapsMapTypeId = {
|
||||
HYBRID: 'MAP_TYPE_HYBRID',
|
||||
NONE: 'MAP_TYPE_NONE',
|
||||
NORMAL: 'MAP_TYPE_NORMAL',
|
||||
ROADMAP: 'MAP_TYPE_ROADMAP',
|
||||
SATELLITE: 'MAP_TYPE_SATELLITE',
|
||||
TERAIN: 'MAP_TYPE_TERRAIN'
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Google Maps
|
||||
* @description This plugin uses the native Google Maps SDK
|
||||
@@ -47,7 +57,8 @@ export const GoogleMapsAnimation = {
|
||||
* GoogleMapsLatLng,
|
||||
* CameraPosition,
|
||||
* GoogleMapsMarkerOptions,
|
||||
* GoogleMapsMarker
|
||||
* GoogleMapsMarker,
|
||||
* GoogleMapsMapTypeId
|
||||
* } from 'ionic-native';
|
||||
*
|
||||
* export class MapPage {
|
||||
@@ -70,9 +81,6 @@ export const GoogleMapsAnimation = {
|
||||
*
|
||||
* let map = new GoogleMap(element);
|
||||
*
|
||||
* // listen to MAP_READY event
|
||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
|
||||
*
|
||||
* // create LatLng object
|
||||
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
|
||||
*
|
||||
@@ -83,9 +91,13 @@ export const GoogleMapsAnimation = {
|
||||
* tilt: 30
|
||||
* };
|
||||
*
|
||||
* // move the map's camera to position
|
||||
* map.moveCamera(position);
|
||||
* // listen to MAP_READY event
|
||||
* map.one(GoogleMapsEvent.MAP_READY).then(() => {
|
||||
* // move the map's camera to position
|
||||
* map.moveCamera(position); // works on iOS and Android
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // create new marker
|
||||
* let markerOptions: GoogleMapsMarkerOptions = {
|
||||
* position: ionic,
|
||||
@@ -97,7 +109,7 @@ export const GoogleMapsAnimation = {
|
||||
* marker.showInfoWindow();
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
@@ -139,12 +151,7 @@ export class GoogleMap {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +269,7 @@ export class GoogleMap {
|
||||
setZoom(zoomLevel: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setMapTypeId(typeId: string): void { }
|
||||
setMapTypeId(mapTypeId: string): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setTilt(tiltLevel: number): void { }
|
||||
@@ -631,12 +638,7 @@ export class GoogleMapsMarker {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,12 +913,7 @@ export class GoogleMapsCircle {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1055,12 +1052,7 @@ export class GoogleMapsPolyline {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1200,12 +1192,7 @@ export class GoogleMapsPolygon {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1347,12 +1334,7 @@ export class GoogleMapsTileOverlay {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1481,12 +1463,7 @@ export class GoogleMapsGroundOverlay {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1606,12 +1583,7 @@ export class GoogleMapsKmlOverlay {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addEventListener(eventName: string): Observable<any> {
|
||||
return new Observable(
|
||||
(observer) => {
|
||||
this._objectInstance.addEventListener(event, observer.next.bind(observer));
|
||||
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
|
||||
}
|
||||
);
|
||||
return Observable.fromEvent(this._objectInstance, eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
100
src/plugins/gyroscope.ts
Normal file
100
src/plugins/gyroscope.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import { Plugin, Cordova} from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
|
||||
/**
|
||||
* Interface that represent output data
|
||||
*/
|
||||
export interface GyroscopeOrientation {
|
||||
/**
|
||||
* Represent x-axis
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* Represent y-axis
|
||||
*/
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* Represent z-axis
|
||||
*/
|
||||
z: number;
|
||||
|
||||
/**
|
||||
* Represent timestamp of sensor read. Default is 10000ms
|
||||
*/
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface that represent option data
|
||||
*/
|
||||
export interface GyroscopeOptions {
|
||||
/**
|
||||
* Represent how often (in milliseconds) sensor should be read. Default is 10000 ms
|
||||
*/
|
||||
frequency: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Gyroscope
|
||||
* @description Read Gyroscope sensor data
|
||||
* @usage
|
||||
* ```
|
||||
* import { Gyroscope, GyroscopeOrientation, GyroscopeOptions } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let options: GyroscopeOptions = {
|
||||
* frequency: 1000
|
||||
* };
|
||||
*
|
||||
* Gyroscope.getCurrent(options)
|
||||
* .then((orientation: GyroscopeOrientation) => {
|
||||
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
|
||||
* })
|
||||
* .catch()
|
||||
*
|
||||
*
|
||||
* Gyroscope.watch()
|
||||
* .subscribe((orientation: GyroscopeOrientation) => {
|
||||
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Gyroscope',
|
||||
plugin: 'cordova-plugin-gyroscope',
|
||||
pluginRef: 'navigator.gyroscope',
|
||||
repo: 'https://github.com/NeoLSN/cordova-plugin-gyroscope',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
export class Gyroscope {
|
||||
|
||||
/**
|
||||
* Watching for gyroscope sensor changes
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @return {Observable<GyroscopeOrientation>} Returns an Observable that resolves GyroscopeOrientation
|
||||
*/
|
||||
static watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
|
||||
return new Observable<GyroscopeOrientation> (
|
||||
(observer: any) => {
|
||||
let watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
|
||||
return () => navigator.gyroscope.clearWatch(watchId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current data from gyroscope sensor
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @return {Promise<GyroscopeOrientation>} Returns a promise that resolves GyroscopeOrientation
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getCurrent(options?: GyroscopeOptions): Promise<GyroscopeOrientation> { return; }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name Headerolor
|
||||
* @name HeaderColor
|
||||
* @description
|
||||
* Cordova plugin to change color of header in multitask view
|
||||
*
|
||||
|
||||
@@ -546,11 +546,11 @@ export class IBeacon {
|
||||
/**
|
||||
* Queries the native layer to determine the current authorization in effect.
|
||||
*
|
||||
* @returns {Promise<any>} Returns a promise which is resolved with the
|
||||
* @returns {Promise<IBeaconPluginResult>} Returns a promise which is resolved with the
|
||||
* requested authorization status.
|
||||
*/
|
||||
@Cordova({otherPromise: true})
|
||||
static getAuthorizationStatus(): Promise<any> { return; }
|
||||
static getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
|
||||
|
||||
/**
|
||||
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
|
||||
|
||||
@@ -20,6 +20,11 @@ export interface ImagePickerOptions {
|
||||
* Quality of images, defaults to 100
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* Output type, defaults to 0 (FILE_URI).
|
||||
*/
|
||||
outputType?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,50 @@ 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. */
|
||||
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. */
|
||||
hidden?: 'yes' | 'no';
|
||||
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */
|
||||
clearcache?: 'yes';
|
||||
/** Set to yes to have the session cookie cache cleared before the new window is opened. */
|
||||
clearsessioncache?: 'yes';
|
||||
/** (Android Only) set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
|
||||
zoom?: 'yes' | 'no';
|
||||
/** Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
|
||||
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. */
|
||||
hardwareback?: 'yes' | 'no';
|
||||
/** Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). */
|
||||
mediaPlaybackRequiresUserAction?: 'yes' | 'no';
|
||||
/** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */
|
||||
shouldPauseOnSuspend?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself. */
|
||||
closebuttoncaption?: string;
|
||||
/** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */
|
||||
disallowoverscroll?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */
|
||||
toolbar?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
|
||||
enableViewportScale?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
|
||||
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no) */
|
||||
allowInlineMediaPlayback?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
|
||||
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */
|
||||
suppressesIncrementalRendering?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */
|
||||
presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen';
|
||||
/** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */
|
||||
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
|
||||
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
|
||||
toolbarposition?: 'top' | 'bottom';
|
||||
/** (Windows only) Set to yes to create the browser control without a border around it.
|
||||
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
|
||||
fullscreen?: 'yes';
|
||||
}
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
type: string;
|
||||
@@ -31,6 +75,7 @@ export interface InAppBrowserEvent extends Event {
|
||||
* ```
|
||||
* @interfaces
|
||||
* InAppBrowserEvent
|
||||
* InAppBrowserOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppBrowser',
|
||||
@@ -50,8 +95,12 @@ export class InAppBrowser {
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
*/
|
||||
constructor(url: string, target?: string, options?: string) {
|
||||
constructor(url: string, target?: string, options?: InAppBrowserOptions);
|
||||
constructor(url: string, target?: string, options?: string);
|
||||
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
|
||||
try {
|
||||
if (options && typeof options !== 'string')
|
||||
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
@@ -63,22 +112,29 @@ export class InAppBrowser {
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
@CordovaInstance({ sync: true })
|
||||
show(): void { }
|
||||
|
||||
/**
|
||||
* Closes the InAppBrowser window.
|
||||
*/
|
||||
@CordovaInstance({sync: true})
|
||||
@CordovaInstance({ sync: true })
|
||||
close(): void { }
|
||||
|
||||
/**
|
||||
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
|
||||
* if the InAppBrowser was already hidden.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
hide(): void { }
|
||||
|
||||
/**
|
||||
* Injects JavaScript code into the InAppBrowser window.
|
||||
* @param script {Object} Details of the script to run, specifying either a file or code key.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeScript(script: {file?: string, code?: string}): Promise<any> {return; }
|
||||
executeScript(script: { file?: string, code?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Injects CSS into the InAppBrowser window.
|
||||
@@ -86,7 +142,7 @@ export class InAppBrowser {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
insertCSS(css: {file?: string, code?: string}): Promise<any> {return; }
|
||||
insertCSS(css: { file?: string, code?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
|
||||
@@ -65,6 +65,13 @@ export interface ILocalNotification {
|
||||
*/
|
||||
smallIcon?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* RGB value for the background color of the smallIcon.
|
||||
* Default: Androids COLOR_DEFAULT, which will vary based on Android version.
|
||||
*/
|
||||
color?: string;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
|
||||
@@ -45,9 +45,7 @@ export interface MediaError {
|
||||
* });
|
||||
*
|
||||
* // get file duration
|
||||
* file.getDuration().then((duration) => {
|
||||
* console.log(position);
|
||||
* });
|
||||
* file.getDuration();
|
||||
*
|
||||
* // skip to 10 seconds (expects int value in ms)
|
||||
* file.seekTo(10000);
|
||||
@@ -227,6 +225,21 @@ export class MediaPlugin {
|
||||
})
|
||||
stopRecord(): void { }
|
||||
|
||||
/**
|
||||
* Pauses recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
pauseRecord(): void { }
|
||||
|
||||
/**
|
||||
* Resumes recording
|
||||
*/
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
resumeRecord(): void { }
|
||||
|
||||
/**
|
||||
* Stops playing an audio file.
|
||||
|
||||
@@ -193,7 +193,7 @@ export class PayPalPayment {
|
||||
/**
|
||||
* Optional array of PayPalItem objects.
|
||||
*/
|
||||
items: string;
|
||||
items: Array<PayPalItem>;
|
||||
|
||||
/**
|
||||
* Optional customer shipping address, if your app wishes to provide this to the SDK.
|
||||
|
||||
@@ -34,7 +34,8 @@ export class PinDialog {
|
||||
* @returns {Promise<{ buttonIndex: number, input1: string }>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1
|
||||
successIndex: 1,
|
||||
errorIndex: 4 // no error callback
|
||||
})
|
||||
static prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number, input1: string }> { return; }
|
||||
|
||||
|
||||
361
src/plugins/pinterest.ts
Normal file
361
src/plugins/pinterest.ts
Normal file
@@ -0,0 +1,361 @@
|
||||
import { Plugin, Cordova, CordovaProperty } from './plugin';
|
||||
|
||||
export interface PinterestUser {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the user on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The user’s Pinterest username.
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* The user’s first name.
|
||||
*/
|
||||
first_name?: string;
|
||||
/**
|
||||
* The user’s last name.
|
||||
*/
|
||||
last_name?: string;
|
||||
/**
|
||||
* The text in the user’s “About you” section in their profile.
|
||||
*/
|
||||
bio?: string;
|
||||
/**
|
||||
* The date the user created their account in ISO 8601 format
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The user’s stats, including how many Pins, follows, boards and likes they have.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The user’s profile image. The response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
}
|
||||
|
||||
export interface PinterestBoard {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the board on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The name of the board.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The link to the board.
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* The user-entered description of the board.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* The first and last name, ID and profile URL of the user who created the board.
|
||||
*/
|
||||
creator?: PinterestUser;
|
||||
/**
|
||||
* The date the user created the board.
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The board’s stats, including how many Pins, followers, user's following and collaborators it has.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The user’s profile image. The response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
}
|
||||
|
||||
export interface PinterestPin {
|
||||
/**
|
||||
* The unique string of numbers and letters that identifies the Pin on Pinterest.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The URL of the webpage where the Pin was created.
|
||||
*/
|
||||
link?: string;
|
||||
/**
|
||||
* The URL of the Pin on Pinterest.
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* The first and last name, ID and profile URL of the user who created the board.
|
||||
*/
|
||||
creator?: PinterestUser;
|
||||
/**
|
||||
* The board that the Pin is on.
|
||||
*/
|
||||
board?: PinterestBoard;
|
||||
/**
|
||||
* The date the Pin was created.
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
* The user-entered description of the Pin.
|
||||
*/
|
||||
note?: string;
|
||||
/**
|
||||
* The dominant color of the Pin’s image in hex code format.
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* The Pin’s stats, including the number of repins, comments and likes.
|
||||
*/
|
||||
counts?: any;
|
||||
/**
|
||||
* The media type of the Pin (image or video).
|
||||
*/
|
||||
media?: any;
|
||||
/**
|
||||
* The source data for videos, including the title, URL, provider, author name, author URL and provider name.
|
||||
*/
|
||||
attribution?: any;
|
||||
/**
|
||||
* The Pin’s image. The default response returns the image’s URL, width and height.
|
||||
*/
|
||||
image?: any;
|
||||
/**
|
||||
* Extra information about the Pin for Rich Pins. Includes the Pin type (e.g., article, recipe) and related information (e.g., ingredients, author).
|
||||
*/
|
||||
metadata?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Pinterest
|
||||
* @description
|
||||
* Cordova plugin for Pinterest
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from 'ionic-native';
|
||||
*
|
||||
* const scopes = [
|
||||
* Pinterest.SCOPES.READ_PUBLIC,
|
||||
* Pinterest.SCOPES.WRITE_PUBLIC,
|
||||
* Pinterest.SCOPES.READ_RELATIONSHIPS,
|
||||
* Pinterest.SCOPES.WRITE_RELATIONSHIPS
|
||||
* ];
|
||||
*
|
||||
* Pinterest.login(scopes)
|
||||
* .then(res => console.log('Logged in!', res))
|
||||
* .catch(err => console.error('Error loggin in', err));
|
||||
*
|
||||
* Pinterest.getMyPins()
|
||||
* .then((pins: Array<PinterestPin>) => console.log(pins))
|
||||
* .catch(err => console.error(err));
|
||||
*
|
||||
* Pinterest.getMe()
|
||||
* .then((user: PinterestUser) => console.log(user));
|
||||
*
|
||||
* Pinterest.getMyBoards()
|
||||
* .then((boards: Array<PinterestBoard>) => console.log(boards));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* PinterestUser
|
||||
* PinterestBoard
|
||||
* PinterestPin
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pinterest',
|
||||
plugin: 'cordova-plugin-pinterest',
|
||||
pluginRef: 'cordova.plugins.Pinterest',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
|
||||
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Pinterest {
|
||||
|
||||
/**
|
||||
* Convenience constant for authentication scopes
|
||||
*/
|
||||
@CordovaProperty
|
||||
SCOPES: {
|
||||
READ_PUBLIC: string;
|
||||
WRITE_PUBLIC: string;
|
||||
READ_RELATIONSHIPS: string;
|
||||
WRITE_RELATIONSHIPS: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs the user in using their Pinterest account.
|
||||
* @param scopes {Array<string>} Array of scopes that you need access to. You can use Pinterest.SCOPES constant for convenience.
|
||||
* @returns {Promise<any>} The response object will contain the user's profile data, as well as the access token (if you need to use it elsewhere, example: send it to your server and perform actions on behalf of the user).
|
||||
*/
|
||||
@Cordova()
|
||||
static login(scopes: string[]): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Gets the authenticated user's profile
|
||||
* @param fields {string} Fields to retrieve, separated by commas. Defaults to all available fields.
|
||||
* @returns {Promise<PinterestUser>} Returns a promise that resolves with the user's object
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMe(fields?: string): Promise<PinterestUser> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyPins(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestBoard>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's likes.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyLikes(fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followers.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestUser>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowers(fields?: string, limit?: number): Promise<Array<PinterestUser>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followed boards.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestBoard>>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowedBoards(fields?: string, limit?: number): Promise<Array<PinterestBoard>> { return; }
|
||||
|
||||
/**
|
||||
* Get the authenticated user's followed interests.
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static getMyFollowedInterests(fields?: string, limit?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get a user's profile.
|
||||
* @param username
|
||||
* @param fields
|
||||
* @returns {Promise<PinterestUser>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getUser(username: string, fields?: string): Promise<PinterestUser> { return; }
|
||||
|
||||
/**
|
||||
* Get a board's data.
|
||||
* @param boardId
|
||||
* @param fields
|
||||
* @returns {Promise<PinterestBoard>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getBoard(boardId: string, fields?: string): Promise<PinterestBoard> { return; }
|
||||
|
||||
/**
|
||||
* Get Pins of a specific board.
|
||||
* @param boardId {string} The ID of the board
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @param limit {number} Optional limit, defaults to 100, maximum is 100.
|
||||
* @returns {Promise<Array<PinterestPin>>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getBoardPins(boardId: string, fields?: string, limit?: number): Promise<Array<PinterestPin>> { return; }
|
||||
|
||||
/**
|
||||
* Delete a board.
|
||||
* @param boardId {string} The ID of the board
|
||||
* @returns {Promise<PinterestUser>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deleteBoard(boardId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create a new board for the authenticated user.
|
||||
* @param name {string} Name of the board
|
||||
* @param desc {string} Optional description of the board
|
||||
* @returns {Promise<PinterestBoard>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
static createBoard(name: string, desc?: string): Promise<PinterestBoard> { return; }
|
||||
|
||||
/**
|
||||
* Get a Pin by ID.
|
||||
* @param pinId {string} The ID of the Pin
|
||||
* @param fields {string} Optional fields separated by comma
|
||||
* @returns {Promise<PinterestPin>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static getPin(pinId: string, fields?: string): Promise<PinterestPin> { return; }
|
||||
|
||||
/**
|
||||
* Deletes a pin
|
||||
* @param pinId {string} The ID of the pin
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
static deletePin(pinId: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Creates a Pin
|
||||
* @param note {string} Note/Description of the pin
|
||||
* @param boardId {string} Board ID to put the Pin under
|
||||
* @param imageUrl {string} URL of the image to share
|
||||
* @param link {string} Optional link to share
|
||||
* @returns {Promise<PinterestPin>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 4,
|
||||
errorIndex: 5
|
||||
})
|
||||
static createPin(note: string, boardId: string, imageUrl: string, link?: string): Promise<PinterestPin> { return; }
|
||||
|
||||
}
|
||||
@@ -1,9 +1,106 @@
|
||||
import { get } from '../util';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PluginConfig {
|
||||
/**
|
||||
* Plugin name, this should match the class name
|
||||
*/
|
||||
pluginName: string;
|
||||
/**
|
||||
* Plugin NPM package name
|
||||
*/
|
||||
plugin: string;
|
||||
/**
|
||||
* Plugin object reference
|
||||
*/
|
||||
pluginRef: string;
|
||||
/**
|
||||
* Github repository URL
|
||||
*/
|
||||
repo: string;
|
||||
/**
|
||||
* Custom install command
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface CordovaOptions {
|
||||
/**
|
||||
* Set to true if the wrapped method is a sync function
|
||||
*/
|
||||
sync?: boolean;
|
||||
/**
|
||||
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes.
|
||||
*/
|
||||
callbackOrder?: 'reverse';
|
||||
/**
|
||||
* Callback style
|
||||
*/
|
||||
callbackStyle?: 'node' | 'object';
|
||||
/**
|
||||
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
successIndex?: number;
|
||||
/**
|
||||
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
|
||||
*/
|
||||
errorIndex?: number;
|
||||
/**
|
||||
* Success function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
successName?: string;
|
||||
/**
|
||||
* Error function property name. This must be set if callbackStyle is set to object.
|
||||
*/
|
||||
errorName?: string;
|
||||
/**
|
||||
* Set to true to return an observable
|
||||
*/
|
||||
observable?: boolean;
|
||||
/**
|
||||
* If observable is set to true, this can be set to a different function name that will cancel the observable.
|
||||
*/
|
||||
clearFunction?: string;
|
||||
/**
|
||||
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
|
||||
*/
|
||||
clearWithArgs?: boolean;
|
||||
/**
|
||||
* Creates an observable that wraps a global event. Replaces document.addEventListener
|
||||
*/
|
||||
eventObservable?: boolean;
|
||||
/**
|
||||
* Event name, this must be set if eventObservable is set to true
|
||||
*/
|
||||
event?: string;
|
||||
/**
|
||||
* Element to attach the event listener to, this is optional, defaults to `window`
|
||||
*/
|
||||
element?: any;
|
||||
/**
|
||||
* Set to true if the wrapped method returns a promise
|
||||
*/
|
||||
otherPromise?: boolean;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param pluginRef
|
||||
@@ -245,14 +342,12 @@ function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
|
||||
/**
|
||||
* Wrap the event with an observable
|
||||
* @param event
|
||||
* @param event even name
|
||||
* @param element The element to attach the event listener to
|
||||
* @returns {Observable}
|
||||
*/
|
||||
function wrapEventObservable(event: string): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
window.addEventListener(event, observer.next.bind(observer), false);
|
||||
return () => window.removeEventListener(event, observer.next.bind(observer), false);
|
||||
});
|
||||
function wrapEventObservable(event: string, element: any = window): Observable<any> {
|
||||
return Observable.fromEvent(element, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +398,7 @@ function overrideFunction(pluginObj: any, methodName: string, args: any[], opts:
|
||||
* @param opts
|
||||
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
|
||||
*/
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
|
||||
return (...args) => {
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
@@ -311,7 +406,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
} else if (opts.observable) {
|
||||
return wrapObservable(pluginObj, methodName, args, opts);
|
||||
} else if (opts.eventObservable && opts.event) {
|
||||
return wrapEventObservable(opts.event);
|
||||
return wrapEventObservable(opts.event, opts.element);
|
||||
} else if (opts.otherPromise) {
|
||||
return wrapOtherPromise(pluginObj, methodName, args, opts);
|
||||
} else {
|
||||
@@ -320,35 +415,6 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export interface PluginConfig {
|
||||
/**
|
||||
* Plugin name, this should match the class name
|
||||
*/
|
||||
pluginName: string;
|
||||
/**
|
||||
* Plugin NPM package name
|
||||
*/
|
||||
plugin: string;
|
||||
/**
|
||||
* Plugin object reference
|
||||
*/
|
||||
pluginRef: string;
|
||||
/**
|
||||
* Github repository URL
|
||||
*/
|
||||
repo: string;
|
||||
/**
|
||||
* Custom install command
|
||||
*/
|
||||
install?: string;
|
||||
/**
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -405,7 +471,7 @@ export function Plugin(config: PluginConfig) {
|
||||
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
|
||||
* and the required plugin are installed.
|
||||
*/
|
||||
export function Cordova(opts: any = {}) {
|
||||
export function Cordova(opts: CordovaOptions = {}) {
|
||||
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
|
||||
@@ -275,6 +275,11 @@ export interface AndroidPushOptions {
|
||||
*/
|
||||
vibrate?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the icon badge will be cleared on init and before push messages are processed.
|
||||
*/
|
||||
clearBadge?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the app clears all pending notifications when it is closed.
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,10 @@ export class SafariViewController {
|
||||
* @param options {SafariViewControllerOptions} optional
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static show(options?: SafariViewControllerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ export class ScreenOrientation {
|
||||
/**
|
||||
* Lock the orientation to the passed value.
|
||||
* See below for accepted values
|
||||
* @param orientation {string} The orientation which should be locked. Accepted values see table below.
|
||||
* @param orientation {string} The orientation which should be locked. Accepted values see table above.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
static lockOrientation(orientation: string): void { }
|
||||
|
||||
@@ -23,13 +23,9 @@ export interface SerialOpenOptions {
|
||||
* ```
|
||||
* import { Serial } from 'ionic-native';
|
||||
*
|
||||
* Serial.requestPermission({
|
||||
* vid: '0403',
|
||||
* pid: '6001',
|
||||
* driver: 'FtdiSerialDriver'
|
||||
* }).then(() => {
|
||||
* Serial.requestPermission().then(() => {
|
||||
* Serial.open({
|
||||
* baudRate: 38400
|
||||
* baudRate: 9800
|
||||
* }).then(() => {
|
||||
* console.log('Serial connection opened');
|
||||
* });
|
||||
@@ -49,11 +45,14 @@ export class Serial {
|
||||
/**
|
||||
* Request permission to connect to a serial device
|
||||
*
|
||||
* @param options {SerialPermissionOptions} Options used to request serial permissions
|
||||
* @param options {SerialPermissionOptions} Options used to request serial permissions for an unknown device
|
||||
* @return {Promise<any>} Returns a promise that resolves when permissions are granted
|
||||
*/
|
||||
@Cordova()
|
||||
static requestPermission(options: SerialPermissionOptions): Promise<any> { return; }
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static requestPermission(options?: SerialPermissionOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Open connection to a serial device
|
||||
|
||||
@@ -24,7 +24,7 @@ declare var sqlitePlugin;
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {});
|
||||
*
|
||||
* })
|
||||
* .catch(error => console.error('Error opening database', error);
|
||||
* .catch(error => console.error('Error opening database', error));
|
||||
*
|
||||
*
|
||||
* // OPTION B: Create a new instance of SQLite
|
||||
|
||||
@@ -21,9 +21,9 @@ import { Plugin, Cordova } from './plugin';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Stepcounter',
|
||||
plugin: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
plugin: 'https://github.com/Slidee/cordova-plugin-stepcounter',
|
||||
pluginRef: 'stepcounter',
|
||||
repo: 'https://github.com/texh/cordova-plugin-stepcounter',
|
||||
repo: 'https://github.com/Slidee/cordova-plugin-stepcounter',
|
||||
platforms: ['Android']
|
||||
})
|
||||
export class Stepcounter {
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface StreamingAudioOptions {
|
||||
* orientation: 'landscape'
|
||||
* };
|
||||
*
|
||||
* StreamingMedia.('https://path/to/video/stream', options);
|
||||
* StreamingMedia.playVideo('https://path/to/video/stream', options);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
|
||||
@@ -67,10 +67,10 @@ export interface StripeCardTokenParams {
|
||||
* number: '4242424242424242',
|
||||
* expMonth: 12,
|
||||
* expYear: 2020,
|
||||
* cvc: 220
|
||||
* cvc: '220'
|
||||
* };
|
||||
*
|
||||
* Stripe.createToken(card)
|
||||
* Stripe.createCardToken(card)
|
||||
* .then(token => console.log(token))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
|
||||
@@ -47,4 +47,8 @@ export class TextToSpeech {
|
||||
return;
|
||||
}
|
||||
|
||||
static stop(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
33
src/plugins/unique-device-id.ts
Normal file
33
src/plugins/unique-device-id.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Plugin, Cordova } from './plugin';
|
||||
|
||||
/**
|
||||
* @name UniqueDeviceID
|
||||
* @description
|
||||
* This plugin produces a unique, cross-install, app-specific device id.
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { UniqueDeviceID } from 'ionic-native';
|
||||
*
|
||||
* UniqueDeviceID.get()
|
||||
* .then((uuid: any) => console.log(uuid))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'UniqueDeviceID',
|
||||
plugin: 'cordova-plugin-uniquedeviceid',
|
||||
pluginRef: 'window.plugins.uniqueDeviceID',
|
||||
repo: 'https://github.com/Paldom/UniqueDeviceID'
|
||||
})
|
||||
export class UniqueDeviceID {
|
||||
|
||||
/**
|
||||
* Gets a unique, cross-install, app-specific device id.
|
||||
* @return {Promise<string>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
static get(): Promise<string> { return; }
|
||||
|
||||
}
|
||||
@@ -35,6 +35,6 @@ export class Zip {
|
||||
successIndex: 2,
|
||||
errorIndex: 4
|
||||
})
|
||||
static unzip(sourceZip: string, destUrl: string, onProgress: Function): Promise<number> {return; }
|
||||
static unzip(sourceZip: string, destUrl: string, onProgress?: Function): Promise<number> {return; }
|
||||
|
||||
}
|
||||
|
||||
30
test/plugins/inappbrowser.spec.ts
Normal file
30
test/plugins/inappbrowser.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { InAppBrowser, InAppBrowserEvent, InAppBrowserOptions } from '../../src/plugins/inappbrowser';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
window.cordova = {
|
||||
InAppBrowser: {
|
||||
open: window.open
|
||||
}
|
||||
};
|
||||
|
||||
describe('InAppBrowser', () => {
|
||||
|
||||
const options: InAppBrowserOptions = { hidden: 'yes', hardwareback: 'no' };
|
||||
let object;
|
||||
|
||||
it('should create an object using strings and InAppBrowserOptions signature', () => {
|
||||
object = new InAppBrowser('http://google.com', '_self', options);
|
||||
expect(object).toBeDefined();
|
||||
});
|
||||
|
||||
it('should create an object using string only signature', () => {
|
||||
object = new InAppBrowser('http://google.com', '_self', 'location=no');
|
||||
expect(object).toBeDefined();
|
||||
});
|
||||
|
||||
it('should create an object with the least amount of parameters', () => {
|
||||
object = new InAppBrowser('http://google.com');
|
||||
expect(object).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user