mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a28b24a0b | ||
|
|
5c72340a37 | ||
|
|
360888563f | ||
|
|
b8a513301e | ||
|
|
4f0cd24476 | ||
|
|
00d35c636b | ||
|
|
e150224cda | ||
|
|
fa4721319e | ||
|
|
6229d4932e | ||
|
|
7c20bddd17 | ||
|
|
2b4e318072 | ||
|
|
dd97df19fe | ||
|
|
9eb63a0d74 | ||
|
|
ba20dbe590 | ||
|
|
b8be1de068 | ||
|
|
592feb409e | ||
|
|
4a38c02c14 | ||
|
|
d84b83b42c | ||
|
|
38cea9da27 | ||
|
|
da28af024c | ||
|
|
c69f8203ff | ||
|
|
eee5fd0c17 | ||
|
|
ef960c8aec | ||
|
|
f2f3741819 | ||
|
|
e802571726 | ||
|
|
644e999d1e | ||
|
|
5a14ec01ef | ||
|
|
3a6210873e | ||
|
|
25fab64e3f | ||
|
|
f69d1755c6 | ||
|
|
3ddb728043 | ||
|
|
ab2816e214 | ||
|
|
a5f3d7a9bd | ||
|
|
e52c1f0cae | ||
|
|
def3914abe | ||
|
|
677b676c77 | ||
|
|
3936f81d8f | ||
|
|
ade3edace4 | ||
|
|
4251d1fba5 | ||
|
|
d2b2be6a70 | ||
|
|
88ed4e121f | ||
|
|
17da427a9d | ||
|
|
abf4983597 | ||
|
|
f1c8ce35e8 | ||
|
|
32661b791a | ||
|
|
d42780daca | ||
|
|
e8a108d92d | ||
|
|
9e0f569eba | ||
|
|
48ffcaeb61 | ||
|
|
4c6006b2e4 | ||
|
|
18b86e8c46 | ||
|
|
b96f066329 |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
69
CHANGELOG.md
69
CHANGELOG.md
@@ -1,11 +1,42 @@
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.0) (2016-06-13)
|
||||
<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)
|
||||
|
||||
### Breaking Changes
|
||||
* **calendar** plugin has been fully rewritten
|
||||
|
||||
### 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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232)
|
||||
* **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180)
|
||||
* **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212)
|
||||
* **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6))
|
||||
@@ -14,13 +45,28 @@
|
||||
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
|
||||
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
|
||||
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
|
||||
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
|
||||
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
|
||||
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
|
||||
* **brightntess:** Add brightness plugin
|
||||
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
|
||||
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.4"></a>
|
||||
## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)
|
||||
|
||||
|
||||
|
||||
<a name="1.2.3"></a>
|
||||
## [1.2.3](https://github.com/driftyco/ionic-native/compare/v1.2.2...v1.2.3) (2016-06-01)
|
||||
|
||||
|
||||
|
||||
<a name="1.2.2"></a>
|
||||
## [1.2.2](https://github.com/driftyco/ionic-native/compare/v1.2.1...v1.2.2) (2016-05-20)
|
||||
@@ -42,12 +88,17 @@
|
||||
|
||||
* **contacts:** plugin rewrite ([aada893](https://github.com/driftyco/ionic-native/commit/aada893))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **plugin:** add wrapper for instance properties ([28d7d5c](https://github.com/driftyco/ionic-native/commit/28d7d5c))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/driftyco/ionic-native/compare/v1.1.0...v1.2.0) (2016-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **BluetoohSerial:** add missing plugin reference ([317437b](https://github.com/driftyco/ionic-native/commit/317437b))
|
||||
@@ -62,6 +113,7 @@
|
||||
* **spinnerdialog:** fix functionality ([66f0e03](https://github.com/driftyco/ionic-native/commit/66f0e03))
|
||||
* **vibration:** fix plugin reference ([beeb075](https://github.com/driftyco/ionic-native/commit/beeb075)), closes [#106](https://github.com/driftyco/ionic-native/issues/106)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **camera:** add camera constants ([ce02d82](https://github.com/driftyco/ionic-native/commit/ce02d82)), closes [#129](https://github.com/driftyco/ionic-native/issues/129)
|
||||
@@ -78,6 +130,7 @@
|
||||
* **toast:** add new features to toast plugin ([ed7e783](https://github.com/driftyco/ionic-native/commit/ed7e783))
|
||||
* **webintent:** add plugin to index ([f357b56](https://github.com/driftyco/ionic-native/commit/f357b56))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **ionicnative:** instance wrapper cleanup and optimization ([5a8d48e](https://github.com/driftyco/ionic-native/commit/5a8d48e))
|
||||
@@ -112,6 +165,7 @@
|
||||
* fix options params ([c71f8d4](https://github.com/driftyco/ionic-native/commit/c71f8d4))
|
||||
* remove confirm callback, not needed. ([662d8ce](https://github.com/driftyco/ionic-native/commit/662d8ce))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **batterystatus:** complete functionality ([e7a09d9](https://github.com/driftyco/ionic-native/commit/e7a09d9))
|
||||
@@ -155,12 +209,13 @@
|
||||
* **geolocation:** call correct clearFunction ([9e86a40](https://github.com/driftyco/ionic-native/commit/9e86a40))
|
||||
* **plugin:** return originalMethod return value ([240f0f8](https://github.com/driftyco/ionic-native/commit/240f0f8))
|
||||
* **plugin:** use call for id based clearFunction ([c2fdf39](https://github.com/driftyco/ionic-native/commit/c2fdf39))
|
||||
* datepicker plugin, pluginref, and @Cordova wrapper ([499ead3](https://github.com/driftyco/ionic-native/commit/499ead3))
|
||||
* datepicker plugin, pluginref, and [@Cordova](https://github.com/Cordova) wrapper ([499ead3](https://github.com/driftyco/ionic-native/commit/499ead3))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **DatePicker:** Added DatePicker ([5afa58f](https://github.com/driftyco/ionic-native/commit/5afa58f))
|
||||
* **plugin:** add sync option to @Cordova for sync functions ([17e3827](https://github.com/driftyco/ionic-native/commit/17e3827))
|
||||
* **plugin:** add sync option to [@Cordova](https://github.com/Cordova) for sync functions ([17e3827](https://github.com/driftyco/ionic-native/commit/17e3827))
|
||||
* **plugin:** call clearFunction with original fn args ([8f27fc9](https://github.com/driftyco/ionic-native/commit/8f27fc9))
|
||||
* add app version plugin ([20cb01f](https://github.com/driftyco/ionic-native/commit/20cb01f))
|
||||
* add app version plugin ([8b78521](https://github.com/driftyco/ionic-native/commit/8b78521))
|
||||
|
||||
@@ -94,11 +94,11 @@ The `@Cordova` decorator has a few more options now.
|
||||
|
||||
### Testing your changes
|
||||
|
||||
You need to run `npm run build_bundle` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
|
||||
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
|
||||
|
||||
### Cleaning the code
|
||||
|
||||
You need to run `gulp tslint` to analyze the code and ensure it's consitency with the repository style. Fix any errors before submitting a PR.
|
||||
You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
|
||||
|
||||
### 'Wrapping' Up
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ dependencies:
|
||||
test:
|
||||
override:
|
||||
- echo "No tests are written at the moment. But we will attempt to build the library with the latest changes."
|
||||
- npm run build_bundle
|
||||
- npm run build
|
||||
|
||||
deployment:
|
||||
staging:
|
||||
|
||||
22
package.json
22
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.3",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
@@ -10,18 +10,19 @@
|
||||
"rxjs": "^5.0.0-beta.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
"browserify": "^13.0.1",
|
||||
"canonical-path": "0.0.2",
|
||||
"conventional-changelog": "^1.1.0",
|
||||
"conventional-changelog-cli": "^1.2.0",
|
||||
"conventional-github-releaser": "^1.1.3",
|
||||
"cpr": "^1.0.0",
|
||||
"cz-conventional-changelog": "^1.1.5",
|
||||
"cz-conventional-changelog": "^1.1.6",
|
||||
"dgeni": "^0.4.2",
|
||||
"dgeni-packages": "^0.10.18",
|
||||
"glob": "^6.0.4",
|
||||
"gulp": "~3.9.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-tslint": "^5.0.0",
|
||||
"gulp-uglify": "^1.5.3",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"lodash": "3.10.1",
|
||||
"minimist": "^1.1.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
@@ -34,8 +35,13 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "tsc --module commonjs --sourcemap --outDir dist/ --experimentalDecorators -d typings/es6-shim/es6-shim.d.ts src/index.ts --target ES5",
|
||||
"build_bundle": "npm run-script build && browserify dist/index.js > dist/ionic.native.js && gulp minify:dist"
|
||||
"tslint": "./node_modules/.bin/gulp tslint",
|
||||
"watch": "./node_modules/.bin/tsc -w",
|
||||
"build": "npm run tslint && npm run build:js && npm run build:bundle && npm run build:minify",
|
||||
"build:js": "./node_modules/.bin/tsc",
|
||||
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
|
||||
"build:minify": "./node_modules/.bin/gulp minify:dist",
|
||||
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
module.exports = [
|
||||
{'name': 'advanced'},
|
||||
{'name': 'demo'},
|
||||
{'name': 'usage'}
|
||||
];
|
||||
|
||||
11
scripts/docs/templates/common.template.html
vendored
11
scripts/docs/templates/common.template.html
vendored
@@ -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>
|
||||
<@ 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 @>
|
||||
|
||||
|
||||
15
src/index.ts
15
src/index.ts
@@ -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,9 @@ 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';
|
||||
import {Screenshot} from './plugins/screenshot';
|
||||
@@ -78,13 +81,16 @@ 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';
|
||||
export * from './plugins/localnotifications';
|
||||
export * from './plugins/media';
|
||||
export * from './plugins/printer';
|
||||
export * from './plugins/push';
|
||||
export * from './plugins/safari-view-controller';
|
||||
export * from './plugins/sms';
|
||||
@@ -104,7 +110,6 @@ export {
|
||||
BLE,
|
||||
BluetoothSerial,
|
||||
Clipboard,
|
||||
Connection,
|
||||
DBMeter,
|
||||
Deeplinks,
|
||||
DeviceAccounts,
|
||||
@@ -122,6 +127,7 @@ export {
|
||||
Insomnia,
|
||||
Keyboard,
|
||||
Network,
|
||||
OneSignal,
|
||||
Screenshot,
|
||||
SocialSharing,
|
||||
Splashscreen,
|
||||
@@ -144,6 +150,7 @@ window['IonicNative'] = {
|
||||
AppVersion: AppVersion,
|
||||
Badge: Badge,
|
||||
BackgroundGeolocation: BackgroundGeolocation,
|
||||
BackgroundMode: BackgroundMode,
|
||||
BarcodeScanner: BarcodeScanner,
|
||||
Base64ToGallery: Base64ToGallery,
|
||||
BatteryStatus: BatteryStatus,
|
||||
@@ -154,7 +161,6 @@ window['IonicNative'] = {
|
||||
Camera: Camera,
|
||||
CardIO: CardIO,
|
||||
Clipboard: Clipboard,
|
||||
Connection: Connection,
|
||||
Contacts: Contacts,
|
||||
DatePicker: DatePicker,
|
||||
DBMeter: DBMeter,
|
||||
@@ -176,6 +182,7 @@ window['IonicNative'] = {
|
||||
GoogleAnalytics: GoogleAnalytics,
|
||||
Hotspot: Hotspot,
|
||||
Httpd: Httpd,
|
||||
IBeacon: IBeacon,
|
||||
ImagePicker: ImagePicker,
|
||||
InAppBrowser: InAppBrowser,
|
||||
Keyboard: Keyboard,
|
||||
@@ -183,7 +190,9 @@ window['IonicNative'] = {
|
||||
LocalNotifications: LocalNotifications,
|
||||
MediaPlugin: MediaPlugin,
|
||||
Network: Network,
|
||||
Printer: Printer,
|
||||
Push: Push,
|
||||
OneSignal: OneSignal,
|
||||
SafariViewController: SafariViewController,
|
||||
Screenshot: Screenshot,
|
||||
SMS: SMS,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
declare var window: any;
|
||||
/**
|
||||
* @name 3DTouch
|
||||
* @description
|
||||
* @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)):
|
||||
@@ -47,6 +50,15 @@ import {Observable} from 'rxjs/Observable';
|
||||
* }
|
||||
* ];
|
||||
* 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({
|
||||
@@ -73,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
|
||||
})
|
||||
@@ -82,12 +101,18 @@ 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; }
|
||||
static onHomeIconPressed(): Observable<any> {
|
||||
return new Observable(observer => {
|
||||
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
|
||||
else {
|
||||
observer.error('3dTouch plugin is not available.');
|
||||
observer.complete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Link Preview.
|
||||
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -114,4 +139,4 @@ export interface ThreeDeeTouchForceTouch {
|
||||
timestamp: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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']
|
||||
})
|
||||
|
||||
@@ -10,9 +10,23 @@ import {Plugin, Cordova} from './plugin';
|
||||
* 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']
|
||||
@@ -36,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; }
|
||||
@@ -48,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']
|
||||
@@ -57,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.
|
||||
|
||||
@@ -27,6 +27,9 @@ import {Plugin, Cordova} from './plugin';
|
||||
})
|
||||
export class BarcodeScanner {
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static Encode: any = {
|
||||
TEXT_TYPE: 'TEXT_TYPE',
|
||||
EMAIL_TYPE: 'EMAIL_TYPE',
|
||||
@@ -37,7 +40,9 @@ export class BarcodeScanner {
|
||||
* Open the barcode scanner.
|
||||
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static scan(options?: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface DeeplinkMatch {
|
||||
@Plugin({
|
||||
plugin: 'ionic-plugin-deeplinks',
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyo/ionic-plugin-deeplinks',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
export class Deeplinks {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -3,187 +3,95 @@ import {Plugin, Cordova} from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'cordova.plugins.diagnostic',
|
||||
pluginRef: 'cordova.plugins.diagnostic',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-plugin-admob'
|
||||
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
|
||||
})
|
||||
export class Diagnostic {
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isLocationEnabled(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
|
||||
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
|
||||
*/
|
||||
@Cordova()
|
||||
static isWifiEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isWifiEnabled(): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
|
||||
* application is authorized to use it.
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isCameraEnabled(): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
*/
|
||||
@Cordova()
|
||||
static isBluetoothEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isBluetoothEnabled(): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns the location authorization status for the application.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*
|
||||
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
*/
|
||||
@Cordova()
|
||||
static requestLocationAuthorization(mode?: string) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<string>((res, rej) => {});
|
||||
}
|
||||
static requestLocationAuthorization(mode?: string): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*/
|
||||
@Cordova()
|
||||
static isLocationAuthorized() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isLocationAuthorized(): Promise<any> {return; }
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if camera hardware is present on device.
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraPresent() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isCameraPresent(): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if the application is authorized to use the camera.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
|
||||
*/
|
||||
@Cordova()
|
||||
static isCameraAuthorized() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
/*
|
||||
static isCameraAuthorized(): Promise<any> {return; }
|
||||
/**
|
||||
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Device only = GPS hardware only (high accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
*/
|
||||
@Cordova()
|
||||
static isGpsLocationEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isGpsLocationEnabled(): Promise<any> {return; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to either:
|
||||
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
|
||||
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
|
||||
*/
|
||||
@Cordova()
|
||||
static isNetworkLocationEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
static isNetworkLocationEnabled(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
|
||||
*/
|
||||
@Cordova()
|
||||
static isRemoteNotificationsEnabled() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
|
||||
static isRemoteNotificationsEnabled(): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
|
||||
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
|
||||
*/
|
||||
@Cordova()
|
||||
static isRegisteredForRemoteNotifications() {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<boolean>((res, rej) => {});
|
||||
}
|
||||
|
||||
|
||||
|
||||
static isRegisteredForRemoteNotifications(): Promise<any> {return; }
|
||||
}
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import {Plugin, Cordova} from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-globalization',
|
||||
pluginRef: 'navigator.globalization',
|
||||
repo: 'https: //github.com/apache/cordova-plugin-globalization'
|
||||
repo: 'https://github.com/apache/cordova-plugin-globalization'
|
||||
})
|
||||
export class Globalization {
|
||||
|
||||
@@ -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,10 +126,11 @@ 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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
698
src/plugins/ibeacon.ts
Normal file
698
src/plugins/ibeacon.ts
Normal 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; }
|
||||
|
||||
}
|
||||
@@ -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
253
src/plugins/onesignal.ts
Normal 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 { }
|
||||
}
|
||||
64
src/plugins/printer.ts
Normal file
64
src/plugins/printer.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
declare var cordova: any;
|
||||
|
||||
export interface PrintOptions {
|
||||
/**
|
||||
* The name of the print job and the document
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The network URL of the printer.
|
||||
* Only supported on iOS.
|
||||
*/
|
||||
printerId?: string;
|
||||
|
||||
/**
|
||||
* Specifies the duplex mode to use for the print job.
|
||||
* Either double-sided (duplex:true) or single-sided (duplex:false).
|
||||
* Double-sided by default.
|
||||
* Only supported on iOS
|
||||
*/
|
||||
duplex?: boolean;
|
||||
|
||||
/**
|
||||
* The orientation of the printed content, portrait or landscape
|
||||
* Portrait by default.
|
||||
*/
|
||||
landscape?: boolean;
|
||||
|
||||
/**
|
||||
* If your application only prints black text, setting this property to true can result in better performance in many cases.
|
||||
* False by default.
|
||||
*/
|
||||
grayscale?: boolean;
|
||||
|
||||
/**
|
||||
* The Size and position of the print view
|
||||
*/
|
||||
bounds?: number[] | any;
|
||||
}
|
||||
|
||||
|
||||
@Plugin({
|
||||
plugin: 'de.appplant.cordova.plugin.printer',
|
||||
pluginRef: 'cordova.plugins.printer',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
export class Printer {
|
||||
|
||||
/**
|
||||
* Checks whether to device is capable of printing.
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Sends content to the printer.
|
||||
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
|
||||
* @param {options} The options to pass to the printer
|
||||
*/
|
||||
@Cordova()
|
||||
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -59,7 +59,7 @@ export class SafariViewController {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static show(options?: SafariViewControllerOptions): void {}
|
||||
static show(options?: SafariViewControllerOptions): Promise<any> {return; }
|
||||
|
||||
/**
|
||||
* Hides Safari View Controller
|
||||
@@ -98,4 +98,4 @@ export interface SafariViewControllerOptions {
|
||||
enterReaderModeIfAvailable?: boolean;
|
||||
tintColor?: string;
|
||||
transition?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,6 +2,30 @@ import {CordovaInstance, Plugin, Cordova} from './plugin';
|
||||
declare var sqlitePlugin;
|
||||
/**
|
||||
* @name SQLite
|
||||
*
|
||||
* @description
|
||||
* Access SQLite databases on the device.
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginRef: 'sqlitePlugin',
|
||||
@@ -15,13 +39,44 @@ export class SQLite {
|
||||
return this._objectInstance.databaseFeatures;
|
||||
}
|
||||
|
||||
constructor (config: any) {
|
||||
new Promise((resolve, reject) => {
|
||||
sqlitePlugin.openDatabase(config, resolve, reject);
|
||||
}).then(
|
||||
db => this._objectInstance = db,
|
||||
error => console.warn(error)
|
||||
);
|
||||
constructor () {}
|
||||
|
||||
/**
|
||||
* Open or create a SQLite database file.
|
||||
*
|
||||
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
|
||||
*
|
||||
* @param config the config for opening the database.
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabse({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
openDatabase (config: any): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
sqlitePlugin.openDatabase(config, db => {
|
||||
this._objectInstance = db;
|
||||
resolve(db);
|
||||
}, error => {
|
||||
console.warn(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@CordovaInstance({
|
||||
@@ -48,6 +103,19 @@ export class SQLite {
|
||||
})
|
||||
start (): void {}
|
||||
|
||||
/**
|
||||
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
|
||||
* ensure it resolved and successfully opened the database.
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```ts
|
||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||
* // Access the items through resultSet.rows
|
||||
* // resultSet.rows.item(i)
|
||||
* }, (err) => {})
|
||||
* ```
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeSql (statement: string, params: any): Promise<any> {return; }
|
||||
|
||||
@@ -104,4 +172,4 @@ export class SQLite {
|
||||
@Cordova()
|
||||
static deleteDatabase (first): Promise<any> {return; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export interface ToastOptions {
|
||||
*
|
||||
*
|
||||
*
|
||||
* Toast.show("I'm a toast", 5000, "center").subscribe(
|
||||
* Toast.show("I'm a toast", "5000", "center").subscribe(
|
||||
* toast => {
|
||||
* console.log(toast);
|
||||
* }
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": false,
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"filesGlob": [
|
||||
"**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"compileOnSave": false,
|
||||
"buildOnSave": false,
|
||||
"atom": {
|
||||
"rewriteTsconfig": false
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "ES5",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"files": [
|
||||
"typings/es6-shim/es6-shim.d.ts",
|
||||
"src/index.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user