Compare commits

...

86 Commits

Author SHA1 Message Date
Ibby
7f368b61be tslint and fix build issues 2017-03-01 21:28:05 -05:00
Ibby Hadeed
af4d5e8968 Revert "fix(File): typing where FileError can be thrown" (#1130) 2017-03-01 21:24:34 -05:00
Vlado Velichkovski
0378b1d7fd feat(gyroscope): add Gyroscope plugin (#1004)
* add gyroscope.ts to plugins

* add gyroscope to index

* Update gyroscope.ts

* Update gyroscope.ts
2017-03-01 21:16:57 -05:00
Josh Strange
57e2691889 feat(background-fetch): Adding Background Fetch requested in #990 (#1013)
* Adding Background Fetch (https://github.com/transistorsoft/cordova-plugin-background-fetch) requested in #990

* Adding BackgroundFetch to index
2017-03-01 21:16:31 -05:00
Sumama Waheed
09a7dcf594 feat(couchbase-lite): add CouchbaseLite cordova plugin (#1025)
* feat(CouchbaseLite): add CouchbaseLite cordova plugin

* add plugin url
2017-03-01 21:15:51 -05:00
Michael Trilus
fd8107b79a feat(appodeal): adds Appodeal SDK wrappers for iOS and Android (#1031)
* feat(Appodeal) bootrapping

* starting docs

* more docs

* feat(appodeal): add event Observables

* feat(appodeal): replace Cordova Observable events with #.fromEvent()

* feat(appodeal): update decorator metadata
2017-03-01 21:11:00 -05:00
Tom Sundstrom
4f86320696 feat(text-to-speech): Add stop method (#1063)
https://github.com/vilic/cordova-plugin-tts/pull/32
2017-03-01 21:01:39 -05:00
Ibby
39f1971471 fix plugin 2017-03-01 21:00:49 -05:00
David Pfeffer
60db10c1d3 feat(unique-device-add): add UniqueDeviceId plugin (#1064) 2017-03-01 20:59:41 -05:00
Rob
2a32624d9d feat(local-notifications): support for icon background color (#1079)
The Cordova plugin Ionic Natives uses allows specifying the background color of the smallIcon.  By not including it in your interface you force users to use the default color for their version of Android.  While the LocalNotification plugin is not well documented, it does include this feature, see Options.java line 253:

```
/**
     * @return
     *      The notification background color for the small icon
     *      Returns null, if no color is given.
     */
    public int getColor() {
        String hex = options.optString("color", null);

        if (hex == null) {
            return NotificationCompat.COLOR_DEFAULT;
        }

        int aRGB = Integer.parseInt(hex, 16);

        return aRGB + 0xFF000000;
    }
```

I've simply added the option to the interface as well as a short description.

This lets you go from the default color (varies by Android version): https://goo.gl/photos/nERcj4GZgapy8aee9
To any color you'd like: https://goo.gl/photos/t8V9WVba8jDU49aHA
And also works if you also specify a large icon: https://goo.gl/photos/gWQYwa12djmdXfYcA
2017-03-01 20:58:53 -05:00
Jan
2fba915b88 fix(file): platform Browser will raise a an DOMException (#1082)
fix(File): Platform Browser will raise a an DOMException on resoleLocalFilesystemUrl and tries to write on readonly property DOMException err.message in fillErrorMessage
2017-03-01 20:58:09 -05:00
Andrew Martin
318ad3f4e0 feat(google-maps): add constant for map type 2017-03-01 20:57:44 -05:00
Vegard Andreas Larsen
c1748bbc28 fix(file): remove FileError from return type (#1086)
Promises that reject with a `FileError` are not of the type `Promise<T|FileError>`, but `Promise<T>`.

The previous declarations of `Promise<T|FileError>` would break typing further down the chain where you are trying to use the value that the typing says could be `T|FileError` but in reality could only be `T`.
2017-03-01 20:56:21 -05:00
PERRONCEL
06fa7452dd docs(google-maps): improve docs (#1095)
Move `map.moveCamera(position);` inside the MAP_READY event.
Allow to zoom the map on first launch (both iOS and Android).
2017-03-01 20:55:42 -05:00
Xueron Nee
2eea3df2c4 feat(alipay): add alipay support. (#1097)
* add cordova-alipay-base plugin. to support Alipay payment

* change ALI_PID to APP_ID, make it same with the latest SDK

* rewrite comments
2017-03-01 20:54:27 -05:00
Ibby
13484f9843 docs(app-update): add docs 2017-03-01 20:33:21 -05:00
Ibby
91ee5bde5f Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-01 20:29:44 -05:00
Xueron Nee
21d40888d8 feat(app-update): add cordova-plugin-app-update support (#1105)
* add new app-update plugin

* update plugin info
2017-03-01 20:29:38 -05:00
Ibby
f0e219570e feat(file): add system paths 2017-03-01 20:26:55 -05:00
JiaLiPassion
104532e1d7 fix(plugin): revert changes to support stable version (#1116)
fix #1001
2017-03-01 20:10:05 -05:00
Ibby
97cf22eedb Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-01 20:06:11 -05:00
Ibby
9c5b593d6b fix(contacts): allow passing asterisk as contact field type
closes #1093
2017-03-01 20:06:03 -05:00
Ibby
26394865fc fix(contacts): allow passing asterisk as contact field type
closes 1093
2017-03-01 20:05:39 -05:00
Ibby
07c867d98e docs(background-geolocation): add return types and platforms 2017-03-01 19:53:50 -05:00
Ibby
fc879926b2 fix(background-geolocation): configure returns a promise
closes #1118
2017-03-01 19:50:40 -05:00
Ibby
281e37ee04 docs(browser-tab): add proper docs 2017-03-01 19:45:46 -05:00
Aaron Czichon
8de37939fb feat(browser-tab): add browser tab plugin (#1126)
* feature: added hasPermission function to Firebase fixes #1115

* feat: Implemented support for BrowserTab #1077
2017-03-01 19:41:54 -05:00
Ibby
448ec7a72b add success/error indices 2017-03-01 19:40:18 -05:00
Thomas Kemmer
da72500c4b fix(serial): Serial.requestPermission() options are optional (#1128) 2017-03-01 19:39:39 -05:00
idroxid
0c466d9739 refactor(paypal): fix type of items (#1125)
Type of items should be Array<PayPalItem> instead of string.
2017-03-01 19:38:43 -05:00
jsteffensen
8e0027b974 docs(stripe): fix type and naming issues (#1129) 2017-03-01 19:37:57 -05:00
Shane Smith
234ed6e9e7 fix(media): add missing pauseRecord and resumeRecord methods (#1122) 2017-02-28 17:31:35 -05:00
Ibby Hadeed
4426e59176 docs(google-maps): fix param type
closes #1110
2017-02-23 18:57:29 -05:00
Michael Nishikawa
f22874342a refactor(file): accept ArrayBuffer for data to write (#1109) 2017-02-23 18:56:26 -05:00
coreyroth
6bcd5d3183 Move marker code inside MAP_READY (#1108)
The code to set the camera position and marker should be moved inside the function handling MAP_READY.  Otherwise they execute before the event is fired and it doesn't work.
2017-02-23 18:55:19 -05:00
Robert Coie
407659a3ef update device orientation docs to reflect renaming of CompassHeading interface (#1107) 2017-02-23 04:30:18 -05:00
Musa Haidari
5ef669ae91 Update sqlite.ts (#1106)
Added a bracket to remove the syntax error
2017-02-23 04:30:02 -05:00
Eric Horodyski
4a39ebd873 Add InAppBrowserOptions interface to documentation. (#1103) 2017-02-23 04:29:33 -05:00
Josep Sayol
23b97f6b4a fix(file): add missing exports (#1101)
Any declaration that is not being exported is missing from the resulting d.ts declaration files.
2017-02-23 03:54:57 -05:00
Markus Wagner
093c8a8231 Update ibeacon.ts (#1099)
Return type of `getAuthorizationStatus()` made more explicit.
2017-02-23 03:53:11 -05:00
Noel De Martin
85a3a40795 fix(facebook): fixes issue when not supplying default params (#1088)
* Fix default facebook logEvent parameters

* Implement correct parameters format in facebook logEvent method
2017-02-23 03:52:49 -05:00
Xueron Nee
b4b7cfa473 fix(imagepicker): add outputType option (#1098) 2017-02-23 03:51:44 -05:00
Tommertom
884ce54181 docs(badge): fix example (#1096)
Error in code example (supplied parameters do not match call signature)
2017-02-23 03:50:05 -05:00
3dd13
70847d1b2b fix(push): add the missing option clearBadge (#1087) 2017-02-18 17:14:57 -05:00
Grisha Rozhnov
ff26f2a019 docs(media): update method usage (#1089) 2017-02-17 13:11:04 -05:00
Eric Horodyski
f4b8236c8d feat(inappbrowser): add interface for IAB options (#1065)
* Add InAppBrowserOptions Interface for better tooling.

* feat(inappbrowser): add  interface for IAB options

* Add more constructor tests.

* Add missing iOS options.
2017-02-15 16:57:16 -05:00
Tine
03ff0a58cf docs(device-motion): update interface names (#1076)
AccelerationData interface is wrongly named in docs. It should be DeviceMotionAccelerationData. And I added it to import statement.
2017-02-15 15:41:48 -05:00
Tedy Kanjirathinkal
c7a888e2de Update file-chooser.ts (#1071)
Removed semicolon after .then() in usage instructions
2017-02-13 18:18:52 -05:00
John Woodruff
439cceea23 fix(apprate): add missing Windows Store option (#1072) 2017-02-13 18:17:43 -05:00
Ibby Hadeed
83f57b9820 fix(zip): progress callback is optional (#1049) 2017-02-13 15:06:33 -05:00
Ibby
78fcdc8d80 chore(): update changelog 2017-02-07 11:32:53 -05:00
Ibby
53f7056b16 2.5.1 2017-02-07 11:32:28 -05:00
Ibby
b7701cdb16 fix(pin-dialog): add missing errorIndex 2017-02-07 10:19:32 -05:00
Ibby
94a4519f2b chore(): update changelog 2017-02-07 07:27:35 -05:00
Ibby
6fe52b610b 2.5.0 2017-02-07 07:27:16 -05:00
Ibby Hadeed
434a6c8ad3 Update stepcounter.ts 2017-02-06 08:33:10 -05:00
Tom Sundstrom
97489ba573 feat(barcodescanner): add option disableSuccessBeep (#1035)
https://github.com/phonegap/phonegap-plugin-barcodescanner/pull/408
2017-02-05 05:41:49 -05:00
Ibby Hadeed
f525a25b49 refractor(google-maps): use Observable.fromEvent instead of addEventListener (#1032) 2017-02-04 04:32:41 -05:00
Ibby
add49e8b4d refractor(): use Observable.fromEvent in wrapEventObservable 2017-02-04 04:16:57 -05:00
Eds
4ab87d8abb feat(inappbrowser): add hide function (#1018) 2017-02-01 01:42:07 -05:00
Prateek Kathal
69ff7afb48 docs(file): add link to additional information (#1022)
Adding a link to **cordova plugin file** for ease of understanding file management using cordova.

It took me almost a day to figure out how to properly save things like a pdf/image in a publicly accessible directory. Having a link to the main **cordova file** documentation will save a lot of time.
2017-02-01 01:40:55 -05:00
Ibby
62a30c7d8f Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-31 04:14:40 -05:00
Ibby
dc37d8f71c fix(safari-view-controller): fix issue caused by calling show without options 2017-01-31 04:14:28 -05:00
Huan LI
8864d1360a docs(streaming-media): add missing method name (#1016) 2017-01-31 01:39:21 -05:00
Ibby
613141998a docs(header-color): fix doc name 2017-01-30 11:45:36 -05:00
Ibby
c2fbb4fb64 docs(geolocation): update watchPosition example 2017-01-30 11:43:58 -05:00
Josh Strange
f0cf86076c feat(background-geolocation): add missing properties for Android 2017-01-30 05:45:42 -05:00
Ibby
a03afcf0fa fix(pinterest): fix PinterestPin interface 2017-01-29 06:49:28 -05:00
Ibby
3abe0bb97d Merge branch 'master' of github.com:driftyco/ionic-native 2017-01-26 20:30:51 -05:00
Ibby
a5b4632ceb fix(file-transfer): fix return type of upload method
fixes #1002
2017-01-26 20:30:44 -05:00
Ibby Hadeed
1c78f77c0f docs(stepcounter): update repo and plugin
closes #1003
2017-01-25 22:22:05 -05:00
Ibby
cb7d3ef3e0 chore(): update changelog 2017-01-24 15:14:36 -05:00
Ibby
5e83a09056 2.4.1 2017-01-24 15:14:07 -05:00
Ibby
b85393de89 chore(): add CordovaOptions interface 2017-01-24 15:12:35 -05:00
Ibby
68c535fd79 style(): missing semicolon 2017-01-24 15:00:43 -05:00
Ibby
1c09ee1fbc fix(screen-orientation): lockOrientation returns a promise
closes #939
2017-01-24 15:00:20 -05:00
Ibby
8b921165bb fix merge conflict 2017-01-24 00:49:14 -05:00
Ibby
0c837de499 chore(): update changelog 2017-01-24 00:48:42 -05:00
Ibby
a44500d206 2.4.0 2017-01-24 00:48:07 -05:00
Ibby
e063613c8c 2.3.3 2017-01-24 00:46:51 -05:00
Ibby
416071a5a1 fix(google-maps): fix event listeners
fixes #999
2017-01-24 00:46:37 -05:00
Ibby
93fdb7eabb fix typo 2017-01-23 23:00:56 -05:00
Ibby
466437a683 feat(pinterest): add pinterest plugin 2017-01-23 22:59:37 -05:00
Ibby
a34723b53c legal name change 2017-01-23 22:22:19 -05:00
Ibby
b9bd5100a2 chore(): update changelog 2017-01-23 22:20:09 -05:00
Ibby
51bafccf38 2.3.2 2017-01-23 22:19:48 -05:00
48 changed files with 1908 additions and 219 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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",

View File

@@ -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
View 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
View 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
View 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');
}
}

View File

@@ -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 {

View 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() { }
}

View File

@@ -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; }
/**

View File

@@ -13,7 +13,7 @@ import { Cordova, Plugin } from './plugin';
*
*
* Badge.set(10);
* Badge.increase();
* Badge.increase(1);
* Badge.clear();
* ```
*/

View File

@@ -22,6 +22,11 @@ export interface BarcodeScannerOptions {
*/
disableAnimations?: boolean;
/**
* Disable success beep. Supported on iOS only.
*/
disableSuccessBeep?: boolean;
/**
* Prompt text. Supported on Android only.
*/

View 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; }
}

View File

@@ -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

View 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; }
}

View File

@@ -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);
* });
*

View File

@@ -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

View File

@@ -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,

View File

@@ -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));
*
* ```

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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}

View File

@@ -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);
* });

View File

@@ -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>}
*/

View File

@@ -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
View 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; }
}

View File

@@ -1,7 +1,7 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Headerolor
* @name HeaderColor
* @description
* Cordova plugin to change color of header in multitask view
*

View File

@@ -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

View File

@@ -20,6 +20,11 @@ export interface ImagePickerOptions {
* Quality of images, defaults to 100
*/
quality?: number;
/**
* Output type, defaults to 0 (FILE_URI).
*/
outputType?: number;
}
/**

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View 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.

View File

@@ -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
View 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 users Pinterest username.
*/
username?: string;
/**
* The users first name.
*/
first_name?: string;
/**
* The users last name.
*/
last_name?: string;
/**
* The text in the users “About you” section in their profile.
*/
bio?: string;
/**
* The date the user created their account in ISO 8601 format
*/
created_at?: string;
/**
* The users stats, including how many Pins, follows, boards and likes they have.
*/
counts?: any;
/**
* The users profile image. The response returns the images 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 boards stats, including how many Pins, followers, user's following and collaborators it has.
*/
counts?: any;
/**
* The users profile image. The response returns the images 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 Pins image in hex code format.
*/
color?: string;
/**
* The Pins 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 Pins image. The default response returns the images 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; }
}

View File

@@ -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[]) {

View File

@@ -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.
*/

View File

@@ -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; }
/**

View File

@@ -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 { }

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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));
*

View File

@@ -47,4 +47,8 @@ export class TextToSpeech {
return;
}
static stop(): Promise<any> {
return;
}
}

View 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; }
}

View File

@@ -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; }
}

View 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();
});
});