Compare commits

...

39 Commits

Author SHA1 Message Date
Max Lynch
0cb79d1cd1 revert(changelog): old changelog 2016-07-14 09:59:41 -05:00
Max Lynch
e8f4b08f66 chore(changelog): Update changelog 2016-07-14 09:50:00 -05:00
Max Lynch
cdf9cdef54 Update CONTRIBUTING.md 2016-07-14 09:45:55 -05:00
Max Lynch
72ec500ffd version bump 2016-07-14 09:43:49 -05:00
Max Lynch
c23f5e90dc fix(touchid): make isAvailable static 2016-07-14 09:42:04 -05:00
Nick Kenens
0315e63782 Update spinnerdialog.ts to fix wrong documentation (#287)
Just implemented the SpinnerDialog into my app to use with Ionic Deploy.

The cancelCallback still happens when set to "false", when setting it to "true, the cancelCallback doesn't get called and therefore the SpinnerDialog doesn't hide on Android.
2016-07-13 17:36:23 -04:00
Ibby Hadeed
9a28b24a0b chore(): update changelog 2016-07-11 18:36:51 -04:00
Ibby Hadeed
5c72340a37 1.3.3 2016-07-11 18:36:13 -04:00
Ibby Hadeed
360888563f refactor(push): add missing semicolumns 2016-07-11 17:44:02 -04:00
Ibby Hadeed
b8a513301e fix(background-geolocation): fix pluginref again 2016-07-11 17:42:11 -04:00
Ibby Hadeed
4f0cd24476 fix(geolocation): fix plugin reference
closes #258
2016-07-11 17:40:51 -04:00
Ibby Hadeed
00d35c636b chore(index): add background mode to IonicNative variable 2016-07-11 17:22:45 -04:00
Ibby Hadeed
e150224cda fix(socialsharing): all methods return Promises now
closes #275
2016-07-11 17:20:11 -04:00
Ibby Hadeed
fa4721319e Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-07-11 17:17:19 -04:00
Ibby Hadeed
6229d4932e refactor(network): remove Connection class
closes #278
2016-07-11 17:15:34 -04:00
Mateo Tibaquirá
7c20bddd17 docs(backgroundMode): fix plugin npm ID (#282)
@ihadeed I meant this fix, `de.appplant.cordova.plugin.background-mode` doesn't exist on npm ;)
2016-07-11 17:15:11 -04:00
DGoms
2b4e318072 chore(): Update index.ts (#281)
Unable to import interface like FileUploadOptions
2016-07-11 16:53:35 -04:00
Justin Schuldt
dd97df19fe feat(ibeacon): add iBeacon plugin support (#270)
* iBeacon hello-world

* moar methods

* added comments

* comments and descriptions

* removed debugging changes

* removed dupe export

* fixed misspellings and added more interface documentation
2016-07-11 16:52:51 -04:00
mhartington
9eb63a0d74 docs(): massive updates 2016-07-08 15:19:13 -04:00
Aaron Czichon
ba20dbe590 feat(onesignal): added wrapper for the Cordova OneSignal Plugin (#252)
* Added OneSignal wrapper

* documentation

* Changes for callback of notification revieced

* fixes for @Cordova decorators without Promise return
2016-07-07 13:19:00 -04:00
Duy Nguyen
b8be1de068 fix(googlemaps): use correct methods for addGroundOverlay and addKmlOverlay (#268) 2016-07-07 13:17:29 -04:00
Bailhache Pierre
592feb409e feat(push): added support for Action Buttons on iOS with categories (#273) 2016-07-07 13:16:38 -04:00
mhartington
4a38c02c14 docs(deviceMotion): update docs 2016-07-07 11:48:22 -04:00
mhartington
d84b83b42c docs(): update improve link 2016-07-07 11:43:06 -04:00
mhartington
38cea9da27 docs(contacts): hide extra 2016-07-06 14:24:58 -04:00
mhartington
da28af024c docs(): update template 2016-07-05 18:13:07 -04:00
mhartington
c69f8203ff docs(bluetooth): update docs 2016-07-05 18:09:08 -04:00
mhartington
eee5fd0c17 docs(Base64ToGallery): update docs 2016-07-05 16:11:27 -04:00
mhartington
ef960c8aec docs(barcodeScanner): hide private methods 2016-07-05 14:52:21 -04:00
mhartington
f2f3741819 docs(backgroundMode): improve docs 2016-07-01 15:46:15 -04:00
mhartington
e802571726 docs(): clean up docs 2016-07-01 15:16:52 -04:00
Ibrahim Hadeed
644e999d1e fix(actionsheet): add missing optional parameter for hide function (#262) 2016-07-01 13:46:18 -04:00
mhartington
5a14ec01ef docs(actionSheet): improve docs 2016-07-01 11:38:12 -04:00
mhartington
3a6210873e docs(3dtouch): improve docs 2016-07-01 09:54:45 -04:00
Ibrahim Hadeed
25fab64e3f fix(): remove unnecessary decorator (#257) 2016-06-30 17:28:23 -04:00
Ibby Hadeed
f69d1755c6 chore(changelog): update changelog 2016-06-27 08:43:32 -04:00
Ibby Hadeed
3ddb728043 1.3.2 2016-06-27 08:42:56 -04:00
Ibby Hadeed
ab2816e214 chore(build): remove github-release command 2016-06-27 08:42:12 -04:00
Ibby Hadeed
a5f3d7a9bd fix(build): disable emitDecoratorMetadata option in tsconfig
closes #251
2016-06-27 08:41:10 -04:00
35 changed files with 1279 additions and 202 deletions

View File

@@ -1,3 +1,35 @@
<a name="1.3.3"></a>
## [1.3.3](https://github.com/driftyco/ionic-native/compare/v1.3.2...v1.3.3) (2016-07-11)
### Bug Fixes
* remove unnecessary decorator ([#257](https://github.com/driftyco/ionic-native/issues/257)) ([25fab64](https://github.com/driftyco/ionic-native/commit/25fab64))
* **actionsheet:** add missing optional parameter for hide function ([#262](https://github.com/driftyco/ionic-native/issues/262)) ([644e999](https://github.com/driftyco/ionic-native/commit/644e999))
* **background-geolocation:** fix pluginref again ([b8a5133](https://github.com/driftyco/ionic-native/commit/b8a5133))
* **geolocation:** fix plugin reference ([4f0cd24](https://github.com/driftyco/ionic-native/commit/4f0cd24)), closes [#258](https://github.com/driftyco/ionic-native/issues/258)
* **googlemaps:** use correct methods for addGroundOverlay and addKmlOverlay ([#268](https://github.com/driftyco/ionic-native/issues/268)) ([b8be1de](https://github.com/driftyco/ionic-native/commit/b8be1de))
* **socialsharing:** all methods return Promises now ([e150224](https://github.com/driftyco/ionic-native/commit/e150224)), closes [#275](https://github.com/driftyco/ionic-native/issues/275)
### Features
* **ibeacon:** add iBeacon plugin support ([#270](https://github.com/driftyco/ionic-native/issues/270)) ([dd97df1](https://github.com/driftyco/ionic-native/commit/dd97df1))
* **onesignal:** added wrapper for the Cordova OneSignal Plugin ([#252](https://github.com/driftyco/ionic-native/issues/252)) ([ba20dbe](https://github.com/driftyco/ionic-native/commit/ba20dbe))
* **push:** added support for Action Buttons on iOS with categories ([#273](https://github.com/driftyco/ionic-native/issues/273)) ([592feb4](https://github.com/driftyco/ionic-native/commit/592feb4))
<a name="1.3.2"></a>
## [1.3.2](https://github.com/driftyco/ionic-native/compare/v1.3.1...v1.3.2) (2016-06-27)
### Bug Fixes
* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251)
<a name="1.3.1"></a>
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26)

View File

@@ -2,11 +2,11 @@
## Feature request?
Have a plugin you'd like to see supported? Because Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whichever plugin you'd like to add.
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
## Having an issue?
## Have an issue?
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.3.1",
"version": "1.3.4",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"files": [
@@ -41,8 +41,7 @@
"build:js": "./node_modules/.bin/tsc",
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
"build:minify": "./node_modules/.bin/gulp minify:dist",
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"github-release": "./node_modules/.bin/conventional-github-releaser -p angular"
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"repository": {
"type": "git",

View File

@@ -5,15 +5,20 @@ module.exports = function removePrivateMembers() {
$runAfter: ['tags-parsed'],
$runBefore: ['rendering-docs'],
$process: function(docs) {
docs.forEach(function(doc){
docs.forEach(function(doc) {
if (doc.members) {
doc.members = doc.members.filter(function(member){
return !member.tags.tagsByName.get("private");
})
doc.members = doc.members.filter(function(member) {
return !member.tags.tagsByName.get('private');
});
}
})
if (doc.statics) {
doc.statics = doc.statics.filter(function(staticMethod) {
return !staticMethod.tags.tagsByName.get('private');
});
}
});
return docs;
}
}
};
};

View File

@@ -1,4 +1,5 @@
module.exports = [
{'name': 'advanced'},
{'name': 'demo'},
{'name': 'usage'}
];

View File

@@ -104,7 +104,7 @@ docType: "<$ doc.docType $>"
</h1>
<a class="improve-v2-docs" href="http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
<a class="improve-v2-docs" href="http://github.com/driftyco/ionic-native/edit/master/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/') $>#L<$ doc.location.start.line $>">
Improve this doc
</a>
@@ -211,10 +211,12 @@ docType: "<$ doc.docType $>"
<@- if method.decorators @>
<@ for prop in method.decorators[0].argumentInfo @>
<@ if prop.platforms @>
<p>
<b>Platforms:</b>
<@- for platform in prop.platforms @>
<code><$ platform $></code>&nbsp;
<@ endfor -@>
</p>
<@ endif @>
<@ endfor @>
<@ endif -@>
@@ -276,6 +278,13 @@ docType: "<$ doc.docType $>"
<@- endif -@>
<@ block advanced @>
<@- if doc.advanced -@>
<h2><a class="anchor" name="advanced" href="#advanced"></a>Advanced</h2>
<$ doc.advanced | marked $>
<@- endif -@>
<@ endblock @>
<!-- related link -->
<@- if doc.see @>

View File

@@ -44,6 +44,7 @@ import {GoogleMap} from './plugins/googlemaps';
import {GoogleAnalytics} from './plugins/googleanalytics';
import {Hotspot} from './plugins/hotspot';
import {Httpd} from './plugins/httpd';
import {IBeacon} from './plugins/ibeacon';
import {ImagePicker} from './plugins/imagepicker';
import {InAppBrowser} from './plugins/inappbrowser';
import {Insomnia} from './plugins/insomnia';
@@ -51,7 +52,8 @@ import {Keyboard} from './plugins/keyboard';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
import {MediaPlugin} from './plugins/media';
import {Network, Connection} from './plugins/network';
import {Network} from './plugins/network';
import {OneSignal} from './plugins/onesignal';
import {Printer} from './plugins/printer';
import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
@@ -79,8 +81,10 @@ export * from './plugins/datepicker';
export * from './plugins/device';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
export * from './plugins/filetransfer';
export * from './plugins/googlemaps';
export * from './plugins/httpd';
export * from './plugins/ibeacon';
export * from './plugins/imagepicker';
export * from './plugins/inappbrowser';
export * from './plugins/launchnavigator';
@@ -106,7 +110,6 @@ export {
BLE,
BluetoothSerial,
Clipboard,
Connection,
DBMeter,
Deeplinks,
DeviceAccounts,
@@ -124,6 +127,7 @@ export {
Insomnia,
Keyboard,
Network,
OneSignal,
Screenshot,
SocialSharing,
Splashscreen,
@@ -146,6 +150,7 @@ window['IonicNative'] = {
AppVersion: AppVersion,
Badge: Badge,
BackgroundGeolocation: BackgroundGeolocation,
BackgroundMode: BackgroundMode,
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
@@ -156,7 +161,6 @@ window['IonicNative'] = {
Camera: Camera,
CardIO: CardIO,
Clipboard: Clipboard,
Connection: Connection,
Contacts: Contacts,
DatePicker: DatePicker,
DBMeter: DBMeter,
@@ -178,6 +182,7 @@ window['IonicNative'] = {
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
InAppBrowser: InAppBrowser,
Keyboard: Keyboard,
@@ -187,6 +192,7 @@ window['IonicNative'] = {
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SMS: SMS,

View File

@@ -7,8 +7,10 @@ declare var window: any;
* @usage
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
* ```
* import {ThreeDeeTouch, ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
* import {ThreeDeeTouch} from 'ionic-native';
*
* // import for type completion on variables
* import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
* ...
*
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
@@ -48,6 +50,15 @@ declare var window: any;
* }
* ];
* ThreeDeeTouch.configureQuickActions(actions);
*
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
* (payload) => {
* // returns an object that is the button you presed
* console.log(`Pressed the ${payload.title} button`)
* console.log(payload.type)
*
* }
* )
* ```
*/
@Plugin({
@@ -74,6 +85,13 @@ export class ThreeDeeTouch {
})
static watchForceTouches(): Observable<ThreeDeeTouchForceTouch> {return; }
/**
* setup the 3D-touch actions, takes an array of objects with the following
* @param {string} type (optional) A type that can be used `onHomeIconPressed` callback
* @param {string} title Title for your action
* @param {string} subtitle (optional) A short description for your action
* @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update
*/
@Cordova({
sync: true
})
@@ -83,9 +101,6 @@ export class ThreeDeeTouch {
* When a home icon is pressed, your app launches and this JS callback is invoked.
* @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
*/
@Cordova({
observable: true
})
static onHomeIconPressed(): Observable<any> {
return new Observable(observer => {
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
@@ -97,6 +112,7 @@ export class ThreeDeeTouch {
}
/**
* Enable Link Preview.
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
*/
@Cordova({
@@ -123,4 +139,4 @@ export interface ThreeDeeTouchForceTouch {
timestamp: number;
x: number;
y: number;
}
}

View File

@@ -22,6 +22,21 @@ import {Plugin, Cordova} from './plugin';
* });
* ```
*
* @advanced
* ActionSheet options
*
* | Option | Type | Description |
* |-------------------------------|-----------|----------------------------------------------|
* | title |`string` | The title for the actionsheet |
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
* | androidTheme |`number` | Theme to be used on Android |
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
* | position |`number[]` | On an iPad, set the X,Y position |
*
*
*/
@Plugin({
plugin: 'cordova-plugin-actionsheet',
@@ -32,20 +47,8 @@ import {Plugin, Cordova} from './plugin';
export class ActionSheet {
/**
* Show the ActionSheet. The ActionSheet's options is an object with the following propterties.
*
* | Option | Type | Description |
* |-------------------------------|-----------|----------------------------------------------|
* | title |`string` | The title for the actionsheet |
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
* | androidTheme |`number` | Theme to be used on Android |
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
* | position |`number[]` | On an iPad, set the X,Y position |
*
* @param {options} Options See table above
* Show a native ActionSheet component. See below for options.
* @param {options} Options See table below
* @returns {Promise} Returns a Promise that resolves with the index of the
* button pressed (1 based, so 1, 2, 3, etc.)
*/
@@ -63,8 +66,9 @@ export class ActionSheet {
/**
* Hide the ActionSheet.
* Progamtically hide the native ActionSheet
* @returns {Promise} Returns a Promise that resolves when the actionsheet is closed
*/
@Cordova()
static hide(): Promise<any> { return; }
static hide(options?: any): Promise<any> { return; }
}

View File

@@ -37,7 +37,7 @@ export class AppAvailability {
/**
* Checks if an app is available on device
* @param app Package name on android, or URI scheme on iOS
* @param {string} app Package name on android, or URI scheme on iOS
* @returns {Promise<boolean>}
*/
@Cordova()

View File

@@ -20,6 +20,27 @@ declare var window;
* AppRate.preferences.storeAppURL.windows8 = 'ms-windows-store:Review?name=<the Package Family Name of the application>';
* AppRate.promptForRating();
* ```
*
* @advanced
*
* Rating dialog preferences
*
* | Option | Type | Default | Description |
* |------------------------------|------------|---------|----------------------------------------------------------------------------------------|
* | useLanguage | `String` | null | custom BCP 47 language tag |
* | displayAppName | `String` | '' | custom application title |
* | promptAgainForEachNewVersion | `Boolean` | true | show dialog again when application version will be updated |
* | usesUntilPrompt | `Integer` | 3 | count of runs of application before dialog will be displayed |
* | openStoreInApp | `Boolean` | false | leave app or no when application page opened in app store (now supported only for iOS) |
* | useCustomRateDialog | `Boolean` | false | use custom view for rate dialog |
* | callbacks.onButtonClicked | `Function` | null | call back function. called when user clicked on rate-dialog buttons |
* | callbacks.onRateDialogShow | `Function` | null | call back function. called when rate-dialog showing |
* | storeAppURL.ios | `String` | null | application id in AppStore |
* | storeAppURL.android | `String` | null | application URL in GooglePlay |
* | storeAppURL.blackberry | `String` | null | application URL in AppWorld |
* | storeAppURL.windows8 | `String` | null | application URL in WindowsStore |
* | customLocale | `Object` | null | custom locale object |
*/
@Plugin({
plugin: 'cordova-plugin-apprate',
@@ -30,31 +51,14 @@ declare var window;
export class AppRate {
/**
* Rating dialog preferences
*
* | Option | Type | Default | Description |
* |------------------------------|------------|---------|----------------------------------------------------------------------------------------|
* | useLanguage | `String` | null | custom BCP 47 language tag |
* | displayAppName | `String` | '' | custom application title |
* | promptAgainForEachNewVersion | `Boolean` | true | show dialog again when application version will be updated |
* | usesUntilPrompt | `Integer` | 3 | count of runs of application before dialog will be displayed |
* | openStoreInApp | `Boolean` | false | leave app or no when application page opened in app store (now supported only for iOS) |
* | useCustomRateDialog | `Boolean` | false | use custom view for rate dialog |
* | callbacks.onButtonClicked | `Function` | null | call back function. called when user clicked on rate-dialog buttons |
* | callbacks.onRateDialogShow | `Function` | null | call back function. called when rate-dialog showing |
* | storeAppURL.ios | `String` | null | application id in AppStore |
* | storeAppURL.android | `String` | null | application URL in GooglePlay |
* | storeAppURL.blackberry | `String` | null | application URL in AppWorld |
* | storeAppURL.windows8 | `String` | null | application URL in WindowsStore |
* | customLocale | `Object` | null | custom locale object |
* @type {{}}
* Configure various settings for the Rating View.
* See table below for options
*/
@CordovaProperty
static get preferences() { return window.AppRate.preferences; }
/**
* Prompts the user for rating
*
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()

View File

@@ -177,7 +177,7 @@ export interface Config {
* debug: true, // enable this hear sounds for background-geolocation life-cycle.
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
* };
*
*
* BackgroundGeolocation.configure(config)
* .then((location) => {
* console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
@@ -202,7 +202,7 @@ export interface Config {
*/
@Plugin({
plugin: 'cordova-plugin-mauron85-background-geolocation',
pluginRef: 'plugins.backgroundGeoLocation',
pluginRef: 'backgroundGeolocation',
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
platforms: ['iOS', 'Android', 'Windows Phone 8']
})

View File

@@ -8,12 +8,25 @@ import {Plugin, Cordova} from './plugin';
*@usage
* ```js
* import {BackgroundMode} from 'ionic-native';
*
*
* BackgroundMode.enable();
* ```
*
* @advanced
*
* Configuration options
*
* | Property | Type | Description |
* |----------|-----------|------------------------------------------------------------------------------|
* | title | `string` | Title of the background task. Optional |
* | ticker | `string` | The text that scrolls itself on the statusbar. Optional |
* | text | `string` | Description of the background task. Optional |
* | silent | `boolean` | If the plugin will display a notification or not. Default is false. Optional |
* | resume | `boolean` | Bring the app into the foreground if the notification is tapped. Optional |
*
*/
@Plugin({
plugin: 'de.appplant.cordova.plugin.background-mode',
plugin: 'cordova-plugin-background-mode',
pluginRef: 'cordova.plugins.backgroundMode',
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
platforms: ['Android', 'iOS', 'Windows Phone 8']
@@ -37,11 +50,14 @@ export class BackgroundMode {
/**
* Checks if background mode is enabled or not.
* @returns {boolean} returns a true of false if the background mode is enabled.
*/
@Cordova()
static isEnabled(): Promise<boolean> {return; }
/**
* Can be used to get the information if the background mode is active.
* @returns {boolean} returns tru or flase if the background mode is active.
*/
@Cordova()
static isActive(): Promise<boolean> {return; }
@@ -49,6 +65,7 @@ export class BackgroundMode {
/**
* Override the default title, ticker and text.
* Available only for Android platform.
* @param {Configure} options List of option to configure. See table below
*/
@Cordova({
platforms: ['Android']
@@ -58,11 +75,13 @@ export class BackgroundMode {
/**
* Modify the displayed information.
* Available only for Android platform.
* @param {Configure} options Any options you want to update. See table below.
*/
@Cordova({
platforms: ['Android']
})
static update(options?: Configure): void {}
/**
* Sets a callback for a specific event
* Can be used to get notified or run function when the background mode has been activated, deactivated or failed.

View File

@@ -27,6 +27,9 @@ import {Plugin, Cordova} from './plugin';
})
export class BarcodeScanner {
/**
* @private
*/
static Encode: any = {
TEXT_TYPE: 'TEXT_TYPE',
EMAIL_TYPE: 'EMAIL_TYPE',

View File

@@ -23,12 +23,13 @@ export class Base64ToGallery {
/**
* Converts a base64 string to an image file in the device gallery
* @param data
* @param prefix
* @param {string} data The actual base64 string that you want to save
* @param {sstring} prefix Prefix the file with a string. Default is 'img_'. Optional.
* @returns {Promise} returns a promise that resolves when the image is saved.
*/
@Cordova()
static base64ToGallery(data: string , prefix?: string ): Promise<any> {
return;
}
}
}

View File

@@ -5,6 +5,24 @@ import {Observable} from 'rxjs/Observable';
* @name Bluetooth Serial
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
* @usage
* ```ts
* // Write a string
* Bluetooth.write("hello world").then(success, failure);
*
* // Array of int or bytes
* Bluetooth.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
* data[0] = 0x41;
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
* Bluetooth.write(data).then(success, failure);
*
* // Array Buffer
* Bluetooth.write(data.buffer).then(success, failure);
* ```
*/
@Plugin({
repo: 'https://github.com/don/BluetoothSerial',
@@ -16,8 +34,8 @@ export class BluetoothSerial {
/**
* Connect to a Bluetooth device
* Returns an Observable. Subscribe to connect, unsubscribe to disconnect.
* @param macAddress_or_uuid Identifier of the remote device
* @param {string} macAddress_or_uuid Identifier of the remote device
* @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -28,8 +46,8 @@ export class BluetoothSerial {
/**
* Connect insecurely to a Bluetooth device
* Returns an Observable. Subscribe to connect, unsubscribe to disconnect.
* @param macAddress Identifier of the remote device
* @param {string} macAddress Identifier of the remote device
* @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
*/
@Cordova({
platforms: ['Android'],
@@ -40,26 +58,8 @@ export class BluetoothSerial {
/**
* Writes data to the serial port
* @param data ArrayBuffer of data
* @usage
* ```ts
* // Write a string
* Bluetooth.write("hello world").then(success, failure);
*
* // Array of int or bytes
* Bluetooth.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
* data[0] = 0x41;
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
* Bluetooth.write(data).then(success, failure);
*
* // Array Buffer
* Bluetooth.write(data.buffer).then(success, failure);
* ```
* @param {any} data ArrayBuffer of data
* @returns {Promise} returns a promise when data has been written
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -68,6 +68,7 @@ export class BluetoothSerial {
/**
* Gets the number of bytes of data available
* @returns {Promise} returns a promise that contains the available bytes
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -75,6 +76,7 @@ export class BluetoothSerial {
/**
* Reads data from the buffer
* @returns {Promise} returns a promise with data from the buffer
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -83,7 +85,8 @@ export class BluetoothSerial {
/**
* Reads data from the buffer until it reaches a delimiter
* @param delimiter
* @param {string} delimiter string that you want to search until
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -92,7 +95,8 @@ export class BluetoothSerial {
/**
* Subscribe to be notified when data is received
* @param delimiter
* @param {string} delimiter the string you want to watch for
* @returns {Observable} returns an observable.
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -103,6 +107,7 @@ export class BluetoothSerial {
/**
* Subscribe to be notified when data is received
* @returns {Observable} returns an observable
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -113,6 +118,7 @@ export class BluetoothSerial {
/**
* Clears data in buffer
* @returns {Promise} returns a promise when completed
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -121,6 +127,7 @@ export class BluetoothSerial {
/**
* Lists bonded devices
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -129,6 +136,7 @@ export class BluetoothSerial {
/**
* Reports if bluetooth is enabled
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -137,6 +145,7 @@ export class BluetoothSerial {
/**
* Reports the connection status
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -145,6 +154,7 @@ export class BluetoothSerial {
/**
* Reads the RSSI from the connected peripheral
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -153,6 +163,7 @@ export class BluetoothSerial {
/**
* Show the Bluetooth settings on the device
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -161,6 +172,7 @@ export class BluetoothSerial {
/**
* Enable Bluetooth on the device
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -169,20 +181,7 @@ export class BluetoothSerial {
/**
* Discover unpaired devices
* @usage
* ```ts
* [{
* "class": 276,
* "id": "10:BF:48:CB:00:00",
* "address": "10:BF:48:CB:00:00",
* "name": "Nexus 7"
* }, {
* "class": 7936,
* "id": "00:06:66:4D:00:00",
* "address": "00:06:66:4D:00:00",
* "name": "RN42"
* }]
* ```
* @returns {Promise} returns a promise
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
@@ -191,6 +190,7 @@ export class BluetoothSerial {
/**
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
* @returns {Observable} Returns an observable
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone'],
@@ -201,7 +201,7 @@ export class BluetoothSerial {
/**
* Sets the human readable device name that is broadcasted to other devices
* @param newName Desired name of device
* @param {string} newName Desired name of device
*/
@Cordova({
platforms: ['Android'],
@@ -211,14 +211,11 @@ export class BluetoothSerial {
/**
* Makes the device discoverable by other devices
* @param discoverableDuration Desired number of seconds device should be discoverable for
* @param {number} discoverableDuration Desired number of seconds device should be discoverable for
*/
@Cordova({
platforms: ['Android'],
sync: true
})
static setDiscoverable (discoverableDuration: number): void {}
}

View File

@@ -95,7 +95,7 @@ export interface CameraPopoverOptions {
* @usage
* ```js
* import {Camera} from 'ionic-native';
*
*
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
@@ -113,8 +113,8 @@ export interface CameraPopoverOptions {
export class Camera {
/**
* Take a picture or video, or load one from the library.
* @param {CameraOptions} options
* @return Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
* @param {CameraOptions} options Options that you want to pass to the camera. Encoding type, quality, etc.
* @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -132,6 +132,7 @@ export class Camera {
static cleanup() { };
/**
* @private
* @enum {number}
*/
static DestinationType = {
@@ -144,6 +145,7 @@ export class Camera {
};
/**
* @private
* @enum {number}
*/
static EncodingType = {
@@ -153,6 +155,7 @@ export class Camera {
PNG: 1
};
/**
* @private
* @enum {number}
*/
static MediaType = {
@@ -165,6 +168,7 @@ export class Camera {
};
/**
* @private
* @enum {number}
*/
static PictureSourceType = {
@@ -177,6 +181,7 @@ export class Camera {
};
/**
* @private
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
*/
@@ -189,6 +194,7 @@ export class Camera {
};
/**
* @private
* @enum {number}
*/
static Direction = {

View File

@@ -41,7 +41,7 @@ export class CardIO {
/**
* Scan a credit card with card.io.
* @param options
* @param {CardIOOptions} options Options for configuring the plugin
*/
@Cordova()
static scan(options?: CardIOOptions): Promise<any> {return; }
@@ -70,4 +70,4 @@ export interface CardIOOptions {
hideCardIOLogo?: boolean;
useCardIOLogo?: boolean;
supressScan?: boolean;
}
}

View File

@@ -18,12 +18,12 @@ import {Plugin, Cordova} from './plugin';
*
* Clipboard.paste().then(
* (resolve : string) => {
* alert(resolve);
* },
* alert(resolve);
* },
* (reject : string) => {
* alert("Error: " + reject);
* }
* );
* );
* );
* ```
*/
@@ -37,15 +37,15 @@ export class Clipboard {
/**
* Copies the given text
* @param text
* @returns {Promise<T>}
* @param {string} text Text that gets copied on the system clipboard
* @returns {Promise<T>} Returns a promise after the text has been copied
*/
@Cordova()
static copy(text: string): Promise<any> { return; }
/**
* Pastes the text stored in clipboard
* @returns {Promise<T>}
* @returns {Promise<T>} Returns a promise after the text has been pasted
*/
@Cordova()
static paste(): Promise<any> { return; }

View File

@@ -31,6 +31,11 @@ export interface IContactProperties {
/** An array of web pages associated with the contact. */
urls?: IContactField[];
}
/**
* @private
*/
export class Contact {
private _objectInstance: any;
@InstanceProperty get id(): string {return; }
@@ -92,6 +97,10 @@ export interface IContactName {
/** The contact's suffix (example Esq.). */
honorificSuffix?: string;
}
/**
* @private
*/
export class ContactName implements IContactName {
private _objectInstance: any;
constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
@@ -114,6 +123,9 @@ export interface IContactField {
pref: boolean;
}
/**
* @private
*/
export class ContactField implements IContactField {
private _objectInstance: any;
constructor(type?: string, value?: string, pref?: boolean) {
@@ -143,6 +155,9 @@ export interface IContactAddress {
country?: string;
}
/**
* @private
*/
export class ContactAddress implements IContactAddress {
private _objectInstance: any;
constructor (pref?: boolean,
@@ -178,6 +193,9 @@ export interface IContactOrganization {
title?: string;
}
/**
* @private
*/
export class ContactOrganization implements IContactOrganization {
private _objectInstance: any;
constructor () {
@@ -200,6 +218,9 @@ export interface IContactFindOptions {
desiredFields?: string[];
}
/**
* @private
*/
export class ContactFindOptions implements IContactFindOptions {
private _objectInstance: any;
constructor () {
@@ -210,6 +231,7 @@ export class ContactFindOptions implements IContactFindOptions {
@InstanceProperty get desiredFields(): any {return; }
@InstanceProperty get hasPhoneNumber(): boolean {return; }
}
/**
* @name Contacts
* @description
@@ -243,9 +265,6 @@ export class Contacts {
}
/**
* Search for contacts in the Contacts list.
*
* Example: Contacts.find(['*'], { filter: 'Max' }) // will search for a displayName of 'Max'
*
* @param fields {string[]} Contact fields to be used as a search qualifier.
* A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
* A contactFields value of "*" searches all contact fields.
@@ -269,4 +288,4 @@ export class Contacts {
*/
@Cordova()
static pickContact(): Promise<any> {return; }
}
}

View File

@@ -77,7 +77,6 @@ export interface DatePickerOptions {
* import {DatePicker} from 'ionic-native';
*
*
*
* DatePicker.show({
* date: new Date(),
* mode: 'date'
@@ -97,10 +96,10 @@ export class DatePicker {
/**
* Shows the date and/or time picker dialog(s)
* @param options
* @param {DatePickerOptions} options Options for the date picker.
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: DatePickerOptions): Promise<Date> { return; }
}
}

View File

@@ -70,7 +70,6 @@ export class DeviceMotion {
/**
* Get the current acceleration along the x, y, and z axes.
*
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
@@ -80,18 +79,8 @@ export class DeviceMotion {
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
*
* ```ts
* // Watch device acceleration
* var subscription = DeviceMotion.watchPosition().subscribe(acceleration => {
* console.log(acceleration);
* });
*
* // Stop watch
* subscription.unsubscribe();
* ```
* @param options
* @returns {Observable<AccelerationData>}
* @param {AccelerometerOptions} options list of options for the accelerometer.
* @returns {Observable<AccelerationData>} Observable returns an observable that you can subscribe to
*/
@Cordova({
callbackOrder: 'reverse',

View File

@@ -83,8 +83,8 @@ export class DeviceOrientation {
* Get the device current heading at a regular interval
*
* Stop the watch by unsubscribing from the observable
* @param options
* @returns {Observable<CompassHeading>}
* @param {CompassOptions} options Options for compass. Frequency and Filter. Optional
* @returns {Observable<CompassHeading>} Returns an observable that contains the compass heading
*/
@Cordova({
callbackOrder: 'reverse',

View File

@@ -40,9 +40,9 @@ export class Dialogs {
/**
* Shows a custom alert or dialog box.
* @param message Dialog message. (String)
* @param title Dialog title. (String) (Optional, defaults to Alert)
* @param buttonName Button name. (String) (Optional, defaults to OK)
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Alert)
* @param {string} buttonName Button name. (Optional, defaults to OK)
* @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
*/
@Cordova({
@@ -57,9 +57,9 @@ export class Dialogs {
/**
* Displays a customizable confirmation dialog box.
* @param message Dialog message. (String)
* @param title Dialog title. (String) (Optional, defaults to Confirm)
* @param buttonLabels Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel])
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Confirm)
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
*/
@Cordova({
@@ -74,10 +74,10 @@ export class Dialogs {
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param message Dialog message. (String)
* @param title Dialog title (String) (Optional, defaults to Prompt)
* @param buttonLabels Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"])
* @param defaultText Default textbox input value (String) (Optional, Default: empty string)
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Prompt)
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
* @param {string} defaultText Default textbox input value. (Optional, Default: empty string)
* @returns {Promise<any>} Returns a promise that resolves an object with the button index clicked and the text entered
*/
@Cordova({
@@ -94,11 +94,11 @@ export class Dialogs {
/**
* The device plays a beep sound.
* @param times The number of times to repeat the beep. (Number)
* @param {numbers} times The number of times to repeat the beep.
*/
@Cordova({
sync: true
})
static beep(times: number): void {}
}
}

View File

@@ -87,8 +87,8 @@ export class Facebook {
/**
* Browser wrapper
* @param appId
* @param version
* @param {number} appId Your Facebook AppID from their dashboard
* @param {string} version The version of API you may want to use. Optional
*/
@Cordova()
static browserInit(appId: number, version?: string): Promise<any> {

View File

@@ -34,9 +34,9 @@ export class Globalization {
/**
* Converts date to string
* @param date
* @param options
* @return {Promise<{value: string}>}
* @param {Date} date Date you wish to convert
* @param options Options for the converted date. Length, selector.
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
*/
@Cordova({
successIndex: 1,
@@ -45,9 +45,10 @@ export class Globalization {
static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> {return; }
/**
*
* @param dateString
* @param options
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
* @param {string} dateString Date as a string to be converted
* @param options Options for the converted date. Length, selector.
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
*/
@Cordova({
successIndex: 1,
@@ -57,8 +58,9 @@ export class Globalization {
/**
*
* @param options
* Returns a pattern string to format and parse dates according to the client's user preferences.
* @param options Object with the format length and selector
* @return {Promise<{value: string}>} Returns a promise.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -67,8 +69,9 @@ export class Globalization {
/**
*
* @param options
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
* @param options Object with type (narrow or wide) and item (month or days).
* @return {Promise<{value: string}>} Returns a promise.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -76,20 +79,22 @@ export class Globalization {
static getDateNames(options: {type: string, item: string}): Promise<{value: Array<string>}> {return; }
/**
* Check if day light saving is active
* @param date
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
* @param {data} date Date to process
* @returns {Promise<dst>} reutrns a promise with the value
*/
@Cordova()
static isDayLightSavingsTime(date: Date): Promise<{dst: string}> {return; }
/**
* Get first day of week
* Returns the first day of the week according to the client's user preferences and calendar.
* @returns {Promise<value>} reutrns a promise with the value
*/
@Cordova()
static getFirstDayOfWeek(): Promise<{value: string}> {return; }
/**
*
* Returns a number formatted as a string according to the client's user preferences.
* @param options
*/
@Cordova({
@@ -100,8 +105,9 @@ export class Globalization {
/**
*
* @param stringToConvert
* @param options
* @param {string} stringToConvert String you want to conver to a number
* @param options The type of number you want to return. Can be decimal, percent, or currency.
* @returns {Promise} Returns a promise with the value.
*/
@Cordova({
successIndex: 1,
@@ -110,8 +116,9 @@ export class Globalization {
static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value: number|string}> {return; }
/**
*
* @param options
* Returns a pattern string to format and parse numbers according to the client's user preferences.
* @param options Can be decimal, percent, or currency.
* @returns {Promise} returns a promise with the value.
*/
@Cordova({
callbackOrder: 'reverse'
@@ -119,8 +126,9 @@ export class Globalization {
static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> {return; }
/**
*
* @param currencyCode
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
* @param {string} currencyCode Currency Code.A
* @returns {Promise} returns a promise with the value
*/
@Cordova()
static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; }

View File

@@ -238,7 +238,7 @@ export class GoogleMap {
addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise<GoogleMapsGroundOverlay> {
return new Promise<GoogleMapsGroundOverlay>(
(resolve, reject) => {
this._objectInstance.addTileOverlay(options, (groundOverlay: any) => {
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
if (groundOverlay) resolve(new GoogleMapsGroundOverlay(groundOverlay));
else reject();
});
@@ -249,7 +249,7 @@ export class GoogleMap {
addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise<GoogleMapsKmlOverlay> {
return new Promise<GoogleMapsKmlOverlay>(
(resolve, reject) => {
this._objectInstance.addTileOverlay(options, (kmlOverlay: any) => {
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
if (kmlOverlay) resolve(new GoogleMapsKmlOverlay(kmlOverlay));
else reject();
});

698
src/plugins/ibeacon.ts Normal file
View File

@@ -0,0 +1,698 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
declare var cordova: any;
export interface Beacon {
/**
* The physical device's identifier.
*/
uuid: string;
/**
* The beacon's major identifier number.
*/
major: number;
/**
* The beacon's major identifier number.
*/
minor: number;
/**
* The proximity of the beacon relative to the phone.
*
* Possible options are:
* ProximityImmediate
* ProximityNear
* ProximityFar
* ProximityUnknown
*/
proximity: 'ProximityImmediate' | 'ProximityNear' | 'ProximityFar' | 'ProximityUnknown';
/**
* Transmission Power of the beacon. A constant emitted by the beacon which indicates what's the expected RSSI at a distance of 1 meter to the beacon.
*/
tx: number;
/**
* Received Signal Strength Indicator. The strength of the beacon's signal when it reaches the device.
* RSSI ranges from aprox -26 (a few inches) to -100 (40-50 m distance).
*/
rssi: number;
/**
* The accuracy of the ranging.
*/
accuracy: number;
}
export interface BeaconRegion {
/**
* A unique identifier for this region.
*/
identifier: string;
/**
* The the beacon identifier the device will "watch" for. Many beacons can share the same uuid.
*/
uuid: string;
/**
* The beacon's major identifier number. Optional, of nothing is supplied
* the plugin will treat it as a wildcard.
*/
major?: number;
/**
* The beacon's major identifier number. Optional, of nothing is supplied
* the plugin will treat it as a wildcard.
*/
minor?: number;
/**
* If set to true the device will scan for beacons and determine region state anytime
* the device's screen is turned on or off. Useful for debugging.
*/
notifyEntryStateOnDisplay?: boolean;
}
export interface CircularRegion {
/**
* A unique identifier for this region.
*/
identifier: string;
/**
* The latitude of this region.
*/
latitude: number;
/**
* The longitude of this region.
*/
longitude: number;
/**
* The radius of the geofence for this region.
*/
radius: number;
}
export type Region = BeaconRegion | CircularRegion;
export interface PluginResult {
/**
* The name of the delegate function that produced the PluginResult object.
*/
eventType: string;
/**
* The region that triggered the event.
*/
region: Region;
/**
* An array of beacon objects
*/
beacons: Beacon[];
/**
* The status of the location permission for iOS.
*/
authorizationStatus: string;
/**
* The state of the phone in relation to the region. Inside/outside for example.
*/
state: 'CLRegionStateInside' | 'CLRegionStateOutside';
}
export interface Delegate {
/**
* An observable that publishes information about the location permission authorization status.
*
* @return Returns a string.
*/
didChangeAuthorizationStatus(): Observable<string>;
/**
* An Observable that publishes event data to it's subscribers
* when the native layer is able to determine the device's state.
*
* This event is called when the phone begins starts monitoring,
* when requestStateForRegion is called, etc.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
didDetermineStateForRegion(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the phone enters a region that it was asked to monitor.
*
* If the user has given the app Always-Location permission, this function
* will be called even when the app is not running on iOS.
* The app will run silently in the background for a small amount of time.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
didEnterRegion(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the phone exits a region that it was asked to monitor.
*
* If the user has given the app Always-Location permission, this function
* will be called even when the app is not running on iOS.
* The app will run silently in the background for a small amount of time.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
didExitRegion(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* each time that the device ranges beacons. Modern Android and iOS devices range
* aproximately once per second.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
didRangeBeaconsInRegion(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the device begins monitoring a region.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
didStartMonitoringForRegion(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the device fails to monitor a region.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
monitoringDidFailForRegionWithError(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the device begins advertising as an iBeacon.
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
peripheralManagerDidStartAdvertising(): Observable<PluginResult>;
/**
* An Observable that publishes event data to it's subscribers
* when the state of the peripheral manager's state updates.
*
*
* @return {PluginResult} Returns a PluginResult object with information about the event, region, and beacon(s).
*/
peripheralManagerDidUpdateState(): Observable<PluginResult>;
}
/**
* @name IBeacon
* @description
* This plugin provides functions for working with iBeacons.
*
* The plugin's API closely mimics the one exposed through the [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html) introduced in iOS 7.
*
* @usage
*
* ```ts
* import {IBeacon} from 'ionic-native';
*
*
* // Request permission to use location on iOS
* IBeacon.requestAlwaysAuthorization();
* // create a new delegate and register it with the native layer
* let delegate = IBeacon.Delegate();
*
* // Subscribe to some of the delegate's event handlers
* delegate.didRangeBeaconsInRegion()
* .subscribe(
* data => {console.log('didRangeBeaconsInRegion: ', data)},
* error => console.error
* );
* delegate.didStartMonitoringForRegion()
* .subscribe(
* data => {console.log('didStartMonitoringForRegion: ', data)},
* error => console.error
* );
* delegate.didEnterRegion()
* .subscribe(
* data => {
* console.log('didEnterRegion: ', data);
* }
* );
*
* let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
*
* IBeacon.startMonitoringForRegion(beaconRegion)
* .then(
* () => console.log('Native layer recieved the request to monitoring'),
* error => console.error('Native layer failed to begin monitoring: ', error)
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-ibeacon',
pluginRef: 'cordova.plugins.locationManager',
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
platforms: ['Android', 'iOS']
})
export class IBeacon {
/**
* Instances of this class are delegates between the {@link LocationManager} and
* the code that consumes the messages generated on in the native layer.
*
* @returns {Delegate} An instance of the type {@type Delegate}.
*/
static Delegate(): Delegate {
let delegate = new cordova.plugins.locationManager.Delegate();
delegate.didChangeAuthorizationStatus = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didChangeAuthorizationStatus = cb;
}
);
};
delegate.didDetermineStateForRegion = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didDetermineStateForRegion = cb;
}
);
};
delegate.didEnterRegion = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didEnterRegion = cb;
}
);
};
delegate.didExitRegion = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didExitRegion = cb;
}
);
};
delegate.didRangeBeaconsInRegion = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didRangeBeaconsInRegion = cb;
}
);
};
delegate.didStartMonitoringForRegion = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.didStartMonitoringForRegion = cb;
}
);
};
delegate.monitoringDidFailForRegionWithError = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.monitoringDidFailForRegionWithError = cb;
}
);
};
delegate.peripheralManagerDidStartAdvertising = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.peripheralManagerDidStartAdvertising = cb;
}
);
};
delegate.peripheralManagerDidUpdateState = (pluginResult?: PluginResult) => {
return new Observable<PluginResult>(
(observer: any) => {
let cb = (data: PluginResult) => observer.next(data);
return delegate.peripheralManagerDidUpdateState = cb;
}
);
};
cordova.plugins.locationManager.setDelegate(delegate);
return delegate;
}
/**
* Creates a new BeaconRegion
*
* @param {String} identifier @see {CLRegion}
* @param {String} uuid The proximity ID of the beacon being targeted.
* This value must not be blank nor invalid as a UUID.
* @param {Number} major The major value that you use to identify one or more beacons.
* @param {Number} minor The minor value that you use to identify a specific beacon.
* @param {BOOL} notifyEntryStateOnDisplay
*
* @return Returns the BeaconRegion that was created
*/
static BeaconRegion(identifer: string, uuid: string, minor?: number, major?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, minor, major, notifyEntryStateOnDisplay);
}
/**
* @return Returns the Delegate
*/
@Cordova()
static getDelegate(): Delegate { return; }
/**
* @param {Delegate} delegate An instance of a delegate to register with the native layer.
*
* @return Returns the Delegate
*/
@Cordova()
static setDelegate(delegate: Delegate): Delegate { return; }
/**
* Signals the native layer that the client side is ready to consume messages.
* Readiness here means that it has a {Delegate} set by the consumer javascript
* code.
*
* The {LocationManager.setDelegate()} will implicitly call this method as well,
* therefore the only case when you have to call this manually is if you don't
* wish to specify a {Delegate} of yours.
*
* The purpose of this signaling mechanism is to make the events work when the
* app is being woken up by the Operating System to give it a chance to handle
* region monitoring events for example.
*
* If you don't set a {Delegate} and don't call this method manually, an error
* message get emitted in the native runtime and the DOM as well after a certain
* period of time.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the request and started to send events.
*/
@Cordova({sync: true})
static onDomDelegateReady(): Promise<void> { return; }
/**
* Determines if bluetooth is switched on, according to the native layer.
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether bluetooth is active.
*/
@Cordova({sync: true})
static isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Enables Bluetooth using the native Layer. (ANDROID ONLY)
*
* @returns Returns a promise which is resolved when Bluetooth
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({sync: true})
static enableBluetooth(): Promise<void> { return; }
/**
* Disables Bluetooth using the native Layer. (ANDROID ONLY)
*
* @returns Returns a promise which is resolved when Bluetooth
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({sync: true})
static disableBluetooth(): Promise<void> { return; }
/**
* Start monitoring the specified region.
*
* If a region of the same type with the same identifier is already being
* monitored for this application,
* it will be removed from monitoring. For circular regions, the region
* monitoring service will prioritize
* regions by their size, favoring smaller regions over larger regions.
*
* This is done asynchronously and may not be immediately reflected in monitoredRegions.
*
* @param {Region} region An instance of {Region} which will be monitored
* by the operating system.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({sync: true})
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
/**
* Stop monitoring the specified region. It is valid to call
* stopMonitoringForRegion: for a region that was registered for monitoring
* with a different location manager object, during this or previous
* launches of your application.
*
* This is done asynchronously and may not be immediately reflected in monitoredRegions.
*
* @param {Region} region An instance of {Region} which will be monitored
* by the operating system.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Request state the for specified region. When result is ready
* didDetermineStateForRegion is triggered. This can be any region,
* also those which is not currently monitored.
*
* This is done asynchronously and may not be immediately reflected in monitoredRegions.
*
* @param {Region} region An instance of {Region} which will be monitored
* by the operating system.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
static requestStateForRegion(region: Region): Promise<void> { return; }
/**
* Start ranging the specified beacon region.
*
* If a region of the same type with the same identifier is already being
* monitored for this application, it will be removed from monitoring.
*
* This is done asynchronously and may not be immediately reflected in rangedRegions.
*
* @param {Region} region An instance of {BeaconRegion} which will be monitored
* by the operating system.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({sync: true})
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Stop ranging the specified region. It is valid to call
* stopMonitoringForRegion: for a region that was registered for ranging
* with a different location manager object, during this or previous
* launches of your application.
*
* This is done asynchronously and may not be immediately reflected in rangedRegions.
*
* @param {Region} region An instance of {BeaconRegion} which will be monitored
* by the operating system.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({sync: true})
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Queries the native layer to determine the current authorization in effect.
*
* @returns Returns a promise which is resolved with the
* requested authorization status.
*/
@Cordova({sync: true})
static getAuthorizationStatus(): Promise<any> { return; }
/**
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
* explicitly request permissions via methods like these:
* <a href="https://developer.apple.com/library/prerelease/iOS/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestWhenInUseAuthorization">requestWhenInUseAuthorization</a>
* <a href="https://developer.apple.com/library/prerelease/iOS/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestAlwaysAuthorization">requestAlwaysAuthorization</a>
*
* If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
* @returns Returns a promise that is resolved when the request dialog is shown.
*/
@Cordova({sync: true})
static requestWhenInUseAuthorization(): Promise<void> { return; }
/**
* See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
*
* @returns Returns a promise which is resolved when the native layer
* shows the request dialog.
*/
@Cordova({sync: true})
static requestAlwaysAuthorization(): Promise<void> { return; }
/**
*
* @returns Returns a promise which is resolved with an {Array}
* of {Region} instances that are being monitored by the native layer.
*/
@Cordova({sync: true})
static getMonitoredRegions(): Promise<Region[]> { return; }
/**
*
* @returns Returns a promise which is resolved with an {Array}
* of {Region} instances that are being ranged by the native layer.
*/
@Cordova({sync: true})
static getRangedRegions(): Promise<Region[]> { return; }
/**
* Determines if ranging is available or not, according to the native layer.
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether ranging is available or not.
*/
@Cordova({sync: true})
static isRangingAvailable(): Promise<boolean> { return; }
/**
* Determines if region type is supported or not, according to the native layer.
*
* @param {Region} region An instance of {Region} which will be checked
* by the operating system.
*
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether the region type is supported or not.
*/
@Cordova({sync: true})
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
/**
* Start advertising the specified region.
*
* If a region a different identifier is already being advertised for
* this application, it will be replaced with the new identifier.
*
* This call will accept a valid beacon even when no BlueTooth is available,
* and will start when BlueTooth is powered on. See {Delegate.}
*
* @param {Region} region An instance of {Region} which will be advertised
* by the operating system.
* @param {Integer} measuredPower: Optional parameter, if left empty, the device will
* use it's own default value.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the advertising request.
*/
@Cordova({sync: true})
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
/**
* Stop advertising as a beacon.
*
* This is done asynchronously and may not be immediately reflected in isAdvertising.
*
* @return Returns a promise which is resolved as soon as the
* native layer acknowledged the dispatch of the request to stop advertising.
*/
@Cordova({sync: true})
static stopAdvertising(region: Region): Promise<void> { return; }
/**
* Determines if advertising is available or not, according to the native layer.
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether advertising is available or not.
*/
@Cordova({sync: true})
static isAdvertisingAvailable(): Promise<boolean> { return; }
/**
* Determines if advertising is currently active, according to the native layer.
* @returns Returns a promise which is resolved with a {Boolean}
* indicating whether advertising is active.
*/
@Cordova({sync: true})
static isAdvertising(): Promise<boolean> { return; }
/**
* Disables debug logging in the native layer. Use this method if you want
* to prevent this plugin from writing to the device logs.
*
* @returns Returns a promise which is resolved as soon as the
* native layer has set the logging level accordingly.
*/
@Cordova({sync: true})
static disableDebugLogs(): Promise<void> { return; }
/**
* Enables the posting of debug notifications in the native layer. Use this method if you want
* to allow the plugin the posting local notifications.
* This can be very helpful when debugging how to apps behave when launched into the background.
*
* @returns Returns a promise which is resolved as soon as the
* native layer has set the flag to enabled.
*/
@Cordova({sync: true})
static enableDebugNotifications(): Promise<void> { return; }
/**
* Disables the posting of debug notifications in the native layer. Use this method if you want
* to prevent the plugin from posting local notifications.
*
* @returns Returns a promise which is resolved as soon as the
* native layer has set the flag to disabled.
*/
@Cordova({sync: true})
static disableDebugNotifications(): Promise<void> { return; }
/**
* Enables debug logging in the native layer. Use this method if you want
* a debug the inner workings of this plugin.
*
* @returns Returns a promise which is resolved as soon as the
* native layer has set the logging level accordingly.
*/
@Cordova({sync: true})
static enableDebugLogs(): Promise<void> { return; }
/**
* Appends the provided [message] to the device logs.
* Note: If debug logging is turned off, this won't do anything.
*
* @param {String} message The message to append to the device logs.
*
* @returns Returns a promise which is resolved with the log
* message received by the native layer for appending. The returned message
* is expected to be equivalent to the one provided in the original call.
*/
@Cordova({sync: true})
static appendToDeviceLog(message: string): Promise<void> { return; }
}

View File

@@ -10,7 +10,7 @@ declare var navigator: any;
*
* @usage
* ```js
* import {Network, Connection} from 'ionic-native';
* import {Network} from 'ionic-native';
*
* // watch network for a disconnect
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
@@ -28,8 +28,7 @@ declare var navigator: any;
*// before we determine the connection type. Might need to wait
* // prior to doing any api requests as well.
* setTimeout(() => {
* console.log(Network.connection);
* if (Network.connection === Connection.WIFI) {
* if (Network.connection === 'wifi') {
* console.log('we got a wifi connection, woohoo!');
* }
* }, 3000);
@@ -39,6 +38,8 @@ declare var navigator: any;
* connectSubscription.unsubscribe();
*
* ```
* @advanced
* The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none`
*/
@Plugin({
plugin: 'cordova-plugin-network-information',
@@ -52,7 +53,7 @@ export class Network {
* Return the network connection type
*/
@CordovaProperty
static get connection(): Connection { return navigator.connection.type; }
static get connection(): String { return navigator.connection.type; }
/**
* Get notified when the device goes offline
@@ -75,14 +76,3 @@ export class Network {
static onConnect(): Observable<any> { return; }
}
export class Connection {
static get UNKNOWN() { return 'unknown'; }
static get ETHERNET() { return 'ethernet'; }
static get WIFI() { return 'wifi'; }
static get CELL_2G() { return '2g'; }
static get CELL_3G() { return '3g'; }
static get CELL_4G() { return '4g'; }
static get CELL() { return 'cellular'; }
static get NONE() { return 'none'; }
}

253
src/plugins/onesignal.ts Normal file
View File

@@ -0,0 +1,253 @@
import {Plugin, Cordova} from './plugin';
/**
* @name OneSignal
* @description
* The OneSignal plugin is an client implementation for using the [OneSignal](https://onesignal.com/) Service.
* OneSignal is a simple implementation for delivering push notifications.
*
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
*
* @usage
* ```ts
* import {OneSignal} from 'ionic-native';
*
* let notificationOpenedCallback(jsonData: any) {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* };
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
* {googleProjectNumber: "703322744261"},
* notificationOpenedCallback);
*
* OneSignal.enableInAppAlertNotification(true);
* ```
*
*/
@Plugin({
plugin: 'onesignal-cordova-plugin',
pluginRef: 'plugins.OneSignal',
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class OneSignal {
/**
* Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
*
* @param {appId} Your AppId from your OneSignal app
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
*/
@Cordova()
static init(appId: string,
options: {
googleProjectNumber: string,
autoRegister: boolean
}): Promise<any> { return; }
/**
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
* Only use if you passed false to autoRegister when calling init.
*/
@Cordova({ sync: true })
static registerForPushNotifications(): void { }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {key} Key of your choosing to create or update.
* @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
*/
@Cordova({ sync: true })
static sendTag(key: string, value: string): void { }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
* Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
*
* @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
static sendTags(json: any): void { }
/**
* Retrieve a list of tags that have been set on the user from the OneSignal server.
*
* @returns {Promise} Returns a Promise that resolves when tags are recieved.
*/
@Cordova()
static getTags(): Promise<any> { return; }
/**
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
*
* @param {key} Key to remove.
*/
@Cordova({ sync: true })
static deleteTag(key: string): void { }
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
*
* @param {keys} Keys to remove.
*/
@Cordova({ sync: true })
static deleteTags(keys: string[]): void { }
/**
* Lets you retrieve the OneSignal user id and device token.
* Your handler is called after the device is successfully registered with OneSignal.
*
* @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
* It returns a JSON with `userId`and `pushToken`.
*/
@Cordova()
static getIds(): Promise<any> { return; }
/**
* Warning:
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
*
* By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
* Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
*
* @param {enable} false to disable vibrate, true to re-enable it.
*/
@Cordova({ sync: true })
static enableVibrate(enable: boolean): void { }
/**
* Warning:
* Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
*
* By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
* Passing false means that the device will only vibrate unless the device is set to a total silent mode.
*
* @param {enable} false to disable sound, true to re-enable it.
*/
@Cordova({ sync: true })
static enableSound(enable: boolean): void { }
/**
* Warning:
* Only applies to Android and Amazon devices.
*
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
*
* @param {enable} enable
*/
@Cordova({ sync: true })
static enableNotificationsWhenActive(enable: boolean): void { }
/**
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
* If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
* The notificationOpenedCallback is then fired after the alert box is closed.
*
* @param {enable} enable
*/
@Cordova({ sync: true })
static enableInAppAlertNotification(enable: boolean): void { }
/**
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
* You can pass true later to opt users back into notifications.
*
* @param {enable} enable
*/
@Cordova({ sync: true })
static setSubscription(enable: boolean): void { }
/**
*
* @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)
* @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
*/
@Cordova()
static postNotification(notificationObj: {
app_id: string,
contents: any,
headings?: any,
isIos?: boolean,
isAndroid?: boolean,
isWP?: boolean,
isWP_WNS?: boolean,
isAdm?: boolean,
isChrome?: boolean,
isChromeWeb?: boolean,
isSafari?: boolean,
isAnyWeb?: boolean,
included_segments?: string[],
excluded_segments?: string[],
include_player_ids?: string[],
include_ios_tokens?: string[],
include_android_reg_ids?: string[],
include_wp_uris?: string[],
include_wp_wns_uris?: string[],
include_amazon_reg_ids?: string[],
include_chrome_reg_ids?: string[],
include_chrome_web_reg_ids?: string[],
app_ids?: string[];
tags?: any[],
ios_badgeType?: string,
ios_badgeCount?: number,
ios_sound?: string,
android_sound?: string,
adm_sound?: string,
wp_sound?: string,
wp_wns_sound?: string,
data?: any,
buttons?: any,
small_icon?: string,
large_icon?: string,
big_picture?: string,
adm_small_icon?: string,
adm_large_icon?: string,
adm_big_picture?: string,
chrome_icon?: string,
chrome_big_picture?: string,
chrome_web_icon?: string,
firefox_icon?: string,
url?: string,
send_after?: string,
delayed_option?: string,
delivery_time_of_day?: string,
android_led_color?: string,
android_accent_color?: string,
android_visibility?: number,
content_available?: boolean,
amazon_background_data?: boolean,
template_id?: string,
android_group?: string,
android_group_message?: any,
adm_group?: string,
adm_group_message?: any,
ttl?: number,
priority?: number,
ios_category?: string
}): Promise<any> { return; }
/**
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
*/
@Cordova({ sync: true })
static promptLocation(): void { }
/**
* Enable logging to help debug if you run into an issue setting up OneSignal.
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
* The higher the value the more information is shown.
*
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
*/
@Cordova({ sync: true })
static setLogLevel(logLevel: {
logLevel: number,
visualLevel: number
}): void { }
}

View File

@@ -186,6 +186,29 @@ export interface IOSPushOptions {
* **Note**: only usable in conjunction with `senderID`.
*/
topics?: string[];
/**
* The data required in order to enable Action Buttons for iOS.
* Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1
*/
categories?: CategoryArray;
}
export interface CategoryArray {
[name: string]: CategoryAction;
}
export interface CategoryAction {
yes?: CategoryActionData;
no?: CategoryActionData;
maybe?: CategoryActionData;
}
export interface CategoryActionData {
callback: string;
title: string;
foreground: boolean;
destructive: boolean;
}
export interface AndroidPushOptions {

View File

@@ -28,10 +28,8 @@ export class SocialSharing {
* @param file {string|Array<string>} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
* @param url {string} A URL to share
*/
@Cordova({
sync: true
})
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
@Cordova()
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): Promise<any> {return; }
/**
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
@@ -58,10 +56,9 @@ export class SocialSharing {
* @param url
*/
@Cordova({
sync: true,
platforms: ['iOS', 'Android']
})
static shareViaTwitter (message: string, image?: string, url?: string): void {}
static shareViaTwitter (message: string, image?: string, url?: string): Promise<any> {return; }
/**
* Shares directly to Facebook

View File

@@ -27,7 +27,7 @@ export class SpinnerDialog {
* Shows the spinner dialog
* @param title {string} Spinner title (shows on Android only)
* @param message {string} Spinner message
* @param cancelCallback {boolean|function} Set to false to set spinner not cancelable. Or provide a function to call when the user cancels the spinner.
* @param cancelCallback {boolean|function} Set to true to set spinner not cancelable. Or provide a function to call when the user cancels the spinner.
* @param iOSOptions {object} Options for iOS only
*/
@Cordova({
@@ -50,4 +50,4 @@ export interface SpinnerDialogIOSOptions {
textColorRed?: number;
textColorGreen?: number;
textColorBlue?: number;
}
}

View File

@@ -53,7 +53,7 @@ export class TouchID {
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/
@Cordova()
isAvailable(): Promise<any> { return; }
static isAvailable(): Promise<any> { return; }
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.

View File

@@ -4,7 +4,6 @@
"target": "ES5",
"sourceMap": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "dist"
},