mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
351 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40e2a2e291 | ||
|
|
85c3c47998 | ||
|
|
825b2d6970 | ||
|
|
ea053ccbe6 | ||
|
|
c403330c0a | ||
|
|
a3d54a34b8 | ||
|
|
3099b8c76c | ||
|
|
8eacf8817c | ||
|
|
eceb7ca1fc | ||
|
|
3d46715b9c | ||
|
|
e09592d2b9 | ||
|
|
61bbe3980c | ||
|
|
1db0ff741f | ||
|
|
a391e37f90 | ||
|
|
3e0b0750d8 | ||
|
|
b426819f92 | ||
|
|
9e2f670d9d | ||
|
|
8c25d1e311 | ||
|
|
6458640ba7 | ||
|
|
be05235a6e | ||
|
|
83196bc947 | ||
|
|
d2d5a5a96c | ||
|
|
bb80d00f58 | ||
|
|
bfee712cdc | ||
|
|
83bb4a96f9 | ||
|
|
e1350a2e7e | ||
|
|
96e9b19732 | ||
|
|
3e78462163 | ||
|
|
47b85a80a9 | ||
|
|
3af9c48f05 | ||
|
|
739fe89400 | ||
|
|
1f3bc1208c | ||
|
|
f896440ae2 | ||
|
|
96e6711776 | ||
|
|
664e257442 | ||
|
|
2d1e2db9cd | ||
|
|
58ea528ee5 | ||
|
|
5471696664 | ||
|
|
5d768b2b9e | ||
|
|
a0f91635fc | ||
|
|
7bcbca7696 | ||
|
|
52fc9f85ad | ||
|
|
fe89f2bf96 | ||
|
|
a57000a55a | ||
|
|
4091b1b37a | ||
|
|
78c3be4c9b | ||
|
|
8e9575b6aa | ||
|
|
83eace835a | ||
|
|
6277d8e997 | ||
|
|
53213bb57a | ||
|
|
18bee4e298 | ||
|
|
7277c0fbe5 | ||
|
|
b274a70ed9 | ||
|
|
a8eebb9212 | ||
|
|
300f75ef92 | ||
|
|
45218102f3 | ||
|
|
a9774e07ae | ||
|
|
6016568c86 | ||
|
|
95d402c7f5 | ||
|
|
df5f832664 | ||
|
|
6112d724f2 | ||
|
|
2913a68d8f | ||
|
|
4d346437f0 | ||
|
|
904455df9e | ||
|
|
cac9872796 | ||
|
|
d4465681cf | ||
|
|
fd3a8de693 | ||
|
|
4c07af7782 | ||
|
|
2ad03fa89b | ||
|
|
ed37c68990 | ||
|
|
66da511526 | ||
|
|
817f0d11b9 | ||
|
|
c8d3afc91d | ||
|
|
3b18135ebf | ||
|
|
614ade447f | ||
|
|
1bcaa39ffd | ||
|
|
82939763ee | ||
|
|
15ed431819 | ||
|
|
7baeab9fee | ||
|
|
41895c165c | ||
|
|
80f4ced369 | ||
|
|
95a67a813d | ||
|
|
799cf94674 | ||
|
|
2b2eb88a64 | ||
|
|
7cad3f350f | ||
|
|
4c8ec5d1fc | ||
|
|
82b632d772 | ||
|
|
240feba76b | ||
|
|
e55a1e1117 | ||
|
|
8764440087 | ||
|
|
07b958ac4e | ||
|
|
dd39c2fa85 | ||
|
|
515b82d634 | ||
|
|
ecb0bb22ed | ||
|
|
3f1fa37a8d | ||
|
|
a74c894064 | ||
|
|
4d7e937d7a | ||
|
|
fc90795a2c | ||
|
|
129ba4dbe2 | ||
|
|
8582fac076 | ||
|
|
d0f665f6fc | ||
|
|
0254cf730e | ||
|
|
92a99145f8 | ||
|
|
a22ee6ed2b | ||
|
|
1aa89ae311 | ||
|
|
6f4d23d072 | ||
|
|
ecd451ceb3 | ||
|
|
bddc221b60 | ||
|
|
27e844cbc2 | ||
|
|
b8695220ea | ||
|
|
364b30af59 | ||
|
|
860d79828d | ||
|
|
9057dc2c93 | ||
|
|
5223dc7dd5 | ||
|
|
bb77620d0d | ||
|
|
b280ef4c55 | ||
|
|
8e79890251 | ||
|
|
f4a4bb9e55 | ||
|
|
d108776981 | ||
|
|
8a65cc943a | ||
|
|
d2e4d3e5ce | ||
|
|
3440dca70f | ||
|
|
499cc5c075 | ||
|
|
f2961fb4bb | ||
|
|
48082eeaef | ||
|
|
4c56d227a8 | ||
|
|
2fd4885fb1 | ||
|
|
7d756394dd | ||
|
|
f4b03bcce4 | ||
|
|
01bfa5cc5e | ||
|
|
996bf00e85 | ||
|
|
30360fe29d | ||
|
|
88bf517697 | ||
|
|
e6ac206b8d | ||
|
|
00ef998ee5 | ||
|
|
f81e181588 | ||
|
|
08332b7c02 | ||
|
|
86cca49236 | ||
|
|
2718bccccc | ||
|
|
042e36de08 | ||
|
|
ec933011e6 | ||
|
|
2312665792 | ||
|
|
eae8c1000c | ||
|
|
509bd72dde | ||
|
|
fe38903e4b | ||
|
|
1ebf447240 | ||
|
|
4788104931 | ||
|
|
fdd38b97b6 | ||
|
|
409a985142 | ||
|
|
8534061b2f | ||
|
|
275741faed | ||
|
|
4c5d70eacd | ||
|
|
0b43c69993 | ||
|
|
fb5d47bff2 | ||
|
|
7033a1822e | ||
|
|
a840a03e33 | ||
|
|
fb540f7774 | ||
|
|
cb4d5b5064 | ||
|
|
265b4ba02f | ||
|
|
5fc13abb10 | ||
|
|
b7a4e44308 | ||
|
|
a1fb93707f | ||
|
|
a575233f23 | ||
|
|
66f2e155f0 | ||
|
|
5f16fcd292 | ||
|
|
fc6d1d0c7f | ||
|
|
acec6cfb18 | ||
|
|
f5d94d824d | ||
|
|
70d4fcd30e | ||
|
|
5cea6141c4 | ||
|
|
cb543b9841 | ||
|
|
3f172cc2b8 | ||
|
|
98b463b0d3 | ||
|
|
8940301e87 | ||
|
|
493405426c | ||
|
|
fcec2d16b3 | ||
|
|
d9ded4d164 | ||
|
|
141f0e6e41 | ||
|
|
199380c0c3 | ||
|
|
a46e308ea8 | ||
|
|
fb0ee819be | ||
|
|
1b6506f53a | ||
|
|
d539eb4f62 | ||
|
|
cfcd8d16a6 | ||
|
|
6bc1b932c8 | ||
|
|
650615e883 | ||
|
|
8b3b2a4b27 | ||
|
|
2b347fe889 | ||
|
|
8032429faa | ||
|
|
4cb97eeec4 | ||
|
|
1d878c6902 | ||
|
|
e65ce4a879 | ||
|
|
bfa4f62e2b | ||
|
|
1af96d1369 | ||
|
|
dcce3489f4 | ||
|
|
3a5c790a56 | ||
|
|
73493e222f | ||
|
|
26447d22ea | ||
|
|
a55bb60d70 | ||
|
|
4d1e0e6949 | ||
|
|
189570d255 | ||
|
|
64ca73e5cc | ||
|
|
4337515961 | ||
|
|
c0d4a2ee34 | ||
|
|
1f7e6a5d02 | ||
|
|
fd81a5e5b7 | ||
|
|
f3b8e34091 | ||
|
|
5cc91bc79a | ||
|
|
e37a7221b1 | ||
|
|
016023a7bb | ||
|
|
852df98647 | ||
|
|
7696706080 | ||
|
|
2c0aa4f124 | ||
|
|
8bcbc955e0 | ||
|
|
3bb6b59112 | ||
|
|
f6e77db7b0 | ||
|
|
acc587aca2 | ||
|
|
c77bdf17c1 | ||
|
|
0c9bf3bf49 | ||
|
|
f54b9e0797 | ||
|
|
7e08680d31 | ||
|
|
de83edb99b | ||
|
|
fac94485a0 | ||
|
|
9c9ed3518f | ||
|
|
a0779de633 | ||
|
|
50408b08c6 | ||
|
|
767391a4b4 | ||
|
|
a2f5acb48c | ||
|
|
3a3e9338e7 | ||
|
|
8badd2943a | ||
|
|
9a46ab1a6d | ||
|
|
952a5c8e11 | ||
|
|
2a995d94ec | ||
|
|
941d394da9 | ||
|
|
cc1f25c38c | ||
|
|
7aa08109ce | ||
|
|
8ce541ff9a | ||
|
|
75190f5166 | ||
|
|
c697139089 | ||
|
|
717f6864f3 | ||
|
|
e9fa3ee6f2 | ||
|
|
28ce962677 | ||
|
|
f576c5f11e | ||
|
|
f488a75e26 | ||
|
|
55fb503d81 | ||
|
|
afe95a6752 | ||
|
|
2ca8bda8f7 | ||
|
|
2b684fadb1 | ||
|
|
7f2da56a28 | ||
|
|
4a546bd11a | ||
|
|
a0f5254988 | ||
|
|
8521b32306 | ||
|
|
d52278b2d1 | ||
|
|
2fadb6b0e1 | ||
|
|
ad11ed21ac | ||
|
|
5857b9654c | ||
|
|
92d5764e01 | ||
|
|
a4db080786 | ||
|
|
54ac2bfdf5 | ||
|
|
9274083b24 | ||
|
|
d04396e631 | ||
|
|
c4b4584d2d | ||
|
|
1fc09098fe | ||
|
|
b217bdb62a | ||
|
|
1b60247807 | ||
|
|
b75f40c76e | ||
|
|
09ca1a1843 | ||
|
|
6cbb226ed2 | ||
|
|
ed80933b6c | ||
|
|
300d7c229c | ||
|
|
43442ac4ea | ||
|
|
12f2782fef | ||
|
|
a586734b92 | ||
|
|
f58183260d | ||
|
|
a3c49fd17a | ||
|
|
6ee94b93ba | ||
|
|
a0ec1252e0 | ||
|
|
dfb0aa3d5d | ||
|
|
312c126cc8 | ||
|
|
b79c8b1ea0 | ||
|
|
49e81cc414 | ||
|
|
2942ebfae4 | ||
|
|
4ae35cba9a | ||
|
|
bb7b516c50 | ||
|
|
c0b092b242 | ||
|
|
a2fe674a3f | ||
|
|
f12da1f4f5 | ||
|
|
0e7bec3633 | ||
|
|
7588eaf9fd | ||
|
|
c5a9d0d258 | ||
|
|
18e4a9cda6 | ||
|
|
26f63c744d | ||
|
|
1cb4c989f9 | ||
|
|
c80d081c92 | ||
|
|
3e0a7395ca | ||
|
|
4c6dc71cbe | ||
|
|
81a10280cc | ||
|
|
56e4a7827f | ||
|
|
c4fe2b7203 | ||
|
|
0dc320bbd2 | ||
|
|
b4201e1b52 | ||
|
|
9a4bef34bb | ||
|
|
2bc8bdc49c | ||
|
|
e363d98bd8 | ||
|
|
980447673b | ||
|
|
7afed90b56 | ||
|
|
0634e64b58 | ||
|
|
a42e7b8258 | ||
|
|
5b5c6e61ac | ||
|
|
79037743b8 | ||
|
|
ed36dc492d | ||
|
|
1f31954cb3 | ||
|
|
4601ea3e01 | ||
|
|
45c64b0394 | ||
|
|
591c290dbd | ||
|
|
66b9d1a011 | ||
|
|
25ef7c98bc | ||
|
|
19ddf3fb93 | ||
|
|
20a3791a88 | ||
|
|
9800271352 | ||
|
|
e288a5d757 | ||
|
|
ab7c7fa491 | ||
|
|
9e306e7de1 | ||
|
|
92e0cb2385 | ||
|
|
0800f4a414 | ||
|
|
e47774b771 | ||
|
|
c0ce17b170 | ||
|
|
c518c8114d | ||
|
|
21dc1f9a56 | ||
|
|
7ea51fcf06 | ||
|
|
c063652800 | ||
|
|
9024ea516a | ||
|
|
e92b7aeb74 | ||
|
|
dc51c3e1e8 | ||
|
|
4859387925 | ||
|
|
10787c8056 | ||
|
|
f874185a35 | ||
|
|
00e34877f3 | ||
|
|
4de49c37dd | ||
|
|
bd4b2e2bb4 | ||
|
|
aa138c4cfe | ||
|
|
4e60c631ae | ||
|
|
767d3b3dd4 | ||
|
|
39be27566b | ||
|
|
029f82f1fd | ||
|
|
6a19509ded | ||
|
|
c75aeb9c39 | ||
|
|
dcd95582d2 | ||
|
|
354af9fe6f | ||
|
|
419b68217e | ||
|
|
cd97375e63 |
31
.github/workflows/nodejs.yml
vendored
Normal file
31
.github/workflows/nodejs.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Test
|
||||
run: npm run test
|
||||
- name: Readmes
|
||||
run: npm run readmes
|
||||
env:
|
||||
CI: true
|
||||
38
.github/workflows/npmpublish.yml
vendored
Normal file
38
.github/workflows/npmpublish.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Node.js Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Test
|
||||
run: npm run test
|
||||
- name: Readmes
|
||||
run: npm run readmes
|
||||
|
||||
publish-npm:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm run shipit
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
3705
CHANGELOG.md
3705
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -88,8 +88,6 @@ It's just a stub. The `return` is only there to keep the TypeScript type-checker
|
||||
|
||||
By default, the `@Cordova` decorator wraps the plugin callbacks in a Promise that resolves when the success callback is called and rejects when the error callback is called. It also ensures that Cordova and the underlying plugin are available, and prints helpful diagnostics if they aren't.
|
||||
|
||||
You'll also notice that `getCurrentPosition` is a static method. That's because the plugin class is just a utility class to call the underlying Cordova plugin methods, it's not an instance and has no state.
|
||||
|
||||
Next, let's look at the `watchPosition` method.
|
||||
|
||||
```
|
||||
|
||||
47
README.md
47
README.md
@@ -6,6 +6,10 @@ Ionic Native is a curated set of wrappers for Cordova plugins that make adding a
|
||||
|
||||
Ionic Native wraps plugin callbacks in a Promise or Observable, providing a common interface for all plugins and making it easy to use plugins with Angular change detection.
|
||||
|
||||
## Capacitor Support
|
||||
|
||||
In addition to Cordova, Ionic Native also works with [Capacitor](https://capacitor.ionicframework.com), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
|
||||
|
||||
## Installation
|
||||
|
||||
Run following command to install Ionic Native in your project.
|
||||
@@ -76,6 +80,49 @@ export class MyComponent {
|
||||
}
|
||||
```
|
||||
|
||||
#### Ionic/React apps
|
||||
|
||||
React apps must use Capacitor to build native mobile apps. However, Ionic Native (and therefore, Cordova plugins) can still be used.
|
||||
|
||||
```bash
|
||||
# Install Core library (once per project)
|
||||
npm install @ionic-native/core
|
||||
|
||||
# Install Ionic Native TypeScript wrapper
|
||||
npm install @ionic-native/barcode-scanner
|
||||
|
||||
# Install Cordova plugin
|
||||
npm install phonegap-plugin-barcodescanner
|
||||
|
||||
# Update native platform project(s) to include newly added plugin
|
||||
ionic cap sync
|
||||
```
|
||||
|
||||
Import the plugin object then use its static methods:
|
||||
|
||||
```typescript
|
||||
import { BarcodeScanner } from '@ionic-native/barcode-scanner';
|
||||
|
||||
const Tab1: React.FC = () => {
|
||||
const openScanner = async () => {
|
||||
const data = await BarcodeScanner.scan();
|
||||
console.log(`Barcode data: ${data.text}`);
|
||||
};
|
||||
return (
|
||||
<IonPage>
|
||||
<IonHeader>
|
||||
<IonToolbar>
|
||||
<IonTitle>Tab 1</IonTitle>
|
||||
</IonToolbar>
|
||||
</IonHeader>
|
||||
<IonContent>
|
||||
<IonButton onClick={openScanner}>Scan barcode</IonButton>
|
||||
</IonContent>
|
||||
</IonPage>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
#### ES2015+/TypeScript
|
||||
These modules can work in any ES2015+/TypeScript app (including Angular/Ionic apps). To use any plugin, import the class from the appropriate package, and use it's static methods.
|
||||
```js
|
||||
|
||||
@@ -3,7 +3,7 @@ jobs:
|
||||
build:
|
||||
working_directory: ~/ionic-native/
|
||||
docker:
|
||||
- image: node:10
|
||||
- image: node:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
key: node_modules_{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Install node modules
|
||||
command: npm i
|
||||
command: npm ci
|
||||
- save_cache:
|
||||
key: node_modules_{{ checksum "package.json" }}
|
||||
paths:
|
||||
|
||||
17200
package-lock.json
generated
17200
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
69
package.json
69
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "5.3.0",
|
||||
"version": "5.25.0",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
@@ -18,50 +18,50 @@
|
||||
"lint": "gulp lint",
|
||||
"readmes": "gulp readmes",
|
||||
"docs-json": "ts-node -P scripts/tsconfig.json scripts/docs-json",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"postchangelog": "git commit -am \"chore(): update changelog\"",
|
||||
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
||||
"shipit": "npm run build && npm run readmes && npm run npmpub"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/common": "^7.2.9",
|
||||
"@angular/compiler": "^7.2.9",
|
||||
"@angular/compiler-cli": "^7.2.9",
|
||||
"@angular/core": "^7.2.9",
|
||||
"@angular/common": "^9.1.4",
|
||||
"@angular/compiler": "^9.1.4",
|
||||
"@angular/compiler-cli": "^9.1.4",
|
||||
"@angular/core": "^9.1.4",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/fs-extra": "^5.0.5",
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/lodash": "^4.14.123",
|
||||
"@types/node": "^10.14.1",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@types/webpack": "^4.4.26",
|
||||
"ajv": "^6.10.0",
|
||||
"async-promise-queue": "^1.0.4",
|
||||
"conventional-changelog-cli": "^2.0.12",
|
||||
"cz-conventional-changelog": "^2.1.0",
|
||||
"@types/fs-extra": "^8.1.0",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/lodash": "^4.14.150",
|
||||
"@types/node": "^12.12.37",
|
||||
"@types/rimraf": "^3.0.0",
|
||||
"@types/webpack": "^4.41.12",
|
||||
"ajv": "^6.12.2",
|
||||
"async-promise-queue": "^1.0.5",
|
||||
"conventional-changelog-cli": "^2.0.31",
|
||||
"cz-conventional-changelog": "^3.2.0",
|
||||
"dgeni": "^0.4.12",
|
||||
"dgeni-packages": "0.16.10",
|
||||
"fs-extra": "^7.0.1",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-tslint": "^8.1.4",
|
||||
"jest": "^24.5.0",
|
||||
"lodash": "^4.17.11",
|
||||
"minimist": "1.2.0",
|
||||
"jest": "^25.5.4",
|
||||
"lodash": "^4.17.15",
|
||||
"minimist": "^1.2.5",
|
||||
"natives": "^1.1.6",
|
||||
"rimraf": "^2.6.3",
|
||||
"rxjs": "^6.4.0",
|
||||
"ts-jest": "^24.0.0",
|
||||
"ts-node": "^8.0.3",
|
||||
"tslint": "^5.14.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^6.5.5",
|
||||
"ts-jest": "^25.4.0",
|
||||
"ts-node": "^8.10.1",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-ionic-rules": "0.0.21",
|
||||
"typedoc": "^0.14.2",
|
||||
"typescript": "3.2.4",
|
||||
"uglifyjs-webpack-plugin": "^2.1.2",
|
||||
"typedoc": "^0.16.11",
|
||||
"typescript": "~3.8.3",
|
||||
"typescript-tslint-plugin": "0.5.5",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"unminified-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack": "^4.43.0",
|
||||
"winston": "^3.2.1",
|
||||
"zone.js": "^0.8.29"
|
||||
"zone.js": "^0.10.3"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
@@ -87,5 +87,8 @@
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^1.11.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function getDecoratorArgs(decorator: any) {
|
||||
const args = {};
|
||||
|
||||
properties.forEach(prop => {
|
||||
let val;
|
||||
let val: number | boolean;
|
||||
|
||||
switch (prop.initializer.kind) {
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
import * as ts from 'typescript';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
import * as ngc from '@angular/compiler-cli';
|
||||
import * as rimraf from 'rimraf';
|
||||
import { generateDeclarations } from './transpile';
|
||||
import { clone } from 'lodash';
|
||||
import { EmitFlags } from '@angular/compiler-cli';
|
||||
import { EmitFlags, createCompilerHost, CompilerOptions, CompilerHost, createProgram } from '@angular/compiler-cli';
|
||||
import { importsTransformer } from './transformers/imports';
|
||||
import { pluginClassTransformer } from './transformers/plugin-class';
|
||||
import { COMPILER_OPTIONS, PLUGIN_PATHS, ROOT } from './helpers';
|
||||
|
||||
export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
const options: ngc.CompilerOptions = clone(COMPILER_OPTIONS);
|
||||
const options: CompilerOptions = clone(COMPILER_OPTIONS);
|
||||
options.basePath = ROOT;
|
||||
options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
||||
options.module = ts.ModuleKind.ES2015;
|
||||
options.target = ts.ScriptTarget.ES5;
|
||||
options.lib = ['dom', 'es2017'];
|
||||
options.inlineSourceMap = true;
|
||||
options.importHelpers = true;
|
||||
options.inlineSources = true;
|
||||
options.enableIvy = false;
|
||||
|
||||
delete options.baseUrl;
|
||||
|
||||
const host: ngc.CompilerHost = ngc.createCompilerHost({ options });
|
||||
|
||||
return ngc.createProgram({
|
||||
const host: CompilerHost = createCompilerHost({ options });
|
||||
return createProgram({
|
||||
rootNames,
|
||||
options,
|
||||
host
|
||||
@@ -34,8 +35,9 @@ export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
export function transpileNgxCore() {
|
||||
getProgram([path.resolve(ROOT, 'src/@ionic-native/core/index.ts')]).emit({
|
||||
emitFlags: EmitFlags.Metadata,
|
||||
emitCallback: ({ program, writeFile, customTransformers, cancellationToken, targetSourceFile }) =>
|
||||
program.emit(targetSourceFile, writeFile, cancellationToken, true, customTransformers)
|
||||
emitCallback: ({ program, writeFile, customTransformers, cancellationToken, targetSourceFile }) => {
|
||||
return program.emit(targetSourceFile, writeFile, cancellationToken, true, customTransformers);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,10 +59,11 @@ export function generateDeclarationFiles() {
|
||||
|
||||
// remove reference to @ionic-native/core decorators
|
||||
export function modifyMetadata() {
|
||||
debugger;
|
||||
PLUGIN_PATHS.map(p => p.replace(path.join(ROOT, 'src'), path.join(ROOT, 'dist')).replace('index.ts', 'ngx/index.metadata.json'))
|
||||
.forEach(p => {
|
||||
const content = fs.readJSONSync(p);
|
||||
let _prop;
|
||||
let _prop: { members: { [x: string]: any[]; }; };
|
||||
for (const prop in content[0].metadata) {
|
||||
_prop = content[0].metadata[prop];
|
||||
removeIonicNativeDecorators(_prop);
|
||||
@@ -78,7 +81,7 @@ export function modifyMetadata() {
|
||||
|
||||
function removeIonicNativeDecorators(node: any) {
|
||||
if (node.decorators && node.decorators.length) {
|
||||
node.decorators = node.decorators.filter((d, i) => d.expression.module !== '@ionic-native/core');
|
||||
node.decorators = node.decorators.filter((d: { expression: { module: string; }; }) => d.expression.module !== '@ionic-native/core');
|
||||
}
|
||||
|
||||
if (node.decorators && !node.decorators.length) delete node.decorators;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import { Application } from 'typedoc';
|
||||
import { basename, dirname, resolve } from 'path';
|
||||
import { Application } from 'typedoc';
|
||||
import { runInNewContext } from 'vm';
|
||||
|
||||
import TypeDoc = require('typedoc');
|
||||
|
||||
interface Plugin {
|
||||
packageName: string;
|
||||
displayName: string;
|
||||
@@ -10,6 +12,7 @@ interface Plugin {
|
||||
platforms: string[];
|
||||
usage: string;
|
||||
repo: string;
|
||||
installVariables: string[];
|
||||
cordovaPlugin: {
|
||||
name: string;
|
||||
};
|
||||
@@ -18,9 +21,13 @@ interface Plugin {
|
||||
const rootDir = resolve(__dirname, '../..');
|
||||
const typedocTmp = resolve(__dirname, 'typedoc.tmp.json');
|
||||
const pluginsDir = resolve(rootDir, 'src/@ionic-native/plugins');
|
||||
const typedoc = new Application({
|
||||
const typedoc = new Application();
|
||||
|
||||
typedoc.options.addReader(new TypeDoc.TSConfigReader());
|
||||
typedoc.options.addReader(new TypeDoc.TypeDocReader());
|
||||
|
||||
typedoc.bootstrap({
|
||||
mode: 'modules',
|
||||
tsconfig: resolve(rootDir, 'tsconfig.json'),
|
||||
ignoreCompilerErrors: true
|
||||
});
|
||||
|
||||
@@ -45,7 +52,9 @@ async function generateTypedoc(root: string, outputPath = typedocTmp) {
|
||||
function processPlugin(pluginModule): Plugin {
|
||||
const pluginClass = pluginModule.children.find(isPlugin);
|
||||
const decorator = getPluginDecorator(pluginClass);
|
||||
const packageName = `@ionic-native/${basename(dirname(pluginModule.originalName))}`;
|
||||
const packageName = `@ionic-native/${basename(
|
||||
dirname(pluginModule.originalName)
|
||||
)}`;
|
||||
const displayName = getTag(pluginClass, 'name');
|
||||
const usage = getTag(pluginClass, 'usage');
|
||||
const description = getTag(pluginClass, 'description');
|
||||
@@ -56,6 +65,7 @@ function processPlugin(pluginModule): Plugin {
|
||||
usage,
|
||||
platforms: decorator.platforms,
|
||||
repo: decorator.repo,
|
||||
installVariables: decorator.installVariables,
|
||||
cordovaPlugin: {
|
||||
name: decorator.plugin
|
||||
}
|
||||
@@ -83,17 +93,17 @@ const getTag = (child: any, tagName: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
const isModule = (child: any): boolean =>
|
||||
child.kind === 1;
|
||||
const isModule = (child: any): boolean => child.kind === 1;
|
||||
|
||||
const isClass = (child: any): boolean =>
|
||||
child.kind === 128;
|
||||
const isClass = (child: any): boolean => child.kind === 128;
|
||||
|
||||
const isPlugin = (child: any): boolean =>
|
||||
isClass(child) && hasTags(child) && Array.isArray(child.decorators) && child.decorators.some(d => d.name === 'Plugin');
|
||||
isClass(child) &&
|
||||
hasTags(child) &&
|
||||
Array.isArray(child.decorators) &&
|
||||
child.decorators.some(d => d.name === 'Plugin');
|
||||
|
||||
const hasPlugin = (child: any): boolean =>
|
||||
child.children.some(isPlugin);
|
||||
const hasPlugin = (child: any): boolean => child.children.some(isPlugin);
|
||||
|
||||
const hasTags = (child: any): boolean =>
|
||||
child.comment && Array.isArray(child.comment.tags);
|
||||
|
||||
@@ -6,35 +6,27 @@ const config = require('./config.json'),
|
||||
Dgeni = require('dgeni');
|
||||
|
||||
module.exports = gulp => {
|
||||
gulp.task('docs', [], () => {
|
||||
gulp.task('docs', () => {
|
||||
try {
|
||||
const ionicPackage = require('./dgeni/dgeni-config')(
|
||||
projectPackage.version
|
||||
),
|
||||
const ionicPackage = require('./dgeni/dgeni-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
|
||||
return dgeni
|
||||
.generate()
|
||||
.then(docs => console.log(docs.length + ' docs generated'));
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' docs generated'));
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('readmes', [], function() {
|
||||
gulp.task('readmes', () => {
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, '..', '..', 'README.md'),
|
||||
path.resolve(__dirname, '..', '..', config.pluginDir, 'core', 'README.md')
|
||||
);
|
||||
|
||||
try {
|
||||
const ionicPackage = require('./dgeni/dgeni-readmes-config')(
|
||||
projectPackage.version
|
||||
),
|
||||
const ionicPackage = require('./dgeni/dgeni-readmes-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni
|
||||
.generate()
|
||||
.then(docs => console.log(docs.length + ' README files generated'));
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' README files generated'));
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
@@ -30,13 +30,14 @@ const DIST = path.resolve(ROOT, 'dist/@ionic-native');
|
||||
const PACKAGES = [];
|
||||
|
||||
const MIN_CORE_VERSION = '^5.1.0';
|
||||
const RXJS_VERSION = '^6.3.0';
|
||||
const RXJS_VERSION = '^5.5.0 || ^6.5.0';
|
||||
|
||||
const PLUGIN_PEER_DEPENDENCIES = {
|
||||
'@ionic-native/core': MIN_CORE_VERSION,
|
||||
rxjs: RXJS_VERSION
|
||||
};
|
||||
|
||||
|
||||
function getPackageJsonContent(name: string, peerDependencies = {}, dependencies = {}) {
|
||||
return merge(PACKAGE_JSON_BASE, {
|
||||
name: '@ionic-native/' + name,
|
||||
@@ -51,7 +52,10 @@ function writePackageJson(data: any, dir: string) {
|
||||
fs.writeJSONSync(filePath, data);
|
||||
PACKAGES.push(dir);
|
||||
}
|
||||
|
||||
function writeNGXPackageJson(data: any, dir: string){
|
||||
const filePath = path.resolve(dir, 'package.json');
|
||||
fs.writeJSONSync(filePath, data);
|
||||
}
|
||||
function prepare() {
|
||||
// write @ionic-native/core package.json
|
||||
writePackageJson(
|
||||
@@ -64,8 +68,9 @@ function prepare() {
|
||||
const pluginName = pluginPath.split(/[\/\\]+/).slice(-2)[0];
|
||||
const packageJsonContents = getPackageJsonContent(pluginName, PLUGIN_PEER_DEPENDENCIES);
|
||||
const dir = path.resolve(DIST, 'plugins', pluginName);
|
||||
|
||||
const ngxDir = path.join(dir, 'ngx');
|
||||
writePackageJson(packageJsonContents, dir);
|
||||
writeNGXPackageJson(packageJsonContents, ngxDir);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
* @returns {Observable}
|
||||
*/
|
||||
function wrapEventObservable(event: string, element: any): Observable<any> {
|
||||
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || typeof window !== 'undefined' || {};
|
||||
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || (typeof window !== 'undefined' ? window : {});
|
||||
return fromEvent(element, event);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,24 +2,20 @@ import { checkAvailability } from './decorators/common';
|
||||
import { get } from './util';
|
||||
|
||||
export class IonicNativePlugin {
|
||||
static pluginName: string;
|
||||
|
||||
static pluginRef: string;
|
||||
|
||||
static plugin: string;
|
||||
|
||||
static repo: string;
|
||||
|
||||
static platforms: string[];
|
||||
|
||||
static install: string;
|
||||
static pluginName = '';
|
||||
static pluginRef = '';
|
||||
static plugin = '';
|
||||
static repo = '';
|
||||
static platforms: string[] = [];
|
||||
static install = '';
|
||||
|
||||
/**
|
||||
* Returns a boolean that indicates whether the plugin is installed
|
||||
* @return {boolean}
|
||||
*/
|
||||
static installed(): boolean {
|
||||
return checkAvailability(this.pluginRef) === true;
|
||||
const isAvailable = checkAvailability(this.pluginRef) === true;
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,27 +32,31 @@ export class IonicNativePlugin {
|
||||
* Returns the plugin's name
|
||||
*/
|
||||
static getPluginName(): string {
|
||||
return this.pluginName;
|
||||
const pluginName = this.pluginName;
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's reference
|
||||
*/
|
||||
static getPluginRef(): string {
|
||||
return this.pluginRef;
|
||||
const pluginRef = this.pluginRef;
|
||||
return pluginRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's install name
|
||||
*/
|
||||
static getPluginInstallName(): string {
|
||||
return this.plugin;
|
||||
const plugin = this.plugin;
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's supported platforms
|
||||
*/
|
||||
static getSupportedPlatforms(): string[] {
|
||||
return this.platforms || [];
|
||||
const platform = this.platforms;
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,23 @@ export interface AdMobFreeBannerConfig {
|
||||
* Auto show ad when loaded
|
||||
*/
|
||||
autoShow?: boolean;
|
||||
/**
|
||||
* Child-directed setting. Default is not calling `tagForChildDirectedTreatment`.
|
||||
* Set to `true` for `tagForChildDirectedTreatment(true)`.
|
||||
* Set to `false` for `tagForChildDirectedTreatment(false)`.
|
||||
*/
|
||||
forChild?: boolean | null;
|
||||
/**
|
||||
* Designed for Families setting. Android-only. Default is not calling setIsDesignedForFamilies.
|
||||
* Set to `true` for `setIsDesignedForFamilies(true)`.
|
||||
* Set to `false` for `setIsDesignedForFamilies(false)`.
|
||||
*/
|
||||
forFamily?: boolean | null;
|
||||
/**
|
||||
* Location targeting. It accept an array in the form of `[latitude, longitude]`.
|
||||
* Android-only. Default is not calling `setLatitude` and `setLongitude`.
|
||||
*/
|
||||
location?: (number)[] | null;
|
||||
/**
|
||||
* Set to true, to put banner at top
|
||||
*/
|
||||
@@ -46,6 +63,23 @@ export interface AdMobFreeInterstitialConfig {
|
||||
* Auto show ad when loaded
|
||||
*/
|
||||
autoShow?: boolean;
|
||||
/**
|
||||
* Child-directed setting. Default is not calling `tagForChildDirectedTreatment`.
|
||||
* Set to `true` for `tagForChildDirectedTreatment(true)`.
|
||||
* Set to `false` for `tagForChildDirectedTreatment(false)`.
|
||||
*/
|
||||
forChild?: boolean | null;
|
||||
/**
|
||||
* Designed for Families setting. Android-only. Default is not calling setIsDesignedForFamilies.
|
||||
* Set to `true` for `setIsDesignedForFamilies(true)`.
|
||||
* Set to `false` for `setIsDesignedForFamilies(false)`.
|
||||
*/
|
||||
forFamily?: boolean | null;
|
||||
/**
|
||||
* Location targeting. It accept an array in the form of `[latitude, longitude]`.
|
||||
* Android-only. Default is not calling `setLatitude` and `setLongitude`.
|
||||
*/
|
||||
location?: (number)[] | null;
|
||||
}
|
||||
|
||||
export interface AdMobFreeRewardVideoConfig {
|
||||
@@ -61,6 +95,23 @@ export interface AdMobFreeRewardVideoConfig {
|
||||
* Auto show ad when loaded
|
||||
*/
|
||||
autoShow?: boolean;
|
||||
/**
|
||||
* Child-directed setting. Default is not calling `tagForChildDirectedTreatment`.
|
||||
* Set to `true` for `tagForChildDirectedTreatment(true)`.
|
||||
* Set to `false` for `tagForChildDirectedTreatment(false)`.
|
||||
*/
|
||||
forChild?: boolean | null;
|
||||
/**
|
||||
* Designed for Families setting. Android-only. Default is not calling setIsDesignedForFamilies.
|
||||
* Set to `true` for `setIsDesignedForFamilies(true)`.
|
||||
* Set to `false` for `setIsDesignedForFamilies(false)`.
|
||||
*/
|
||||
forFamily?: boolean | null;
|
||||
/**
|
||||
* Location targeting. It accept an array in the form of `[latitude, longitude]`.
|
||||
* Android-only. Default is not calling `setLatitude` and `setLongitude`.
|
||||
*/
|
||||
location?: (number)[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,6 +88,11 @@ export class AdMob extends IonicNativePlugin {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
setDevMode(value: boolean): void {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
on(event: string): Observable<any> {
|
||||
return fromEvent(document, event);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface AdmobOptions {
|
||||
/**
|
||||
* (Optional) Your interstitial id code from your AdMob account. Defaults to publisherId
|
||||
*/
|
||||
interstitialAdId?: string;
|
||||
interstitiaAdlId?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Your rewarded id code from your AdMob account. Defaults to publisherId
|
||||
@@ -19,7 +19,27 @@ export interface AdmobOptions {
|
||||
rewardedAdId?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Your tappx id for iOS apps. If Admob is configured, it is also used to backfill your lost inventory when there are no Admob ads available
|
||||
* (Optional) Your ad slot code from your AdSense account. Only for browser platform
|
||||
*/
|
||||
adSlot?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Indicates if show a close button on interstitial browser ads. Only for browser platform
|
||||
*/
|
||||
interstitialShowCloseButton?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Indicates the number of seconds that the interstitial ad waits before show the close button. Only for browser platform
|
||||
*/
|
||||
secondsToShowCloseButton?: number;
|
||||
|
||||
/**
|
||||
* (Optional) Indicates the number of seconds that the interstitial ad waits before close the ad. Only for browser platform
|
||||
*/
|
||||
secondsToCloseInterstitial?: number;
|
||||
|
||||
/**
|
||||
* (Optional) Your tappx id for iOS apps. If Admob is configured, it is also used to backfill your lost inventory (when there are no Admob ads available)
|
||||
*/
|
||||
tappxIdiOS?: string;
|
||||
|
||||
@@ -100,7 +120,7 @@ export interface AdmobOptions {
|
||||
* // Admob options config
|
||||
* const admobOptions: AdmobOptions = {
|
||||
* publisherId: 'XXX-XXXX-XXXX',
|
||||
* interstitialAdId: 'XXX-XXXX-XXXX',
|
||||
* interstitialId: 'XXX-XXXX-XXXX',
|
||||
* rewardedAdId: 'XXX-XXXX-XXXX',
|
||||
* isTesting: true,
|
||||
* autoShowBanner: false,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* constructor(private alipay: Alipay) {
|
||||
*
|
||||
* //alipayOrder is a string that has been generated and signed by the server side.
|
||||
* this.alipay.pay(alipayOrder)
|
||||
* this.alipay.pay(alipayOrder, success, error)
|
||||
* .then(result => {
|
||||
* console.log(result); // Success
|
||||
* })
|
||||
@@ -30,7 +30,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
@Plugin({
|
||||
pluginName: 'Alipay',
|
||||
plugin: 'cordova-plugin-gubnoi-alipay',
|
||||
pluginRef: 'Alipay',
|
||||
pluginRef: 'cordova.plugins.alipay',
|
||||
repo: 'https://github.com/jing-zhou/cordova-plugin-alipay',
|
||||
install: 'ionic cordova plugin add cordova-plugin-gubnoi-alipay --variable APP_ID=your_app_id',
|
||||
installVariables: ['APP_ID'],
|
||||
@@ -44,7 +44,7 @@ export class Alipay extends IonicNativePlugin {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
pay(order: string): Promise<any> {
|
||||
pay(order: string, success?: (res?: any) => void, error?: (err?: any) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,20 +204,20 @@ export class AndroidPermissions extends IonicNativePlugin {
|
||||
/**
|
||||
* Check permission
|
||||
* @param {string} permission The name of the permission
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<AndroidPermissionResponse>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
checkPermission(permission: string): Promise<any> {
|
||||
checkPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permission
|
||||
* @param {string} permission The name of the permission to request
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<AndroidPermissionResponse>}
|
||||
*/
|
||||
@Cordova()
|
||||
requestPermission(permission: string): Promise<any> {
|
||||
requestPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,10 +234,14 @@ export class AndroidPermissions extends IonicNativePlugin {
|
||||
/**
|
||||
* This function still works now, will not support in the future.
|
||||
* @param {string} permission The name of the permission
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<AndroidPermissionResponse>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(permission: string): Promise<any> {
|
||||
hasPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AndroidPermissionResponse {
|
||||
hasPermission: boolean;
|
||||
}
|
||||
|
||||
51
src/@ionic-native/plugins/anyline/index.ts
Normal file
51
src/@ionic-native/plugins/anyline/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AnylineOptions {
|
||||
// Valid License Key
|
||||
licenseKey: string;
|
||||
|
||||
// Scanning options
|
||||
config: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Anyline
|
||||
* @description
|
||||
* Anyline provides an easy-to-use SDK for applications to enable Optical Character Recognition (OCR) on mobile devices.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Anyline } from '@ionic-native/anyline/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private anyline: Anyline) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.anyline.scan(options)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Anyline',
|
||||
plugin: 'io-anyline-cordova',
|
||||
pluginRef: 'Anyline',
|
||||
repo: 'https://github.com/Anyline/anyline-ocr-cordova-module',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Anyline extends IonicNativePlugin {
|
||||
/**
|
||||
* Scan
|
||||
* @param options {AnylineOptions} Scanning options
|
||||
* @return {Promise<any>} Returns a promise that resolves when Code is captured
|
||||
*/
|
||||
@Cordova()
|
||||
scan(options: AnylineOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,12 @@ export interface AppRateCustomLocale {
|
||||
|
||||
/** Feedback prompt title */
|
||||
feedbackPromptTitle?: string;
|
||||
|
||||
/** Feedback prompt message */
|
||||
appRatePromptMessage?: string;
|
||||
|
||||
/** Feedback prompt message */
|
||||
feedbackPromptMessage?: string;
|
||||
}
|
||||
|
||||
export interface AppRateCallbacks {
|
||||
|
||||
@@ -2,9 +2,11 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AppUpdateOptions {
|
||||
authType: string;
|
||||
authType?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
skipPromptDialog?: boolean;
|
||||
skipProgressDialog?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,8 @@ export type ICompleteTransaction = 'Payment status applied.';
|
||||
export type IUpdateItemsAndShippingStatus =
|
||||
| 'Updated List Info'
|
||||
| 'Did you make a payment request?';
|
||||
export type IMerchantCapabilities = '3ds' | 'credit' | 'debit' | 'emv';
|
||||
export type ISupportedNetworks = 'visa' | 'amex' | 'discover' | 'masterCard';
|
||||
|
||||
export interface IPaymentResponse {
|
||||
billingNameFirst?: string;
|
||||
@@ -84,6 +86,8 @@ export interface IOrder extends IOrderItemsAndShippingMethods {
|
||||
billingAddressRequirement?: IBillingRequirement | IBillingRequirement[];
|
||||
shippingAddressRequirement?: IBillingRequirement | IBillingRequirement[];
|
||||
shippingType?: IShippingType;
|
||||
merchantCapabilities?: IMerchantCapabilities | IMerchantCapabilities[];
|
||||
supportedNetworks?: ISupportedNetworks | ISupportedNetworks[];
|
||||
}
|
||||
|
||||
export interface ISelectedShippingContact {
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface CardData {
|
||||
paymentNetwork?: string;
|
||||
}
|
||||
|
||||
export interface EligibilityData {
|
||||
export interface PairedDevicesFlags {
|
||||
isInWallet: boolean;
|
||||
isInWatch: boolean;
|
||||
FPANID: string;
|
||||
@@ -31,10 +31,6 @@ export interface WatchExistData {
|
||||
isWatchPaired: boolean;
|
||||
}
|
||||
|
||||
export interface CardPrimarySuffixData {
|
||||
primaryAccountSuffix: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Apple Wallet
|
||||
* @description
|
||||
@@ -60,14 +56,13 @@ export interface CardPrimarySuffixData {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call to check existence and ellibagility to add a card
|
||||
* this.appleWallet.isCardExistInWalletOrWatch(data: CardPrimarySuffixData)
|
||||
* .then((res: EligibilityData) => {
|
||||
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
|
||||
* // Simple call to check Card Eligibility
|
||||
* this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string)
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
@@ -77,10 +72,36 @@ export interface CardPrimarySuffixData {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call to checkCardEligibilityBySuffix
|
||||
* this.appleWallet.checkCardEligibilityBySuffix(cardSuffix: string)
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button
|
||||
* this.appleWallet.isPairedWatchExist()
|
||||
* this.appleWallet.checkPairedDevices()
|
||||
* .then((res: WatchExistData) => {
|
||||
* // object contains boolean value that ensure that there is already a paired Watch
|
||||
* // object contains boolean flags showing paired devices
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Simple call to check paired devices with a card by its suffix
|
||||
* this.appleWallet.checkPairedDevicesBySuffix(cardSuffix: string)
|
||||
* .then((res: PairedDevicesFlags) => {
|
||||
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
@@ -121,9 +142,8 @@ export interface CardPrimarySuffixData {
|
||||
* EncryptedCardData
|
||||
* SignatureCertificatesData
|
||||
* CardData
|
||||
* EligibilityData
|
||||
* PairedDevicesFlags
|
||||
* WatchExistData
|
||||
* CardPrimarySuffixData
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppleWallet',
|
||||
@@ -144,12 +164,22 @@ export class AppleWallet extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check existence and ellibagility to add a card
|
||||
* @param {CardPrimarySuffixData} data
|
||||
* @return {Promise<EligibilityData>}
|
||||
* Simple call to check Card Eligibility
|
||||
* @param {string} primaryAccountIdentifier
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isCardExistInWalletOrWatch(data: CardPrimarySuffixData): Promise<EligibilityData> {
|
||||
checkCardEligibility(primaryAccountIdentifier: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to checkCardEligibilityBySuffix
|
||||
* @param {string} cardSuffix
|
||||
* @return {Promise<PairedDevicesFlags>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkCardEligibilityBySuffix(cardSuffix: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -158,7 +188,17 @@ export class AppleWallet extends IonicNativePlugin {
|
||||
* @return {Promise<WatchExistData>}
|
||||
*/
|
||||
@Cordova()
|
||||
isPairedWatchExist(): Promise<WatchExistData> {
|
||||
checkPairedDevices(): Promise<WatchExistData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check paired devices with a card by its suffix
|
||||
* @param {string} cardSuffix
|
||||
* @return {Promise<PairedDevicesFlags>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkPairedDevicesBySuffix(cardSuffix: string): Promise<PairedDevicesFlags> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,13 @@ export class Appsflyer extends IonicNativePlugin {
|
||||
@Cordova({ sync: true })
|
||||
updateServerUninstallToken(token: string): void {}
|
||||
|
||||
/**
|
||||
* (iOS) Allows to pass APN Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking.
|
||||
* @param {string} token APN Token
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
registerUninstall(token: string): void {}
|
||||
|
||||
/**
|
||||
* Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs.
|
||||
*/
|
||||
|
||||
@@ -101,7 +101,7 @@ export class BackgroundFetch extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
finish(): void {
|
||||
finish(taskId: string): void {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -404,7 +404,7 @@ export interface BackgroundGeolocationConfig {
|
||||
*
|
||||
* @default 100
|
||||
*/
|
||||
syncThreshold?: string;
|
||||
syncThreshold?: number;
|
||||
|
||||
/**
|
||||
* Optional HTTP headers sent along in HTTP request.
|
||||
@@ -499,7 +499,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationEvents, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation/ngx';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
@@ -516,7 +516,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
* this.backgroundGeolocation.configure(config)
|
||||
* .then(() => {
|
||||
*
|
||||
* this.backgroundGeolocation.on('location').subscribe((location: BackgroundGeolocationResponse) => {
|
||||
* this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {
|
||||
* console.log(location);
|
||||
*
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
@@ -540,7 +540,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundGeolocation',
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation@alpha',
|
||||
plugin: '@mauron85/cordova-plugin-background-geolocation',
|
||||
pluginRef: 'BackgroundGeolocation',
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
platforms: ['Android', 'iOS']
|
||||
|
||||
@@ -91,8 +91,37 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
* Disable the background mode.
|
||||
* Once the background mode has been disabled, the app will be paused when in background.
|
||||
*/
|
||||
@Cordova()
|
||||
disable(): Promise<any> {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
disable(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the background mode.
|
||||
*
|
||||
* @param enable {boolean} The status to set for.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setEnabled(enable: boolean): void {}
|
||||
|
||||
/**
|
||||
* Fire event with given arguments.
|
||||
*
|
||||
* @param event {string} event The event's name.
|
||||
* @param args {array} The callback's arguments.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
fireEvent(event: string, ...args: any[]): string {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,17 +148,15 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the default title, ticker and text.
|
||||
* Overwrite the default settings.
|
||||
* Available only for Android platform.
|
||||
* @param {BackgroundModeConfiguration} options List of option to configure. See table below
|
||||
* @param overrides {BackgroundModeConfiguration} Dict of options to be overridden.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
setDefaults(options?: BackgroundModeConfiguration): Promise<any> {
|
||||
return;
|
||||
}
|
||||
setDefaults(overrides?: BackgroundModeConfiguration): void {}
|
||||
|
||||
/**
|
||||
* Modify the displayed information.
|
||||
@@ -143,7 +170,8 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
configure(options?: BackgroundModeConfiguration): void {}
|
||||
|
||||
/**
|
||||
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* Register callback for given event.
|
||||
* > Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* @param event {string} Event name
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@@ -156,6 +184,17 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* @param event {string} Event name
|
||||
* @param callback {function} The function to be exec as callback.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
un(event: string, callback: (...args: any[]) => void): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android allows to programmatically move from foreground to background.
|
||||
*/
|
||||
@@ -202,15 +241,14 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
excludeFromTaskList(): void {}
|
||||
|
||||
/**
|
||||
* The method works async instead of isActive() or isEnabled().
|
||||
* If the screen is off.
|
||||
* @param fn {function} Callback function to invoke with boolean arg.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
isScreenOff(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
isScreenOff(fn: (arg0: boolean) => void): void {}
|
||||
|
||||
/**
|
||||
* Turn screen on
|
||||
@@ -229,4 +267,13 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
sync: true
|
||||
})
|
||||
unlock(): void {}
|
||||
|
||||
/**
|
||||
* Disables battery optimazation mode for the app (android only)
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
sync: true
|
||||
})
|
||||
disableBatteryOptimizations(): void {}
|
||||
}
|
||||
|
||||
102
src/@ionic-native/plugins/biocatch/index.ts
Normal file
102
src/@ionic-native/plugins/biocatch/index.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name BioCatch
|
||||
* @description
|
||||
* BioCatch SDK Cordova support
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BioCatch } from '@ionic-native/biocatch';
|
||||
*
|
||||
*
|
||||
* constructor(private biocatch: BioCatch) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.biocatch.start('customer-session-1', 'http://example.com', 'some-public-key')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BioCatch',
|
||||
plugin: 'cordova-plugin-biocatch',
|
||||
pluginRef: 'BioCatch',
|
||||
repo: 'https://bitbucket.org/carlos_orellana/ionic-plugin',
|
||||
platforms: ['iOS', 'Android'],
|
||||
})
|
||||
@Injectable()
|
||||
export class BioCatch extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Start a session
|
||||
* @param customerSessionID {String} Customer session id
|
||||
* @param wupUrl {String} WUP server URL
|
||||
* @param publicKey {String} Public Key
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
start(customerSessionID: string | null, wupUrl: string, publicKey: string | null): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause the session
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
pause(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume the session
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
resume(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the session
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
stop(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the session
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
resetSession(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the session context
|
||||
* @param contextName {String} Context name
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
changeContext(contextName: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the customer session ID
|
||||
* @param customerSessionID {String}
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
updateCustomerSessionID(customerSessionID: string | null): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
59
src/@ionic-native/plugins/biometric-wrapper/index.ts
Normal file
59
src/@ionic-native/plugins/biometric-wrapper/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name BiometricWrapper
|
||||
* @description
|
||||
* This plugin capture biometric(Iris and Fingerprint) and validate the user.
|
||||
* May be used in Banking domain
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BiometricWrapper } from '@ionic-native/biometric-wrapper/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private biometricWrapper: BiometricWrapper) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.biometricWrapper.activateIris({'PID_XML': '<pid-xml/>'})
|
||||
* .then((res: any) => )
|
||||
* .catch((error: any) => );
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
|
||||
@Plugin({
|
||||
pluginName: 'BiometricWrapper',
|
||||
plugin: 'cordova-plugin-biometric',
|
||||
pluginRef: 'cordova.plugins.BiometricWrapper',
|
||||
repo: '',
|
||||
install: '',
|
||||
installVariables: [],
|
||||
platforms: ['Android']
|
||||
})
|
||||
|
||||
@Injectable()
|
||||
export class BiometricWrapper extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function activate iris activity
|
||||
* @return {Promise<any>} Returns a promise that resolves when iris data captured
|
||||
*/
|
||||
@Cordova()
|
||||
activateIris(args: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function activate fingerprint activity
|
||||
* @return {Promise<any>} Returns a promise that resolves when FP data captured
|
||||
*/
|
||||
@Cordova()
|
||||
activateFingerprint(args: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,6 +198,13 @@ export interface DocumentVerificationOverlaySettingsCtor {
|
||||
new(): DocumentVerificationOverlaySettings;
|
||||
}
|
||||
|
||||
export interface BlinkCardOverlaySettings extends OverlaySettings {
|
||||
glareMessage: string;
|
||||
}
|
||||
export interface BlinkCardOverlaySettingsCtor {
|
||||
new(): BlinkCardOverlaySettings;
|
||||
}
|
||||
|
||||
export interface RecognizerResult {
|
||||
resultState: RecognizerResultState;
|
||||
}
|
||||
@@ -837,47 +844,26 @@ export interface EgyptIdFrontRecognizer extends Recognizer<EgyptIdFrontRecognize
|
||||
}
|
||||
export interface EgyptIdFrontRecognizerCtor extends RecognizerCtor<EgyptIdFrontRecognizer> {}
|
||||
|
||||
export interface ElitePaymentCardBackRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
fullDocumentImage: string;
|
||||
inventoryNumber: string;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface ElitePaymentCardBackRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardBackRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardBackRecognizer extends Recognizer<ElitePaymentCardBackRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractValidThru: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
|
||||
export interface ElitePaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
export interface BlinkCardEliteRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
digitalSignature: string;
|
||||
digitalSignatureVersion: string;
|
||||
documentDataMatch: boolean;
|
||||
fullDocumentImage: string;
|
||||
fullDocumentBackImage: string;
|
||||
fullDocumentFrontImage: string;
|
||||
inventoryNumber: string;
|
||||
owner: string;
|
||||
scanningFirstSideDone: boolean;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface ElitePaymentCardCombinedRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardCombinedRecognizerResult> {}
|
||||
export interface BlinkCardEliteRecognizerResultCtor extends RecognizerResultCtor<BlinkCardEliteRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardCombinedRecognizer extends Recognizer<ElitePaymentCardCombinedRecognizerResult> {
|
||||
export interface BlinkCardEliteRecognizer extends Recognizer<BlinkCardEliteRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
@@ -886,20 +872,7 @@ export interface ElitePaymentCardCombinedRecognizer extends Recognizer<ElitePaym
|
||||
returnFullDocumentImage: boolean;
|
||||
signResult: boolean;
|
||||
}
|
||||
|
||||
export interface ElitePaymentCardFrontRecognizerResult extends RecognizerResult {
|
||||
fullDocumentImage: string;
|
||||
owner: string;
|
||||
}
|
||||
export interface ElitePaymentCardFrontRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardFrontRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardFrontRecognizer extends Recognizer<ElitePaymentCardFrontRecognizerResult> {
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractOwner: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
}
|
||||
export interface BlinkCardEliteRecognizerCtor extends RecognizerCtor<BlinkCardEliteRecognizer> {}
|
||||
|
||||
export interface EudlRecognizerResult extends RecognizerResult {
|
||||
address: string;
|
||||
@@ -1731,24 +1704,7 @@ export interface NewZealandDlFrontRecognizer extends Recognizer<NewZealandDlFron
|
||||
}
|
||||
export interface NewZealandDlFrontRecognizerCtor extends RecognizerCtor<NewZealandDlFrontRecognizer> {}
|
||||
|
||||
export interface PaymentCardBackRecognizerResult extends RecognizerResult {
|
||||
cvv: string;
|
||||
fullDocumentImage: string;
|
||||
inventoryNumber: string;
|
||||
}
|
||||
export interface PaymentCardBackRecognizerResultCtor extends RecognizerResultCtor<PaymentCardBackRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardBackRecognizer extends Recognizer<PaymentCardBackRecognizerResult> {
|
||||
anonymizeCvv: boolean;
|
||||
detectGlare: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
export interface PaymentCardBackRecognizerCtor extends RecognizerCtor<PaymentCardBackRecognizer> {}
|
||||
|
||||
export interface PaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
export interface BlinkCardRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
digitalSignature: string;
|
||||
@@ -1757,16 +1713,19 @@ export interface PaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
fullDocumentBackImage: string;
|
||||
fullDocumentFrontImage: string;
|
||||
inventoryNumber: string;
|
||||
issuer: string;
|
||||
owner: string;
|
||||
scanningFirstSideDone: boolean;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface PaymentCardCombinedRecognizerResultCtor extends RecognizerResultCtor<PaymentCardCombinedRecognizerResult> {}
|
||||
export interface BlinkCardRecognizerResultCtor extends RecognizerResultCtor<BlinkCardRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardCombinedRecognizer extends Recognizer<PaymentCardCombinedRecognizerResult> {
|
||||
export interface BlinkCardRecognizer extends Recognizer<BlinkCardRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
@@ -1775,27 +1734,7 @@ export interface PaymentCardCombinedRecognizer extends Recognizer<PaymentCardCom
|
||||
returnFullDocumentImage: boolean;
|
||||
signResult: boolean;
|
||||
}
|
||||
export interface PaymentCardCombinedRecognizerCtor extends RecognizerCtor<PaymentCardCombinedRecognizer> {}
|
||||
|
||||
export interface PaymentCardFrontRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
fullDocumentImage: string;
|
||||
owner: string;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface PaymentCardFrontRecognizerResultCtor extends RecognizerResultCtor<PaymentCardFrontRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardFrontRecognizer extends Recognizer<PaymentCardFrontRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
export interface PaymentCardFrontRecognizerCtor extends RecognizerCtor<PaymentCardFrontRecognizer> {}
|
||||
export interface BlinkCardRecognizerCtor extends RecognizerCtor<BlinkCardRecognizer> {}
|
||||
|
||||
export interface Pdf417RecognizerResult extends RecognizerResult {
|
||||
barcodeType: string;
|
||||
@@ -2738,6 +2677,40 @@ export interface UsdlCombinedRecognizerCtor extends RecognizerCtor<UsdlCombinedR
|
||||
* this.barcodeStringData = barcodeRecognizer.result.stringData;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const overlaySettings = new this.blinkId.BlinkCardOverlaySettings();
|
||||
* const recognizer = new this.blinkId.BlinkCardRecognizer();
|
||||
* recognizer.returnFullDocumentImage = false;
|
||||
* recognizer.detectGlare = true;
|
||||
* recognizer.extractCvv = true;
|
||||
* recognizer.extractValidThru = true;
|
||||
* recognizer.extractOwner = true;
|
||||
*
|
||||
* const recognizerCollection = new this.blinkId.RecognizerCollection([recognizer]);
|
||||
* const canceled = await this.blinkId.scanWithCamera(
|
||||
* overlaySettings,
|
||||
* recognizerCollection,
|
||||
* {
|
||||
* ios: '', //iOS License Key
|
||||
* android: '' //Android License Key
|
||||
* },
|
||||
* );
|
||||
*
|
||||
* if (!canceled) {
|
||||
* if (recognizer.result.resultState === RecognizerResultState.valid) {
|
||||
* const results = recognizer.result;
|
||||
*
|
||||
* if (results.resultState === RecognizerResultState.valid) {
|
||||
* const ccInfo = {
|
||||
* cardNumber: Number(results.cardNumber),
|
||||
* expirationMonth: Number(results.validThru.month),
|
||||
* expirationYear: Number(results.validThru.year),
|
||||
* cvv: Number(results.cvv)
|
||||
* };
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -2753,7 +2726,7 @@ export interface UsdlCombinedRecognizerCtor extends RecognizerCtor<UsdlCombinedR
|
||||
export class BlinkId extends IonicNativePlugin {
|
||||
/**
|
||||
* Opens the camera dialog and attempts to scan a barcode/document
|
||||
* @param overlaySettings {OverlaySettings} for camera overla customization
|
||||
* @param overlaySettings {OverlaySettings} for camera overlay customization
|
||||
* @param recognizerCollection {RecognizerCollection} collection of recognizers to scan with
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@@ -2773,6 +2746,7 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() BarcodeOverlaySettings: BarcodeOverlaySettingsCtor;
|
||||
@CordovaProperty() DocumentOverlaySettings: DocumentOverlaySettingsCtor;
|
||||
@CordovaProperty() DocumentVerificationOverlaySettings: DocumentVerificationOverlaySettingsCtor;
|
||||
@CordovaProperty() BlinkCardOverlaySettings: BlinkCardOverlaySettingsCtor;
|
||||
|
||||
@CordovaProperty() RecognizerCollection: RecognizerCollectionCtor;
|
||||
|
||||
@@ -2795,6 +2769,10 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() AustriaIdFrontRecognizer: AustriaIdFrontRecognizerCtor;
|
||||
@CordovaProperty() AustriaPassportRecognizerResult: AustriaPassportRecognizerResultCtor;
|
||||
@CordovaProperty() AustriaPassportRecognizer: AustriaPassportRecognizerCtor;
|
||||
@CordovaProperty() BlinkCardEliteRecognizer: BlinkCardEliteRecognizerCtor;
|
||||
@CordovaProperty() BlinkCardEliteRecognizerResult: BlinkCardEliteRecognizerResultCtor;
|
||||
@CordovaProperty() BlinkCardRecognizerResult: BlinkCardRecognizerResultCtor;
|
||||
@CordovaProperty() BlinkCardRecognizer: BlinkCardRecognizerCtor;
|
||||
@CordovaProperty() ColombiaDlFrontRecognizerResult: ColombiaDlFrontRecognizerResultCtor;
|
||||
@CordovaProperty() ColombiaIdBackRecognizerResult: ColombiaIdBackRecognizerResultCtor;
|
||||
@CordovaProperty() ColombiaIdBackRecognizer: ColombiaIdBackRecognizerCtor;
|
||||
@@ -2812,9 +2790,6 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() DocumentFaceRecognizerResult: DocumentFaceRecognizerResultCtor;
|
||||
@CordovaProperty() EgyptIdFrontRecognizerResult: EgyptIdFrontRecognizerResultCtor;
|
||||
@CordovaProperty() EgyptIdFrontRecognizer: EgyptIdFrontRecognizerCtor;
|
||||
@CordovaProperty() ElitePaymentCardBackRecognizerResult: ElitePaymentCardBackRecognizerResultCtor;
|
||||
@CordovaProperty() ElitePaymentCardCombinedRecognizerResult: ElitePaymentCardCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() ElitePaymentCardFrontRecognizerResult: ElitePaymentCardFrontRecognizerResultCtor;
|
||||
@CordovaProperty() EudlRecognizerResult: EudlRecognizerResultCtor;
|
||||
@CordovaProperty() GermanyCombinedRecognizerResult: GermanyCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() GermanyCombinedRecognizer: GermanyCombinedRecognizerCtor;
|
||||
@@ -2868,12 +2843,6 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() MyKadFrontRecognizer: MyKadFrontRecognizerCtor;
|
||||
@CordovaProperty() NewZealandDlFrontRecognizerResult: NewZealandDlFrontRecognizerResultCtor;
|
||||
@CordovaProperty() NewZealandDlFrontRecognizer: NewZealandDlFrontRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardBackRecognizerResult: PaymentCardBackRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardBackRecognizer: PaymentCardBackRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardCombinedRecognizerResult: PaymentCardCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardCombinedRecognizer: PaymentCardCombinedRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardFrontRecognizerResult: PaymentCardFrontRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardFrontRecognizer: PaymentCardFrontRecognizerCtor;
|
||||
@CordovaProperty() Pdf417RecognizerResult: Pdf417RecognizerResultCtor;
|
||||
@CordovaProperty() Pdf417Recognizer: Pdf417RecognizerCtor;
|
||||
@CordovaProperty() PolandCombinedRecognizerResult: PolandCombinedRecognizerResultCtor;
|
||||
|
||||
@@ -82,6 +82,8 @@ export interface ScanParams {
|
||||
matchNum?: BluetoothMatchNum;
|
||||
/** Defaults to All Matches. Available from API21 / API 23. (Android) */
|
||||
callbackType?: BluetoothCallbackType;
|
||||
/** True/false to show only connectable devices, rather than all devices ever seen, defaults to false (Windows) */
|
||||
isConnectable?: boolean;
|
||||
}
|
||||
|
||||
export interface NotifyParams {
|
||||
@@ -431,20 +433,20 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* @name initialize
|
||||
* Initialize Bluetooth on the device
|
||||
* @param {InitParams} [params]
|
||||
* @returns {(Promise<{ status: 'enabled' | 'disabled'}>)} The callback that is passed initialize status (enabled/disabled)
|
||||
* @returns {(Observable<{ status: 'enabled' | 'disabled'}>)} The callback that is passed initialize status (enabled/disabled)
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
initialize(params?: InitParams): Promise<{ status: 'enabled' | 'disabled' }> {
|
||||
@Cordova({ successIndex: 0, errorIndex: 2, observable: true })
|
||||
initialize(params?: InitParams): Observable<{ status: 'enabled' | 'disabled' }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name enable (Android)
|
||||
* Enable Bluetooth on the device. Android support only
|
||||
* @returns {Promise<{ status: boolean }>}
|
||||
* @returns void
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', sync: true })
|
||||
enable(): Promise<{ status: boolean }> {
|
||||
enable() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -480,10 +482,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* Android API >= 23 also requires location services to be enabled. Use isLocationEnabled to determine whether location services are enabled.
|
||||
* If not enabled, use requestLocation to prompt the location services settings page.
|
||||
* @param {ScanParams} params Scan params
|
||||
* @returns {(Observable<{ status: ScanStatus }>)}
|
||||
* @returns {(Observable< ScanStatus >)}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', observable: true })
|
||||
startScan(params: ScanParams): Observable<{ status: ScanStatus }> {
|
||||
startScan(params: ScanParams): Observable< ScanStatus > {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -559,7 +561,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
connect(params: {
|
||||
address: string;
|
||||
autoConnect?: boolean;
|
||||
}): Observable<{ status: DeviceInfo }> {
|
||||
}): Observable< DeviceInfo > {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -567,10 +569,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* @name reconnect
|
||||
* Reconnect to a previously connected Bluetooth device
|
||||
* @param {{address: string}} params The address/identifier
|
||||
* @returns {(Observable<{ status: DeviceInfo }>)}
|
||||
* @returns {(Observable<DeviceInfo>)}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse', observable: true })
|
||||
reconnect(params: { address: string }): Observable<{ status: DeviceInfo }> {
|
||||
reconnect(params: { address: string }): Observable<DeviceInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -579,10 +581,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* Disconnect from a Bluetooth LE device.
|
||||
* Note: It's simpler to just call close(). Starting with iOS 10, disconnecting before closing seems required!
|
||||
* @param {{address: string}} params The address/identifier
|
||||
* @returns {Promise<{ status: DeviceInfo }>}
|
||||
* @returns {Promise<DeviceInfo>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
disconnect(params: { address: string }): Promise<{ status: DeviceInfo }> {
|
||||
disconnect(params: { address: string }): Promise<DeviceInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -592,10 +594,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* Prior to 2.7.0, you needed to disconnect to the device before closing, but this is no longer the case.
|
||||
* Starting with iOS 10, disconnecting before closing seems required!
|
||||
* @param {{ address: string }} params The address/identifier
|
||||
* @returns {Promise<{ status: DeviceInfo }>}
|
||||
* @returns {Promise<DeviceInfo>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
close(params: { address: string }): Promise<{ status: DeviceInfo }> {
|
||||
close(params: { address: string }): Promise<DeviceInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -609,7 +611,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* Subsequent discover events will make use of this cache.
|
||||
* If your device's services change, set the clearCache parameter to force Android to re-discover services.
|
||||
* @param {{ address: string, clearCache: boolean }} params The address/identifier
|
||||
* @returns {Promise<{ device: Device }>}
|
||||
* @returns {Promise<Device>}
|
||||
* success: device object (contains array of service objects)
|
||||
* error: The callback that will be triggered when the unbond operation fails
|
||||
*/
|
||||
@@ -617,7 +619,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
discover(params: {
|
||||
address: string;
|
||||
clearCache?: boolean;
|
||||
}): Promise<{ device: Device }> {
|
||||
}): Promise<Device> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -626,13 +628,13 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* Discover the device's services.
|
||||
* Not providing an array of services will return all services and take longer to discover. iOS support only.
|
||||
* @param {{address: string, services: string[]}} params
|
||||
* @returns {Promise<{ services: Services }>}
|
||||
* @returns {Promise<Services>}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
services(params: {
|
||||
address: string;
|
||||
services?: string[];
|
||||
}): Promise<{ services: Services }> {
|
||||
}): Promise<Services> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -747,10 +749,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* @name rssi
|
||||
* Read RSSI of a connected device. RSSI is also returned with scanning.
|
||||
* @param {{ address: string }} params
|
||||
* @returns {Promise<{ rssi: RSSI }>}
|
||||
* @returns {Promise< RSSI >}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
rssi(params: { address: string }): Promise<{ rssi: RSSI }> {
|
||||
rssi(params: { address: string }): Promise< RSSI > {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -758,10 +760,10 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
* @name mtu (Android, Android 5+)
|
||||
* Set MTU of a connected device. Android only.
|
||||
* @param {{ address: string, mtu: number }} params
|
||||
* @returns {Promise<{ mtu: MTU }>}
|
||||
* @returns {Promise< MTU >}
|
||||
*/
|
||||
@Cordova({ callbackOrder: 'reverse' })
|
||||
mtu(params: { address: string; mtu?: number }): Promise<{ mtu: MTU }> {
|
||||
mtu(params: { address: string; mtu?: number }): Promise< MTU > {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1057,7 +1059,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
@CordovaProperty()
|
||||
SCAN_MODE_LOW_LATENCY: number;
|
||||
@CordovaProperty()
|
||||
MATCH_MODE_AGRESSIVE: number;
|
||||
MATCH_MODE_AGGRESSIVE: number;
|
||||
@CordovaProperty()
|
||||
MATCH_MODE_STICKY: number;
|
||||
@CordovaProperty()
|
||||
|
||||
@@ -475,6 +475,21 @@ export class Calendar extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an event by id.
|
||||
*
|
||||
* @param {string} [id] The event id
|
||||
* @param {Date} [fromDate] The date where it start deleting from
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
deleteEventById(
|
||||
id: string,
|
||||
fromDate?: Date
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the calendar at the specified date.
|
||||
* @param {Date} date The date you want to open the calendar on
|
||||
|
||||
@@ -113,6 +113,14 @@ export interface CameraPreviewPictureOptions {
|
||||
* this.picture = 'assets/img/test.jpg';
|
||||
* });
|
||||
*
|
||||
* // take a snap shot
|
||||
* this.cameraPreview.takeSnapshot(this.pictureOpts).then((imageData) => {
|
||||
* this.picture = 'data:image/jpeg;base64,' + imageData;
|
||||
* }, (err) => {
|
||||
* console.log(err);
|
||||
* this.picture = 'assets/img/test.jpg';
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Switch camera
|
||||
* this.cameraPreview.switchCamera();
|
||||
@@ -245,6 +253,20 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Take a snapshot of preview window (size specified in startCamera options)
|
||||
* @param {CameraPreviewPictureOptions} [options] quality of the picture to take
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
takeSnapshot(options?: CameraPreviewPictureOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Set camera color effect.
|
||||
@@ -456,4 +478,22 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
onBackButton(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return in use device camera fov
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getHorizontalFOV(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the characteristics of all available cameras
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getCameraCharacteristics(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,11 +211,11 @@ export class Camera extends IonicNativePlugin {
|
||||
* Convenience constant
|
||||
*/
|
||||
PictureSourceType = {
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
||||
PHOTOLIBRARY: 0,
|
||||
/** Take picture from camera */
|
||||
CAMERA: 1,
|
||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
SAVEDPHOTOALBUM: 2
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export class Chooser extends IonicNativePlugin {
|
||||
* base64-encoded data: URI, MIME type, display name, and original URI.
|
||||
*/
|
||||
@Cordova()
|
||||
getFile(accept: string): Promise<ChooserResult | undefined> {
|
||||
getFile(accept?: string): Promise<ChooserResult | undefined> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
105
src/@ionic-native/plugins/clover-go/index.ts
Normal file
105
src/@ionic-native/plugins/clover-go/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface Response {
|
||||
type?: string;
|
||||
message?: string;
|
||||
reason?: string;
|
||||
}
|
||||
export interface InitResponse extends Response {
|
||||
merchantName?: string;
|
||||
}
|
||||
export interface SaleResponse extends Response {
|
||||
paymentId?: string;
|
||||
transactionType?: string;
|
||||
entryType?: string;
|
||||
cardFirst6?: string;
|
||||
cardLast4?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Clover Go
|
||||
* @description
|
||||
* This plugin connect to Clover Go payment device and process payments.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CloverGo } from '@ionic-native/clover-go/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private cloverGo: CloverGo) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.cloverGo.init(configuration)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* this.cloverGo.connect()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* this.cloverGo.disconnect()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* this.cloverGo.sale(saleInfo)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'CloverGo',
|
||||
plugin: 'cordova-plugin-clovergo',
|
||||
pluginRef: 'clovergo',
|
||||
repo: 'https://github.com/hotwax/cordova-plugin-clovergo',
|
||||
install: 'ionic plugin add cordova-plugin-clovergo',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class CloverGo extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function initialises Clover Go SDK
|
||||
* @param configuration {object}
|
||||
* @return {Promise<InitResponse>}
|
||||
*/
|
||||
@Cordova()
|
||||
init(configuration: object): Promise<InitResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function connects to available clover go device
|
||||
*
|
||||
* @return {Promise<Response>}
|
||||
*/
|
||||
@Cordova()
|
||||
connect(): Promise<Response> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function disconnects to available clover go device
|
||||
*
|
||||
* @return {Promise<Response>}
|
||||
*/
|
||||
@Cordova()
|
||||
disconnect(): Promise<Response> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initiate sale for Clover Go device
|
||||
* @param saleInfo {object}
|
||||
* @return {Promise<SaleResponse>}
|
||||
*/
|
||||
@Cordova()
|
||||
sale(saleInfo: object): Promise<SaleResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
/**
|
||||
* @name Couchbase Lite
|
||||
* @description
|
||||
* Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android
|
||||
* Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android <docs-card href="https://ionicframework.com/integrations/couchbase-lite" ionicon="alert">This Plugin is no longer supported by Couchbase. Please see our Couchbase Lite Integration</docs-card>
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
@@ -33,6 +33,9 @@ export interface DeeplinkOptions {
|
||||
* @description This plugin handles deeplinks on iOS and Android for both custom URL scheme links
|
||||
* and Universal App Links.
|
||||
*
|
||||
* Please read the [ionic plugin deeplinks docs](https://github.com/ionic-team/ionic-plugin-deeplinks) for iOS and Android integration.
|
||||
* You must add `universal-links` to your `config.xml` and set up Apple App Site Association (AASA) for iOS and Asset Links for Android.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Deeplinks } from '@ionic-native/deeplinks/ngx';
|
||||
|
||||
@@ -35,9 +35,9 @@ export interface AndroidAccount {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceAccounts',
|
||||
plugin: 'cordova-device-accounts',
|
||||
pluginRef: 'plugins.DeviceAccounts',
|
||||
repo: 'https://github.com/danielsogl/cordova-device-accounts',
|
||||
plugin: 'cordova-device-accounts-v2',
|
||||
pluginRef: 'DeviceAccounts',
|
||||
repo: 'https://github.com/xUnholy/cordova-device-accounts-v2',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -78,4 +78,23 @@ export class DeviceAccounts extends IonicNativePlugin {
|
||||
getEmail(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get permissions for access to email registered on Android device 8.0+
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
getPermissions(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get permissions for access to email registered on Android device 8.0+ for requested type
|
||||
* @param {string} type
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
getPermissionsByType(type: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,11 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
@CordovaProperty()
|
||||
permissionStatus: {
|
||||
GRANTED: string;
|
||||
/**
|
||||
* @deprecated cordova.plugins.diagnostic@5.0.0 uses DENIED_ONCE to unify DENIED* statuses across iOS/Android
|
||||
*/
|
||||
DENIED: string;
|
||||
DENIED_ONCE: string;
|
||||
NOT_REQUESTED: string;
|
||||
DENIED_ALWAYS: string;
|
||||
RESTRICTED: string;
|
||||
@@ -812,6 +816,15 @@ export class Diagnostic extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests reminders authorization for the application.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['iOS'] })
|
||||
requestRemoteNotificationsAuthorization(types?: string[], omitRegistration?: boolean): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the current setting of notification types for the app in the Settings app.
|
||||
* Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
|
||||
|
||||
94
src/@ionic-native/plugins/document-scanner/index.ts
Normal file
94
src/@ionic-native/plugins/document-scanner/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export enum DocumentScannerSourceType {
|
||||
/**
|
||||
* Scan directly from device camera.
|
||||
* This is the default.
|
||||
*/
|
||||
CAMERA = 1,
|
||||
|
||||
/**
|
||||
* Scan from an image already stored on device.
|
||||
*/
|
||||
GALLERY = 0
|
||||
}
|
||||
|
||||
export interface DocumentScannerOptions {
|
||||
/**
|
||||
* Choose to scan from camera or existing image file. Only valid for Android.
|
||||
*/
|
||||
sourceType?: DocumentScannerSourceType;
|
||||
|
||||
/**
|
||||
* Filename to save scanned image to (minus extension, which is always ".png").
|
||||
* Only valid for iOS. Caller is responsible for cleaning up any files created
|
||||
* if this parameter is set to anything other than the default value,
|
||||
* which is "image".
|
||||
*/
|
||||
fileName?: string;
|
||||
|
||||
/**
|
||||
* Quality to use when capturing the image, must be a float value
|
||||
* from 1.0(default - Highest quality) to 5.0(Lowest Quality). Any value
|
||||
* in between will be accepted. Any value not equal to or not between these values
|
||||
* will default to the highest quality of 1.0.
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* If the image should be returned as a base64 encoding instead of as a file URL.
|
||||
* If true, the plugin will return the scanned image as base64. If false,
|
||||
* the plugin will return the image URL of the image.
|
||||
*/
|
||||
returnBase64?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Document Scanner
|
||||
* @description
|
||||
* This plugin processes images of documents, compensating for perspective.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { DocumentScanner, DocumentScannerOptions } from '@ionic-native/document-scanner';
|
||||
*
|
||||
*
|
||||
* constructor(private documentScanner: DocumentScanner) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let opts: DocumentScannerOptions = {};
|
||||
* this.documentScanner.scanDocument(opts)
|
||||
* .then((res: string) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* DocumentScannerOptions
|
||||
* @enums
|
||||
* DocumentScannerSourceType
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DocumentScanner',
|
||||
plugin: 'cordova-plugin-document-scanner',
|
||||
pluginRef: 'scan',
|
||||
repo: 'https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class DocumentScanner extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Scan a document
|
||||
* @param opts {DocumentScannerOptions} optional parameter for controlling scanning
|
||||
* @return {Promise<string>} file URL of scanned document image
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
scanDoc(opts?: DocumentScannerOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -70,9 +70,27 @@ export interface EmailComposerOptions {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.emailComposer.isAvailable().then((available: boolean) =>{
|
||||
* this.emailComposer.getClients().then((apps: []) => {
|
||||
* // Returns an array of configured email clients for the device
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.hasClient().then(app, (isValid: boolean) => {
|
||||
* if (isValid) {
|
||||
* // Now we know we have a valid email client configured
|
||||
* // Not specifying an app will return true if at least one email client is configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.hasAccount().then((isValid: boolean) => {
|
||||
* if (isValid) {
|
||||
* // Now we know we have a valid email account configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.isAvailable().then(app, (available: boolean) => {
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* // Now we know we can send an email, calls hasClient and hasAccount
|
||||
* // Not specifying an app will return true if at least one email client is configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
@@ -142,6 +160,68 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if an email account is configured on the device.
|
||||
*
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
hasAccount(): Promise<any> {
|
||||
return getPromise<boolean>((resolve) => {
|
||||
EmailComposer.getPlugin().hasAccount((result: boolean) => {
|
||||
if (result) {
|
||||
resolve(true);
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if a specific email client is installed on the device.
|
||||
*
|
||||
* @param {string} [app] App id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
|
||||
@CordovaCheck()
|
||||
hasClient(app?: string): Promise<any> {
|
||||
return getPromise<boolean>((resolve) => {
|
||||
if (app) {
|
||||
EmailComposer.getPlugin().hasClient(app, (result: boolean) => {
|
||||
if (result) {
|
||||
resolve(true);
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
EmailComposer.getPlugin().getClients((apps: string[]) => {
|
||||
resolve(apps && apps.length > 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of email clients installed on the device.
|
||||
*
|
||||
* @returns {Promise<string[]>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
getClients(): Promise<string[]> {
|
||||
return getPromise<string[]>(resolve => {
|
||||
EmailComposer.getPlugin().getClients((apps: any) => {
|
||||
if (Object.prototype.toString.call(apps) === '[object String]') {
|
||||
apps = [apps];
|
||||
}
|
||||
resolve(apps);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
@@ -150,24 +230,11 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return getPromise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
return getPromise<boolean>((resolve) => {
|
||||
Promise.all([this.hasAccount, this.hasClient(app)])
|
||||
.then((results) => {
|
||||
return resolve(results.length === 2 && results[0] && results[1]);
|
||||
});
|
||||
} else {
|
||||
EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
61
src/@ionic-native/plugins/emm-app-config/index.ts
Normal file
61
src/@ionic-native/plugins/emm-app-config/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name Emm App Config
|
||||
* @description
|
||||
* This plugin provides information on EMM application configuration
|
||||
*
|
||||
* Requires the Cordova plugin: `cordova-plugin-emm-app-config`. For more info, please see the [Cordova EMM App Config Plugin Docs](https://github.com/oracle/cordova-plugin-emm-app-config).
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { EmmAppConfig } from '@ionic-native/emm-app-config/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private readonly emmAppConfig: EmmAppConfig) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Get all the values of the emm app configuration
|
||||
* const values = this.emmAppConfig.getValue();
|
||||
*
|
||||
* // Get specific value of the emm app configuration
|
||||
* const value = this.emmAppConfig.getValue('serverUrl');
|
||||
*
|
||||
* // Get an event every time the emm app config changes
|
||||
* this.emmAppConfig.registerChangedListener()
|
||||
* .subscribe(() => console.log('App config changes'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
platforms: ['Android', 'iOS'],
|
||||
plugin: 'cordova-plugin-emm-app-config',
|
||||
pluginName: 'EmmAppConfig',
|
||||
pluginRef: 'cordova.plugins.EmmAppConfig',
|
||||
repo: 'https://github.com/oracle/cordova-plugin-emm-app-config',
|
||||
})
|
||||
@Injectable()
|
||||
export class EmmAppConfig extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Get value from the Emm application configuration.
|
||||
* @param configKey {string} Key of the value to get, or null to get all the values as an object.
|
||||
* @return {any} Returns configuration on an object
|
||||
*/
|
||||
@Cordova({ sync: true }) getValue(configKey?: string): any {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a listener that will be invoked when the application configuration is changed.
|
||||
* @return {void}
|
||||
*/
|
||||
@Cordova({ observable: true }) registerChangedListener(): Observable<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -117,39 +117,39 @@ export interface FacebookLoginResponse {
|
||||
})
|
||||
@Injectable()
|
||||
export class Facebook extends IonicNativePlugin {
|
||||
EVENTS: {
|
||||
EVENT_NAME_ACTIVATED_APP: 'fb_mobile_activate_app';
|
||||
EVENT_NAME_DEACTIVATED_APP: 'fb_mobile_deactivate_app';
|
||||
EVENT_NAME_SESSION_INTERRUPTIONS: 'fb_mobile_app_interruptions';
|
||||
EVENT_NAME_TIME_BETWEEN_SESSIONS: 'fb_mobile_time_between_sessions';
|
||||
EVENT_NAME_COMPLETED_REGISTRATION: 'fb_mobile_complete_registration';
|
||||
EVENT_NAME_VIEWED_CONTENT: 'fb_mobile_content_view';
|
||||
EVENT_NAME_SEARCHED: 'fb_mobile_search';
|
||||
EVENT_NAME_RATED: 'fb_mobile_rate';
|
||||
EVENT_NAME_COMPLETED_TUTORIAL: 'fb_mobile_tutorial_completion';
|
||||
EVENT_NAME_PUSH_TOKEN_OBTAINED: 'fb_mobile_obtain_push_token';
|
||||
EVENT_NAME_ADDED_TO_CART: 'fb_mobile_add_to_cart';
|
||||
EVENT_NAME_ADDED_TO_WISHLIST: 'fb_mobile_add_to_wishlist';
|
||||
EVENT_NAME_INITIATED_CHECKOUT: 'fb_mobile_initiated_checkout';
|
||||
EVENT_NAME_ADDED_PAYMENT_INFO: 'fb_mobile_add_payment_info';
|
||||
EVENT_NAME_PURCHASED: 'fb_mobile_purchase';
|
||||
EVENT_NAME_ACHIEVED_LEVEL: 'fb_mobile_level_achieved';
|
||||
EVENT_NAME_UNLOCKED_ACHIEVEMENT: 'fb_mobile_achievement_unlocked';
|
||||
EVENT_NAME_SPENT_CREDITS: 'fb_mobile_spent_credits';
|
||||
EVENT_PARAM_CURRENCY: 'fb_currency';
|
||||
EVENT_PARAM_REGISTRATION_METHOD: 'fb_registration_method';
|
||||
EVENT_PARAM_CONTENT_TYPE: 'fb_content_type';
|
||||
EVENT_PARAM_CONTENT_ID: 'fb_content_id';
|
||||
EVENT_PARAM_SEARCH_STRING: 'fb_search_string';
|
||||
EVENT_PARAM_SUCCESS: 'fb_success';
|
||||
EVENT_PARAM_MAX_RATING_VALUE: 'fb_max_rating_value';
|
||||
EVENT_PARAM_PAYMENT_INFO_AVAILABLE: 'fb_payment_info_available';
|
||||
EVENT_PARAM_NUM_ITEMS: 'fb_num_items';
|
||||
EVENT_PARAM_LEVEL: 'fb_level';
|
||||
EVENT_PARAM_DESCRIPTION: 'fb_description';
|
||||
EVENT_PARAM_SOURCE_APPLICATION: 'fb_mobile_launch_source';
|
||||
EVENT_PARAM_VALUE_YES: '1';
|
||||
EVENT_PARAM_VALUE_NO: '0';
|
||||
EVENTS = {
|
||||
EVENT_NAME_ACTIVATED_APP: 'fb_mobile_activate_app',
|
||||
EVENT_NAME_DEACTIVATED_APP: 'fb_mobile_deactivate_app',
|
||||
EVENT_NAME_SESSION_INTERRUPTIONS: 'fb_mobile_app_interruptions',
|
||||
EVENT_NAME_TIME_BETWEEN_SESSIONS: 'fb_mobile_time_between_sessions',
|
||||
EVENT_NAME_COMPLETED_REGISTRATION: 'fb_mobile_complete_registration',
|
||||
EVENT_NAME_VIEWED_CONTENT: 'fb_mobile_content_view',
|
||||
EVENT_NAME_SEARCHED: 'fb_mobile_search',
|
||||
EVENT_NAME_RATED: 'fb_mobile_rate',
|
||||
EVENT_NAME_COMPLETED_TUTORIAL: 'fb_mobile_tutorial_completion',
|
||||
EVENT_NAME_PUSH_TOKEN_OBTAINED: 'fb_mobile_obtain_push_token',
|
||||
EVENT_NAME_ADDED_TO_CART: 'fb_mobile_add_to_cart',
|
||||
EVENT_NAME_ADDED_TO_WISHLIST: 'fb_mobile_add_to_wishlist',
|
||||
EVENT_NAME_INITIATED_CHECKOUT: 'fb_mobile_initiated_checkout',
|
||||
EVENT_NAME_ADDED_PAYMENT_INFO: 'fb_mobile_add_payment_info',
|
||||
EVENT_NAME_PURCHASED: 'fb_mobile_purchase',
|
||||
EVENT_NAME_ACHIEVED_LEVEL: 'fb_mobile_level_achieved',
|
||||
EVENT_NAME_UNLOCKED_ACHIEVEMENT: 'fb_mobile_achievement_unlocked',
|
||||
EVENT_NAME_SPENT_CREDITS: 'fb_mobile_spent_credits',
|
||||
EVENT_PARAM_CURRENCY: 'fb_currency',
|
||||
EVENT_PARAM_REGISTRATION_METHOD: 'fb_registration_method',
|
||||
EVENT_PARAM_CONTENT_TYPE: 'fb_content_type',
|
||||
EVENT_PARAM_CONTENT_ID: 'fb_content_id',
|
||||
EVENT_PARAM_SEARCH_STRING: 'fb_search_string',
|
||||
EVENT_PARAM_SUCCESS: 'fb_success',
|
||||
EVENT_PARAM_MAX_RATING_VALUE: 'fb_max_rating_value',
|
||||
EVENT_PARAM_PAYMENT_INFO_AVAILABLE: 'fb_payment_info_available',
|
||||
EVENT_PARAM_NUM_ITEMS: 'fb_num_items',
|
||||
EVENT_PARAM_LEVEL: 'fb_level',
|
||||
EVENT_PARAM_DESCRIPTION: 'fb_description',
|
||||
EVENT_PARAM_SOURCE_APPLICATION: 'fb_mobile_launch_source',
|
||||
EVENT_PARAM_VALUE_YES: '1',
|
||||
EVENT_PARAM_VALUE_NO: '0'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -306,4 +306,13 @@ export class Facebook extends IonicNativePlugin {
|
||||
getDeferredApplink(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually log activation events
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
activateApp(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,14 @@ export interface NotificationData {
|
||||
* backend.registerToken(token);
|
||||
* });
|
||||
*
|
||||
* this.fcm.hasPermission().then(hasPermission => {
|
||||
* if (hasPermission) {
|
||||
* console.log("Has permission!");
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* this.fcm.clearAllNotifications();
|
||||
*
|
||||
* this.fcm.unsubscribeFromTopic('marketing');
|
||||
*
|
||||
* ```
|
||||
@@ -62,6 +70,16 @@ export interface NotificationData {
|
||||
})
|
||||
@Injectable()
|
||||
export class FCM extends IonicNativePlugin {
|
||||
/**
|
||||
* Gets ios device's current APNS token
|
||||
*
|
||||
* @returns {Promise<string>} Returns a Promise that resolves with the APNS token
|
||||
*/
|
||||
@Cordova()
|
||||
getAPNSToken(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets device's current registration id
|
||||
*
|
||||
@@ -108,6 +126,19 @@ export class FCM extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking for permissions on iOS. On android, it always returns `true`.
|
||||
*
|
||||
* @returns {Promise<boolean | null>} Returns a Promise:
|
||||
* - true: push was allowed (or platform is android)
|
||||
* - false: push will not be available
|
||||
* - null: still not answered, recommended checking again later.
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(): Promise<boolean | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Watch for incoming notifications
|
||||
*
|
||||
@@ -121,4 +152,14 @@ export class FCM extends IonicNativePlugin {
|
||||
onNotification(): Observable<NotificationData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes existing push notifications from the notifications center
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
clearAllNotifications(): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface FileChooserOptions {
|
||||
/**
|
||||
* comma seperated mime types to filter files.
|
||||
*/
|
||||
mime: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name File Chooser
|
||||
* @description
|
||||
@@ -20,6 +27,8 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* FileChooserOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileChooser',
|
||||
@@ -33,10 +42,11 @@ export class FileChooser extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Open a file
|
||||
* @param {FileChooserOptions} [options] Optional parameter, defaults to ''. Filters the file selection list according to mime types
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
open(): Promise<string> {
|
||||
open(options?: FileChooserOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* .then(() => console.log('File is opened'))
|
||||
* .catch(e => console.log('Error opening file', e));
|
||||
*
|
||||
* this.fileOpener.showOpenWithDialog('path/to/file.pdf', 'application/pdf')
|
||||
* .then(() => console.log('File is opened'))
|
||||
* .catch(e => console.log('Error opening file', e));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -71,4 +75,19 @@ export class FileOpener extends IonicNativePlugin {
|
||||
appIsInstalled(packageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens with system modal to open file with an already installed app.
|
||||
* @param {string} filePath File Path
|
||||
* @param {string} fileMIMEType File MIME Type
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'object',
|
||||
successName: 'success',
|
||||
errorName: 'error'
|
||||
})
|
||||
showOpenWithDialog(filePath: string, fileMIMEType: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ export interface LocalFileSystem {
|
||||
/**
|
||||
* Allows the user to look up the Entry for a file or directory referred to by a local URL.
|
||||
* @param url A URL referring to a local file in a filesystem accessable via this API.
|
||||
* @param successCallback A callback that is called to report the Entry to which the supplied URL refers.
|
||||
* @param successCallback A callback that is called to report the FileEntry to which the supplied URL refers.
|
||||
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is
|
||||
* denied.
|
||||
*/
|
||||
resolveLocalFileSystemURL(
|
||||
url: string,
|
||||
successCallback: EntryCallback,
|
||||
successCallback: FileEntryCallback,
|
||||
errorCallback?: ErrorCallback
|
||||
): void;
|
||||
|
||||
|
||||
@@ -3,29 +3,41 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface FingerprintOptions {
|
||||
/**
|
||||
* Key for platform keychain
|
||||
* Title in biometric prompt (android only)
|
||||
* @default {APP_NAME} Biometric Sign On
|
||||
*/
|
||||
clientId: string;
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Secret password. Only for android
|
||||
* Subtitle in biometric Prompt (android only)
|
||||
* @default null
|
||||
*/
|
||||
clientSecret?: string;
|
||||
subtitle?: string;
|
||||
|
||||
/**
|
||||
* Disable 'use backup' option. Only for android (optional)
|
||||
* Description in biometric Prompt
|
||||
* @default null
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Title of fallback button.
|
||||
* @default "Use Pin"
|
||||
*/
|
||||
fallbackButtonTitle?: string;
|
||||
|
||||
/**
|
||||
* Title for cancel button on Android
|
||||
* @default "Cancel"
|
||||
*/
|
||||
cancelButtonTitle?: string;
|
||||
|
||||
/**
|
||||
* Disable 'use backup' option.
|
||||
* @default false
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
|
||||
/**
|
||||
* Title of fallback button. Only for iOS
|
||||
*/
|
||||
localizedFallbackTitle?: string;
|
||||
|
||||
/**
|
||||
* Description in authentication dialogue. Only for iOS
|
||||
*/
|
||||
localizedReason?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,12 +54,17 @@ export interface FingerprintOptions {
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.faio.show().then((result: any) => console.log(result)).catch((error: any) => console.log(error));
|
||||
*
|
||||
* OR with options...
|
||||
*
|
||||
* this.faio.show({
|
||||
* clientId: 'Fingerprint-Demo',
|
||||
* clientSecret: 'password', //Only necessary for Android
|
||||
* disableBackup:true, //Only for Android(optional)
|
||||
* localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
* localizedReason: 'Please authenticate' //Only for iOS
|
||||
* title: 'Biometric Authentication', // (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
|
||||
* subtitle: 'Coolest Plugin ever' // (Android Only) | optional | Default: null
|
||||
* description: 'Please authenticate' // optional | Default: null
|
||||
* fallbackButtonTitle: 'Use Backup', // optional | When disableBackup is false defaults to "Use Pin".
|
||||
* // When disableBackup is true defaults to "Cancel"
|
||||
* disableBackup:true, // optional | default: false
|
||||
* })
|
||||
* .then((result: any) => console.log(result))
|
||||
* .catch((error: any) => console.log(error));
|
||||
@@ -65,6 +82,73 @@ export interface FingerprintOptions {
|
||||
})
|
||||
@Injectable()
|
||||
export class FingerprintAIO extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_UNKNOWN_ERROR = -100;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_UNAVAILABLE = -101;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_AUTHENTICATION_FAILED = -102;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_SDK_NOT_SUPPORTED = -103;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_PERMISSION_NOT_GRANTED = -105;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_NOT_ENROLLED = -106;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_DISMISSED = -108;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_SCREEN_GUARD_UNSECURED = -110;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_LOCKED_OUT = -111;
|
||||
/**
|
||||
* Convenience constant
|
||||
* @type {number}
|
||||
*/
|
||||
BIOMETRIC_LOCKED_OUT_PERMANENT = -112;
|
||||
|
||||
/**
|
||||
* Check if fingerprint authentication is available
|
||||
* @return {Promise<any>} Returns a promise with result
|
||||
|
||||
@@ -90,4 +90,13 @@ export class FirebaseAnalytics extends IonicNativePlugin {
|
||||
setCurrentScreen(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all analytics data for this instance from the device and resets the app instance ID
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
resetAnalyticsData(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ export class FirebaseAuthentication extends IonicNativePlugin {
|
||||
@Cordova({ sync: true })
|
||||
signInWithVerificationId(
|
||||
verificationId: string,
|
||||
smsCode: number
|
||||
smsCode: string
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,18 +28,38 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
plugin: 'cordova-plugin-firebase-config',
|
||||
pluginRef: 'cordova.plugins.firebase.config',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-config',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS'],
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseConfig extends IonicNativePlugin {
|
||||
/**
|
||||
* Fetches remote config values with appropriate TTL and then activates them.
|
||||
* Starts fetching configs, adhering to the specified minimum fetch interval.
|
||||
*
|
||||
* @param {number} ttlSeconds
|
||||
* @param {number} expirationDuration
|
||||
* @returns {Promise<null>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
update(ttlSeconds: number): Promise<null> {
|
||||
fetch(expirationDuration?: number): Promise<null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously activates the most recently fetched configs, so that the fetched key value pairs take effect.
|
||||
*
|
||||
* @returns {Promise<null>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
activate(): Promise<null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously fetches and then activates the fetched configs.
|
||||
*
|
||||
* @returns {Promise<null>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
fetchAndActivate(): Promise<null> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,11 +67,10 @@ export class FirebaseConfig extends IonicNativePlugin {
|
||||
* Fetches a boolean configuration value from RemoteConfig
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getBoolean(key: string, namespace?: string): Promise<boolean> {
|
||||
getBoolean(key: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,11 +78,10 @@ export class FirebaseConfig extends IonicNativePlugin {
|
||||
* Fetches a string configuration value from RemoteConfig
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getString(key: string, namespace?: string): Promise<string> {
|
||||
getString(key: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,11 +89,10 @@ export class FirebaseConfig extends IonicNativePlugin {
|
||||
* Fetches a numeric configuration value from RemoteConfig
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getNumber(key: string, namespace?: string): Promise<number> {
|
||||
getNumber(key: string): Promise<number> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,11 +100,10 @@ export class FirebaseConfig extends IonicNativePlugin {
|
||||
* Fetches an array of bytes configuration value from RemoteConfig
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} [namespace]
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getBytes(key: string, namespace?: string): Promise<any[]> {
|
||||
getBytes(key: string): Promise<any[]> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
64
src/@ionic-native/plugins/firebase-crash/index.ts
Normal file
64
src/@ionic-native/plugins/firebase-crash/index.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name FirebaseCrash
|
||||
* @description
|
||||
* This plugin brings crash reporting from Google Firebase to your Cordova project! Android and iOS supported.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseCrash } from '@ionic-native/firebase-crash';
|
||||
*
|
||||
* constructor(private firebaseCrash: FirebaseCrash) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.firebaseCrash.setUserId('123456789');
|
||||
* this.firebaseCrash.log('message');
|
||||
* this.firebaseCrash.logError('non fatal exception');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseCrash',
|
||||
plugin: 'cordova-plugin-firebase-crash',
|
||||
pluginRef: 'cordova.plugins.firebase.crashlytics',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-crash',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseCrash extends IonicNativePlugin {
|
||||
/**
|
||||
* Add logging that will be sent with your crash data in case of app crash.
|
||||
* https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#add_custom_logs
|
||||
* @param {string} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
log(message: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log non-fatal exceptions in addition to automatically reported app crashes.
|
||||
* https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#log_non-fatal_exceptions
|
||||
* @param {string} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
logError(message: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user identifier property for crashlytics reporting.
|
||||
* https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids
|
||||
* @param {string} userId value to set the userId
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setUserId(userId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export class FirebaseCrashlytics extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
initialize(): void {
|
||||
initialise(): any {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,41 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface IFirebaseMessage {
|
||||
aps: any;
|
||||
gcm: any;
|
||||
export interface IFirebaseGCMMessage {
|
||||
gcm: {
|
||||
body: string;
|
||||
title: string;
|
||||
sound: string;
|
||||
icon: string;
|
||||
tag: string;
|
||||
color: string;
|
||||
clickAction: string;
|
||||
};
|
||||
'google.message_id': string;
|
||||
'google.sent_time': number;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface IFirebaseAPSMessage {
|
||||
aps: {
|
||||
alert: {
|
||||
title: string;
|
||||
body: string;
|
||||
};
|
||||
badge?: number;
|
||||
};
|
||||
'gcm.message_id': 'string';
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type IFirebaseMessage = IFirebaseAPSMessage | IFirebaseGCMMessage;
|
||||
|
||||
export interface IRequestPermissionOptions {
|
||||
forceShow?: boolean;
|
||||
}
|
||||
|
||||
export type FirebaseMessagingTokenType = 'apns-buffer' | 'apns-string';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Firebase Messaging
|
||||
@@ -36,7 +66,7 @@ export interface IFirebaseMessage {
|
||||
plugin: 'cordova-plugin-firebase-messaging',
|
||||
pluginRef: 'cordova.plugins.firebase.messaging',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-messaging',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS'],
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseMessaging extends IonicNativePlugin {
|
||||
@@ -61,22 +91,35 @@ export class FirebaseMessaging extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Grant permission to recieve push notifications (will trigger prompt on iOS).
|
||||
* Grant permission to receive push notifications (will trigger prompt on iOS).
|
||||
*
|
||||
* @param {IRequestPermissionOptions} [options]
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
requestPermission(): Promise<string> {
|
||||
requestPermission(options?: { forceShow?: boolean }): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise thaf fulfills with the device instance ID
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getInstanceId(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that fulfills with the current FCM token
|
||||
*
|
||||
* This method also accepts optional argument type.
|
||||
* Currently iOS implementation supports values "apns-buffer" and "apns-string" that defines presentation of resolved APNS token.
|
||||
*
|
||||
* @param {FirebaseMessagingTokenType} [type] iOS only. Defines presentation of resolved APNS token
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getToken(): Promise<string> {
|
||||
getToken(type?: FirebaseMessagingTokenType): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
44
src/@ionic-native/plugins/firebase-vision/index.ts
Normal file
44
src/@ionic-native/plugins/firebase-vision/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Firebase Vision
|
||||
* @description
|
||||
* Cordova plugin for Firebase MLKit Vision
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseVision } from '@ionic-native/firebase-vision/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseVision: FirebaseVision) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.firebaseVision.onDeviceTextRecognizer(FILE_URI)
|
||||
* .then((res: string) => console.log(res))
|
||||
* .catch((error: string) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseVision',
|
||||
plugin: 'cordova-plugin-firebase-mlvision',
|
||||
pluginRef: 'FirebaseVisionPlugin',
|
||||
repo: 'https://github.com/alon22/cordova-plugin-firebase-mlvision',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseVision extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Recognize text in image
|
||||
* @param file_uri {string} Image URI
|
||||
* @return {Promise<string>} Returns a promise that fulfills with the text in the image
|
||||
*/
|
||||
@Cordova()
|
||||
onDeviceTextRecognizer(file_uri: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
679
src/@ionic-native/plugins/firebase-x/index.ts
Normal file
679
src/@ionic-native/plugins/firebase-x/index.ts
Normal file
@@ -0,0 +1,679 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface IChannelOptions {
|
||||
/**
|
||||
* Channel ID - must be unique per app package
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Channel name. Default: empty string
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Channel description. Default: empty string
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* The sound to play once a push comes. Default value: 'default'
|
||||
* Values allowed:
|
||||
* 'default' - plays the default notification sound
|
||||
* 'ringtone' - plays the currently set ringtone
|
||||
* 'false' - silent; don't play any sound
|
||||
* filename - the filename of the sound file located in '/res/raw' without file extension (mysound.mp3 -> mysound)
|
||||
*/
|
||||
sound?: string;
|
||||
|
||||
/**
|
||||
* Vibrate on new notification. Default value: true
|
||||
* Possible values:
|
||||
* Boolean - vibrate or not
|
||||
* Array - vibration pattern - e.g. [500, 200, 500] - milliseconds vibrate, milliseconds pause, vibrate, pause, etc.
|
||||
*/
|
||||
vibration?: boolean | number[];
|
||||
|
||||
/**
|
||||
* Whether to blink the LED
|
||||
*/
|
||||
light?: boolean;
|
||||
|
||||
/**
|
||||
* LED color in ARGB format - this example BLUE color. If set to -1, light color will be default. Default value: -1.
|
||||
*/
|
||||
lightColor?: string;
|
||||
|
||||
/**
|
||||
* Importance - integer from 0 to 4. Default value: 4
|
||||
* 0 - none - no sound, does not show in the shade
|
||||
* 1 - min - no sound, only shows in the shade, below the fold
|
||||
* 2 - low - no sound, shows in the shade, and potentially in the status bar
|
||||
* 3 - default - shows everywhere, makes noise, but does not visually intrude
|
||||
* 4 - high - shows everywhere, makes noise and peeks
|
||||
*/
|
||||
importance?: 0 | 1 | 2 | 3 | 4;
|
||||
|
||||
/**
|
||||
* Show badge over app icon when non handled pushes are present. Default value: true
|
||||
*/
|
||||
badge?: boolean;
|
||||
|
||||
/**
|
||||
* Show message on locked screen. Default value: 1
|
||||
* Possible values (default 1):
|
||||
* -1 - secret - Do not reveal any part of the notification on a secure lockscreen.
|
||||
* 0 - private - Show the notification on all lockscreens, but conceal sensitive or private information on secure lockscreens.
|
||||
* 1 - public - Show the notification in its entirety on all lockscreens.
|
||||
*/
|
||||
visibility?: -1 | 0 | 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Firebase X
|
||||
* @description
|
||||
* This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported.
|
||||
* It is a maintained fork from unmaintained ionic-navite plugin called Firebase.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseX } from '@ionic-native/firebase-x/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseX: FirebaseX) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.firebaseX.getToken()
|
||||
* .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
|
||||
* .catch(error => console.error('Error getting token', error));
|
||||
*
|
||||
* this.firebaseX.onMessageReceived()
|
||||
* .subscribe(data => console.log(`User opened a notification ${data}`));
|
||||
*
|
||||
* this.firebaseX.onTokenRefresh()
|
||||
* .subscribe((token: string) => console.log(`Got a new token ${token}`));
|
||||
* ```
|
||||
* @interfaces
|
||||
* IChannelOptions
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseX',
|
||||
plugin: 'cordova-plugin-firebasex',
|
||||
pluginRef: 'FirebasePlugin',
|
||||
repo: 'https://github.com/dpa99c/cordova-plugin-firebasex',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseX extends IonicNativePlugin {
|
||||
/**
|
||||
* Get the current FCM token.
|
||||
* @return {Promise<null | string>} Note that token will be null if it has not been established yet
|
||||
*/
|
||||
@Cordova()
|
||||
getToken(): Promise<null | string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the app instance ID (an constant ID which persists as long as the app is not uninstalled/reinstalled)
|
||||
* @return {Promise<null | string>} Note that ID will be null if it has not been established yet
|
||||
*/
|
||||
@Cordova()
|
||||
getId(): Promise<null | string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notified when a token is refreshed.
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
onTokenRefresh(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS only.
|
||||
* Get the APNS token allocated for this app install.
|
||||
* @return {Promise<null | string>} Note that token will be null if it has not been established yet
|
||||
*/
|
||||
@Cordova()
|
||||
getAPNSToken(): Promise<null | string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS only.
|
||||
* Registers a handler to call when the APNS token is allocated.
|
||||
* This will be called once when remote notifications permission has been granted by the user at runtime.
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
onApnsTokenReceived(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a callback function to invoke when:
|
||||
* - a notification or data message is received by the app
|
||||
* - a system notification is tapped by the user
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
onMessageReceived(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grant permission to receive push notifications (will trigger prompt) and return hasPermission: true. iOS only (Android will always return true).
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
grantPermission(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permission to receive push notifications and return hasPermission: true. iOS only (Android will always return true).
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister from firebase, used to stop receiving push notifications. Call this when you logout user from your app.
|
||||
*/
|
||||
@Cordova()
|
||||
unregister(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a number on the icon badge. Set 0 to clear the badge
|
||||
* @param {number} badgeNumber
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setBadgeNumber(badgeNumber: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon badge number.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getBadgeNumber(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all pending notifications from the drawer.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
clearAllNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to a topic. Topic messaging allows you to send a message to multiple devices that have opted in to a particular topic.
|
||||
* @param {string} topic
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
subscribe(topic: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe from a topic. This will stop you receiving messages for that topic.
|
||||
* @param {string} topic
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
unsubscribe(topic: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android 8+ only. Creates a custom channel to be used by notification messages which have the channel property set in the message payload to the id of the created channel:
|
||||
* - for background (system) notifications: android.notification.channel_id
|
||||
* - for foreground/data notifications: data.notification_android_channel_id
|
||||
*
|
||||
* Calling on Android 7 or below or another platform will have no effect.
|
||||
* @param {IChannelOptions} channelOptions
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
createChannel(channelOptions: IChannelOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android 8+ only. Overrides the properties for the default channel.
|
||||
* The default channel is used if no other channel exists or is specified in the notification.
|
||||
* Any options not specified will not be overridden. Should be called as soon as possible (on app start) so default notifications will work as expected.
|
||||
* Calling on Android 7 or below or another platform will have no effect.
|
||||
* @param {IChannelOptions} channelOptions
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setDefaultChannel(channelOptions: IChannelOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android 8+ only. Removes a previously defined channel.
|
||||
* Calling on Android 7 or below or another platform will have no effect.
|
||||
* @param {string} channelID
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
deleteChannel(channelID: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android 8+ only. Gets a list of all channels.
|
||||
* Calling on Android 7 or below or another platform will have no effect.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
listChannels(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable analytics collection (useful for GDPR/privacy settings).
|
||||
* @param {boolean} enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setAnalyticsCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable Crashlytics collection.
|
||||
* @param {boolean} enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable performance collection.
|
||||
* @param {boolean} enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setPerformanceCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
* @param {string} type
|
||||
* @param {Object} data
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
logEvent(type: string, data: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the current screen in Analytics
|
||||
* @param {string} name Screen name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setScreenName(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a user id for use in Analytics
|
||||
* @param {string} userId
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setUserId(userId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a user property for use in Analytics
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setUserProperty(name: string, value: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Crashlytics user identifier.
|
||||
* To diagnose an issue, it’s often helpful to know which of your users experienced a given crash.
|
||||
* Crashlytics includes a way to anonymously identify users in your crash reports.
|
||||
* To add user IDs to your reports, assign each user a unique identifier in the form of an ID number, token, or hashed value.
|
||||
*
|
||||
* More info https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids
|
||||
* @param {string} userId
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setCrashlyticsUserId(userId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates (causes) a fatal native crash which causes a crash event to be sent to Crashlytics (useful for testing).
|
||||
* See the Firebase documentation regarding crash testing.
|
||||
* Crashes will appear under Event type = "Crashes" in the Crashlytics console.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
sendCrash(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a crash-related log message that will appear in the Logs section of the next native crash event.
|
||||
* Note: if you don't then crash, the message won't be sent! Also logs the message to the native device console.
|
||||
* @param {string} message
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
logMessage(message: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a non-fatal error event to Crashlytics. In a Cordova app, you may use this to log unhandled Javascript exceptions, for example.
|
||||
* The event will appear under Event type = "Non-fatals" in the Crashlytics console.
|
||||
* The error message will appear in the Logs section of the non-fatal error event.
|
||||
* Also logs the error message to the native device console.
|
||||
* @param {string} error
|
||||
* @param {object} (optional) a stack trace generated by stacktrace.js
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
logError(error: string, stackTrace?: object): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests verification of a phone number in order to authenticate a user and sign then into Firebase in your app.
|
||||
*
|
||||
* NOTE: This will only work on physical devices with a SIM card (not iOS Simulator or Android Emulator)
|
||||
*
|
||||
* In response to your request, you'll receive a verification ID which you can use in conjunction with the verification code
|
||||
* to sign the user in.
|
||||
*
|
||||
* On iOS and some Android devices, the user will receive and SMS containing the verification code which they must manually enter
|
||||
* into your app.
|
||||
*
|
||||
* Some Android devices support "instant verfication", in which case an SMS will not be send and you will be returned
|
||||
* the verification code along with the verification ID. In this case, the user doesn't need to do anything in order for you
|
||||
* to sign them in.
|
||||
*
|
||||
* @param {function} success - callback function to pass {object} credentials to as an argument
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument
|
||||
* @param {string} phoneNumber - phone number to verify
|
||||
* @param {integer} timeOutDuration - (optional) time to wait in seconds before timing out
|
||||
* @param {string} fakeVerificationCode - (optional) to test instant verification on Android ,specify a fake verification code to return for whitelisted phone numbers.
|
||||
*
|
||||
* The success callback will be passed a credential object with the following properties:
|
||||
* instantVerification {boolean} - true if the Android device supports instant verification, in which case the verification code will be included in the credential object. If this is false, the device will be sent an SMS containing the verification code for the user to manually enter into your app. Always false on iOS.
|
||||
* verificationId {string} - the verification ID you'll need to pass along with the verification code to sign the user in. Always returned on both Android & iOS.
|
||||
* code {string} - verification code. Will only be present if instantVerification is true. Always undefined on iOS.
|
||||
*/
|
||||
@Cordova()
|
||||
verifyPhoneNumber(success: (value: string | object) => void, error: (err: string) => void, phoneNumber: string, timeoutDuration = 0): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs the user into Firebase with credentials obtained using verifyPhoneNumber().
|
||||
* See the Android- and iOS-specific Firebase documentation for more info.
|
||||
* @param {object} credential - a credential object returned by the success callback of an authentication method
|
||||
* @param {function} success - callback function to call on successful sign-in using credentials
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument
|
||||
*/
|
||||
@Cordova()
|
||||
signInWithCredential(credential: object, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links the user account to an existing Firebase user account with credentials obtained using verifyPhoneNumber().
|
||||
* See the Android- and iOS-specific Firebase documentation for more info.
|
||||
* @param {object} credential - a credential object returned by the success callback of an authentication method
|
||||
* @param {function} success - callback function to call on successful sign-in using credentials
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument
|
||||
*/
|
||||
@Cordova()
|
||||
linkUserWithCredential(credential: object, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reauthenticates the currently signed in user with credentials obtained via an authentication method such as verifyPhoneNumber() or authenticateUserWithGoogle().
|
||||
* @param {Object} credential - a credential object returned by the success callback of an authentication method
|
||||
* @param {function} success - callback function to call on successful sign-in using credentials
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument
|
||||
*/
|
||||
@Cordova()
|
||||
reauthenticateWithCredential(credential: any, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Javascript function to invoke when Firebase Authentication state changes between user signed in/signed out.
|
||||
* @param {function} fn - callback function to invoke when authentication state changes
|
||||
*/
|
||||
@Cordova()
|
||||
registerAuthStateChangeListener(fn: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Remote Config parameter values for your app.
|
||||
* @param {number} cacheExpirationSeconds specify the cacheExpirationSeconds
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
fetch(cacheExpirationSeconds?: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the Remote Config fetched config.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
activateFetched(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a Remote Config value.
|
||||
* @param {string} key
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getValue(key: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android only. Retrieve a Remote Config byte array.
|
||||
* @param {string} key
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getByteArray(key: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android only. Get the current state of the FirebaseRemoteConfig singleton object.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getInfo(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android only. Change the settings for the FirebaseRemoteConfig object's operations.
|
||||
* @param {Object} settings
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setConfigSettings(settings: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Android only. Set defaults in the Remote Config.
|
||||
* @param {Object} settings
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setDefaults(settings: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a trace.
|
||||
* @param {string} name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
startTrace(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* To count the performance-related events that occur in your app (such as cache hits or retries),
|
||||
* add a line of code similar to the following whenever the event occurs,
|
||||
* using a string other than retry to name that event if you are counting a different type of event.
|
||||
* @param {string} name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
incrementCounter(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the trace.
|
||||
* @param {string} name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
stopTrace(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new document to a Firestore collection, which will be allocated an auto-generated document ID.
|
||||
* @param {object} document - document object to add to collection
|
||||
* @param {string} collection - name of top-level collection to add document to.
|
||||
* @param {function} success - callback function to call on successfully adding the document. Will be passed a {string} argument containing the auto-generated document ID that the document was stored against.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
addDocumentToFirestoreCollection(document: object, collection: string, success: (id: string) => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (adds/replaces) a document with the given ID in a Firestore collection.
|
||||
* @param {string} documentId - document ID to use when setting document in the collection.
|
||||
* @param {object} document - document object to set in collection.
|
||||
* @param {string} collection - name of top-level collection to set document in.
|
||||
* @param {function} success - callback function to call on successfully setting the document.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
setDocumentInFirestoreCollection(documentId: string, document: object, collection: string, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing document with the given ID in a Firestore collection. This is a non-destructive update that will only
|
||||
* overwrite existing keys in the existing document or add new ones if they don't already exist. If the no document with the
|
||||
* specified ID exists in the collection, an error will be raised.
|
||||
* @param {string} documentId - document ID of the document to update.
|
||||
* @param {object} document - entire document or document fragment to update existing document with.
|
||||
* @param {string} collection - name of top-level collection to update document in.
|
||||
* @param {function} success - callback function to call on successfully updating the document.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
updateDocumentInFirestoreCollection(documentId: string, document: object, collection: string, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing document with the given ID in a Firestore collection.
|
||||
* - Note: If the no document with the specified ID exists in the collection, the Firebase SDK will still return a successful outcome.
|
||||
* @param {string} documentId - document ID of the document to delete.
|
||||
* @param {string} collection - name of top-level collection to delete document in.
|
||||
* @param {function} success - callback function to call on successfully deleting the document.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
deleteDocumentFromFirestoreCollection(documentId: string, collection: string, success: () => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches an existing document with the given ID from a Firestore collection.
|
||||
* -Note: If the no document with the specified ID exists in the collection, the error callback will be invoked.
|
||||
* @param {string} documentId - document ID of the document to fetch.
|
||||
* @param {string} collection - name of top-level collection to fetch document from.
|
||||
* @param {function} success - callback function to call on successfully fetching the document. Will be passed an {object} contain the document contents.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
fetchDocumentInFirestoreCollection(documentId: string, collection: string, success: (doc: any) => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all the documents in the specific collection.
|
||||
* @param {string} collection - name of top-level collection to fetch.
|
||||
* @param {function} success - callback function to call on successfully deleting the document. Will be passed an {object} containing all the documents in the collection,
|
||||
* indexed by document ID. If a Firebase collection with that name does not exist or it contains no documents, the object will be empty.
|
||||
* @param {function} error - callback function which will be passed a {string} error message as an argument.
|
||||
*/
|
||||
@Cordova()
|
||||
fetchFirestoreCollection(collection: string, success: (docs: any) => void, error: (err: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -343,6 +343,9 @@ export class Firebase extends IonicNativePlugin {
|
||||
* Clear all pending notifications from the drawer
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
clearAllNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
94
src/@ionic-native/plugins/foreground-service/index.ts
Normal file
94
src/@ionic-native/plugins/foreground-service/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Foreground Service
|
||||
* @description
|
||||
* This plugin allows for android devices to continue running services in the background, using a
|
||||
* foreground ongoing notification. This is targeted towards use with plugins such as
|
||||
* 'cordova-geolocation' that will not run while the app is in the background on android API 26+.
|
||||
*
|
||||
* For android API 28+, the following xml snippet should be inserted into ```config.xml```:
|
||||
*
|
||||
* ```
|
||||
* ...
|
||||
* <platform name="android">
|
||||
* <config-file parent="/*" target="AndroidManifest.xml">
|
||||
* <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
* </config-file>
|
||||
* ...
|
||||
* ```
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ForegroundService } from '@ionic-native/foreground-service/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(public foregroundService: ForegroundService) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* startService() {
|
||||
* // Notification importance is optional, the default is 1 - Low (no sound or vibration)
|
||||
* this.foregroundService.start('GPS Running', 'Background Service', 'drawable/fsicon');
|
||||
* }
|
||||
*
|
||||
* stopService() {
|
||||
* // Disable the foreground service
|
||||
* this.foregroundService.stop();
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ForegroundService',
|
||||
plugin: 'cordova-plugin-foreground-service',
|
||||
pluginRef: 'cordova.plugins.foregroundService',
|
||||
repo: 'https://github.com/DavidBriglio/cordova-plugin-foreground-service',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class ForegroundService extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Enables the foreground service
|
||||
*
|
||||
* @param {string} title (content title) A brief headline for the notification
|
||||
* @param {string} text (content text) Supporting information
|
||||
* @param {string} icon The drawable icon can be any drawable image that exists in the resource folder. This means you must copy the icon you want to use into the platforms/android/app/src/main/res/drawable folder set. If no icon can be found using the icon name parameter, a default star icon will be used.
|
||||
*
|
||||
* For an example, if the `fsicon.png` (see xml below) resides here: ```src/assets/icon/fsicon.png```. Then ```icon``` parameter value would be ```'drawable/fsicon'```. In order for this example to work, the following xml snippet must be in ```config.xml```.
|
||||
*
|
||||
* ```
|
||||
* <platform name="android">
|
||||
* <resource-file src="www/assets/icon/fsicon.png" target="app/src/main/res/drawable/fsicon.png" />
|
||||
* ...
|
||||
* ```
|
||||
* @param {number} importance Notification importance dictates how the notification is initially presented:
|
||||
*
|
||||
* Value | Importance | Description | Examples
|
||||
* --- | --- | --- | ---
|
||||
* 1|IMPORTANCE_LOW|Does not make a sound or heads-up display (plugin's default)|New content the user has subscribed to, social network invitations
|
||||
* 2|IMPORTANCE_DEFAULT|Makes a sound, but no heads-up display|Traffic alerts, task reminders
|
||||
* 3|IMPORTANCE_HIGH|Makes a sound and heads-up display|Text messages, alarms, phone calls
|
||||
*
|
||||
* @param {number} id The notification id is a customizable integer that is used to reference the notification that will be launched. This is customizable to avoid conflicting with any other notifications. If this is not included, a [*unique*] default id will be used.
|
||||
*
|
||||
* @see https://material.io/design/platform-guidance/android-notifications.html
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
start(title: string, text: string, icon?: string, importance: 1 | 2 | 3 = 1, id = 0): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the foreground service
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
stop(): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
61
src/@ionic-native/plugins/full-screen-image/index.ts
Normal file
61
src/@ionic-native/plugins/full-screen-image/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Full Screen Image
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FullScreenImage } from '@ionic-native/full-screen-image';
|
||||
*
|
||||
*
|
||||
* constructor(private fullScreenImage: FullScreenImage) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fullScreenImage.showImageURL('/assets/...')
|
||||
* .then((data: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fullScreenImage.showImageBase64('iVBORw0KGgoAAAANSUhEUgAAA...')
|
||||
* .then((data: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FullScreenImage',
|
||||
plugin: 'es.keensoft.fullscreenimage',
|
||||
pluginRef: 'FullScreenImage',
|
||||
repo: 'https://github.com/keensoft/FullScreenImage-Cordova-Plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FullScreenImage extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Opens an image from a URL or path
|
||||
* @param url {string} url or image path
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showImageURL(url: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an image from a base64 string
|
||||
* @param base64String {string} base64 string
|
||||
* @param name? {string} image name
|
||||
* @param type? {string} image extension
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showImageBase64(base64String: string, name?: string, type?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name Gao De Location
|
||||
@@ -14,9 +15,42 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
*
|
||||
* constructor(private gaoDeLocation: GaoDeLocation) { }
|
||||
*
|
||||
* this.gaoDeLocation.getCurrentPosition()
|
||||
* .then((res: PositionOptions) => console.log(res))
|
||||
* .catch((error) => console.error(error));
|
||||
*
|
||||
* const positionOptions: PositionOptions = {
|
||||
* androidOption: {
|
||||
* locationMode: LocationModeEnum.Hight_Accuracy,
|
||||
* gpsFirst: false,
|
||||
* HttpTimeOut: 30000,
|
||||
* interval: 2000,
|
||||
* needAddress: true,
|
||||
* onceLocation: false,
|
||||
* onceLocationLatest: false,
|
||||
* locationProtocol: LocationProtocolEnum.HTTP,
|
||||
* sensorEnable: false,
|
||||
* wifiScan: true,
|
||||
* locationCacheEnable: true
|
||||
* }, iosOption: {
|
||||
* desiredAccuracy: DesiredAccuracyEnum.kCLLocationAccuracyBest,
|
||||
* pausesLocationUpdatesAutomatically: 'YES',
|
||||
* allowsBackgroundLocationUpdates: 'NO',
|
||||
* locationTimeout: 10,
|
||||
* reGeocodeTimeout: 5,
|
||||
* }
|
||||
* };
|
||||
* const positionRes: PositionRes = await this.gaoDeLocation.getCurrentPosition(positionOptions).catch((e: any) => {
|
||||
* console.log(e);
|
||||
* }) || null;
|
||||
* console.log(JSON.stringify(positionRes));
|
||||
*
|
||||
*
|
||||
* this.gaoDeLocation.startSerialLocation(positionOptions).subscribe((positionRes: PositionRes) => {
|
||||
* console.log(JSON.stringify(positionRes));
|
||||
* });
|
||||
*
|
||||
* const positionRes: any = this.gaoDeLocation.stopSerialLocation().catch((e) => {
|
||||
* console.log(e);
|
||||
* }) || null;
|
||||
* console.log(JSON.stringify(positionRes));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@@ -32,83 +66,288 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
@Injectable()
|
||||
export class GaoDeLocation extends IonicNativePlugin {
|
||||
/**
|
||||
* Get longitude and latitude, country, province, city, postal code, specific address, region
|
||||
* @returns {Promise<PositionOptions>}
|
||||
* Single location
|
||||
* @param positionOptions
|
||||
* @return Promise<PositionRes>
|
||||
*/
|
||||
@Cordova()
|
||||
getCurrentPosition(): Promise<PositionOptions> {
|
||||
@Cordova(
|
||||
{
|
||||
callbackOrder: 'reverse',
|
||||
}
|
||||
)
|
||||
getCurrentPosition(positionOptions: PositionOptions): Promise<PositionRes> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start serial location
|
||||
* @param positionOptions
|
||||
* @return Promise<PositionRes>
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
observable: true
|
||||
})
|
||||
startSerialLocation(positionOptions: PositionOptions): Observable<PositionRes> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop Serial Location
|
||||
* @return Promise<any>
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
})
|
||||
stopSerialLocation(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Location parameter
|
||||
*/
|
||||
export interface PositionOptions {
|
||||
/*
|
||||
* latitude
|
||||
* */
|
||||
latitude: number;
|
||||
/*
|
||||
* longitude
|
||||
* */
|
||||
longitude: number;
|
||||
/*
|
||||
* ios Horizontal accuracy,android accuracy
|
||||
* */
|
||||
accuracy: string;
|
||||
/*
|
||||
* Postal Code
|
||||
* */
|
||||
adcode: string;
|
||||
/*
|
||||
* Detailed address
|
||||
* */
|
||||
address: string;
|
||||
/*
|
||||
* city
|
||||
* */
|
||||
city: string;
|
||||
/*
|
||||
* city Code
|
||||
* */
|
||||
citycode: string;
|
||||
/*
|
||||
* country
|
||||
* */
|
||||
country: string;
|
||||
/*
|
||||
* district
|
||||
* */
|
||||
district: string;
|
||||
/*
|
||||
* Address name
|
||||
* */
|
||||
poi: string;
|
||||
/*
|
||||
* province
|
||||
* */
|
||||
province: string;
|
||||
/*
|
||||
* The state of the calling plug-in
|
||||
* */
|
||||
status: string;
|
||||
/*
|
||||
* Location type
|
||||
* */
|
||||
type: string;
|
||||
/*
|
||||
* Android Location time, ios void
|
||||
* **/
|
||||
time?: string;
|
||||
/*
|
||||
* backtime, ios void
|
||||
* **/
|
||||
backtime?: string;
|
||||
/*
|
||||
* angle
|
||||
* */
|
||||
bearing?: string;
|
||||
/*
|
||||
* Number of satellites, ios void
|
||||
* */
|
||||
satellites?: string;
|
||||
/**
|
||||
* android options
|
||||
*/
|
||||
androidOption: AndroidOptions;
|
||||
/**
|
||||
* ios options
|
||||
*/
|
||||
iosOption: IosOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* android positioning accuracy
|
||||
*/
|
||||
export interface AndroidOptions {
|
||||
/**
|
||||
* location mode
|
||||
*/
|
||||
locationMode: LocationModeEnum;
|
||||
/**
|
||||
* gps first
|
||||
*/
|
||||
gpsFirst: boolean;
|
||||
/**
|
||||
* Http timeOut
|
||||
*/
|
||||
HttpTimeOut: number;
|
||||
/**
|
||||
* Location interval
|
||||
*/
|
||||
interval: number;
|
||||
/**
|
||||
* Open reverse address
|
||||
*/
|
||||
needAddress: boolean;
|
||||
/**
|
||||
* once location
|
||||
*/
|
||||
onceLocation: boolean;
|
||||
/**
|
||||
* once location latest
|
||||
*/
|
||||
onceLocationLatest: boolean;
|
||||
/**
|
||||
* location protocol
|
||||
*/
|
||||
locationProtocol: LocationProtocolEnum;
|
||||
/**
|
||||
* sensor enable
|
||||
*/
|
||||
sensorEnable: boolean;
|
||||
/**
|
||||
* wifi scan
|
||||
*/
|
||||
wifiScan: boolean;
|
||||
/**
|
||||
* location cache enable
|
||||
*/
|
||||
locationCacheEnable: boolean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* IOS positioning parameters
|
||||
*
|
||||
*/
|
||||
export interface IosOptions {
|
||||
/**
|
||||
* desired accuracy
|
||||
*/
|
||||
desiredAccuracy?: DesiredAccuracyEnum;
|
||||
/**
|
||||
* pauses location updates automatically
|
||||
*/
|
||||
pausesLocationUpdatesAutomatically: IosBoolean;
|
||||
/**
|
||||
* allows background location updates
|
||||
*/
|
||||
allowsBackgroundLocationUpdates: IosBoolean;
|
||||
/**
|
||||
* location timeout
|
||||
*/
|
||||
locationTimeout: number;
|
||||
/**
|
||||
* re geocode timeout
|
||||
*/
|
||||
reGeocodeTimeout?: number;
|
||||
/**
|
||||
* locating with re geocode
|
||||
*/
|
||||
locatingWithReGeocode?: IosBoolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* ios positioning accuracy
|
||||
* https://developer.apple.com/documentation/corelocation/kcllocationaccuracybestfornavigation
|
||||
*/
|
||||
export enum DesiredAccuracyEnum {
|
||||
/**
|
||||
* The highest possible accuracy that uses additional sensor data to facilitate navigation apps.
|
||||
*/
|
||||
kCLLocationAccuracyBestForNavigation = 1,
|
||||
/**
|
||||
* The best level of accuracy available.
|
||||
*/
|
||||
kCLLocationAccuracyBest = 2,
|
||||
/**
|
||||
* Accurate to within ten meters of the desired target.
|
||||
*/
|
||||
kCLLocationAccuracyNearestTenMeters = 3,
|
||||
/**
|
||||
* Accurate to within one hundred meters.
|
||||
*/
|
||||
kCLLocationAccuracyHundredMeters = 4,
|
||||
/**
|
||||
* Accurate to the nearest kilometer.
|
||||
*/
|
||||
kCLLocationAccuracyKilometer = 5,
|
||||
/**
|
||||
* Accurate to the nearest three kilometers.
|
||||
*/
|
||||
kCLLocationAccuracyThreeKilometers = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* locationModeEnum
|
||||
*/
|
||||
export enum LocationModeEnum {
|
||||
Hight_Accuracy = 1,
|
||||
Battery_Saving = 2,
|
||||
Device_Sensors = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* locationProtocolEnum
|
||||
*/
|
||||
export enum LocationProtocolEnum {
|
||||
HTTP = 1,
|
||||
HTTPS = 2
|
||||
}
|
||||
|
||||
/**
|
||||
* ios boolean
|
||||
*/
|
||||
export declare type IosBoolean = 'YES' | 'NO';
|
||||
|
||||
/**
|
||||
* Positioning return result
|
||||
*/
|
||||
export interface PositionRes {
|
||||
/**
|
||||
* Status code
|
||||
*/
|
||||
code: number;
|
||||
/**
|
||||
* latitude
|
||||
*/
|
||||
latitude: string;
|
||||
/**
|
||||
* longitude
|
||||
*/
|
||||
longitude: string;
|
||||
/**
|
||||
* accuracy
|
||||
*/
|
||||
accuracy: string;
|
||||
/**
|
||||
* address
|
||||
*/
|
||||
formattedAddress: string;
|
||||
/**
|
||||
* country
|
||||
*/
|
||||
country: string;
|
||||
/**
|
||||
* province
|
||||
*/
|
||||
province: string;
|
||||
/**
|
||||
* city
|
||||
*/
|
||||
city: string;
|
||||
/**
|
||||
* district
|
||||
*/
|
||||
district: string;
|
||||
/**
|
||||
* citycode
|
||||
*/
|
||||
citycode: string;
|
||||
/**
|
||||
* adcode
|
||||
*/
|
||||
adcode: string;
|
||||
/**
|
||||
* street
|
||||
*/
|
||||
street: string;
|
||||
/**
|
||||
* Street number information
|
||||
*/
|
||||
number: string;
|
||||
/**
|
||||
* POI name
|
||||
*/
|
||||
POIName: string;
|
||||
/**
|
||||
* AOI Name
|
||||
*/
|
||||
AOIName: string;
|
||||
/**
|
||||
* altitude
|
||||
*/
|
||||
altitude?: string;
|
||||
/**
|
||||
* speed
|
||||
*/
|
||||
speed?: string;
|
||||
/**
|
||||
* bearing
|
||||
*/
|
||||
bearing?: string;
|
||||
/**
|
||||
* building id
|
||||
*/
|
||||
buildingId?: string;
|
||||
/**
|
||||
* floor
|
||||
*/
|
||||
floor?: string;
|
||||
/**
|
||||
* gps accuracy status
|
||||
*/
|
||||
gpsAccuracyStatus?: string;
|
||||
/**
|
||||
* Get location result source
|
||||
*/
|
||||
locationType?: string;
|
||||
/**
|
||||
* Location detail
|
||||
*/
|
||||
locationDetail?: string;
|
||||
}
|
||||
|
||||
64
src/@ionic-native/plugins/ge-tui-sdk-plugin/index.ts
Normal file
64
src/@ionic-native/plugins/ge-tui-sdk-plugin/index.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Ge Tui Sdk Plugin
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { GeTuiSdkPlugin } from '@ionic-native/ge-tui-sdk-plugin';
|
||||
*
|
||||
*
|
||||
* constructor(private geTuiSdkPlugin: GeTuiSdkPlugin) { }
|
||||
*
|
||||
* this.geTuiSdkPlugin.callback_init((res) => { console.log(res)});
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* this.geTuiSdkPlugin.initialize();
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* this.geTuiSdkPlugin.getClientId();
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* this.geTuiSdkPlugin.getVersion();
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GeTuiSdkPlugin',
|
||||
plugin: 'cordova-plugin-getuisdk',
|
||||
pluginRef: 'GeTuiSdkPlugin',
|
||||
repo: 'git@github.com:GetuiLaboratory/cordova-plugin-getuisdk.git',
|
||||
install: 'cordova plugin add cordova-plugin-getuisdk --variable PUSH_APPID=your appid --variable PUSH_APPKEY=your appkey --variable PUSH_APPSECRET=your appsecret',
|
||||
installVariables: ['PUSH_APPID', 'PUSH_APPKEY', 'PUSH_APPSECRET'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class GeTuiSdkPlugin extends IonicNativePlugin {
|
||||
|
||||
@Cordova()
|
||||
callback_init(callback: Function): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({
|
||||
sync: true,
|
||||
})
|
||||
initialize() {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova()
|
||||
getClientId(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova()
|
||||
getVersion(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,13 @@ export interface ScoreData {
|
||||
|
||||
}
|
||||
|
||||
export interface PlayerScoreData {
|
||||
/**
|
||||
* The player score.
|
||||
*/
|
||||
playerScore: number;
|
||||
}
|
||||
|
||||
export interface LeaderboardData {
|
||||
|
||||
/**
|
||||
@@ -83,6 +90,40 @@ export interface Player {
|
||||
|
||||
}
|
||||
|
||||
export interface SubmittedScoreData {
|
||||
|
||||
/**
|
||||
* The leaderboard ID from Goole Play Developer console.
|
||||
*/
|
||||
leaderboardId: string;
|
||||
|
||||
/**
|
||||
* The player ID from Goole Play Developer console.
|
||||
*/
|
||||
playerId: string;
|
||||
|
||||
/**
|
||||
* The score data in a display-appropriate format.
|
||||
*/
|
||||
formattedScore: string;
|
||||
|
||||
/**
|
||||
* Whether or not this score was the player's new best score.
|
||||
*/
|
||||
newBest: boolean;
|
||||
|
||||
/**
|
||||
* The raw score value of this score result.
|
||||
*/
|
||||
rawScore: number;
|
||||
|
||||
/**
|
||||
* The score tag associated with this result, if any.
|
||||
*/
|
||||
scoreTag: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Google Play Games Services
|
||||
* @description
|
||||
@@ -126,6 +167,21 @@ export interface Player {
|
||||
* leaderboardId: 'SomeLeaderboardId'
|
||||
* });
|
||||
*
|
||||
* // Submit a score and wait for reponse.
|
||||
* this.googlePlayGamesServices.submitScoreNow({
|
||||
* score: 100,
|
||||
* leaderboardId: 'SomeLeaderboardId'
|
||||
* }).then((data: SubmittedScoreData) => {
|
||||
* console.log('Score related data', data);
|
||||
* });
|
||||
*
|
||||
* // Get the player score on a leaderboard.
|
||||
* this.googlePlayGamesServices.getPlayerScore({
|
||||
* leaderboardId: 'SomeLeaderBoardId'
|
||||
* }).then((data: PlayerScoreData) => {
|
||||
* console.log('Player score', data);
|
||||
* });
|
||||
*
|
||||
* // Show the native leaderboards window.
|
||||
* this.googlePlayGamesServices.showAllLeaderboards()
|
||||
* .then(() => console.log('The leaderboard window is visible.'));
|
||||
@@ -138,12 +194,23 @@ export interface Player {
|
||||
* // Unlock an achievement.
|
||||
* this.googlePlayGamesServices.unlockAchievement({
|
||||
* achievementId: 'SomeAchievementId'
|
||||
* }).then(() => console.log('Achievement sent'));
|
||||
*
|
||||
* // Unlock an achievement and wait for response.
|
||||
* this.googlePlayGamesServices.unlockAchievementNow({
|
||||
* achievementId: 'SomeAchievementId'
|
||||
* }).then(() => console.log('Achievement unlocked'));
|
||||
*
|
||||
* // Incremement an achievement.
|
||||
* this.googlePlayGamesServices.incrementAchievement({
|
||||
* step: 1,
|
||||
* achievementId: 'SomeAchievementId'
|
||||
* }).then(() => console.log('Achievement increment sent'));
|
||||
*
|
||||
* // Incremement an achievement and wait for response.
|
||||
* this.googlePlayGamesServices.incrementAchievementNow({
|
||||
* step: 1,
|
||||
* achievementId: 'SomeAchievementId'
|
||||
* }).then(() => console.log('Achievement incremented'));
|
||||
*
|
||||
* // Show the native achievements window.
|
||||
@@ -220,6 +287,33 @@ export class GooglePlayGamesServices extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit a score to a leaderboard and waits for the response from
|
||||
* Google Play Games. You should ensure that you have a
|
||||
* successful return from auth() before submitting a score.
|
||||
*
|
||||
* @param data {ScoreData} The score data you want to submit.
|
||||
* @return {Promise<SubmittedScoreData>} Returns a promise that resolves when Play
|
||||
* Games Services returns the score information.
|
||||
*/
|
||||
@Cordova()
|
||||
submitScoreNow(data: ScoreData): Promise<SubmittedScoreData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player score on a leaderboard. You should ensure that you have a
|
||||
* successful return from auth() before requesting a score.
|
||||
*
|
||||
* @param data {LeaderboardData} The leaderboard score you want to request.
|
||||
* @return {Promise<PlayerScoreData>} Returns a promise that resolves when Play
|
||||
* Games Services returns the player score.
|
||||
*/
|
||||
@Cordova()
|
||||
getPlayerScore(data: LeaderboardData): Promise<PlayerScoreData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the native Play Games leaderboard view controller to show all the
|
||||
* leaderboards.
|
||||
@@ -250,25 +344,49 @@ export class GooglePlayGamesServices extends IonicNativePlugin {
|
||||
*
|
||||
* @param data {AchievementData}
|
||||
* @return {Promise<any>} Returns a promise that resolves when the
|
||||
* achievement is unlocked.
|
||||
* achievement is sent.
|
||||
*/
|
||||
@Cordova()
|
||||
unlockAchievement(data: AchievementData): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock an achievement and wait for response.
|
||||
*
|
||||
* @param data {AchievementData}
|
||||
* @return {Promise<any>} Returns a promise that resolves when the Play
|
||||
* Games Services returns that the achievement is unlocked.
|
||||
*/
|
||||
@Cordova()
|
||||
unlockAchievementNow(data: AchievementData): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment an achievement.
|
||||
*
|
||||
* @param data {IncrementableAchievementData}
|
||||
* @return {Promise<any>} Returns a promise that resolves when the
|
||||
* achievement is incremented.
|
||||
* achievement is sent.
|
||||
*/
|
||||
@Cordova()
|
||||
incrementAchievement(data: IncrementableAchievementData): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment an achievement and wait for response.
|
||||
*
|
||||
* @param data {IncrementableAchievementData}
|
||||
* @return {Promise<any>} Returns a promise that resolves when the Play
|
||||
* Games Services returns that the achievement has been incremented.
|
||||
*/
|
||||
@Cordova()
|
||||
incrementAchievementNow(data: IncrementableAchievementData): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lauches the native Play Games achievements view controller to show
|
||||
* achievements.
|
||||
|
||||
@@ -39,7 +39,7 @@ export class GooglePlus extends IonicNativePlugin {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
login(options?: any): Promise<any> {
|
||||
login(options: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface HealthQueryOptionsAggregated {
|
||||
* if specified, aggregation is grouped an array of "buckets" (windows of time),
|
||||
* supported values are: 'hour', 'day', 'week', 'month', 'year'.
|
||||
*/
|
||||
bucket: string;
|
||||
bucket?: string;
|
||||
|
||||
/**
|
||||
* In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface HTTPResponse {
|
||||
/**
|
||||
* The status number of the response
|
||||
* The HTTP status number of the response or a negative internal error code.
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* The headers of the response
|
||||
* The headers of the response.
|
||||
*/
|
||||
headers: any;
|
||||
headers: {[ key: string ]: string };
|
||||
/**
|
||||
* The URL of the response. This property will be the final URL obtained after any redirects.
|
||||
*/
|
||||
@@ -30,8 +30,9 @@ export interface HTTPResponse {
|
||||
* Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
|
||||
*
|
||||
* Advantages over Javascript requests:
|
||||
* - Background threading - all requests are done in a background thread
|
||||
* - SSL Pinning
|
||||
* - SSL / TLS Pinning
|
||||
* - CORS restrictions do not apply
|
||||
* - Handling of HTTP code 401 - read more at [Issue CB-2415](https://issues.apache.org/jira/browse/CB-2415)
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -70,6 +71,21 @@ export interface HTTPResponse {
|
||||
})
|
||||
@Injectable()
|
||||
export class HTTP extends IonicNativePlugin {
|
||||
/**
|
||||
* This enum represents the internal error codes which can be returned in a HTTPResponse object.
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly ErrorCode: {
|
||||
GENERIC: number;
|
||||
SSL_EXCEPTION: number;
|
||||
SERVER_NOT_FOUND: number;
|
||||
TIMEOUT: number;
|
||||
UNSUPPORTED_URL: number;
|
||||
NOT_CONNECTED: number;
|
||||
POST_PROCESSING_FAILED: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* This returns an object representing a basic HTTP Authorization header of the form.
|
||||
* @param username {string} Username
|
||||
@@ -118,11 +134,12 @@ export class HTTP extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer. Can be urlencoded, utf8 or json
|
||||
* Set the data serializer which will be used for all future POST, PUT and PATCH requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer.
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setdataserializer
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDataSerializer(serializer: string): void {}
|
||||
setDataSerializer(serializer: 'urlencoded' | 'json' | 'utf8' | 'multipart' | 'raw'): void {}
|
||||
|
||||
/**
|
||||
* Add a custom cookie.
|
||||
@@ -172,26 +189,32 @@ export class HTTP extends IonicNativePlugin {
|
||||
setRequestTimeout(timeout: number): void {}
|
||||
|
||||
/**
|
||||
* Set SSL Cert handling mode, being one of the following values
|
||||
* default: default SSL cert handling using system's CA certs
|
||||
* legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android)
|
||||
* nocheck: disable SSL cert checking, trusting all certs (meant to be used only for testing purposes)
|
||||
* pinned: trust only provided certs
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setsslcertmode
|
||||
* @param {'default' | 'legacy' | 'nocheck' | 'pinned'} mode SSL Cert handling mode
|
||||
* Resolve if it should follow redirects automatically.
|
||||
* @returns {boolean} returns true if it is configured to follow redirects automatically
|
||||
*/
|
||||
@Cordova()
|
||||
setSSLCertMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
@Cordova({ sync: true })
|
||||
getFollowRedirect(): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable following redirects automatically.
|
||||
* @param disable {boolean} Set to true to disable following redirects automatically
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
* Configure if it should follow redirects automatically.
|
||||
* @param follow {boolean} Set to false to disable following redirects automatically
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setFollowRedirect(follow: boolean): void {}
|
||||
|
||||
/**
|
||||
* Set server trust mode, being one of the following values:
|
||||
* default: default SSL trustship and hostname verification handling using system's CA certs;
|
||||
* legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android);
|
||||
* nocheck: disable SSL certificate checking and hostname verification, trusting all certs (meant to be used only for testing purposes);
|
||||
* pinned: trust only provided certificates;
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setservertrustmode
|
||||
* @param {string} mode server trust mode
|
||||
*/
|
||||
@Cordova()
|
||||
disableRedirect(disable: boolean): Promise<void> {
|
||||
setServerTrustMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +223,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
post(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -212,7 +235,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -224,7 +247,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
put(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -236,7 +259,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
patch(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -248,7 +271,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -260,24 +283,36 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an OPTIONS request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
options(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @param filePath {string} The local path of the file to upload
|
||||
* @param name {string} The name of the parameter to pass the file along as
|
||||
* @returns {Promise<any>} returns a FileEntry promise that resolve on success, and reject on failure
|
||||
* @param filePath {string} The local path(s) of the file(s) to upload
|
||||
* @param name {string} The name(s) of the parameter to pass the file(s) along as
|
||||
* @returns {Promise<any>} returns a FileEntry promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<any> {
|
||||
uploadFile(url: string, body: any, headers: any, filePath: string | string[], name: string | string[]): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,7 +322,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @param filePath {string} The path to download the file to, including the file name.
|
||||
* @returns {Promise<any>} returns a FileEntry promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<any>} returns a FileEntry promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<any> {
|
||||
@@ -304,23 +339,25 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values
|
||||
* @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value
|
||||
* @param options.headers {Object} headers object (key value pair), will be merged with global values
|
||||
* @param options.filePath {string} filePath to be used during upload and download see uploadFile and downloadFile for detailed information
|
||||
* @param options.name {string} name to be used during upload see uploadFile for detailed information
|
||||
* @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information
|
||||
* @param options.name {string} name(s) to be used during upload see uploadFile for detailed information
|
||||
* @param options.responseType {string} response type, defaults to text
|
||||
*
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
sendRequest(
|
||||
url: string,
|
||||
options: {
|
||||
method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'upload' | 'download';
|
||||
method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download';
|
||||
data?: { [index: string]: any };
|
||||
params?: { [index: string]: string | number };
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8';
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart';
|
||||
timeout?: number;
|
||||
headers?: { [index: string]: string };
|
||||
filePath?: string;
|
||||
name?: string;
|
||||
filePath?: string | string[];
|
||||
name?: string | string[];
|
||||
responseType?: 'text' | 'arraybuffer' | 'blob' | 'json';
|
||||
}
|
||||
): Promise<HTTPResponse> {
|
||||
return;
|
||||
|
||||
113
src/@ionic-native/plugins/iamport-cordova/index.ts
Normal file
113
src/@ionic-native/plugins/iamport-cordova/index.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const cordova: Cordova & { plugins: any };
|
||||
|
||||
export interface PaymentObject {
|
||||
title?: TitleData; // webview title data
|
||||
userCode: string; // user identification code
|
||||
data: PaymentData; // payment data
|
||||
callback: any; // callback function after payment
|
||||
}
|
||||
|
||||
export interface CertificationObject {
|
||||
title?: TitleData; // webview title data
|
||||
userCode: string; // user identification code
|
||||
data: CertificationData; // certification data
|
||||
callback: any; // callback function after certification
|
||||
}
|
||||
|
||||
export interface TitleData {
|
||||
name?: string; // webview title name
|
||||
color?: string; // webview title background color
|
||||
}
|
||||
|
||||
export interface PaymentData {
|
||||
pg?: string; // payment gateway type
|
||||
pay_method?: string; // payment method
|
||||
name: string; // name of order
|
||||
merchant_uid?: string; // unique merchant id
|
||||
amount: string; // payment amount
|
||||
buyer_name?: string; // buyer name
|
||||
buyer_tel?: string; // buyer contact
|
||||
buyer_email?: string; // buyer email address
|
||||
buyer_addr?: string; // buyer address
|
||||
buyer_postcode?: string; // buyer postcode
|
||||
app_scheme: string; // custom app url scheme
|
||||
custom_data?: any; // custom data
|
||||
notice_url?: string; // notification url
|
||||
escrow?: boolean; // whether the type of this order is escrow
|
||||
digital?: boolean; // whether this order is for real products or contents
|
||||
display?: {
|
||||
card_quota?: number[], // credit card installment setting value
|
||||
};
|
||||
currency?: string; // payment currency
|
||||
customer_uid?: string; // unique customer id for subscription payments
|
||||
tax_free?: string; // tax amount
|
||||
language?: string; // language type
|
||||
vbank_due?: string; // vbank due date
|
||||
biz_num?: string; // business number
|
||||
}
|
||||
|
||||
export interface CertificationData {
|
||||
company?: string; // company name
|
||||
phone?: string; // cell phone number
|
||||
name?: string; // name
|
||||
carrier?: string; // carrier code
|
||||
birth?: string; // birth date
|
||||
merchant_uid?: string; // unique merchant id
|
||||
min_age?: string; // minimum age to allow certification
|
||||
popup?: boolean; // whether the webview is popup
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Iamport Cordova
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { IamportCordova } from '@ionic-native/iamport-cordova/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private iamportCordova: IamportCordova) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.iamportCordova.functionName('Hello', 123)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IamportCordova',
|
||||
plugin: 'iamport-cordova',
|
||||
pluginRef: 'cordova.plugins.IamportCordova',
|
||||
repo: 'https://github.com/iamport/iamport-cordova',
|
||||
platforms: ['ios', 'android']
|
||||
})
|
||||
@Injectable()
|
||||
export class IamportCordova extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function is to load a webview of a payment gateway to pay for something
|
||||
* @param paymentObject {PaymentObject} Payment data to set the payment webview
|
||||
* @return {Promise<any>} A callback function of the payment data is triggered when the webview is closed
|
||||
*/
|
||||
@Cordova()
|
||||
payment(paymentObject: PaymentObject): Promise<any> {
|
||||
return cordova.plugins.IamportCordova.payment(paymentObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to load a webview for identification with carrier type(like Verizon), name and phone number
|
||||
* @param certificationObject {CertificationObject} Certification data to set the certification webview
|
||||
* @return {Promise<any>} A callback function of the certification data is triggered when the webview is closed
|
||||
*/
|
||||
@Cordova()
|
||||
certification(certificationObject: CertificationObject): Promise<any> {
|
||||
return cordova.plugins.IamportCordova.certification(certificationObject);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export interface ImagePickerOptions {
|
||||
* Max width to allow images to be
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* Max height to allow images to be
|
||||
*/
|
||||
@@ -22,6 +23,21 @@ export interface ImagePickerOptions {
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* Videos allowed?
|
||||
*/
|
||||
allow_video?: boolean;
|
||||
|
||||
/**
|
||||
* the default is the message of the old plugin impl
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* the old plugin impl didn't have it, so passing null by default
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* Choose the format of the return value.
|
||||
* Defined in ImagePicker.OutputType. Default is FILE_URI.
|
||||
@@ -29,6 +45,11 @@ export interface ImagePickerOptions {
|
||||
* DATA_URL : 1, Return image as base64-encoded string
|
||||
*/
|
||||
outputType?: number;
|
||||
|
||||
/**
|
||||
* Disable the iOS popover as seen on iPad
|
||||
*/
|
||||
disable_popover?: boolean;
|
||||
}
|
||||
|
||||
export enum OutputType {
|
||||
@@ -42,7 +63,7 @@ export enum OutputType {
|
||||
* Cordova Plugin For Multiple Image Selection
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-image-picker`.
|
||||
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
|
||||
* For more info, please see the https://github.com/Telerik-Verified-Plugins/ImagePicker
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
@@ -10,83 +10,123 @@ import { Observable, Observer } from 'rxjs';
|
||||
declare const cordova: Cordova & { InAppBrowser: any };
|
||||
|
||||
export interface InAppBrowserOptions {
|
||||
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
|
||||
location?: 'yes' | 'no';
|
||||
/* Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
|
||||
* Omit or set to no (default) to have the browser open and load normally. */
|
||||
hidden?: 'yes' | 'no';
|
||||
/**
|
||||
* (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
|
||||
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no)
|
||||
*/
|
||||
allowInlineMediaPlayback?: 'yes' | 'no';
|
||||
/**
|
||||
* set to enable the beforeload event to modify which pages are actually loaded in the browser. Accepted values are get to
|
||||
* intercept only GET requests, post to intercept on POST requests or yes to intercept both GET & POST requests.
|
||||
* Note that POST requests are not currently supported and will be ignored (if you set beforeload=post it will raise an error).
|
||||
*/
|
||||
beforeload?: 'yes' | 'get' | 'post';
|
||||
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */
|
||||
clearcache?: 'yes';
|
||||
/* Set to yes to have the session cookie cache cleared before the new window is opened. */
|
||||
clearsessioncache?: 'yes';
|
||||
/* (Android) Set to a string to use as the close button's caption instead of a X. Note that you need to localize this value yourself.
|
||||
* (iOS) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself. */
|
||||
clearcache?: 'yes' | 'no';
|
||||
/** set to yes to have the browser's entire local storage cleared (cookies, HTML5 local storage, IndexedDB, etc.) before the new window is opened */
|
||||
cleardata?: 'yes' | 'no';
|
||||
/**
|
||||
* Set to yes to have the session cookie cache cleared before the new window is opened.
|
||||
* For WKWebView, requires iOS 11+ on target device.
|
||||
*/
|
||||
clearsessioncache?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android) Set to a string to use as the close button's caption instead of a X. Note that you need to localize this value yourself.
|
||||
* (iOS) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself.
|
||||
*/
|
||||
closebuttoncaption?: string;
|
||||
/* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the close button color from default, regardless of being a text or default X. Only has effect if user has location set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default Done button's color. Only applicable if toolbar is not disabled. */
|
||||
/**
|
||||
* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the close button color from default, regardless of being a text or default X. Only has effect if user has location set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default Done button's color. Only applicable if toolbar is not disabled.
|
||||
*/
|
||||
closebuttoncolor?: string;
|
||||
/** (Android Only) Set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
|
||||
zoom?: 'yes' | 'no';
|
||||
/* (Android & Windows Phone Only) Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
|
||||
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. */
|
||||
hardwareback?: 'yes' | 'no';
|
||||
/*
|
||||
* Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). */
|
||||
mediaPlaybackRequiresUserAction?: 'yes' | 'no';
|
||||
/* (Android) Set to yes to hide the navigation buttons on the location toolbar, only has effect if user has location set to yes. The default value is no.
|
||||
* (iOS) Set to yes or no to turn the toolbar navigation buttons on or off (defaults to no). Only applicable if toolbar is not disabled.*/
|
||||
hidenavigationbuttons?: 'yes' | 'no';
|
||||
/* (Android) Set to yes to hide the url bar on the location toolbar, only has effect if user has location set to yes. The default value is no.*/
|
||||
hideurlbar?: 'yes' | 'no';
|
||||
/* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color of both navigation buttons from default. Only has effect if user has location set to yes and not hidenavigationbuttons set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color. Only applicable if navigation buttons are visible. */
|
||||
navigationbuttoncolor?: string;
|
||||
/* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color the toolbar from default. Only has effect if user has location set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color of the toolbar. Only applicable if toolbar is not disabled.*/
|
||||
toolbarcolor?: string;
|
||||
/** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */
|
||||
shouldPauseOnSuspend?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */
|
||||
disallowoverscroll?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
|
||||
enableViewportScale?: 'yes' | 'no';
|
||||
/** (Android Only) Set to yes to show a close button in the footer similar to the iOS Done button. The close button will appear the same as for the header hence use closebuttoncaption and closebuttoncolor to set its properties */
|
||||
footer?: 'yes' | 'no';
|
||||
/** (Android Only) Set to a valid hex color string, for example #00ff00 or #CC00ff00 (#aarrggbb), and it will change the footer color from default. Only has effect if user has footer set to yes */
|
||||
footercolor?: string;
|
||||
/** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */
|
||||
disallowoverscroll?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */
|
||||
toolbar?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to make the toolbar translucent(semi-transparent) (defaults to yes). Only applicable if toolbar is not disabled. */
|
||||
toolbartranslucent?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
|
||||
enableViewportScale?: 'yes' | 'no';
|
||||
/* (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
|
||||
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no) */
|
||||
allowInlineMediaPlayback?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
|
||||
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */
|
||||
suppressesIncrementalRendering?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */
|
||||
presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen';
|
||||
/** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */
|
||||
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
|
||||
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
|
||||
toolbarposition?: 'top' | 'bottom';
|
||||
/**
|
||||
* (Windows only) Set to yes to create the browser control without a border around it.
|
||||
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window.
|
||||
*/
|
||||
fullscreen?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android & Windows Only) Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
|
||||
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser.
|
||||
*/
|
||||
hardwareback?: 'yes' | 'no';
|
||||
/**
|
||||
* Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
|
||||
* Omit or set to no (default) to have the browser open and load normally.
|
||||
*/
|
||||
hidden?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android) Set to yes to hide the navigation buttons on the location toolbar, only has effect if user has location set to yes. The default value is no.
|
||||
* (iOS) Set to yes or no to turn the toolbar navigation buttons on or off (defaults to no). Only applicable if toolbar is not disabled.
|
||||
*/
|
||||
hidenavigationbuttons?: 'yes' | 'no';
|
||||
/**
|
||||
* (iOS Only) Set to yes or no to change the visibility of the loading indicator (defaults to no).
|
||||
*/
|
||||
hidespinner?: 'yes' | 'no';
|
||||
/* (Windows only) Set to yes to create the browser control without a border around it.
|
||||
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
|
||||
fullscreen?: 'yes';
|
||||
/** (Android) Set to yes to hide the url bar on the location toolbar, only has effect if user has location set to yes. The default value is no. */
|
||||
hideurlbar?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
|
||||
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android) Set to yes to swap positions of the navigation buttons and the close button. Specifically, navigation buttons go to the left and close button to the right.
|
||||
* (iOS) Set to yes to swap positions of the navigation buttons and the close button. Specifically, close button goes to the right and navigation buttons to the left.
|
||||
*/
|
||||
lefttoright?: 'yes' | 'no';
|
||||
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
|
||||
location?: 'yes' | 'no';
|
||||
/**
|
||||
* Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no).
|
||||
*/
|
||||
mediaPlaybackRequiresUserAction?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color of both navigation buttons from default. Only has effect if user has location set to yes and not hidenavigationbuttons set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color. Only applicable if navigation buttons are visible.
|
||||
*/
|
||||
navigationbuttoncolor?: string;
|
||||
/** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */
|
||||
presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen';
|
||||
/** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */
|
||||
shouldPauseOnSuspend?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */
|
||||
suppressesIncrementalRendering?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */
|
||||
toolbar?: 'yes' | 'no';
|
||||
/**
|
||||
* (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color the toolbar from default. Only has effect if user has location set to yes.
|
||||
* (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color of the toolbar. Only applicable if toolbar is not disabled.
|
||||
*/
|
||||
toolbarcolor?: string;
|
||||
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
|
||||
toolbarposition?: 'top' | 'bottom';
|
||||
/** (iOS Only) Set to yes or no to make the toolbar translucent(semi-transparent) (defaults to yes). Only applicable if toolbar is not disabled. */
|
||||
toolbartranslucent?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */
|
||||
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
|
||||
/** (Android Only) Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is no, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is yes and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. (defaults to yes). */
|
||||
useWideViewPort?: 'yes' | 'no';
|
||||
/** (iOS Only) Set to yes to use WKWebView engine for the InappBrowser. Omit or set to no (default) to use UIWebView. */
|
||||
usewkwebview?: 'yes' | 'no';
|
||||
/** (Android Only) Set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
|
||||
zoom?: 'yes' | 'no';
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type InAppBrowserEventType = 'loadstart' | 'loadstop' | 'loaderror' | 'exit' | 'beforeload' | 'message' | 'customscheme';
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
/** the event name */
|
||||
type: string;
|
||||
/** the URL that was loaded. */
|
||||
url: string;
|
||||
@@ -94,6 +134,8 @@ export interface InAppBrowserEvent extends Event {
|
||||
code: number;
|
||||
/** the error message, only in the case of loaderror. */
|
||||
message: string;
|
||||
/** the postMessage data, only in the case of message. */
|
||||
data: any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,6 +180,13 @@ export class InAppBrowserObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to be called after the "beforeload" event to continue the script
|
||||
* @param strUrl {String} The URL the InAppBrowser should navigate to.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
_loadAfterBeforeload(strUrl: string): void {}
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
@@ -178,6 +227,28 @@ export class InAppBrowserObject {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event {InAppBrowserEventType} Name of the event
|
||||
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
|
||||
*/
|
||||
@InstanceCheck()
|
||||
on(event: InAppBrowserEventType): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>(
|
||||
(observer: Observer<InAppBrowserEvent>) => {
|
||||
this._objectInstance.addEventListener(
|
||||
event,
|
||||
observer.next.bind(observer)
|
||||
);
|
||||
return () =>
|
||||
this._objectInstance.removeEventListener(
|
||||
event,
|
||||
observer.next.bind(observer)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event {string} Name of the event
|
||||
|
||||
@@ -1,79 +1,10 @@
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name In App Purchase 2
|
||||
* @description
|
||||
* In-App Purchase for Cordova on iOS, Android and Windows
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2/ngx';
|
||||
*
|
||||
* constructor(private store: InAppPurchase2) { }
|
||||
*
|
||||
* ...
|
||||
* ```
|
||||
*
|
||||
* * @advanced
|
||||
*
|
||||
* ```typescript
|
||||
* // After Platform Ready
|
||||
* this.store.verbosity = this.store.DEBUG;
|
||||
* this.store.register({
|
||||
* id: productId,
|
||||
* alias: productId,
|
||||
* type: this.store.NON_RENEWING_SUBSCRIPTION
|
||||
* });
|
||||
*
|
||||
* // Register Event Handlers for the specific product
|
||||
* this.store.when(productId).registered( (product: IAPProduct) => {
|
||||
* console.log('Registered: ' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
* // Updated
|
||||
* this.store.when(productId).updated( (product: IAPProduct) => {
|
||||
* console.log('Loaded' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
* // Issue with buying
|
||||
* this.store.when(productId).cancelled( (product) => {
|
||||
* alert('Purchase was Cancelled');
|
||||
* });
|
||||
*
|
||||
* // Track All Store Errors
|
||||
* this.store.error( (err) => {
|
||||
* alert('Store Error ' + JSON.stringify(err));
|
||||
* });
|
||||
*
|
||||
* this.store.ready(() => {
|
||||
* console.log(JSON.stringify(this.store.get(productId)));
|
||||
* console.log('Store is Ready: ' + JSON.stringify(status));
|
||||
* console.log('Products: ' + JSON.stringify(this.store.products));
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Errors
|
||||
* this.store.when(productId).error( (error) => {
|
||||
* this.loader.dismiss();
|
||||
* alert('An Error Occured' + JSON.stringify(error));
|
||||
* });
|
||||
* // Refresh Starts Handlers
|
||||
* console.log('Refresh Store');
|
||||
* this.store.refresh();
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // To Purchase
|
||||
* this.store.order(productId);
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
export interface IAPProductOptions {
|
||||
id: string;
|
||||
alias: string;
|
||||
alias?: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
@@ -98,7 +29,7 @@ export interface IAPProduct {
|
||||
|
||||
id: string;
|
||||
|
||||
alias: string;
|
||||
alias?: string;
|
||||
|
||||
type: string;
|
||||
|
||||
@@ -108,7 +39,7 @@ export interface IAPProduct {
|
||||
|
||||
description: string;
|
||||
|
||||
priceMicros: string;
|
||||
priceMicros: number;
|
||||
|
||||
price: string;
|
||||
|
||||
@@ -122,16 +53,91 @@ export interface IAPProduct {
|
||||
|
||||
owned: boolean;
|
||||
|
||||
downloading: boolean;
|
||||
downloading?: boolean;
|
||||
|
||||
downloaded: boolean;
|
||||
downloaded?: boolean;
|
||||
|
||||
additionalData: any;
|
||||
lastRenewalDate?: string;
|
||||
|
||||
transaction: any;
|
||||
expiryDate?: string;
|
||||
|
||||
introPrice?: string;
|
||||
|
||||
introPriceMicros?: number;
|
||||
|
||||
introPriceNumberOfPeriods?: number;
|
||||
|
||||
introPriceSubscriptionPeriod?: string;
|
||||
|
||||
introPricePaymentMode?: string;
|
||||
|
||||
ineligibleForIntroPrice?: boolean;
|
||||
|
||||
billingPeriod?: number;
|
||||
|
||||
billingPeriodUnit?: string;
|
||||
|
||||
trialPeriod?: number;
|
||||
|
||||
trialPeriodUnit?: string;
|
||||
|
||||
additionalData?: any;
|
||||
|
||||
transaction?: any;
|
||||
|
||||
/**
|
||||
* Call `product.finish()` to confirm to the store that an approved order has been delivered.
|
||||
*
|
||||
* This will change the product state from `APPROVED` to `FINISHED` (see product life-cycle).
|
||||
*
|
||||
* As long as you keep the product in state `APPROVED`:
|
||||
*
|
||||
* - the money may not be in your account (i.e. user isn't charged)
|
||||
* - you will receive the `approved` event each time the application starts,
|
||||
* where you should try again to finish the pending transaction.
|
||||
*
|
||||
* **example use**
|
||||
*
|
||||
* ```js
|
||||
* store.when("product.id").approved(function(product){
|
||||
* // synchronous
|
||||
* app.unlockFeature();
|
||||
* product.finish();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* store.when("product.id").approved(function(product){
|
||||
* // asynchronous
|
||||
* app.downloadFeature(function() {
|
||||
* product.finish();
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
finish(): void;
|
||||
|
||||
/**
|
||||
* Initiate purchase validation as defined by the `store.validator` attribute.
|
||||
*
|
||||
* **return value**
|
||||
*
|
||||
* A Promise with the following methods:
|
||||
*
|
||||
* - `done(function(product){})`
|
||||
* - called whether verification failed or succeeded.
|
||||
* - `expired(function(product){})`
|
||||
* - called if the purchase expired.
|
||||
* - `success(function(product, purchaseData){})`
|
||||
* - called if the purchase is valid and verified.
|
||||
* - `purchaseData` is the device dependent transaction details
|
||||
* returned by the validator, which you can most probably ignore.
|
||||
* - `error(function(err){})`
|
||||
* - validation failed, either because of expiry or communication
|
||||
* failure.
|
||||
* - `err` is a store.Error object, with a code expected to be
|
||||
* `store.ERR_PAYMENT_EXPIRED` or `store.ERR_VERIFICATION_FAILED`.
|
||||
*/
|
||||
verify(): any;
|
||||
|
||||
set(key: string, value: any): void;
|
||||
@@ -149,24 +155,42 @@ export interface IAPProduct {
|
||||
}
|
||||
|
||||
export interface IAPProductEvents {
|
||||
loaded: (callback: IAPQueryCallback) => void;
|
||||
updated: (callback: IAPQueryCallback) => void;
|
||||
error: (callback: IAPQueryCallback) => void;
|
||||
approved: (callback: IAPQueryCallback) => void;
|
||||
owned: (callback: IAPQueryCallback) => void;
|
||||
cancelled: (callback: IAPQueryCallback) => void;
|
||||
refunded: (callback: IAPQueryCallback) => void;
|
||||
registered: (callback: IAPQueryCallback) => void;
|
||||
valid: (callback: IAPQueryCallback) => void;
|
||||
invalid: (callback: IAPQueryCallback) => void;
|
||||
requested: (callback: IAPQueryCallback) => void;
|
||||
initiated: (callback: IAPQueryCallback) => void;
|
||||
finished: (callback: IAPQueryCallback) => void;
|
||||
verified: (callback: IAPQueryCallback) => void;
|
||||
unverified: (callback: IAPQueryCallback) => void;
|
||||
expired: (callback: IAPQueryCallback) => void;
|
||||
downloading: (product: IAPProduct, progress: any, time_remaining: any) => void;
|
||||
downloaded: (callback: IAPQueryCallback) => void;
|
||||
/** Called when product data is loaded from the store. */
|
||||
loaded: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when any change occured to a product. */
|
||||
updated: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when an order failed. The `err` parameter is an IAPError object. */
|
||||
error: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when a product order is approved. */
|
||||
approved: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when a non-consumable product or subscription is owned. */
|
||||
owned: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when a product order is cancelled by the user. */
|
||||
cancelled: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when an order is refunded by the user. */
|
||||
refunded: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when product has just been registered. */
|
||||
registered: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when the product details have been successfully loaded. */
|
||||
valid: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when the product cannot be loaded from the store. */
|
||||
invalid: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when an order has just been requested. */
|
||||
requested: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when the purchase process has been initiated. */
|
||||
initiated: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when the purchase process has completed. */
|
||||
finished: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when receipt validation successful. */
|
||||
verified: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when receipt verification failed. */
|
||||
unverified: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when validation find a subscription to be expired. */
|
||||
expired: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
/** Called when content download is started. */
|
||||
downloading: (product: IAPProduct, progress: any, time_remaining: any) => IAPProductEvents;
|
||||
/** Called when content download has successfully completed. */
|
||||
downloaded: (callback: IAPQueryCallback) => IAPProductEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,18 +204,343 @@ export class IAPError {
|
||||
/**
|
||||
* @name In App Purchase 2
|
||||
* @description
|
||||
* In-App Purchase on iOS, Android, Windows, macOS and XBox.
|
||||
*
|
||||
* ## Features
|
||||
*
|
||||
* | | ios | android | win-8 | win-10/uwp | mac |
|
||||
* |--|--|--|--|--|--|
|
||||
* | consumables | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
* | non consumables | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
* | subscriptions | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
* | restore purchases | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
* | receipt validations | ✅ | ✅ | | ✅ | ✅ |
|
||||
* | downloadable content | ✅ | | | | ✅ |
|
||||
* | introductory prices | ✅ | ✅ | | ✅ | ✅ |
|
||||
*
|
||||
* Supports:
|
||||
*
|
||||
* - **iOS** version 7.0 or higher.
|
||||
* - **Android** version 2.2 (API level 8) or higher
|
||||
* - with Google Play client version 3.9.16 or higher
|
||||
* - **Windows** Store/Phone 8.1 or higher
|
||||
* - **Windows 10 Mobile**
|
||||
* - **macOS** version 10
|
||||
* - **Xbox One**
|
||||
* - (and any platform supporting Microsoft's UWP)
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* ```typescript
|
||||
* import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private inAppPurchase2: InAppPurchase2) { }
|
||||
* constructor(public platform: Platform, private store: InAppPurchase2) {
|
||||
* platform.ready().then(() => {
|
||||
* this.store.register({
|
||||
* id: "my_product_id",
|
||||
* type: this.store.NON_RENEWING_SUBSCRIPTION,
|
||||
* });
|
||||
* this.store.when("my_product_id")
|
||||
* .approved(p => p.verify())
|
||||
* .verified(p => p.finish());
|
||||
* this.store.refresh();
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.store.order("my_product_id");
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* ## Full example
|
||||
*
|
||||
* ```typescript
|
||||
* // After platform ready
|
||||
* this.store.verbosity = this.store.DEBUG;
|
||||
* this.store.register({
|
||||
* id: "my_product_id",
|
||||
* type: this.store.PAID_SUBSCRIPTION,
|
||||
* });
|
||||
*
|
||||
* // Register event handlers for the specific product
|
||||
* this.store.when("my_product_id").registered( (product: IAPProduct) => {
|
||||
* console.log('Registered: ' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
* // Updated
|
||||
* this.store.when("my_product_id").updated( (product: IAPProduct) => {
|
||||
* console.log('Updated' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
* // User closed the native purchase dialog
|
||||
* this.store.when("my_product_id").cancelled( (product) => {
|
||||
* console.error('Purchase was Cancelled');
|
||||
* });
|
||||
*
|
||||
* // Track all store errors
|
||||
* this.store.error( (err) => {
|
||||
* console.error('Store Error ' + JSON.stringify(err));
|
||||
* });
|
||||
*
|
||||
* // Run some code only when the store is ready to be used
|
||||
* this.store.ready(() => {
|
||||
* console.log('Store is ready');
|
||||
* console.log('Products: ' + JSON.stringify(this.store.products));
|
||||
* console.log(JSON.stringify(this.store.get("my_product_id")));
|
||||
* });
|
||||
*
|
||||
* // Refresh the status of in-app products
|
||||
* this.store.refresh();
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // To make a purchase
|
||||
* this.store.order("my_product_id");
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* ## Philosophy
|
||||
*
|
||||
* The API is mostly events based. As a user of this plugin,
|
||||
* you will have to register listeners to changes happening to the products
|
||||
* you register.
|
||||
*
|
||||
* The core of the listening mechanism is the `when()` method. It allows you to
|
||||
* be notified of changes to one or a set of products using a query mechanism:
|
||||
* ```typescript
|
||||
* this.store.when("product").updated(refreshScreen); // match any product
|
||||
* this.store.when("full_version").owned(unlockApp); // match a specific product
|
||||
* this.store.when("subscription").approved(serverCheck); // match all subscriptions
|
||||
* this.store.when("downloadable content").downloaded(showContent);
|
||||
* ```
|
||||
*
|
||||
* The `updated` event is fired whenever one of the fields of a product is
|
||||
* changed (its `owned` status for instance).
|
||||
*
|
||||
* This event provides a generic way to track the statuses of your purchases,
|
||||
* to unlock features when needed and to refresh your views accordingly.
|
||||
*
|
||||
* ## Registering products
|
||||
*
|
||||
* The store needs to know the type and identifiers of your products before you
|
||||
* can use them in your code.
|
||||
*
|
||||
* Use `store.register()` to define them before your first call to `store.refresh()`.
|
||||
*
|
||||
* Once registered, you can use `store.get()` to retrieve an `IAPProduct` object.
|
||||
*
|
||||
* ```typescript
|
||||
* this.store.register({
|
||||
* id: "my_consumable1",
|
||||
* type: this.store.CONSUMABLE
|
||||
* });
|
||||
* ...
|
||||
* const p = this.store.get("my_consumable1");
|
||||
* ```
|
||||
*
|
||||
* The product `id` and `type` have to match products defined in your
|
||||
* Apple, Google or Microsoft developer consoles.
|
||||
*
|
||||
* Learn more about it [from the wiki](https://github.com/j3k0/cordova-plugin-purchase/wiki).
|
||||
*
|
||||
* ## Displaying products
|
||||
*
|
||||
* Right after you registered your products, nothing much is known about them
|
||||
* except their `id`, `type` and an optional `alias`.
|
||||
*
|
||||
* When you perform the initial call to `store.refresh()`, the platforms' server will
|
||||
* be contacted to load informations about the registered products: human
|
||||
* readable `title` and `description`, `price`, etc.
|
||||
*
|
||||
* This isn't an optional step, store owners require you
|
||||
* to display information about a product exactly as retrieved from their server: no
|
||||
* hard-coding of price and title allowed! This is also convenient for you
|
||||
* as you can change the price of your items knowing that it'll be reflected instantly
|
||||
* on your clients' devices.
|
||||
*
|
||||
* Note that the information may not be available when the first view that needs
|
||||
* them appears on screen. For you, the best option is to have your view monitor
|
||||
* changes made to the product.
|
||||
*
|
||||
* ## Purchasing
|
||||
*
|
||||
* #### initiate a purchase
|
||||
*
|
||||
* Purchases are initiated using the `store.order("some_product_id")` method.
|
||||
*
|
||||
* The store will manage the internal purchase flow. It'll end:
|
||||
*
|
||||
* - with an `approved` event. The product enters the `APPROVED` state.
|
||||
* - with a `cancelled` event. The product gets back to the `VALID` state.
|
||||
* - with an `error` event. The product gets back to the `VALID` state.
|
||||
*
|
||||
* See the product life-cycle section for details about product states.
|
||||
*
|
||||
* #### finish a purchase
|
||||
*
|
||||
* Once the transaction is approved, the product still isn't owned: the store needs
|
||||
* confirmation that the purchase was delivered before closing the transaction.
|
||||
*
|
||||
* To confirm delivery, you'll use the `product.finish()` method.
|
||||
*
|
||||
* #### example usage
|
||||
*
|
||||
* During initialization:
|
||||
* ```typescript
|
||||
* this.store.when("extra_chapter").approved((product: IAPProduct) => {
|
||||
* // download the feature
|
||||
* app.downloadExtraChapter()
|
||||
* .then(() => product.finish());
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* When the purchase button is clicked:
|
||||
* ```typescript
|
||||
* this.store.order("extra_chapter");
|
||||
* ```
|
||||
*
|
||||
* #### un-finished purchases
|
||||
*
|
||||
* If your app wasn't able to deliver the content, `product.finish()` won't be called.
|
||||
*
|
||||
* Don't worry: the `approved` event will be re-triggered the next time you
|
||||
* call `store.refresh()`, which can very well be the next time
|
||||
* the application starts. Pending transactions are persistant.
|
||||
*
|
||||
* #### simple case
|
||||
*
|
||||
* In the most simple case, where:
|
||||
*
|
||||
* - delivery of purchases is only local ;
|
||||
* - you don't want (or need) to implement receipt validation ;
|
||||
*
|
||||
* You may just want to finish all purchases automatically. You can do it this way:
|
||||
* ```js
|
||||
* this.store.when("product").approved((p: IAPProduct) => p.finish());
|
||||
* ```
|
||||
*
|
||||
* NOTE: the "product" query will match any purchases (see "queries" to learn more details about queries).
|
||||
*
|
||||
* ## Receipt validation
|
||||
*
|
||||
* To get the most up-to-date information about purchases (in case a purchase have been canceled, or a subscription renewed),
|
||||
* you should implement server side receipt validation.
|
||||
*
|
||||
* This also protects you against fake "purchases", made by some users using
|
||||
* "free in-app purchase" apps on their devices.
|
||||
*
|
||||
* When a purchase has been approved by the store, it's enriched with
|
||||
* transaction information (see `product.transaction` attribute).
|
||||
*
|
||||
* To verify a purchase you'll have to do three things:
|
||||
*
|
||||
* - configure the validator.
|
||||
* - call `product.verify()` from the `approved` event, before finishing the transaction.
|
||||
* - finish the transaction when transaction is `verified`.
|
||||
*
|
||||
* **Shameless Plug**: this is a feature many users struggle with, so as the author of this plugin, we can provide it to you as-a-service: https://billing.fovea.cc/
|
||||
* (which is free until you start making serious money)
|
||||
*
|
||||
* #### example using a validation URL
|
||||
*
|
||||
* ```js
|
||||
* this.store.validator = "https://billing.fovea.cc/";
|
||||
*
|
||||
* this.store.when("my stuff")
|
||||
* .approved((p: IAPProduct) => p.verify())
|
||||
* .verified((p: IAPProduct) => p.finish());
|
||||
* ```
|
||||
*
|
||||
* ## Subscriptions
|
||||
*
|
||||
* For subscription, you MUST implement remote receipt validation.
|
||||
*
|
||||
* When the receipt validator returns a `store.PURCHASE_EXPIRED` error code, the subscription will
|
||||
* automatically loose its `owned` status.
|
||||
*
|
||||
* Typically, you'll enable and disable access to your content this way.
|
||||
* ```typescript
|
||||
* this.store.when("my_subcription").updated((product: IAPProduct) => {
|
||||
* if (product.owned)
|
||||
* app.subscriberMode();
|
||||
* else
|
||||
* app.guestMode();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* ## Product life-cycle
|
||||
*
|
||||
* A product will change state during the application execution.
|
||||
*
|
||||
* Find below a diagram of the different states a product can pass by.
|
||||
*
|
||||
* ```
|
||||
* REGISTERED +--> INVALID
|
||||
* |
|
||||
* +--> VALID +--> REQUESTED +--> INITIATED +-+
|
||||
* |
|
||||
* ^ +------------------------------+
|
||||
* | |
|
||||
* | | +--> DOWNLOADING +--> DOWNLOADED +
|
||||
* | | | |
|
||||
* | +--> APPROVED +--------------------------------+--> FINISHED +--> OWNED
|
||||
* | |
|
||||
* +-------------------------------------------------------------+
|
||||
*
|
||||
* #### Notes
|
||||
*
|
||||
* - When finished, a consumable product will get back to the `VALID` state, while other will enter the `OWNED` state.
|
||||
* - Any error in the purchase process will bring a product back to the `VALID` state.
|
||||
* - During application startup, products may go instantly from `REGISTERED` to `APPROVED` or `OWNED`, for example if they are purchased non-consumables or non-expired subscriptions.
|
||||
* - Non-Renewing Subscriptions are iOS products only. Please see the [iOS Non Renewing Subscriptions documentation](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/ios.md#non-renewing) for a detailed explanation.
|
||||
*
|
||||
* ## events
|
||||
*
|
||||
* - `loaded(IAPProduct)`
|
||||
* - Called when product data is loaded from the store.
|
||||
* - `updated(IAPProduct)`
|
||||
* - Called when any change occured to a product.
|
||||
* - `error(err)`
|
||||
* - Called when an order failed.
|
||||
* - The `err` parameter is an error object
|
||||
* - `approved(IAPProduct)`
|
||||
* - Called when a product order is approved.
|
||||
* - `owned(IAPProduct)`
|
||||
* - Called when a non-consumable product or subscription is owned.
|
||||
* - `cancelled(IAPProduct)`
|
||||
* - Called when a product order is cancelled by the user.
|
||||
* - `refunded(IAPProduct)`
|
||||
* - Called when an order is refunded by the user.
|
||||
* - Actually, all other product states have their promise
|
||||
* - `registered`, `valid`, `invalid`, `requested`,
|
||||
* `initiated` and `finished`
|
||||
* - `verified(IAPProduct)`
|
||||
* - Called when receipt validation successful
|
||||
* - `unverified(IAPProduct)`
|
||||
* - Called when receipt verification failed
|
||||
* - `expired(IAPProduct)`
|
||||
* - Called when validation find a subscription to be expired
|
||||
* - `downloading(IAPProduct, progress, time_remaining)`
|
||||
* - Called when content download is started
|
||||
* - `downloaded(IAPProduct)`
|
||||
* - Called when content download has successfully completed
|
||||
*
|
||||
* ## Learn More
|
||||
*
|
||||
* - [GitHub](https://github.com/j3k0/cordova-plugin-purchase)
|
||||
* - [GitBook](https://purchase.cordova.fovea.cc/)
|
||||
* - [Wiki](https://github.com/j3k0/cordova-plugin-purchase/wiki)
|
||||
* - [API reference](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md)
|
||||
*
|
||||
* ## Technical Support or Questions
|
||||
*
|
||||
* If you have questions or need help integrating In-App Purchase, [Open an Issue on GitHub](https://github.com/j3k0/cordova-plugin-purchase/issues) or email us at _support@fovea.cc_.
|
||||
*
|
||||
* @interfaces
|
||||
* IAPProduct
|
||||
* IAPProductOptions
|
||||
* IAPProductEvents
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppPurchase2',
|
||||
@@ -225,12 +574,26 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
@CordovaProperty()
|
||||
verbosity: number;
|
||||
|
||||
/**
|
||||
* Set to true to clear the transaction queue. Not recommended for production.
|
||||
* https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#random-tips
|
||||
*/
|
||||
@CordovaProperty()
|
||||
autoFinishTransactions: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to invoke the platform purchase sandbox. (Windows only)
|
||||
*/
|
||||
@CordovaProperty()
|
||||
sandbox: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to disable downloading of hosted content. (Apple only).
|
||||
* Useful in development or when migrating your app away from Apple Hosted Content.
|
||||
*/
|
||||
@CordovaProperty()
|
||||
disableHostedContent: boolean;
|
||||
|
||||
@CordovaProperty()
|
||||
FREE_SUBSCRIPTION: string;
|
||||
|
||||
@@ -342,6 +705,8 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
DOWNLOADED: string;
|
||||
|
||||
|
||||
/* validation error codes */
|
||||
|
||||
@CordovaProperty()
|
||||
INVALID_PAYLOAD: number;
|
||||
|
||||
@@ -351,11 +716,28 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
@CordovaProperty()
|
||||
PURCHASE_EXPIRED: number;
|
||||
|
||||
@CordovaProperty()
|
||||
PURCHASE_CONSUMED: number;
|
||||
|
||||
@CordovaProperty()
|
||||
INTERNAL_ERROR: number;
|
||||
|
||||
@CordovaProperty()
|
||||
NEED_MORE_DATA: number;
|
||||
|
||||
@CordovaProperty()
|
||||
products: IAPProducts;
|
||||
|
||||
@CordovaProperty()
|
||||
validator: string | ((product: string | IAPProduct, callback: Function) => void);
|
||||
validator: string | ((url: string | IAPProduct, callback: Function) => void);
|
||||
|
||||
@CordovaProperty()
|
||||
applicationUsername: string | (() => string);
|
||||
|
||||
@Cordova({ sync: true })
|
||||
getApplicationUsername(): string {
|
||||
return;
|
||||
}
|
||||
|
||||
@CordovaProperty()
|
||||
log: {
|
||||
@@ -387,7 +769,7 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
* @param product {IAPProductOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
register(product: IAPProductOptions): void {}
|
||||
register(product: IAPProductOptions | IAPProductOptions[]): void {}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -421,6 +803,29 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
off(callback: Function): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate the purchase of a product.
|
||||
*
|
||||
* The `product` argument can be either:
|
||||
*
|
||||
* - the `IAPProduct` object
|
||||
* - the product `id`
|
||||
* - the product `alias`
|
||||
*
|
||||
* The `additionalData` argument is an optional object with attributes:
|
||||
* - `oldPurchasedSkus`: a string array with the old subscription to upgrade/downgrade on Android. See: [android developer](https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus) for more info
|
||||
* - `developerPayload`: string representing the developer payload as described in [billing best practices](https://developer.android.com/google/play/billing/billing_best_practices.html)
|
||||
* - `applicationUsername`: the identifier of the user in your application.
|
||||
*
|
||||
* See the "Purchasing section" to learn more about the purchase process.
|
||||
*
|
||||
* **return value**
|
||||
*
|
||||
* `store.order()` returns a Promise with the following methods:
|
||||
*
|
||||
* - `then` - called when the order was successfully initiated.
|
||||
* - `error` - called if the order couldn't be initiated.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
order(product: string | IAPProduct, additionalData?: any): { then: Function; error: Function; } {
|
||||
return;
|
||||
@@ -428,9 +833,50 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
|
||||
@Cordova()
|
||||
ready(callback: Function): void { return; }
|
||||
|
||||
/**
|
||||
* After you're done registering your store's product and events handlers,
|
||||
* time to call `store.refresh()`.
|
||||
*
|
||||
* This will initiate all the complex behind-the-scene work, to load product
|
||||
* data from the servers and restore whatever already have been
|
||||
* purchased by the user.
|
||||
*
|
||||
* Note that you can call this method again later during the application
|
||||
* execution to re-trigger all that hard-work. It's kind of expensive in term of
|
||||
* processing, so you'd better consider it twice.
|
||||
*
|
||||
* One good way of doing it is to add a "Refresh Purchases" button in your
|
||||
* applications settings. This way, if delivery of a purchase failed or
|
||||
* if a user wants to restore purchases he made from another device, he'll
|
||||
* have a way to do just that.
|
||||
*
|
||||
* **example usage**
|
||||
*
|
||||
* ```typescript
|
||||
* // ...
|
||||
* // register products and events handlers here
|
||||
* // ...
|
||||
* //
|
||||
* // then and only then, call refresh.
|
||||
* this.store.refresh();
|
||||
* ```
|
||||
*
|
||||
* **restore purchases**
|
||||
*
|
||||
* Add a "Refresh Purchases" button to call the `store.refresh()` method, like:
|
||||
*
|
||||
* `<button onclick="<pseudo_code>this.store.refresh()</pseudo_code>">Restore Purchases</button>`
|
||||
*
|
||||
* To make the restore purchases work as expected, please make sure that
|
||||
* the "approved" event listener had be registered properly,
|
||||
* and in the callback `product.finish()` should be called.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
refresh(): void {
|
||||
}
|
||||
|
||||
/** Opens the Manage Subscription page (AppStore, Play, Microsoft, ...). */
|
||||
@Cordova({ sync: true })
|
||||
manageSubscriptions(): void {}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
logout(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param secureHash {string}
|
||||
@@ -141,6 +150,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
displayHelpCenter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
@@ -188,4 +206,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param token {string}
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
sendPushTokenToIntercom(token: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, IonicNativePlugin, CordovaProperty, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export enum KeyboardStyle {
|
||||
Light = 'light',
|
||||
Dark = 'dark'
|
||||
}
|
||||
|
||||
export enum KeyboardResizeMode {
|
||||
Native = 'native',
|
||||
Ionic = 'ionic',
|
||||
Body = 'body',
|
||||
None = 'none'
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name Keyboard
|
||||
* @description
|
||||
@@ -43,7 +56,10 @@ export class Keyboard extends IonicNativePlugin {
|
||||
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
||||
* @param hide {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
hideFormAccessoryBar(hide: boolean): void {}
|
||||
|
||||
/**
|
||||
@@ -72,7 +88,27 @@ export class Keyboard extends IonicNativePlugin {
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
setResizeMode(mode: string): void {}
|
||||
setResizeMode(mode: KeyboardResizeMode): void {}
|
||||
|
||||
/**
|
||||
* Programatically set Keyboard style
|
||||
* @param mode {string}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
setKeyboardStyle(style: KeyboardStyle): void {}
|
||||
|
||||
/**
|
||||
* Programatically enable or disable the WebView scroll
|
||||
* @param mode {string}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
disableScroll(disable: boolean): void {}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
||||
@@ -100,6 +136,19 @@ export class Keyboard extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard did show. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'keyboardDidShow',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
onKeyboardDidShow(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
@@ -125,4 +174,17 @@ export class Keyboard extends IonicNativePlugin {
|
||||
onKeyboardWillHide(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard did hide. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'keyboardDidHide',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
onKeyboardDidHide(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export class KeychainTouchId extends IonicNativePlugin {
|
||||
* @return {Promise<any>} Returns a promise that resolves when there is a result
|
||||
*/
|
||||
@Cordova()
|
||||
save(key: string, password: string): Promise<any> {
|
||||
save(key: string, password: string, userAuthenticationRequired: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
167
src/@ionic-native/plugins/kommunicate/index.ts
Normal file
167
src/@ionic-native/plugins/kommunicate/index.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name Kommunicate
|
||||
* @description
|
||||
* The plugin for the Kommunicate SDK.
|
||||
* With the help of this plugin, you can easily add human + bot chat support functionality to you app.
|
||||
* Refer to: TODO: insert site link
|
||||
* For documentation: TODO: insert link
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Kommunicate } from '@ionic-native/Kommunicate';
|
||||
*
|
||||
* constructor(private kommunicate: Kommunicate) { }
|
||||
* //also add [..., Kommunicate, ... ] inside the providers array, if required
|
||||
*
|
||||
* var kmUser = {
|
||||
* userId : 'randomstring',
|
||||
* authenticationTypeId : 1
|
||||
* };
|
||||
*
|
||||
* this.kommunicate.login(kmUser)
|
||||
* .then((res: any) => console.log("Sucessfully logged in." + res))
|
||||
* .catch((error: any) => console.error("Error logging in." + error));
|
||||
*
|
||||
* var conversationObject = {
|
||||
* isUnique : false
|
||||
* };
|
||||
*
|
||||
* this.kommunicate.conversationBuilder(converationObject)
|
||||
* .then((clientChannelKey: any) => console.log("Kommunicate create conversation successful the clientChannelKey is : " + clientChannelKey))
|
||||
* .catch((error: any) => console.error("Error creating conversation." + error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Kommunicate',
|
||||
plugin: 'kommunicate-cordova-plugin',
|
||||
pluginRef: 'kommunicate',
|
||||
repo: 'https://github.com/Kommunicate-io/Kommunicate-Cordova-Ionic-PhoneGap-Chat-Plugin',
|
||||
platforms: ['Android', 'Browser', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Kommunicate extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Login the user with the details passed in
|
||||
* Creates a new user with the details provided there is no existing user
|
||||
*
|
||||
* var kmUser = {
|
||||
* 'userId' : 'userId', //Replace it with the userId of the logged in user
|
||||
* 'password' : 'password', //replace with password
|
||||
* 'authenticationTypeId' : 1,
|
||||
* 'imageLink' : <image-link-for-user>
|
||||
* 'applicationId' : '<APP_ID>', //replace this with your APP_ID from Applozic Dashboard
|
||||
* 'deviceApnsType' : 0 //Set 0 for Development and 1 for Distribution (Release)
|
||||
* };
|
||||
*
|
||||
* @param kmUser {any} the user details
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
login(kmUser: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Register for push notification
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
registerPushNotification(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if any user is logged in or not
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
isLoggedIn(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Update the token for push notifications
|
||||
*
|
||||
* @param token {string} the user details
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
updatePushNotificationToken(token: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Launch the conversation screen (it contains all the existing conversations)
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
launchConversation(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Launch the conversation identified by the given channel(conversation) key
|
||||
*
|
||||
* let convObj = {
|
||||
* 'clientChannelKey' : clientChannelKey, //pass the clientChannelKey here
|
||||
* 'takeOrder' : true //skip chat list on back press, pass false if you want to show chat list on back press
|
||||
* };
|
||||
*
|
||||
* @param conversationObject {any} the channel key and other information
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
launchParticularConversation(conversationObject: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start a new conversation, details about the conversation to be passed as parameters
|
||||
*
|
||||
* @deprecated
|
||||
* @param converationParams {any} the user details
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
startNewConversation(conversationParams: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Process push notifications
|
||||
*
|
||||
* @param data {any} the user details
|
||||
* @return {boolean} Returns true/false
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
processPushNotification(data: any): boolean { return; }
|
||||
|
||||
/**
|
||||
* Logout the current user
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
logout(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Start a single chat (conversation)
|
||||
*
|
||||
* @deprecated
|
||||
* @param data {any} the user details
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
startSingleChat(data: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Launches a conversation with the properties passed in the conversation param
|
||||
*
|
||||
* var conversationObject = {
|
||||
* 'isUnique' : false,
|
||||
* 'agentIds':['<AGENT_ID>'], //List of agentIds. AGENT_ID is the emailID used to signup on Kommunicate
|
||||
* 'botIds': ['<BOT_ID>'] //List of botIds. Go to Manage Bots(https://dashboard.kommunicate.io/bots/manage-bots) -> Copy botID
|
||||
* };
|
||||
*
|
||||
* @param conversationObject {any} the user details
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
conversationBuilder(converationObject: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* ...
|
||||
*
|
||||
* this.launchReview.launch()
|
||||
* .then(() => console.log('Successfully launched store app');
|
||||
* .then(() => console.log('Successfully launched store app'));
|
||||
*
|
||||
* if(this.launchReview.isRatingSupported()){
|
||||
* this.launchReview.rating()
|
||||
|
||||
@@ -23,6 +23,11 @@ export interface LineLoginProfile {
|
||||
* Line Profile Name
|
||||
*/
|
||||
displayName: string;
|
||||
|
||||
/**
|
||||
* Email
|
||||
*/
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export interface LineLoginAccessToken {
|
||||
@@ -91,10 +96,7 @@ export class LineLogin extends IonicNativePlugin {
|
||||
* Login
|
||||
* @return {Promise<LineLoginProfile>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
@Cordova()
|
||||
login(): Promise<LineLoginProfile> {
|
||||
return;
|
||||
}
|
||||
@@ -104,10 +106,7 @@ export class LineLogin extends IonicNativePlugin {
|
||||
* (iOS only)
|
||||
* @return {Promise<LineLoginProfile>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
@Cordova()
|
||||
loginWeb(): Promise<LineLoginProfile> {
|
||||
return;
|
||||
}
|
||||
|
||||
115
src/@ionic-native/plugins/mlkit-translate/index.ts
Normal file
115
src/@ionic-native/plugins/mlkit-translate/index.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* This is the language object which will be returned by `downloadModel`, `deleteModel`, `getAvailableModels` and `getDownloadedModels` methods.
|
||||
*/
|
||||
export interface LanguageModel {
|
||||
/**
|
||||
* BCP-47 language code of the language. For example: en
|
||||
* For full list of languages codes, see https://firebase.google.com/docs/ml-kit/translation-language-support
|
||||
*/
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* Display name of the language. For example: English
|
||||
*/
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MLKitTranslate
|
||||
* @description
|
||||
* Plugin that implements MLKit Translation and Language Identification features.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MLKitTranslate } from '@ionic-native/ml-kit-translate';
|
||||
*
|
||||
*
|
||||
* constructor(private mlkitTranslate: MLKitTranslate) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.mlkitTranslate.translate('Hello', 'en', 'es')
|
||||
* .then((resultText: string) => console.log(res))
|
||||
* .catch((error: string) => console.error(error));
|
||||
*
|
||||
* @interfaces
|
||||
* LanguageModel
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MLKitTranslate',
|
||||
plugin: 'cordova-plugin-mlkit-translate',
|
||||
pluginRef: 'MLKitTranslate',
|
||||
repo: 'https://github.com/rigelglen/cordova-plugin-mlkit-translate',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class MLKitTranslate extends IonicNativePlugin {
|
||||
/**
|
||||
* Translates text from one language to another. Requires the source and target languages need to be downloaded.
|
||||
* If not the languages are downloaded in the background automatically.
|
||||
* @param text {string} text to be translated
|
||||
* @param targetLanguage {string} BCP-47 language code of the language to translate to
|
||||
* @param sourceLanguage {string=} (optional) BCP-47 language code of the language to translate to. If not provided, source language is inferred from text
|
||||
* @return {Promise<string>} Returns a promise that resolves with the translated text
|
||||
*/
|
||||
@Cordova()
|
||||
translate(
|
||||
text: string,
|
||||
targetLanguage: string,
|
||||
sourceLanguage?: string
|
||||
): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the language of a string of text.
|
||||
* @param text {string} text to be translated
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the identified language
|
||||
*/
|
||||
@Cordova()
|
||||
identifyLanguage(text: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of language models that have been downloaded to the device.
|
||||
* @return {Promise<LanguageModel[]>} Returns a promise that resolves with an array of languages that have been downloaded.
|
||||
*/
|
||||
@Cordova()
|
||||
getDownloadedModels(): Promise<LanguageModel[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of language models that can be downloaded.
|
||||
* @return {Promise<LanguageModel[]>} Returns a promise that resolves with an array of possible languages that can be downloaded.
|
||||
*/
|
||||
@Cordova()
|
||||
getAvailableModels(): Promise<LanguageModel[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a specified language model.
|
||||
* @param code {string} BCP-47 language code of the language to download
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the downloaded language.
|
||||
*/
|
||||
@Cordova()
|
||||
downloadModel(code: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a specified language model.
|
||||
* @param code {string} BCP-47 language code of the language to delete
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the deleted language.
|
||||
*/
|
||||
@Cordova()
|
||||
deleteModel(code: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MobileAccessibility } from '@ionic-native/mobile-ccessibility/ngx';
|
||||
* import { MobileAccessibility } from '@ionic-native/mobile-accessibility/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private mobileAccessibility: MobileAccessibility) { }
|
||||
|
||||
447
src/@ionic-native/plugins/mobile-messaging/index.ts
Normal file
447
src/@ionic-native/plugins/mobile-messaging/index.ts
Normal file
@@ -0,0 +1,447 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export type OS = 'Android' | 'iOS';
|
||||
export type Gender = 'Male' | 'Female';
|
||||
export type Event =
|
||||
| 'messageReceived'
|
||||
| 'notificationTapped'
|
||||
| 'tokenReceived'
|
||||
| 'registrationUpdated'
|
||||
| 'geofenceEntered'
|
||||
| 'actionTapped'
|
||||
| 'installationUpdated'
|
||||
| 'userUpdated'
|
||||
| 'personalized'
|
||||
| 'depersonalized';
|
||||
|
||||
export interface CustomEvent {
|
||||
definitionId: string;
|
||||
properties: Record<string, string | number | boolean>;
|
||||
}
|
||||
|
||||
export interface Configuration {
|
||||
/**
|
||||
* The application code of your Application from Push Portal website
|
||||
*/
|
||||
applicationCode: string;
|
||||
geofencingEnabled?: boolean;
|
||||
/**
|
||||
* Message storage save callback
|
||||
*/
|
||||
messageStorage?: string;
|
||||
defaultMessageStorage?: boolean;
|
||||
ios?: {
|
||||
notificationTypes?: string[];
|
||||
forceCleanup?: boolean;
|
||||
logging?: boolean;
|
||||
};
|
||||
android?: {
|
||||
notificationIcon: string; // a resource name for a status bar icon (without extension), located in '/platforms/android/app/src/main/res/mipmap'
|
||||
multipleNotifications: boolean;
|
||||
notificationAccentColor: string;
|
||||
};
|
||||
privacySettings?: {
|
||||
applicationCodePersistingDisabled?: boolean;
|
||||
userDataPersistingDisabled?: boolean;
|
||||
carrierInfoSendingDisabled?: boolean;
|
||||
systemInfoSendingDisabled?: boolean;
|
||||
};
|
||||
notificationCategories?: [
|
||||
{
|
||||
identifier?: string;
|
||||
actions?: [
|
||||
{
|
||||
identifier?: string;
|
||||
title?: string;
|
||||
foreground?: boolean;
|
||||
authenticationRequired?: boolean;
|
||||
moRequired?: boolean;
|
||||
destructive?: boolean;
|
||||
icon?: string;
|
||||
textInputActionButtonTitle?: string;
|
||||
textInputPlaceholder?: string;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export interface UserData {
|
||||
externalUserId: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
middleName?: string;
|
||||
gender?: Gender;
|
||||
birthday?: Date;
|
||||
phones?: string[];
|
||||
emails?: string[];
|
||||
tags?: string[];
|
||||
customAttributes?: Record<string, string | number | boolean>;
|
||||
}
|
||||
|
||||
export interface Installation {
|
||||
isPrimaryDevice?: boolean;
|
||||
isPushRegistrationEnabled?: boolean;
|
||||
notificationsEnabled?: boolean;
|
||||
geoEnabled?: boolean;
|
||||
sdkVersion?: string;
|
||||
appVersion?: string;
|
||||
os?: OS;
|
||||
osVersion: string;
|
||||
deviceManufacturer?: string;
|
||||
deviceModel?: string;
|
||||
deviceSecure?: boolean;
|
||||
language?: string;
|
||||
deviceTimezoneId?: string;
|
||||
applicationUserId?: string;
|
||||
deviceName?: string;
|
||||
customAttributes?: Record<string, string | number | boolean>;
|
||||
}
|
||||
|
||||
export interface UserIdentity {
|
||||
phones?: string[];
|
||||
emails?: string[];
|
||||
externalUserId: string;
|
||||
}
|
||||
|
||||
export interface PersonalizeContext {
|
||||
userIdentity: UserIdentity;
|
||||
userAttributes?: Record<string, string>;
|
||||
forceDepersonalize?: boolean;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
messageId: string;
|
||||
title?: string;
|
||||
body?: string;
|
||||
sound?: string;
|
||||
silent?: boolean;
|
||||
customPayload?: Record<string, string>;
|
||||
internalData?: string;
|
||||
receivedTimestamp?: number;
|
||||
seenDate?: number;
|
||||
contentUrl?: string;
|
||||
seen?: boolean;
|
||||
geo?: boolean;
|
||||
originalPayload?: Record<string, string>; // iOS only
|
||||
vibrate?: boolean; // Android only
|
||||
icon?: string; // Android only
|
||||
category?: string; // Android only
|
||||
}
|
||||
|
||||
export interface MobileMessagingError {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export class DefaultMessageStorage {
|
||||
@Cordova({ sync: true })
|
||||
find(messageId: string, callback: (message: Message) => void) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
findAll(callback: (messages: Message[]) => void) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
delete(messageId: string, callback: () => void) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
deleteAll(callback: () => void) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Mobile Messaging
|
||||
* @description
|
||||
* Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application.
|
||||
* In almost no time of implementation you get push notification in your application and access to the features of [Infobip IP Messaging Platform](https://portal.infobip.com/push/).
|
||||
* This document describes library integration steps for your Cordova project.
|
||||
*
|
||||
* For more info see [Cordova plugin docs](https://github.com/infobip/mobile-messaging-cordova-plugin)
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MobileMessaging } from '@ionic-native/mobile-messaging/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private mobileMessaging: MobileMessaging) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.mobileMessaging.init({
|
||||
* applicationCode: '<your_application_code>',
|
||||
* geofencingEnabled: '<true/false>',
|
||||
* defaultMessageStorage: '<true/false>',
|
||||
* ios: {
|
||||
* notificationTypes: ['alert', 'badge', 'sound']
|
||||
* },
|
||||
* android: {
|
||||
* notificationIcon: <String; a resource name for a status bar icon (without extension), located in '/platforms/android/app/src/main/res/mipmap'>,
|
||||
* multipleNotifications: <Boolean; set to 'true' to enable multiple notifications>,
|
||||
* notificationAccentColor: <String; set to hex color value in format '#RRGGBB' or '#AARRGGBB'>
|
||||
* }}, (err) => {
|
||||
* ...
|
||||
* });
|
||||
*
|
||||
* this.mobileMessaging.register('messageReceived').subscribe((message: Message) => {
|
||||
* ...
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MobileMessaging',
|
||||
plugin: 'com-infobip-plugins-mobilemessaging',
|
||||
pluginRef: 'MobileMessaging',
|
||||
repo: 'https://github.com/infobip/mobile-messaging-cordova-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class MobileMessaging extends IonicNativePlugin {
|
||||
/**
|
||||
* Starts a new Mobile Messaging session.
|
||||
*
|
||||
* @name init
|
||||
* @param config. Configuration for Mobile Messaging
|
||||
* @param {Function} onInitError. Error callback
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
init(
|
||||
config: Configuration,
|
||||
onInitError?: (error: MobileMessagingError) => void
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register to event coming from MobileMessaging library.
|
||||
*
|
||||
* @name register
|
||||
* @param event
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
register(event: Event): Observable<Message> {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
on(event: Event): Observable<Message> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Un register from MobileMessaging library event.
|
||||
*
|
||||
* @name unregister
|
||||
* @param {String} eventName
|
||||
* @param {Function} handler will be unregistered from event
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
unregister(event: Event): Observable<Message> {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
off(event: Event): Observable<Message> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an event to the server eventually, handles possible errors and do retries for you.
|
||||
*
|
||||
* @name submitEvent
|
||||
* @param {Object} eventData. An object containing event data
|
||||
* {
|
||||
* definitionId: "eventDefinitionId"
|
||||
* properties: {
|
||||
* "stringAttribute": "string",
|
||||
* "numberAttribute": 1,
|
||||
* "dateAttribute": "2020-02-26T09:41:57Z",
|
||||
* "booleanAttribute": true
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
submitEvent(event: CustomEvent): void {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends an event to the server immediately.
|
||||
* You have to handle possible connection or server errors, do retries yourself.
|
||||
*
|
||||
* @name submitEventImmediately
|
||||
* @param {Object} eventData. An object containing event data
|
||||
* {
|
||||
* definitionId: "eventDefinitionId"
|
||||
* properties: {
|
||||
* "stringAttribute": "string",
|
||||
* "numberAttribute": 1,
|
||||
* "dateAttribute": "2020-02-26T09:41:57Z",
|
||||
* "booleanAttribute": true
|
||||
* }
|
||||
* }
|
||||
* @param {Function} callback will be called on result, you have to handle error and do retries yourself
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
submitEventImmediately(event: CustomEvent): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves user data to the server.
|
||||
*
|
||||
* @name saveUser
|
||||
* @param {Object} userData. An object containing user data
|
||||
*/
|
||||
@Cordova()
|
||||
saveUser(userData: UserData): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user data from the server.
|
||||
*
|
||||
* @name fetchUser
|
||||
*/
|
||||
@Cordova()
|
||||
fetchUser(): Promise<UserData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user data from the locally stored cache.
|
||||
*
|
||||
* @name getUser
|
||||
*/
|
||||
@Cordova()
|
||||
getUser(): Promise<UserData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves installation to the server.
|
||||
*
|
||||
* @name saveInstallation
|
||||
* @param {Object} installation. An object containing installation data
|
||||
*/
|
||||
@Cordova()
|
||||
saveInstallation(installation: Installation): Promise<Installation> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches installation from the server.
|
||||
*
|
||||
* @name fetchInstallation
|
||||
*/
|
||||
@Cordova()
|
||||
fetchInstallation(): Promise<Installation> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets locally cached installation.
|
||||
*
|
||||
* @name getInstallation
|
||||
*/
|
||||
@Cordova()
|
||||
getInstallation(): Promise<Installation> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets any installation as primary for this user.
|
||||
*
|
||||
* @name setInstallationAsPrimary
|
||||
* @param {String} pushRegistrationId of an installation
|
||||
* @param {Boolean} primary or not
|
||||
*/
|
||||
@Cordova()
|
||||
setInstallationAsPrimary(
|
||||
pushRegistrationId: string,
|
||||
primary: boolean
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs personalization of the current installation on the platform.
|
||||
*
|
||||
* @name personalize
|
||||
* @param {Object} context. An object containing user identity information as well as additional user attributes.
|
||||
*/
|
||||
@Cordova()
|
||||
personalize(context: PersonalizeContext): Promise<PersonalizeContext> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs depersonalization of the current installation on the platform.
|
||||
*
|
||||
* @name depersonalize
|
||||
*/
|
||||
@Cordova()
|
||||
depersonalize(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs depersonalization of the installation referenced by pushRegistrationId.
|
||||
*
|
||||
* @param {String} pushRegistrationId of the remote installation to depersonalize
|
||||
*/
|
||||
@Cordova()
|
||||
depersonalizeInstallation(pushRegistrationId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark messages as seen
|
||||
*
|
||||
* @name markMessagesSeen
|
||||
* @param {Array} messageIds of identifiers of message to mark as seen
|
||||
*/
|
||||
@Cordova()
|
||||
markMessagesSeen(messageIds: string[]): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays built-in error dialog so that user can resolve errors during sdk initialization.
|
||||
*
|
||||
* @name showDialogForError
|
||||
* @param {Number} errorCode to display dialog for
|
||||
*/
|
||||
@Cordova()
|
||||
showDialogForError(errorCode: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
defaultMessageStorage(): DefaultMessageStorage | undefined {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { CordovaInstance, InstanceProperty, IonicNativePlugin, Plugin, checkAvai
|
||||
|
||||
export interface AuthenticationResult {
|
||||
accessToken: string;
|
||||
accesSTokenType: string;
|
||||
accessTokenType: string;
|
||||
expiresOn: Date;
|
||||
idToken: string;
|
||||
isMultipleResourceRefreshToken: boolean;
|
||||
@@ -138,12 +138,13 @@ export class AuthenticationContext {
|
||||
* @param {String} extraQueryParameters
|
||||
* Extra query parameters (optional)
|
||||
* Parameters should be escaped before passing to this method (e.g. using 'encodeURI()')
|
||||
* @param {String} claims Claim parameter. Parameter should be used under conditional access scenarios (optional)
|
||||
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any): Promise<AuthenticationResult> {
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any, claims?: string): Promise<AuthenticationResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,3 +166,20 @@ export class AuthenticationContext {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class AuthenticationSettings {
|
||||
/**
|
||||
* Sets flag to use or skip authentication broker.
|
||||
* By default, the flag value is false and ADAL will not talk to broker.
|
||||
*
|
||||
* @param useBroker Flag to use or skip authentication broker
|
||||
*
|
||||
* @returns {Promise} Promise either fulfilled or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
static setUseBroker(useBroker: boolean): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ export interface MusicControlsOptions {
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.musicControls.listen(); // activates the observable above
|
||||
*
|
||||
@@ -203,7 +204,7 @@ export class MusicControls extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
updateElapsed(args: { elapsed: string; isPlaying: boolean }): void {}
|
||||
updateElapsed(args: { elapsed: number; isPlaying: boolean }): void {}
|
||||
|
||||
/**
|
||||
* Toggle dismissable:
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult, NativeGeocoderOptions } from '@ionic-native/native-geocoder/ngx';
|
||||
* import { NativeGeocoder, NativeGeocoderResult, NativeGeocoderOptions } from '@ionic-native/native-geocoder/ngx';
|
||||
*
|
||||
* constructor(private nativeGeocoder: NativeGeocoder) { }
|
||||
*
|
||||
@@ -20,16 +20,15 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* };
|
||||
*
|
||||
* this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818, options)
|
||||
* .then((result: NativeGeocoderReverseResult[]) => console.log(JSON.stringify(result[0])))
|
||||
* .then((result: NativeGeocoderResult[]) => console.log(JSON.stringify(result[0])))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* this.nativeGeocoder.forwardGeocode('Berlin', options)
|
||||
* .then((coordinates: NativeGeocoderForwardResult[]) => console.log('The coordinates are latitude=' + coordinates[0].latitude + ' and longitude=' + coordinates[0].longitude))
|
||||
* .then((result: NativeGeocoderResult[]) => console.log('The coordinates are latitude=' + result[0].latitude + ' and longitude=' + result[0].longitude))
|
||||
* .catch((error: any) => console.log(error));
|
||||
* ```
|
||||
* @interfaces
|
||||
* NativeGeocoderReverseResult
|
||||
* NativeGeocoderForwardResult
|
||||
* NativeGeocoderResult
|
||||
* NativeGeocoderOptions
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -47,32 +46,40 @@ export class NativeGeocoder extends IonicNativePlugin {
|
||||
* @param latitude {number} The latitude
|
||||
* @param longitude {number} The longitude
|
||||
* @param options {NativeGeocoderOptions} The options
|
||||
* @return {Promise<NativeGeocoderReverseResult[]>}
|
||||
* @return {Promise<NativeGeocoderResult[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
reverseGeocode(latitude: number, longitude: number, options?: NativeGeocoderOptions): Promise<NativeGeocoderReverseResult[]> { return; }
|
||||
reverseGeocode(latitude: number, longitude: number, options?: NativeGeocoderOptions): Promise<NativeGeocoderResult[]> { return; }
|
||||
|
||||
/**
|
||||
* Forward geocode a given address to find coordinates
|
||||
* @param addressString {string} The address to be geocoded
|
||||
* @param options {NativeGeocoderOptions} The options
|
||||
* @return {Promise<NativeGeocoderForwardResult[]>}
|
||||
* @return {Promise<NativeGeocoderResult[]>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
forwardGeocode(addressString: string, options?: NativeGeocoderOptions): Promise<NativeGeocoderForwardResult[]> { return; }
|
||||
forwardGeocode(addressString: string, options?: NativeGeocoderOptions): Promise<NativeGeocoderResult[]> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates format information about a reverse geocoding result.
|
||||
* Encapsulates format information about a geocoding result.
|
||||
* more Info:
|
||||
* - https://developer.apple.com/documentation/corelocation/clplacemark
|
||||
* - https://developer.android.com/reference/android/location/Address.html
|
||||
*/
|
||||
export interface NativeGeocoderReverseResult {
|
||||
export interface NativeGeocoderResult {
|
||||
/**
|
||||
* The latitude.
|
||||
*/
|
||||
latitude: string;
|
||||
/**
|
||||
* The longitude.
|
||||
*/
|
||||
longitude: string;
|
||||
/**
|
||||
* The country code.
|
||||
*/
|
||||
@@ -109,20 +116,10 @@ export interface NativeGeocoderReverseResult {
|
||||
* The subThoroughfare.
|
||||
*/
|
||||
subThoroughfare: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates format information about a forward geocoding result.
|
||||
*/
|
||||
export interface NativeGeocoderForwardResult {
|
||||
/**
|
||||
* The latitude.
|
||||
* The areasOfInterest
|
||||
*/
|
||||
latitude: string;
|
||||
/**
|
||||
* The longitude.
|
||||
*/
|
||||
longitude: string;
|
||||
areasOfInterest: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,18 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class NativeStorage extends IonicNativePlugin {
|
||||
/**
|
||||
* Initialises shared storage with the suite name when using app groups in iOS
|
||||
* @param reference {string}
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
initWithSuiteName(reference: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a value
|
||||
* @param reference {string}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Network extends IonicNativePlugin {
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
onchange(): Observable<any> {
|
||||
onChange(): Observable<any> {
|
||||
return merge(this.onConnect(), this.onDisconnect());
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import { Observable } from 'rxjs';
|
||||
declare let window: any;
|
||||
|
||||
// tag should be NfcTag, but keeping as NdefTag to avoid breaking existing code
|
||||
export interface NdefEvent {
|
||||
tag: NdefTag;
|
||||
}
|
||||
@@ -19,6 +20,9 @@ export interface NdefRecord {
|
||||
type: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use NfcTag
|
||||
*/
|
||||
export interface NdefTag {
|
||||
canMakeReadOnly: boolean;
|
||||
id: number[];
|
||||
@@ -29,6 +33,16 @@ export interface NdefTag {
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface NfcTag {
|
||||
id?: number[];
|
||||
canMakeReadOnly?: boolean;
|
||||
isWritable?: boolean;
|
||||
maxSize?: number;
|
||||
ndefMessage?: NdefRecord[];
|
||||
techTypes?: string[];
|
||||
type?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name NFC
|
||||
* @description
|
||||
@@ -50,43 +64,140 @@ export interface NdefTag {
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.nfc.addNdefListener(() => {
|
||||
* console.log('successfully attached ndef listener');
|
||||
* }, (err) => {
|
||||
* console.log('error attaching ndef listener', err);
|
||||
* }).subscribe((event) => {
|
||||
* console.log('received ndef message. the tag contains: ', event.tag);
|
||||
* console.log('decoded tag id', this.nfc.bytesToHexString(event.tag.id));
|
||||
* // Read NFC Tag - Android
|
||||
* // Once the reader mode is enabled, any tags that are scanned are sent to the subscriber
|
||||
* let flags = this.nfc.FLAG_READER_NFC_A | this.nfc.FLAG_READER_NFC_V;
|
||||
* this.readerMode$ = this.nfc.readerMode(flags).subscribe(
|
||||
* tag => console.log(JSON.stringify(tag)),
|
||||
* err => console.log('Error reading tag', err)
|
||||
* );
|
||||
*
|
||||
* let message = this.ndef.textRecord('Hello world');
|
||||
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
||||
* });
|
||||
* // Read NFC Tag - iOS
|
||||
* // On iOS, a NFC reader session takes control from your app while scanning tags then returns a tag
|
||||
* try {
|
||||
* let tag = await this.nfc.scanNdef();
|
||||
* console.log(JSON.stringify(tag));
|
||||
* } catch (err) {
|
||||
* console.log('Error reading tag', err);
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* For more details on NFC tag operations see https://github.com/chariotsolutions/phonegap-nfc
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NFC',
|
||||
plugin: 'phonegap-nfc',
|
||||
pluginRef: 'nfc',
|
||||
repo: 'https://github.com/chariotsolutions/phonegap-nfc',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Windows', 'Windows Phone 8']
|
||||
platforms: ['Android', 'BlackBerry 10', 'Windows', 'Windows Phone 8', 'iOS']
|
||||
})
|
||||
/**
|
||||
* @{ NFC } class methods
|
||||
*/
|
||||
@Injectable()
|
||||
export class NFC extends IonicNativePlugin {
|
||||
FLAG_READER = {
|
||||
NFC_A: 0,
|
||||
NFC_B: 0x2,
|
||||
NFC_F: 0x4,
|
||||
NFC_V: 0x8,
|
||||
NFC_BARCODE: 0x10,
|
||||
SKIP_NDEF_CHECK: 0x80,
|
||||
NO_PLATFORM_SOUNDS: 0x100,
|
||||
};
|
||||
|
||||
// Flags for readerMode
|
||||
// https://developer.android.com/reference/android/nfc/NfcAdapter#FLAG_READER_NFC_A
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NFC_A: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NFC_B: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NFC_F: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NFC_V: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NFC_BARCODE: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_SKIP_NDEF_CHECK: number;
|
||||
@CordovaProperty()
|
||||
FLAG_READER_NO_PLATFORM_SOUNDS: number;
|
||||
|
||||
/**
|
||||
* Read NFC tags sending the tag data to the success callback.
|
||||
* See https://github.com/chariotsolutions/phonegap-nfc#nfcreadermode
|
||||
*
|
||||
* @param flags
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'disableReaderMode',
|
||||
clearWithArgs: false
|
||||
})
|
||||
readerMode(flags: number): Observable<NfcTag> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function scanNdef starts the NFCNDEFReaderSession allowing iOS to scan NFC tags.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfcscanndef
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
scanNdef(): Promise<NfcTag> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function scanTag starts the NFCTagReaderSession allowing iOS to scan NFC tags.
|
||||
*
|
||||
* You probably want *scanNdef* for reading NFC tags on iOS. Only use scanTag if you need the tag UID.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfcscantag
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
scanTag(): Promise<NfcTag> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function cancelScan stops the NFCReaderSession returning control to your app.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfccancelscan
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
cancelScan(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the tag and enable I/O operations to the tag from this TagTechnology object.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfcconnect
|
||||
*
|
||||
* @param tech The tag technology class name e.g. android.nfc.tech.IsoDep
|
||||
* @param timeout The transceive(byte[]) timeout in milliseconds [optional]
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
connect(tech: string, timeout?: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close TagTechnology connection.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfcclose
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
close(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw command to the tag and receive the response.
|
||||
* https://github.com/chariotsolutions/phonegap-nfc#nfctransceive
|
||||
*
|
||||
* Example code https://github.com/chariotsolutions/phonegap-nfc#tag-technology-functions-1
|
||||
*
|
||||
* @param data an ArrayBuffer or string of hex data e.g. '00 A4 04 00 07 D2 76 00 00 85 01 00'
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
transceive(data: string | ArrayBuffer): Promise<ArrayBuffer> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the NFCNDEFReaderSession allowing iOS to scan NFC tags.
|
||||
* @deprecated use scanNdef or scanTag
|
||||
*
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
* @returns {Observable<any>}
|
||||
@@ -196,7 +307,7 @@ export class NFC extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
makeReadyOnly(): Promise<any> {
|
||||
makeReadOnly(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -394,7 +505,7 @@ export class Ndef extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
docodeTnf(tnf_byte: any): any {
|
||||
decodeTnf(tnf_byte: any): any {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,6 +565,16 @@ export class NfcUtil extends IonicNativePlugin {
|
||||
isType(record: NdefRecord, tnf: number, type: number[] | string): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
arrayBufferToHexString(buffer: ArrayBuffer): string {
|
||||
return;
|
||||
}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
hexStringToArrayBuffer(hexString: string): ArrayBuffer {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export class TextHelper extends IonicNativePlugin {
|
||||
|
||||
167
src/@ionic-native/plugins/ocr/index.ts
Normal file
167
src/@ionic-native/plugins/ocr/index.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export enum OCRSourceType {
|
||||
/**
|
||||
* Normal processing from a file URL. This is the overall recommended choice
|
||||
* for most applications. The distinction between file and native URLs is
|
||||
* only relevant on iOS; under Android `NORMFILEURL` and `NORMNATIVEURL`
|
||||
* are interchangeable.
|
||||
*/
|
||||
NORMFILEURL = 0,
|
||||
|
||||
/**
|
||||
* Normal processing from a native URL. Since this source type uses deprecated
|
||||
* OS APIs to interact with the camera plugin, it is best avoided, especially
|
||||
* if ongoing forward compatibility is a concern. For further information, see
|
||||
* https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr#plugin-usage
|
||||
* Under Android, this is equivalent to `NORMFILEURL`.
|
||||
*/
|
||||
NORMNATIVEURL = 1,
|
||||
|
||||
/**
|
||||
* Fast processing from a file URL. As the compression done internally causes
|
||||
* a significant loss in extraction quality, it should only be preferred when
|
||||
* dealing with large images containing significant amounts of text, where
|
||||
* the execution time required to perform normal processing is prohibitive.
|
||||
* The distinction between file and native URLs is only relevant on iOS;
|
||||
* under Android `FASTFILEURL` and `FASTNATIVEURL` are interchangeable.
|
||||
*/
|
||||
FASTFILEURL = 2,
|
||||
|
||||
/**
|
||||
* Fast processing from a native URL. See comments above for `FASTFILEURL`
|
||||
* concerning quality loss.
|
||||
*
|
||||
* The distinction between file and native URLs is only relevant on iOS;
|
||||
* under Android `FASTFILEURL` and `FASTNATIVEURL` are interchangeable.
|
||||
*/
|
||||
FASTNATIVEURL = 3,
|
||||
|
||||
/**
|
||||
* Normal processing from a base64-encoded string. Quality is equivalent
|
||||
* to `NORMFILEURL`, but due to significantly higher memory requirements,
|
||||
* is only appropriate for use with very small images.
|
||||
*/
|
||||
BASE64 = 4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Four points (ordered in clockwise direction) that enclose a text
|
||||
* component. May not be axis-aligned due to perspective skew.
|
||||
*/
|
||||
export interface OCRCorners {
|
||||
x1: number;
|
||||
y1: number;
|
||||
x2: number;
|
||||
y2: number;
|
||||
x3: number;
|
||||
y3: number;
|
||||
x4: number;
|
||||
y4: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An axis-aligned bounding rectangle. `x` and `y` represent the top left.
|
||||
*/
|
||||
export interface OCRRect {
|
||||
x: number;
|
||||
y: number;
|
||||
height: number;
|
||||
width: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the return value from the `recText` method.
|
||||
*/
|
||||
export interface OCRResult {
|
||||
/**
|
||||
* Was any text extracted? If `foundText` is false, no other fields are
|
||||
* returned. If foundText is true, all other fields are reliable.
|
||||
*/
|
||||
foundText: boolean;
|
||||
|
||||
/**
|
||||
* A block is the largest unit of text, which can be thought of as a paragraph.
|
||||
* This field consists of several parallel arrays, so the text in `blocktext[0]`
|
||||
* is bounded by `blockpoints[0]` and `blockframe[0]`.
|
||||
*/
|
||||
blocks: {
|
||||
blocktext: string[];
|
||||
blockpoints: OCRCorners[];
|
||||
blockframe: OCRRect[];
|
||||
};
|
||||
|
||||
/**
|
||||
* A line is the central unit of text, containing several elements. A block
|
||||
* can contain N lines. This field consists of several parallel arrays, so the
|
||||
* text in `linetext[0]` is bounded by `linepoints[0]` and `lineframe[0]`.
|
||||
*/
|
||||
lines: {
|
||||
linetext: string[];
|
||||
linepoints: OCRCorners[];
|
||||
lineframe: OCRRect[];
|
||||
};
|
||||
|
||||
/**
|
||||
* A word (or element) is the smallest unit of text. This field consists of
|
||||
* several parallel arrays, so the text in `wordtext[0]` is bounded by
|
||||
* `wordpoints[0]` and `wordframe[0]`.
|
||||
*/
|
||||
words: {
|
||||
wordtext: string[];
|
||||
wordpoints: OCRCorners[];
|
||||
wordframe: OCRRect[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @name OCR
|
||||
* @description
|
||||
* This plugin attempts to identify and extract text from an image.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { OCR, OCRSourceType } from '@ionic-native/ocr/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private ocr: OCR) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.ocr.recText(OCRSourceType.NORMFILEURL, "file://path/to/image.png")
|
||||
* .then((res: OCRResult) => console.log(JSON.stringify(res)))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* OCRCorners
|
||||
* OCRRect
|
||||
* OCRResult
|
||||
*
|
||||
* @enums
|
||||
* OCRSourceType
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'OCR',
|
||||
plugin: 'cordova-plugin-mobile-ocr',
|
||||
pluginRef: 'textocr',
|
||||
repo: 'https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class OCR extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Extract text from image
|
||||
* @param sourceType {OCRSourceType} type of image source
|
||||
* @param source {string} image source (either file URL or base64 string)
|
||||
* @return {Promise<OCRResult>} extracted text and geometry
|
||||
*/
|
||||
@Cordova()
|
||||
recText(sourceType: OCRSourceType, source: string): Promise<OCRResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -770,4 +770,19 @@ export class OneSignal extends IonicNativePlugin {
|
||||
*/
|
||||
@Cordova()
|
||||
userProvidedPrivacyConsent(callback: Function): void {}
|
||||
|
||||
/**
|
||||
* Allows you to use your own system's user ID's to send push notifications to your users.
|
||||
* To tie a user to a given user ID, you can use this method.
|
||||
* @param {string} externalId
|
||||
*/
|
||||
@Cordova()
|
||||
setExternalUserId(externalId: string): void {}
|
||||
|
||||
/**
|
||||
* Removes whatever was set as the current user's external user ID.
|
||||
*/
|
||||
@Cordova()
|
||||
removeExternalUserId(): void {}
|
||||
|
||||
}
|
||||
|
||||
87
src/@ionic-native/plugins/pdf-generator/index.ts
Normal file
87
src/@ionic-native/plugins/pdf-generator/index.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface PDFGeneratorOptions {
|
||||
/**
|
||||
* The document size, e.g., A2, A3, or A4.
|
||||
* Only supported on iOS.
|
||||
* The default is 'A4'.
|
||||
*/
|
||||
documentSize?: string;
|
||||
|
||||
/**
|
||||
* Option to change to landscape orientation.
|
||||
* Default is 'portrait'.
|
||||
*/
|
||||
landscape?: 'landscape' | 'portrait';
|
||||
|
||||
/**
|
||||
* The type to be returned, either 'share' or 'base64'.
|
||||
* If 'share is chosen, the PDF is shared with the system capabilities.
|
||||
* Default is 'base64'
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The desired filename the resulting PDF should have.
|
||||
* Default is 'default.pdf'
|
||||
*/
|
||||
fileName?: string;
|
||||
|
||||
/**
|
||||
* Option to set the base URL for pathing.
|
||||
* Default is 'null'.
|
||||
*/
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name PDFGenerator
|
||||
* @description
|
||||
* Simple plugin to generate (offline) pdf. The plugin transforms HTML to PDF and also provide the mechanism to share the pdf to other apps like Mail, etc.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PDFGenerator } from '@ionic-native/pdf-generator';
|
||||
*
|
||||
* constructor(private pdfGenerator: PDFGenerator) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.pdfGenerator.fromURL(url, options).then(base64String => console.log(base64String));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PDFGenerator',
|
||||
plugin: 'cordova-pdf-generator',
|
||||
pluginRef: 'cordova.plugins.pdf',
|
||||
repo: 'https://github.com/cesarvr/pdf-generator',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PDFGenerator extends IonicNativePlugin {
|
||||
/**
|
||||
* Creates a PDF using a URL, it download the document into an in memory Webkit object, and renders it into a PDF.
|
||||
* @param url {string} URL to create a PDF from
|
||||
* @param options {PDFGeneratorOptions} options for PDF generation
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
fromURL(url: string, options?: PDFGeneratorOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a PDF using string with the HTML representation, it download the document into an in memory Webkit object, and renders it into a PDF.
|
||||
* @param data {string} HTML string representation to create a PDF from
|
||||
* @param options {PDFGeneratorOptions} options for PDF generation
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
fromData(data: string, options?: PDFGeneratorOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class PhotoLibrary extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> {
|
||||
getLibrary(success?: (res?: any) => void, error?: (err?: any) => void, options?: GetLibraryOptions): Observable<LibraryItem[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
46
src/@ionic-native/plugins/preview-any-file/index.ts
Normal file
46
src/@ionic-native/plugins/preview-any-file/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
/**
|
||||
* @name PreviewAnyFile
|
||||
* @description
|
||||
* Whatever the file is PDF document, Word document, Excel, office document,zip archive file, image, text, html or anything else, you can perform a preview by this cordova Plugin to preview any file in native mode by providing the local or external URL.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-preview-any-file`. For more info, please see the [previewAnyFile plugin docs](https://github.com/mostafa-mansour1/previewAnyFile).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PreviewAnyFile } from '@ionic-native/preview-any-file/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private previewAnyFile: PreviewAnyFile) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.previewAnyFile.preview('file://filepath.ext')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PreviewAnyFile',
|
||||
plugin: 'cordova-plugin-preview-any-file', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: 'PreviewAnyFile', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: 'https://github.com/mostafa-mansour1/previewAnyFile', // the github repository URL for the plugin
|
||||
install: '', // OPTIONAL install command, in case the plugin requires variables
|
||||
installVariables: [], // OPTIONAL the plugin requires variables
|
||||
platforms: ['Android', 'iOS'] // Array of platforms supported, example: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class PreviewAnyFile extends IonicNativePlugin {
|
||||
/**
|
||||
* this function return SUCCESS in success callback if the file successfully opened, if the content is base64 you have to write it into file by cordova-plugin-file
|
||||
* @param url {string} full absolute URL for the file, if the path is content:// you need to resolve the native url, if the path is https:// it may not work in android
|
||||
* @return {Promise<any>} Returns a promise that resolves if the file opened reject if not;
|
||||
*/
|
||||
@Cordova()
|
||||
preview(url: string): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
|
||||
|
||||
interface FontOptions {
|
||||
name: string; // The name of the font family. Only supported on iOS
|
||||
size: number; // The size of the font. Only supported on iOS, Android
|
||||
italic: boolean; // Set to true to enable these font traits. Only supported on iOS
|
||||
bold: boolean; // Set to true to enable these font traits. Only supported on iOS
|
||||
align: 'left' | 'right' | 'center' | 'justified'; // Possible alignments are left, right, center and justified. Only supported on iOS
|
||||
color: string; // The color of the font in hexa-decimal RGB format - "FF0000" means red. Only supported on iOS
|
||||
}
|
||||
|
||||
interface HeaderFooterLabelOptions {
|
||||
text: string; // The plain text to display. Use %ld to indicate where to insert the page index. For example "Page %ld" would result into "Page 1", "Page 2", .... Only supported on iOS
|
||||
top: string; // The relative position where to place the label within the footer or header area. Only supported on iOS
|
||||
right: string; // The relative position where to place the label within the footer or header area. Only supported on iOS
|
||||
left: string; // The relative position where to place the label within the footer or header area. Only supported on iOS
|
||||
bottom: string; // The relative position where to place the label within the footer or header area. Only supported on iOS
|
||||
font: FontOptions; // The font attributes for the label. Only supported on iOS
|
||||
showPageIndex: boolean; // Set to true if you want to display the page index. Only supported on iOS
|
||||
}
|
||||
|
||||
export interface PrintOptions {
|
||||
/**
|
||||
* The name of the print job and the document
|
||||
@@ -8,16 +27,22 @@ export interface PrintOptions {
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The network URL of the printer.
|
||||
* Only supported on iOS.
|
||||
* The number of copies for the print task.
|
||||
* Only supported on iOS, Windows
|
||||
*/
|
||||
printerId?: string;
|
||||
copies?: number;
|
||||
|
||||
/**
|
||||
* Limits the pages to print even the document contains more.
|
||||
* To skip the last n pages you can assign a negative value on iOS.
|
||||
* Only supported on iOS, Android
|
||||
*/
|
||||
pageCount?: number;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Either double-sided on short site (duplex:'short'),
|
||||
* double-sided on long site (duplex:'long') or single-sided (duplex:'none').
|
||||
*/
|
||||
duplex?: boolean;
|
||||
|
||||
@@ -25,18 +50,85 @@ export interface PrintOptions {
|
||||
* The orientation of the printed content, portrait or landscape
|
||||
* Portrait by default.
|
||||
*/
|
||||
landscape?: boolean;
|
||||
orientation?: 'landscape' | 'portrait';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
monochrome?: boolean;
|
||||
|
||||
/**
|
||||
* The Size and position of the print view
|
||||
* If your application only prints black text, setting this property to true can result in better performance in many cases.
|
||||
* False by default.
|
||||
* Only supported on iOS, Windows
|
||||
*/
|
||||
bounds?: number[] | any;
|
||||
photo?: boolean;
|
||||
|
||||
/**
|
||||
* Set to false to disable downscaling the image to fit into the content aread.
|
||||
* Only supported on Android
|
||||
*/
|
||||
autoFit?: boolean;
|
||||
|
||||
/**
|
||||
* The network URL to the printer.
|
||||
* Only supported on iOS
|
||||
*/
|
||||
printer?: string;
|
||||
|
||||
/**
|
||||
* Defines the maximum size of the content area.
|
||||
* Only supported on iOS
|
||||
*/
|
||||
maxHeight?: string;
|
||||
|
||||
/**
|
||||
* Defines the maximum size of the content area.
|
||||
* Only supported on iOS
|
||||
*/
|
||||
maxWidth?: string;
|
||||
|
||||
/**
|
||||
* Set to false to avoid margins.
|
||||
* The margins for each printed page. Each printer might have its own minimum margins depends on media type and paper format.
|
||||
*/
|
||||
margin?: boolean | {
|
||||
top?: string;
|
||||
left?: string;
|
||||
right?: string;
|
||||
bottom?: string;
|
||||
};
|
||||
|
||||
ui?: {
|
||||
hideNumberOfCopies?: string; // Set to true to hide the control for the number of copies. Only supported on iOS
|
||||
hidePaperFormat?: string; // Set to true to hide the control for the paper format. Only supported on iOS
|
||||
top?: number; // The position of the printer picker. Only supported on iPad
|
||||
left?: number; // The position of the printer picker. Only supported on iPad
|
||||
height?: number; // The size of the printer picker. Only supported on iPad
|
||||
width?: number; // The size of the printer picker. Only supported on iPad
|
||||
};
|
||||
|
||||
paper?: {
|
||||
width: string; // The dimensions of the paper – iOS will will try to choose a format which fits bests. Only supported on iOS
|
||||
height: string; // The dimensions of the paper – iOS will will try to choose a format which fits bests. Only supported on iOS
|
||||
name: string; // The name of the format like IsoA4 or Roll22Inch. https://docs.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize. Only supported on Windows
|
||||
length: string; // On roll-fed printers you can decide when the printer cuts the paper. https://docs.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize. Only supported on iOs
|
||||
};
|
||||
|
||||
font?: FontOptions;
|
||||
|
||||
header?: {
|
||||
height: string; // The height of the header or footer on each page. Only supported on iOS
|
||||
labels: string[]; // An array of labels to display. Only use if there are more then one. Only supported on iOS
|
||||
label: HeaderFooterLabelOptions;
|
||||
};
|
||||
|
||||
footer?: {
|
||||
height: string; // The height of the header or footer on each page. Only supported on iOS
|
||||
labels: string[]; // An array of labels to display. Only use if there are more then one. Only supported on iOS
|
||||
label: HeaderFooterLabelOptions;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,11 +146,10 @@ export interface PrintOptions {
|
||||
*
|
||||
* let options: PrintOptions = {
|
||||
* name: 'MyDocument',
|
||||
* printerId: 'printer007',
|
||||
* duplex: true,
|
||||
* landscape: true,
|
||||
* grayscale: true
|
||||
* }
|
||||
* orientation: 'landscape',
|
||||
* monochrome: true
|
||||
* }
|
||||
*
|
||||
* this.printer.print(content, options).then(onSuccess, onError);
|
||||
* ```
|
||||
@@ -85,14 +176,14 @@ export class Printer extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
|
||||
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
|
||||
* Checks To check if printing is supported in general
|
||||
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
check(): Promise<any> {
|
||||
return getPromise<any>((resolve: Function) => {
|
||||
Printer.getPlugin()
|
||||
.check((avail: boolean, count: any) => {
|
||||
.canPrintItem((avail: boolean, count: any) => {
|
||||
resolve({ avail, count });
|
||||
});
|
||||
});
|
||||
@@ -117,7 +208,7 @@ export class Printer extends IonicNativePlugin {
|
||||
successIndex: 2,
|
||||
errorIndex: 4
|
||||
})
|
||||
print(content: string | HTMLElement, options?: PrintOptions): Promise<any> {
|
||||
print(content?: string | HTMLElement, options?: PrintOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaCheck, CordovaInstance, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Information about the currently running app
|
||||
*/
|
||||
export interface AppInfo {
|
||||
platform: string;
|
||||
platformVersion: string;
|
||||
version: string;
|
||||
bundleName: string;
|
||||
bundleVersion: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about the current live update
|
||||
*/
|
||||
export interface DeployInfo {
|
||||
deploy_uuid: string;
|
||||
channel: string;
|
||||
binary_version: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object for manually configuring deploy
|
||||
*/
|
||||
export interface DeployConfig {
|
||||
appId?: string;
|
||||
host?: string;
|
||||
channel?: string;
|
||||
}
|
||||
|
||||
export type ProgressMessage = number | string;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class ProDeploy {
|
||||
constructor(private _objectInstance: any) {}
|
||||
|
||||
/**
|
||||
* Re-initialize Deploy plugin with a new App ID and host. Not used in most cases.
|
||||
* @param config A valid Deploy config object
|
||||
*/
|
||||
@CordovaInstance()
|
||||
init(config: DeployConfig): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Check a channel for an available update
|
||||
* @return {Promise<string>} Resolves with 'true' or 'false', or rejects with an error.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
check(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download an available version
|
||||
* @return {Observable<ProgressMessage>} Updates with percent completion, or errors with a message.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
observable: true
|
||||
})
|
||||
download(): Observable<ProgressMessage> { return; }
|
||||
|
||||
/**
|
||||
* Unzip the latest downloaded version
|
||||
* @return {Observable<ProgressMessage>} Updates with percent completion, or errors with a message.
|
||||
*/
|
||||
@CordovaInstance({
|
||||
observable: true
|
||||
})
|
||||
extract(): Observable<ProgressMessage> { return; }
|
||||
|
||||
/**
|
||||
* Reload app with the deployed version
|
||||
*/
|
||||
@CordovaInstance()
|
||||
redirect(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Get info about the version running on the device
|
||||
* @return {Promise<DeployInfo>} Information about the current version running on the app.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
info(): Promise<DeployInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List versions stored on the device
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVersions(): Promise<string[]> { return; }
|
||||
|
||||
/**
|
||||
* Delete a version stored on the device by UUID
|
||||
* @param version A version UUID
|
||||
*/
|
||||
@CordovaInstance()
|
||||
deleteVersion(version: string): Promise<void> { return; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Pro
|
||||
* @description
|
||||
* This plugin enables Ionic Pro services like live updates and error monitoring
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Pro, AppInfo, DeployInfo } from '@ionic-native/pro/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private pro: Pro) { }
|
||||
*
|
||||
* // Get app info
|
||||
* this.pro.getAppInfo().then((res: AppInfo) => {
|
||||
* console.log(res)
|
||||
* })
|
||||
*
|
||||
* // Get live update info
|
||||
* this.pro.deploy.info().then((res: DeployInfo) => {
|
||||
* console.log(res)
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Pro',
|
||||
plugin: 'cordova-plugin-ionic',
|
||||
pluginRef: 'IonicCordova',
|
||||
repo: 'https://github.com/ionic-team/cordova-plugin-ionic',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install:
|
||||
'ionic cordova plugin add cordova-plugin-ionic --save --variable APP_ID="XXXXXXXX" --variable CHANNEL_NAME="Channel"'
|
||||
})
|
||||
@Injectable()
|
||||
export class Pro extends IonicNativePlugin {
|
||||
_deploy: ProDeploy;
|
||||
|
||||
/**
|
||||
* Ionic Pro Deploy .js API.
|
||||
*/
|
||||
@CordovaCheck({ sync: true })
|
||||
deploy(): ProDeploy {
|
||||
if (this._deploy) {
|
||||
return this._deploy;
|
||||
} else {
|
||||
this._deploy = new ProDeploy(Pro.getPlugin().deploy);
|
||||
return this._deploy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
enableCrashLogging(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
checkForPendingCrash(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
loadPendingCrash(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not yet implemented
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
forceCrash(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the currently running app
|
||||
* @return {Promise<any>} Returns a promise that resolves with current app info
|
||||
*/
|
||||
@Cordova()
|
||||
getAppInfo(): Promise<AppInfo> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
629
src/@ionic-native/plugins/pspdfkit-cordova/index.ts
Normal file
629
src/@ionic-native/plugins/pspdfkit-cordova/index.ts
Normal file
@@ -0,0 +1,629 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name PSPDFKit-Cordova
|
||||
* @description
|
||||
* The official plugin to use PSPDFKit with Cordova and Ionic.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PSPDFKit } from '@ionic-native/pspdfkit-cordova/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private pspdfkit: PSPDFKit) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Set your license key here.
|
||||
* this.pspdfkit.setLicenseKey("YOUR KEY");
|
||||
*
|
||||
* // Show a PDF in single page mode, with a black background.
|
||||
* this.pspdfkit.present('document.pdf', {pageMode: 'single', backgroundColor: "black"})
|
||||
* .then(result => {
|
||||
* console.log(result); // Success
|
||||
* })
|
||||
* .catch(error => {
|
||||
* console.log(error); // Failed
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* // Scroll to page at index 1.
|
||||
* this.pspdfkit.setPage(1, true);
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PSPDFKit',
|
||||
plugin: 'pspdfkit-cordova',
|
||||
pluginRef: 'PSPDFKit',
|
||||
repo: 'https://github.com/PSPDFKit/PSPDFKit-Cordova',
|
||||
install: 'ionic cordova plugin add pspdfkit-cordova',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class PSPDFKit extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Activates PSPDFKit with your license key from https://customers.pspdfkit.com.
|
||||
*
|
||||
* @param key {string} The license key.
|
||||
* @return {Promise<any>} Success and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
setLicenseKey(licenseKey: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS: Displays a PDF in a full-screen modal.
|
||||
* Android: Opens the PSPDFActivity to show a document from the local device file system.
|
||||
*
|
||||
* @param path {string} The path should be a string containing the file path (not URL) for the PDF. Relative paths are assumed to be relative to the www directory (if the path has a different base URL set, this will be ignored). To specify a path inside the application documents or library directory, use a `~`, e.g. `"~/Documents/mypdf.pdf"` or `"~/Library/Application Support/mypdf.pdf"`. Path can be null, but must not be omitted
|
||||
* @param options {any} The `options` parameter is an optional object containing configuration properties for the PDF document and/or view controller. All currently supported values are listed below under Options.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
present(path: string, options?: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the PSPDFActivity to show a document from the app's assets folder. This method copies the
|
||||
* file to the internal app directory on the device before showing it.
|
||||
* @param assetFile {string} Relative path within the app's assets folder.
|
||||
* @param options {any} PSPDFKit configuration options.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
presentFromAssets(assetFile: string, options?: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a PDF in a full-screen modal and imports annotations from a given XFDF file.
|
||||
*
|
||||
* @param path {string} Should be a string containing the file path (not URL) for the PDF. Relative paths are assumed to be relative to the www directory (if the path has a different base URL set, this will be ignored). To specify a path inside the application documents or library directory, use a `~`, e.g. `"~/Documents/mypdf.pdf"` or `"~/Library/Application Support/mypdf.pdf"`. Path can be null, but must not be omitted
|
||||
* @param xfdfPath {string} should be a string containing the file path (not URL) for the XFDF file backing the PDF document. Relative paths are assumed to be relative to the www directory (if the xfdf path has a different base URL set, we will create an XFDF file in `'"~/Documents/" + xfdfPath'`). To specify a path inside the application documents or library directory, use a ~, e.g. `"~/Documents/myXFDF.xfdf"` or `"~/Library/Application Support/myXFDF.xfdf"`. The xfdfPath cannot be null and must not be omitted.
|
||||
* @param options {any} The `options` parameter is an optional object containing configuration properties for the PDF document and/or view controller. All currently supported values are listed below under Options.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
presentWithXFDF(path: string, xfdfPath: string, options?: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS: Dismisses the modally presented PDF view.
|
||||
* Android: Dismisses any previously launched PDF activity. Calls the optional callback function after all activities have been dismissed.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
dismiss(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the current PDF.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
reload(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Saves the document to original location if it has been changed. If there were no changes to the
|
||||
* document, the document file will not be modified.
|
||||
* Provides "wasModified" as a part of a successful response which will be equal to true if
|
||||
* the file was modified and changes were saved. false if there was nothing to save.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
saveDocument(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves any changed annotations in the current document.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
saveAnnotations(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true in the success (or result) callback if the document has unsaved annotation. Returns false otherwise.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
getHasDirtyAnnotations(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a search for the specified query.
|
||||
*
|
||||
* @param query {string} Search Term to query
|
||||
* @param animated {boolean} Determines if the search should be animated (if omitted, the search will not be animated). The optional headless argument determines whether the search UI should be disaplyed (if omitted, the search UI *will* be displayed).
|
||||
* @param headless {boolean} Determines whether the search UI should be disaplyed (if omitted, the search UI *will* be displayed).
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
search(query: string, animated?: boolean, headless?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets multiple document and view controller settings at once.
|
||||
*
|
||||
* @param options {any} The options set will be applied to the current document (if there is one) as well as all subsequently displayed documents. All currently supported values are listed below under Options.
|
||||
* @param animated {boolean} determines if the property should be animated. Not all property changes can be animated, so if the property does not support animation the animated argument will be ignored.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
setOptions(options: any, animated: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets several document or view controller options in a single call.
|
||||
*
|
||||
* @param names {any} array of option names
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
getOptions(names: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single document or view controller settings at once.
|
||||
*
|
||||
* @param name {string} the option name
|
||||
* @param value {any} the option value
|
||||
* @param animated {boolean} determines if the property should be animated. Not all property changes can be animated, so if the property does not support animation the animated argument will be ignored.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
setOption(name: string, value: any, animated: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single document or view controller settings at once.
|
||||
*
|
||||
* @param name {string} the option name
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
getOption(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current visible page.
|
||||
*
|
||||
* @param page {number} the page index
|
||||
* @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated).
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
setPage(page: number, animated?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently visible page.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
getPage(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the page count of the current document.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
getPageCount(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to the next page.
|
||||
*
|
||||
* @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated).
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
scrollToNextPage(animated?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to the previous page.
|
||||
*
|
||||
* @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated).
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
scrollToPreviousPage(animated?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the appearance mode.
|
||||
*
|
||||
* @param appearanceMode {string} the appearance mode. Can be 'default', 'sepia', or 'night'
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
setAppearanceMode(appearanceMode: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the entire render cache. This invalidates render caches for all previously rendered documents.
|
||||
* Consider using `removeCacheForPresentedDocument()` or `clearCacheForPage()` instead of this,
|
||||
* since invalidating single documents or specific page caches since excessive cache invalidation may decrease performance.
|
||||
*
|
||||
* @param clearDiskCache {boolean} optional parameter. Android: if set to true clears disk cache as well. iOS: has no effect.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
clearCache(clearDiskCache?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cache from the currently presented document.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
removeCacheForPresentedDocument(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the render cache for the specified page.
|
||||
*
|
||||
* @param pageIndex {number} 0-based index of the page whose render cache should be invalidated.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
clearCacheForPage(pageIndex: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the annotation toolbar
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
hideAnnotationToolbar(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the annotation toolbar
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
showAnnotationToolbar(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the annotation toolbar
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
toggleAnnotationToolbar(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the passed in document Instant JSON.
|
||||
*
|
||||
* @param jsonValue {string} The document Instant JSON to apply.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
applyInstantJSON(jsonValue: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new annotation to the current document using the Instant JSON Annotation
|
||||
* payload - https://pspdfkit.com/guides/ios/current/importing-exporting/instant-json/#instant-annotation-json-api
|
||||
*
|
||||
* @param jsonAnnotation {string} Instant JSON of the annotation to add.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
addAnnotation(jsonAnnotation: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a given annotation from the current document. The annotaion is expected to be in Instant
|
||||
* JSON format - https://pspdfkit.com/guides/ios/current/importing-exporting/instant-json/#instant-annotation-json-api
|
||||
*
|
||||
* @param jsonAnnotation {string} Instant JSON of the annotation to remove.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
removeAnnotation(jsonAnnotation: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all annotations of the given type from the page.
|
||||
*
|
||||
* @param pageIndex {number} The page to get the annotations for.
|
||||
* @param type {string} The type of annotations to get (See here for types https://pspdfkit.com/guides/server/current/api/json-format/) or `null` to get all annotations.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
getAnnotations(pageIndex: number, type?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all unsaved changes to annotations.
|
||||
*
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
getAllUnsavedAnnotations(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the form element of the fully qualified name.
|
||||
*
|
||||
* @param value {string} the value.
|
||||
* @param fullyQualifiedName {string} the fully qualified name of the form element.
|
||||
* @return {Promise<any>} callback Success (result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
setFormFieldValue(value: string, fullyQualifiedName: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the form element of the fully qualified name.
|
||||
*
|
||||
* @param fullyQualifiedName {string} description.
|
||||
* @return {Promise<any>} callback Success (result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
getFormFieldValue(fullyQualifiedName: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports all annotations from the specified XFDF file to the current document.
|
||||
*
|
||||
* @param xfdfPath {string} XFDF file path to import annotations
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
importXFDF(xfdfPath: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports all annotations from the current document to the specified XFDF file path.
|
||||
*
|
||||
* @param xfdfPath {string} XFDF file path to export annotations
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
exportXFDF(xfdfPath: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes annotations (embed, remove, flatten, or print) and saves the processed document to the given document path.
|
||||
*
|
||||
* @param annotationChange {string} the annotation change. Can be 'flatten', 'remove', 'embed' or 'print'
|
||||
* @param processedDocumentPath {string} description.
|
||||
* @param annotationType {string} The optional string annotationType argument. If omitted, we process 'All' annotations. The annotation type can have one of the following values: None, Undefined, Link, Highlight, StrikeOut, Underline, Squiggly, FreeText, Ink, Square, Circle, Line, Text, Stamp, Caret, RichMedia, Screen, Widget, Sound, FileAttachment, Polygon, PolyLine, Popup, Watermark, TrapNet, 3D, Redact, All.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
* -Android
|
||||
*/
|
||||
@Cordova()
|
||||
processAnnotations(annotationChange: string, processedDocumentPath: string, annotationType: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a PDF document from HTML string.
|
||||
*
|
||||
* @param html {string} HTML string.
|
||||
* @param fileName {string} File name of the generated PDF.
|
||||
* @param options {string} Options to be considered when converting the HTML string to PDF.
|
||||
* @return {Promise<any>} callback Success (or result) and error callback function.
|
||||
*
|
||||
* __Supported Platforms__
|
||||
*
|
||||
* -iOS
|
||||
*/
|
||||
@Cordova()
|
||||
convertPDFFromHTMLString(html: string, fileName: string, options: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
919
src/@ionic-native/plugins/purchases/index.ts
Normal file
919
src/@ionic-native/plugins/purchases/index.ts
Normal file
@@ -0,0 +1,919 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @deprecated use ATTRIBUTION_NETWORK instead
|
||||
*
|
||||
* Enum for attribution networks
|
||||
* @readonly
|
||||
* @enum {Number}
|
||||
*/
|
||||
export enum ATTRIBUTION_NETWORKS {
|
||||
APPLE_SEARCH_ADS = 0,
|
||||
ADJUST = 1,
|
||||
APPSFLYER = 2,
|
||||
BRANCH = 3,
|
||||
TENJIN = 4,
|
||||
FACEBOOK = 5,
|
||||
}
|
||||
|
||||
export enum ATTRIBUTION_NETWORK {
|
||||
APPLE_SEARCH_ADS = 0,
|
||||
ADJUST = 1,
|
||||
APPSFLYER = 2,
|
||||
BRANCH = 3,
|
||||
TENJIN = 4,
|
||||
FACEBOOK = 5,
|
||||
}
|
||||
|
||||
export enum PURCHASE_TYPE {
|
||||
/**
|
||||
* A type of SKU for in-app products.
|
||||
*/
|
||||
INAPP = 'inapp',
|
||||
|
||||
/**
|
||||
* A type of SKU for subscriptions.
|
||||
*/
|
||||
SUBS = 'subs',
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use PURCHASE_TYPE instead
|
||||
*
|
||||
* Enum for attribution networks
|
||||
* @readonly
|
||||
* @enum {String}
|
||||
*/
|
||||
export enum ProductType {
|
||||
SUBS = 'subs',
|
||||
INAPP = 'inapp'
|
||||
}
|
||||
|
||||
export enum PRORATION_MODE {
|
||||
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,
|
||||
|
||||
/**
|
||||
* Replacement takes effect immediately, and the remaining time will be
|
||||
* prorated and credited to the user. This is the current default behavior.
|
||||
*/
|
||||
IMMEDIATE_WITH_TIME_PRORATION = 1,
|
||||
|
||||
/**
|
||||
* Replacement takes effect immediately, and the billing cycle remains the
|
||||
* same. The price for the remaining period will be charged. This option is
|
||||
* only available for subscription upgrade.
|
||||
*/
|
||||
IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,
|
||||
|
||||
/**
|
||||
* Replacement takes effect immediately, and the new price will be charged on
|
||||
* next recurrence time. The billing cycle stays the same.
|
||||
*/
|
||||
IMMEDIATE_WITHOUT_PRORATION = 3,
|
||||
|
||||
/**
|
||||
* Replacement takes effect when the old plan expires, and the new price will
|
||||
* be charged at the same time.
|
||||
*/
|
||||
DEFERRED = 4,
|
||||
}
|
||||
|
||||
export enum PACKAGE_TYPE {
|
||||
|
||||
/**
|
||||
* A package that was defined with a custom identifier.
|
||||
*/
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
|
||||
/**
|
||||
* A package that was defined with a custom identifier.
|
||||
*/
|
||||
CUSTOM = 'CUSTOM',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined lifetime identifier.
|
||||
*/
|
||||
LIFETIME = 'LIFETIME',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined annual identifier.
|
||||
*/
|
||||
ANNUAL = 'ANNUAL',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined six month identifier.
|
||||
*/
|
||||
SIX_MONTH = 'SIX_MONTH',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined three month identifier.
|
||||
*/
|
||||
THREE_MONTH = 'THREE_MONTH',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined two month identifier.
|
||||
*/
|
||||
TWO_MONTH = 'TWO_MONTH',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined monthly identifier.
|
||||
*/
|
||||
MONTHLY = 'MONTHLY',
|
||||
|
||||
/**
|
||||
* A package configured with the predefined weekly identifier.
|
||||
*/
|
||||
WEEKLY = 'WEEKLY',
|
||||
}
|
||||
|
||||
export enum INTRO_ELIGIBILITY_STATUS {
|
||||
/**
|
||||
* RevenueCat doesn't have enough information to determine eligibility.
|
||||
*/
|
||||
INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,
|
||||
/**
|
||||
* The user is not eligible for a free trial or intro pricing for this product.
|
||||
*/
|
||||
INTRO_ELIGIBILITY_STATUS_INELIGIBLE,
|
||||
/**
|
||||
* The user is eligible for a free trial or intro pricing for this product.
|
||||
*/
|
||||
INTRO_ELIGIBILITY_STATUS_ELIGIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Purchases
|
||||
* @description
|
||||
* Purchases is a cross platform solution for managing in-app subscriptions. A backend is also provided via [RevenueCat](https://www.revenuecat.com)
|
||||
*
|
||||
* ## Features
|
||||
* | | RevenueCat |
|
||||
* | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
* | ✅ | Server-side receipt validation |
|
||||
* | ➡️ | [Webhooks](https://docs.revenuecat.com/docs/webhooks) - enhanced server-to-server communication with events for purchases, renewals, cancellations, and more |
|
||||
* | 🎯 | Subscription status tracking - know whether a user is subscribed whether they're on iOS, Android or web |
|
||||
* | 📊 | Analytics - automatic calculation of metrics like conversion, mrr, and churn |
|
||||
* | 📝 | [Online documentation](https://docs.revenuecat.com/docs) up to date |
|
||||
* | 🔀 | [Integrations](https://www.revenuecat.com/integrations) - over a dozen integrations to easily send purchase data where you need it |
|
||||
* | 💯 | Well maintained - [frequent releases](https://github.com/RevenueCat/cordova-plugin-purchases/releases) |
|
||||
* | 📮 | Great support - [Help Center](https://revenuecat.zendesk.com) |
|
||||
* | 🤩 | Awesome [new features](https://trello.com/b/RZRnWRbI/revenuecat-product-roadmap) |
|
||||
*
|
||||
* ## Getting Started
|
||||
*
|
||||
* For more detailed information, you can view our complete documentation at [docs.revenuecat.com](https://docs.revenuecat.com/docs).
|
||||
*
|
||||
* @usage
|
||||
* #### 1. Get a RevenueCat API key
|
||||
*
|
||||
* Log in to the [RevenueCat dashboard](https://app.revenuecat.com) and obtain a free API key for your application.
|
||||
*
|
||||
* #### 2. Initialize the SDK
|
||||
*
|
||||
* You should only configure _Purchases_ once (usually on app launch) as soon as your app has a unique user id for your user. This can be when a user logs in if you have accounts or on launch if you can generate a random user identifier.
|
||||
*
|
||||
* ```typescript
|
||||
* import { Platform } from "@ionic/angular";
|
||||
* import { Purchases } from "@ionic-native/purchases/ngx";
|
||||
*
|
||||
* constructor(public platform: Platform, private purchases: Purchases) {
|
||||
* platform.ready().then(() => {
|
||||
* this.purchases.setDebugLogsEnabled(true); // Enable to get debug logs
|
||||
* this.purchases.setup("my_api_key", "my_app_user_id");
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* #### 3. Quickstart
|
||||
* Please follow the [Quickstart Guide](https://docs.revenuecat.com/docs/) for more information on how to use the SDK
|
||||
*
|
||||
* ### Requirements
|
||||
* Requires XCode 11.0+ and minimum target iOS 9.0+
|
||||
* This plugin has been tested with cordova-plugin-purchases@
|
||||
*
|
||||
* @interfaces
|
||||
* PurchasesError
|
||||
* IntroEligibility
|
||||
* UpgradeInfo
|
||||
* PurchasesOfferings
|
||||
* PurchasesOffering
|
||||
* PurchasesPackage
|
||||
* PurchasesProduct
|
||||
* PurchaserInfo
|
||||
* PurchasesEntitlementInfos
|
||||
* PurchasesEntitlementInfo
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Purchases',
|
||||
plugin: 'cordova-plugin-purchases@1.1.0',
|
||||
pluginRef: 'Purchases', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: 'https://github.com/RevenueCat/cordova-plugin-purchases', // the github repository URL for the plugin
|
||||
platforms: ['Android', 'iOS'] // Array of platforms supported, example: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class Purchases extends IonicNativePlugin {
|
||||
|
||||
static ATTRIBUTION_NETWORKS = ATTRIBUTION_NETWORK;
|
||||
/**
|
||||
* Enum for attribution networks
|
||||
* @readonly
|
||||
* @enum {Number}
|
||||
*/
|
||||
static ATTRIBUTION_NETWORK = ATTRIBUTION_NETWORK;
|
||||
|
||||
/**
|
||||
* Supported SKU types.
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
*/
|
||||
static PURCHASE_TYPE = PURCHASE_TYPE;
|
||||
|
||||
/**
|
||||
* Replace SKU's ProrationMode.
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
static PRORATION_MODE = PRORATION_MODE;
|
||||
|
||||
/**
|
||||
* Enumeration of all possible Package types.
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
*/
|
||||
static PACKAGE_TYPE = PACKAGE_TYPE;
|
||||
|
||||
/**
|
||||
* Enum of different possible states for intro price eligibility status.
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
static INTRO_ELIGIBILITY_STATUS = INTRO_ELIGIBILITY_STATUS;
|
||||
|
||||
/**
|
||||
* Sets up Purchases with your API key and an app user id.
|
||||
* @param {string} apiKey RevenueCat API Key. Needs to be a String
|
||||
* @param {string?} appUserID A unique id for identifying the user
|
||||
* @param {boolean} observerMode An optional boolean. Set this to TRUE if you have your own IAP implementation and
|
||||
* want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have
|
||||
* to acknowledge the purchases yourself.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setup(
|
||||
apiKey: string,
|
||||
appUserID?: string | null,
|
||||
observerMode = false
|
||||
): void {}
|
||||
|
||||
/**
|
||||
* Set this to true if you are passing in an appUserID but it is anonymous, this is true by default if you didn't pass an appUserID
|
||||
* If a user tries to purchase a product that is active on the current app store account, we will treat it as a restore and alias
|
||||
* the new ID with the previous id.
|
||||
* @param allowSharing {boolean} true if enabled, false to disabled
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setAllowSharingStoreAccount(allowSharing: boolean): void {}
|
||||
|
||||
/**
|
||||
* Add a dict of attribution information
|
||||
* @param {object} data Attribution data from any of the attribution networks in Purchases.ATTRIBUTION_NETWORKS
|
||||
* @param {ATTRIBUTION_NETWORK} network Which network, see Purchases.ATTRIBUTION_NETWORK
|
||||
* @param {string?} networkUserId An optional unique id for identifying the user. Needs to be a string.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
addAttributionData(
|
||||
data: { [key: string]: any },
|
||||
network: ATTRIBUTION_NETWORK,
|
||||
networkUserId?: string
|
||||
): void {}
|
||||
|
||||
/**
|
||||
* Gets the Offerings configured in the dashboard
|
||||
*
|
||||
* @return {Observable<PurchasesOfferings>} Will return a [PurchasesError] if the offerings are not properly configured in RevenueCat or if there is another error retrieving them.
|
||||
*/
|
||||
@Cordova()
|
||||
getOfferings(): Promise<PurchasesOfferings> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the product info
|
||||
* @param {string[]} productIdentifiers Array of product identifiers
|
||||
* @param {PURCHASE_TYPE} type Optional type of products to fetch, can be inapp or subs. Subs by default
|
||||
*
|
||||
* @return {Promise<PurchasesProduct[]>} Will return a [PurchasesError] if the products are not properly configured in RevenueCat or if there is another error retrieving them.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
getProducts(
|
||||
productIdentifiers: string[],
|
||||
type: PURCHASE_TYPE = PURCHASE_TYPE.SUBS
|
||||
): Promise<PurchasesProduct[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} MakePurchaseResponse
|
||||
* @property {string} productIdentifier - The product identifier that has been purchased
|
||||
* @property {PurchaserInfo} purchaserInfo - The new PurchaserInfo after the successful purchase
|
||||
*/
|
||||
|
||||
/**
|
||||
* Make a purchase
|
||||
*
|
||||
* @deprecated Use purchaseProduct instead.
|
||||
*
|
||||
* @param {string} productIdentifier The product identifier of the product you want to purchase.
|
||||
* @param {string?} oldSKU Optional sku you wish to upgrade from.
|
||||
* @param {PURCHASE_TYPE} type Optional type of product, can be inapp or subs. Subs by default
|
||||
*
|
||||
* @return {Promise<MakePurchaseResponse>} A [PurchasesError] is triggered after an error or when the user cancels the purchase.
|
||||
* If user cancelled, userCancelled will be true
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2,
|
||||
observable: true
|
||||
})
|
||||
makePurchase(
|
||||
productIdentifier: string,
|
||||
oldSKU?: string | null,
|
||||
type: PURCHASE_TYPE = PURCHASE_TYPE.SUBS
|
||||
): Promise<{ productIdentifier: string; purchaserInfo: PurchaserInfo; }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a purchase
|
||||
*
|
||||
* @param {string} productIdentifier The product identifier of the product you want to purchase.
|
||||
* @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
|
||||
* and the optional prorationMode.
|
||||
* @param {PURCHASE_TYPE} type Optional type of product, can be inapp or subs. Subs by default
|
||||
*
|
||||
* @return {Promise<MakePurchaseResponse>} A [PurchasesError] is triggered after an error or when the user cancels the purchase.
|
||||
* If user cancelled, userCancelled will be true
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
purchaseProduct(
|
||||
productIdentifier: string,
|
||||
upgradeInfo?: UpgradeInfo | null,
|
||||
type: PURCHASE_TYPE = PURCHASE_TYPE.SUBS
|
||||
): Promise<{ productIdentifier: string; purchaserInfo: PurchaserInfo; }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a purchase
|
||||
*
|
||||
* @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
|
||||
* @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
|
||||
* and the optional prorationMode.
|
||||
*
|
||||
* @return {Promise<MakePurchaseResponse>} A [PurchasesError] is triggered after an error or when the user cancels the purchase.
|
||||
* If user cancelled, userCancelled will be true
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
purchasePackage(
|
||||
aPackage: PurchasesPackage,
|
||||
upgradeInfo?: UpgradeInfo | null
|
||||
): Promise<{ productIdentifier: string; purchaserInfo: PurchaserInfo; }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
|
||||
*
|
||||
* @return {Promise<PurchaserInfo>} Errors are of type [PurchasesError]
|
||||
*/
|
||||
@Cordova()
|
||||
restoreTransactions(): Promise<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appUserID that is currently in placed in the SDK
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getAppUserID(): string {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will alias two appUserIDs together.
|
||||
* @param newAppUserID {String} The new appUserID that should be linked to the currently identified appUserID. Needs to be a string.
|
||||
*
|
||||
* @return {Promise<PurchaserInfo>} Errors are of type [PurchasesError] and get normally triggered if there
|
||||
* is an error retrieving the new purchaser info for the new user or if there is an error creating the alias.
|
||||
*/
|
||||
@Cordova()
|
||||
createAlias(newAppUserID: string): Promise<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will identify the current user with an appUserID. Typically this would be used after a logout to identify a new user without calling configure
|
||||
* @param newAppUserID {String} The new appUserID that should be linked to the currently identified appUserID. Needs to be a string.
|
||||
*
|
||||
* @return {Promise<PurchaserInfo>} Errors are of type [PurchasesError] and get normally triggered if there
|
||||
* is an error retrieving the new purchaser info for the new user.
|
||||
*/
|
||||
@Cordova()
|
||||
identify(newAppUserID: string): Promise<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
|
||||
*
|
||||
* @return {Promise<PurchaserInfo>} Errors are of type [PurchasesError] and get normally triggered if there
|
||||
* is an error retrieving the new purchaser info for the new user.
|
||||
*/
|
||||
@Cordova()
|
||||
reset(): Promise<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current purchaser info. This call will return the cached purchaser info unless the cache is stale, in which case,
|
||||
* it will make a network call to retrieve it from the servers.
|
||||
*
|
||||
* @return {Promise<PurchaserInfo>} Errors are of type [PurchasesError] and get normally triggered if there
|
||||
* is an error retrieving the purchaser info.
|
||||
*/
|
||||
@Cordova()
|
||||
getPurchaserInfo(): Promise<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an observable that can be used to receive updates on the purchaser info
|
||||
*
|
||||
* @return {Observable<PurchaserInfo>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onPurchaserInfoUpdated',
|
||||
element: 'window'
|
||||
})
|
||||
onPurchaserInfoUpdated(): Observable<PurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/Disables debugs logs
|
||||
* @param {boolean} enabled true to enable debug logs, false to disable
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDebugLogsEnabled(enabled: boolean): void {}
|
||||
|
||||
/**
|
||||
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
||||
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
||||
*
|
||||
* @warning This function should only be called if you're not calling makePurchase.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
syncPurchases(): void {}
|
||||
|
||||
/**
|
||||
* Enable automatic collection of Apple Search Ads attribution. Disabled by default.
|
||||
* @param {Boolean} enabled Enable or not automatic collection
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): void {}
|
||||
|
||||
/**
|
||||
* @return {Promise<boolean>} A boolean indicating if the `appUserID` has been generated
|
||||
* by RevenueCat or not.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
isAnonymous(): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product.
|
||||
* You should use this method to determine whether or not you show the user the normal product price or the
|
||||
* introductory price. This also applies to trials (trials are considered a type of introductory pricing).
|
||||
*
|
||||
* @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't
|
||||
* definitively compute the eligibility, most likely because of missing group information, it will return
|
||||
* `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro
|
||||
* pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of
|
||||
* iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.
|
||||
*
|
||||
* @param productIdentifiers Array of product identifiers for which you want to compute eligibility
|
||||
* @returns { Promise<Object.<string, IntroEligibility>> } Map of IntroEligibility per productId
|
||||
*/
|
||||
@Cordova()
|
||||
checkTrialOrIntroductoryPriceEligibility(
|
||||
productIdentifiers: string[]
|
||||
): Promise<{ [productId: string]: IntroEligibility; }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS.
|
||||
* @param {ShouldPurchasePromoProductListener} shouldPurchasePromoProductListener Called when a user initiates a
|
||||
* promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run
|
||||
* the deferredPurchase function. If the app is not in a state to make a purchase: cache the deferredPurchase, then
|
||||
* call the deferredPurchase when the app is ready to make the promotional purchase.
|
||||
* If the purchase should never be made, you don't need to ever call the deferredPurchase and the app will not
|
||||
* proceed with promotional purchases.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
addShouldPurchasePromoProductListener(shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener): void {}
|
||||
|
||||
/**
|
||||
* Removes a given ShouldPurchasePromoProductListener
|
||||
* @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of the listener to remove
|
||||
* @returns {boolean} True if listener was removed, false otherwise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeShouldPurchasePromoProductListener(listenerToRemove: ShouldPurchasePromoProductListener): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the cache for purchaser information.
|
||||
* This is useful for cases where purchaser information might have been updated outside of the app, like if a
|
||||
* promotional subscription is granted through the RevenueCat dashboard.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
invalidatePurchaserInfoCache(): void {}
|
||||
|
||||
/**
|
||||
* Subscriber attributes are useful for storing additional, structured information on a user.
|
||||
* Since attributes are writable using a public key they should not be used for
|
||||
* managing secure or sensitive information such as subscription status, coins, etc.
|
||||
*
|
||||
* Key names starting with "$" are reserved names used by RevenueCat. For a full list of key
|
||||
* restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes
|
||||
*
|
||||
* @param attributes Map of attributes by key. Set the value as an empty string to delete an attribute.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setAttributes(attributes: { [key: string]: string | null }): void {}
|
||||
|
||||
/**
|
||||
* Subscriber attribute associated with the email address for the user
|
||||
*
|
||||
* @param email Empty String or null will delete the subscriber attribute.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setEmail(email: string | null): void {}
|
||||
/**
|
||||
* Subscriber attribute associated with the phone number for the user
|
||||
*
|
||||
* @param phoneNumber Empty String or null will delete the subscriber attribute.
|
||||
*/
|
||||
|
||||
@Cordova({ sync: true })
|
||||
setPhoneNumber(phoneNumber: string | null): void {}
|
||||
/**
|
||||
* Subscriber attribute associated with the display name for the user
|
||||
*
|
||||
* @param displayName Empty String or null will delete the subscriber attribute.
|
||||
*/
|
||||
|
||||
@Cordova({ sync: true })
|
||||
setDisplayName(displayName: string | null): void {}
|
||||
/**
|
||||
* Subscriber attribute associated with the push token for the user
|
||||
*
|
||||
* @param pushToken null will delete the subscriber attribute.
|
||||
*/
|
||||
|
||||
@Cordova({ sync: true })
|
||||
setPushToken(pushToken: string | null): void {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use PurchasesProduct instead
|
||||
*/
|
||||
export interface RCProduct {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use PurchaserInfo instead
|
||||
*/
|
||||
export interface RCPurchaserInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use PurchasesError instead
|
||||
*/
|
||||
export interface RCError {
|
||||
}
|
||||
/**
|
||||
* The EntitlementInfo object gives you access to all of the information about the status of a user entitlement.
|
||||
*/
|
||||
export interface PurchasesEntitlementInfo {
|
||||
/**
|
||||
* The entitlement identifier configured in the RevenueCat dashboard
|
||||
*/
|
||||
readonly identifier: string;
|
||||
/**
|
||||
* True if the user has access to this entitlement
|
||||
*/
|
||||
readonly isActive: boolean;
|
||||
/**
|
||||
* True if the underlying subscription is set to renew at the end of the billing period (expirationDate).
|
||||
* Will always be True if entitlement is for lifetime access.
|
||||
*/
|
||||
readonly willRenew: boolean;
|
||||
/**
|
||||
* The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL.
|
||||
*/
|
||||
readonly periodType: string;
|
||||
/**
|
||||
* The latest purchase or renewal date for the entitlement.
|
||||
*/
|
||||
readonly latestPurchaseDate: string;
|
||||
/**
|
||||
* The first date this entitlement was purchased.
|
||||
*/
|
||||
readonly originalPurchaseDate: string;
|
||||
/**
|
||||
* The expiration date for the entitlement, can be `null` for lifetime access. If the `periodType` is `trial`,
|
||||
* this is the trial expiration date.
|
||||
*/
|
||||
readonly expirationDate: string | null;
|
||||
/**
|
||||
* The store where this entitlement was unlocked from. Either: appStore, macAppStore, playStore, stripe,
|
||||
* promotional, unknownStore
|
||||
*/
|
||||
readonly store: string;
|
||||
/**
|
||||
* The product identifier that unlocked this entitlement
|
||||
*/
|
||||
readonly productIdentifier: string;
|
||||
/**
|
||||
* False if this entitlement is unlocked via a production purchase
|
||||
*/
|
||||
readonly isSandbox: boolean;
|
||||
/**
|
||||
* The date an unsubscribe was detected. Can be `null`.
|
||||
*
|
||||
* @note: Entitlement may still be active even if user has unsubscribed. Check the `isActive` property.
|
||||
*/
|
||||
readonly unsubscribeDetectedAt: string | null;
|
||||
/**
|
||||
* The date a billing issue was detected. Can be `null` if there is no billing issue or an issue has been resolved
|
||||
*
|
||||
* @note: Entitlement may still be active even if there is a billing issue. Check the `isActive` property.
|
||||
*/
|
||||
readonly billingIssueDetectedAt: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains all the entitlements associated to the user.
|
||||
*/
|
||||
export interface PurchasesEntitlementInfos {
|
||||
/**
|
||||
* Map of all EntitlementInfo (`PurchasesEntitlementInfo`) objects (active and inactive) keyed by entitlement identifier.
|
||||
*/
|
||||
readonly all: { [key: string]: PurchasesEntitlementInfo };
|
||||
/**
|
||||
* Map of active EntitlementInfo (`PurchasesEntitlementInfo`) objects keyed by entitlement identifier.
|
||||
*/
|
||||
readonly active: { [key: string]: PurchasesEntitlementInfo };
|
||||
}
|
||||
|
||||
export interface PurchaserInfo {
|
||||
/**
|
||||
* Entitlements attached to this purchaser info
|
||||
*/
|
||||
readonly entitlements: PurchasesEntitlementInfos;
|
||||
/**
|
||||
* Set of active subscription skus
|
||||
*/
|
||||
readonly activeSubscriptions: [string];
|
||||
/**
|
||||
* Set of purchased skus, active and inactive
|
||||
*/
|
||||
readonly allPurchasedProductIdentifiers: [string];
|
||||
/**
|
||||
* The latest expiration date of all purchased skus
|
||||
*/
|
||||
readonly latestExpirationDate: string | null;
|
||||
/**
|
||||
* The date this user was first seen in RevenueCat.
|
||||
*/
|
||||
readonly firstSeen: string;
|
||||
/**
|
||||
* The original App User Id recorded for this user.
|
||||
*/
|
||||
readonly originalAppUserId: string;
|
||||
/**
|
||||
* Date when this info was requested
|
||||
*/
|
||||
readonly requestDate: string;
|
||||
/**
|
||||
* Map of skus to expiration dates
|
||||
*/
|
||||
readonly allExpirationDates: { [key: string]: string | null };
|
||||
/**
|
||||
* Map of skus to purchase dates
|
||||
*/
|
||||
readonly allPurchaseDates: { [key: string]: string | null };
|
||||
/**
|
||||
* Returns the version number for the version of the application when the
|
||||
* user bought the app. Use this for grandfathering users when migrating
|
||||
* to subscriptions.
|
||||
*
|
||||
* This corresponds to the value of CFBundleVersion (in iOS) in the
|
||||
* Info.plist file when the purchase was originally made. This is always null
|
||||
* in Android
|
||||
*/
|
||||
readonly originalApplicationVersion: string | null;
|
||||
}
|
||||
|
||||
export interface PurchasesProduct {
|
||||
/**
|
||||
* Product Id.
|
||||
*/
|
||||
readonly identifier: string;
|
||||
/**
|
||||
* Description of the product.
|
||||
*/
|
||||
readonly description: string;
|
||||
/**
|
||||
* Title of the product.
|
||||
*/
|
||||
readonly title: string;
|
||||
/**
|
||||
* Price of the product in the local currency.
|
||||
*/
|
||||
readonly price: number;
|
||||
/**
|
||||
* Formatted price of the item, including its currency sign, such as €3.99.
|
||||
*/
|
||||
readonly price_string: string;
|
||||
/**
|
||||
* Currency code for price and original price.
|
||||
*/
|
||||
readonly currency_code: string;
|
||||
/**
|
||||
* Introductory price of a subscription in the local currency.
|
||||
*/
|
||||
readonly intro_price: number | null;
|
||||
/**
|
||||
* Formatted introductory price of a subscription, including its currency sign, such as €3.99.
|
||||
*/
|
||||
readonly intro_price_string: string | null;
|
||||
/**
|
||||
* Billing period of the introductory price, specified in ISO 8601 format.
|
||||
*/
|
||||
readonly intro_price_period: string | null;
|
||||
/**
|
||||
* Number of subscription billing periods for which the user will be given the introductory price, such as 3.
|
||||
*/
|
||||
readonly intro_price_cycles: number | null;
|
||||
/**
|
||||
* Unit for the billing period of the introductory price, can be DAY, WEEK, MONTH or YEAR.
|
||||
*/
|
||||
readonly intro_price_period_unit: string | null;
|
||||
/**
|
||||
* Number of units for the billing period of the introductory price.
|
||||
*/
|
||||
readonly intro_price_period_number_of_units: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains information about the product available for the user to purchase.
|
||||
* For more info see https://docs.revenuecat.com/docs/entitlements
|
||||
*/
|
||||
export interface PurchasesPackage {
|
||||
/**
|
||||
* Unique identifier for this package. Can be one a predefined package type or a custom one.
|
||||
*/
|
||||
readonly identifier: string;
|
||||
/**
|
||||
* Package type for the product. Will be one of [PACKAGE_TYPE].
|
||||
*/
|
||||
readonly packageType: PACKAGE_TYPE;
|
||||
/**
|
||||
* Product assigned to this package.
|
||||
*/
|
||||
readonly product: PurchasesProduct;
|
||||
/**
|
||||
* Offering this package belongs to.
|
||||
*/
|
||||
readonly offeringIdentifier: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An offering is a collection of Packages (`PurchasesPackage`) available for the user to purchase.
|
||||
* For more info see https://docs.revenuecat.com/docs/entitlements
|
||||
*/
|
||||
export interface PurchasesOffering {
|
||||
/**
|
||||
* Unique identifier defined in RevenueCat dashboard.
|
||||
*/
|
||||
readonly identifier: string;
|
||||
/**
|
||||
* Offering description defined in RevenueCat dashboard.
|
||||
*/
|
||||
readonly serverDescription: string;
|
||||
/**
|
||||
* Array of `Package` objects available for purchase.
|
||||
*/
|
||||
readonly availablePackages: [PurchasesPackage];
|
||||
/**
|
||||
* Lifetime package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly lifetime: PurchasesPackage | null;
|
||||
/**
|
||||
* Annual package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly annual: PurchasesPackage | null;
|
||||
/**
|
||||
* Six month package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly sixMonth: PurchasesPackage | null;
|
||||
/**
|
||||
* Three month package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly threeMonth: PurchasesPackage | null;
|
||||
/**
|
||||
* Two month package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly twoMonth: PurchasesPackage | null;
|
||||
/**
|
||||
* Monthly package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly monthly: PurchasesPackage | null;
|
||||
/**
|
||||
* Weekly package type configured in the RevenueCat dashboard, if available.
|
||||
*/
|
||||
readonly weekly: PurchasesPackage | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains all the offerings configured in RevenueCat dashboard.
|
||||
* For more info see https://docs.revenuecat.com/docs/entitlements
|
||||
*/
|
||||
export interface PurchasesOfferings {
|
||||
/**
|
||||
* Map of all Offerings [PurchasesOffering] objects keyed by their identifier.
|
||||
*/
|
||||
readonly all: { [key: string]: PurchasesOffering };
|
||||
/**
|
||||
* Current offering configured in the RevenueCat dashboard.
|
||||
*/
|
||||
readonly current: PurchasesOffering | null;
|
||||
}
|
||||
|
||||
export interface PurchasesError {
|
||||
code: number;
|
||||
message: string;
|
||||
readableErrorCode: string;
|
||||
underlyingErrorMessage?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds the information used when upgrading from another sku. For Android use only.
|
||||
*/
|
||||
export interface UpgradeInfo {
|
||||
/**
|
||||
* The oldSKU to upgrade from.
|
||||
*/
|
||||
readonly oldSKU: string;
|
||||
/**
|
||||
* The [PRORATION_MODE] to use when upgrading the given oldSKU.
|
||||
*/
|
||||
readonly prorationMode?: PRORATION_MODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds the introductory price status
|
||||
*/
|
||||
export interface IntroEligibility {
|
||||
/**
|
||||
* The introductory price eligibility status
|
||||
*/
|
||||
readonly status: INTRO_ELIGIBILITY_STATUS;
|
||||
/**
|
||||
* Description of the status
|
||||
*/
|
||||
readonly description: string;
|
||||
}
|
||||
|
||||
export type ShouldPurchasePromoProductListener = (deferredPurchase: () => void) => void;
|
||||
@@ -136,6 +136,7 @@ export interface CategoryActionData {
|
||||
title: string;
|
||||
foreground: boolean;
|
||||
destructive: boolean;
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
export interface AndroidPushOptions {
|
||||
@@ -230,6 +231,7 @@ export interface Channel {
|
||||
sound?: string;
|
||||
vibration?: boolean | number[];
|
||||
visibility?: Visibility;
|
||||
badge?: boolean;
|
||||
}
|
||||
|
||||
export type PushEvent = string;
|
||||
@@ -269,7 +271,11 @@ export type PushEvent = string;
|
||||
* id: "testchannel1",
|
||||
* description: "My first test channel",
|
||||
* // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
|
||||
* importance: 3
|
||||
* importance: 3,
|
||||
* //badge is used to if badge appears on the app icon see https://developer.android.com/reference/android/app/NotificationChannel.html#setShowBadge(boolean).
|
||||
* //false = no badge on app icon.
|
||||
* //true = badge on app icon
|
||||
* badge: false
|
||||
* }).then(() => console.log('Channel created'));
|
||||
*
|
||||
* // Delete a channel (Android O and above)
|
||||
|
||||
465
src/@ionic-native/plugins/pushape-push/index.ts
Normal file
465
src/@ionic-native/plugins/pushape-push/index.ts
Normal file
@@ -0,0 +1,465 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaInstance, IonicNativePlugin, checkAvailability } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
declare const window: any;
|
||||
|
||||
export type EventResponse = PushapeRegistrationEventResponse &
|
||||
RegistrationEventResponse &
|
||||
NotificationEventResponse &
|
||||
Error;
|
||||
|
||||
interface RegistrationEventResponse {
|
||||
/**
|
||||
* The registration ID provided by the 3rd party remote push service.
|
||||
*/
|
||||
registrationId: string;
|
||||
}
|
||||
|
||||
export interface NotificationEventResponse {
|
||||
/**
|
||||
* The text of the push message sent from the 3rd party service.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* The optional title of the push message sent from the 3rd party service.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
|
||||
* For windows, it represents the value in the badge notification which could be a number or a status glyph.
|
||||
*/
|
||||
count: string;
|
||||
/**
|
||||
* The name of the sound file to be played upon receipt of the notification.
|
||||
*/
|
||||
sound: string;
|
||||
/**
|
||||
* The path of the image file to be displayed in the notification.
|
||||
*/
|
||||
image: string;
|
||||
/**
|
||||
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
|
||||
*/
|
||||
additionalData: NotificationEventAdditionalData & any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation
|
||||
*
|
||||
* Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one
|
||||
* so that he could specify any custom code without having to use array notation (map['prop']) for all of them.
|
||||
*/
|
||||
export interface NotificationEventAdditionalData {
|
||||
/**
|
||||
* Whether the notification was received while the app was in the foreground
|
||||
*/
|
||||
foreground?: boolean;
|
||||
collapse_key?: string;
|
||||
coldstart?: boolean;
|
||||
from?: string;
|
||||
notId?: string;
|
||||
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
export interface IOSPushOptions {
|
||||
/**
|
||||
* Whether to use prod or sandbox GCM setting.
|
||||
*/
|
||||
fcmSandbox?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the device shows an alert on receipt of notification.
|
||||
* **Note**: the value you set this option to the first time you call the init
|
||||
* method will be how the application always acts. Once this is set
|
||||
* programmatically in the init method it can only be changed manually by the
|
||||
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
|
||||
*/
|
||||
alert?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the device sets the badge number on receipt of notification.
|
||||
* **Note**: the value you set this option to the first time you call the init
|
||||
* method will be how the application always acts. Once this is set
|
||||
* programmatically in the init method it can only be changed manually by the
|
||||
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
|
||||
*/
|
||||
badge?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the device plays a sound on receipt of notification.
|
||||
* **Note**: the value you set this option to the first time you call the init
|
||||
* method will be how the application always acts. Once this is set
|
||||
* programmatically in the init method it can only be changed manually by the
|
||||
* user in Settings>Notifications>App Name. This is normal iOS behaviour.
|
||||
*/
|
||||
sound?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the badge will be cleared on app startup.
|
||||
*/
|
||||
clearBadge?: boolean | string;
|
||||
|
||||
/**
|
||||
* If the array contains one or more strings each string will be used to
|
||||
* subscribe to a GcmPubSub topic.
|
||||
* **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;
|
||||
|
||||
/**
|
||||
* If true the device will be set up to receive VoIP Push notifications and the
|
||||
* other options will be ignored since VoIP notifications are silent
|
||||
* notifications that should be handled in the "notification" event.
|
||||
*/
|
||||
voip?: boolean | string;
|
||||
}
|
||||
|
||||
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;
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
export interface AndroidPushOptions {
|
||||
/**
|
||||
* Maps to the project number in the Google Developer Console.
|
||||
*/
|
||||
senderID?: string;
|
||||
|
||||
/**
|
||||
* The name of a drawable resource to use as the small-icon. The name should
|
||||
* not include the extension.
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/**
|
||||
* Sets the background color of the small icon on Android 5.0 and greater.
|
||||
* [Supported Formats](http://developer.android.com/intl/ru/reference/android/graphics/Color.html#parseColor(java.lang.String))
|
||||
*/
|
||||
iconColor?: string;
|
||||
|
||||
/**
|
||||
* If true it plays the sound specified in the push data or the default system
|
||||
* sound.
|
||||
*/
|
||||
sound?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the device vibrates on receipt of notification.
|
||||
*/
|
||||
vibrate?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the icon badge will be cleared on init and before push messages are processed.
|
||||
*/
|
||||
clearBadge?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true the app clears all pending notifications when it is closed.
|
||||
*/
|
||||
clearNotifications?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true will always show a notification, even when the app is on the
|
||||
* foreground.
|
||||
*/
|
||||
forceShow?: boolean | string;
|
||||
|
||||
/**
|
||||
* If the array contains one or more strings each string will be used to
|
||||
* subscribe to a GcmPubSub topic.
|
||||
*/
|
||||
topics?: string[];
|
||||
|
||||
/**
|
||||
* The key to search for text of notification.
|
||||
*/
|
||||
messageKey?: string;
|
||||
|
||||
/**
|
||||
* The key to search for title of notification.
|
||||
*/
|
||||
titleKey?: string;
|
||||
}
|
||||
|
||||
export interface BrowserPushOptions {
|
||||
/**
|
||||
* Optional. Your GCM API key if you are using VAPID keys.
|
||||
*/
|
||||
applicationServerKey?: string;
|
||||
|
||||
/**
|
||||
* URL for the push server you want to use.
|
||||
* Default: http://push.api.phonegap.com/v1/push Optional.
|
||||
*/
|
||||
pushServiceURL?: string;
|
||||
}
|
||||
|
||||
interface PushOptions {
|
||||
ios?: IOSPushOptions;
|
||||
android?: AndroidPushOptions;
|
||||
windows?: any;
|
||||
browser?: BrowserPushOptions;
|
||||
}
|
||||
|
||||
export type Priority = 1 | 2 | 3 | 4 | 5;
|
||||
export type Visibility = 0 | 1 | -1;
|
||||
|
||||
export interface Channel {
|
||||
id: string;
|
||||
description: string;
|
||||
importance: Priority;
|
||||
sound?: string;
|
||||
vibration?: boolean | number[];
|
||||
visibility?: Visibility;
|
||||
badge?: boolean;
|
||||
}
|
||||
|
||||
export type PushEvent = 'registration' | 'notification' | 'error';
|
||||
|
||||
|
||||
/** Extended Pushape types */
|
||||
|
||||
export interface PushapePushOptions {
|
||||
id_app: string;
|
||||
platform: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface PushapeOptions extends PushOptions {
|
||||
enabled?: boolean;
|
||||
pushape: PushapePushOptions;
|
||||
id_user: string;
|
||||
}
|
||||
|
||||
export interface PushapeRegistrationEventResponse extends RegistrationEventResponse {
|
||||
push_id: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name PushapePush
|
||||
* @description
|
||||
* Register and receive push notifications.
|
||||
* This plugin extends functionalities of Push native plugin in order to use it with Pushape service.
|
||||
*
|
||||
* Pushape service: @link https://glue-labs.com/pushape-invio-notifiche-push-ios-android-api-sdk
|
||||
*
|
||||
* Requires Cordova plugin: `pushape-cordova-push`. For more info, please see the [Pushape plugin docs](https://github.com/gluelabs/pushape-cordova-push).
|
||||
*
|
||||
* For TypeScript users, see the [Pushape plugin docs about using TypeScript for custom notifications](https://github.com/gluelabs/pushape-cordova-push/blob/master/docs/PUSHAPE_TYPESCRIPT.md).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PushapePush } from '@ionic-native/pushape-push/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private readonly pushapePush: PushapePush) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* PushapeRegistrationEventResponse
|
||||
* NotificationEventResponse
|
||||
* NotificationEventAdditionalData
|
||||
* IOSPushOptions
|
||||
* AndroidPushOptions
|
||||
* BrowserPushOptions
|
||||
* PushapePushOptions
|
||||
* PushapeOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PushapePush',
|
||||
plugin: 'pushape-cordova-push',
|
||||
pluginRef: 'PushNotification', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: 'https://github.com/gluelabs/pushape-cordova-push',
|
||||
install: 'ionic cordova plugin add pushape-cordova-push',
|
||||
platforms: ['Android', 'Browser', 'iOS'],
|
||||
})
|
||||
@Injectable()
|
||||
export class PushapePush extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Init push notifications
|
||||
* @param options {PushapeOptions}
|
||||
* @return {PushObject}
|
||||
*/
|
||||
init(options: PushapeOptions): PushObject {
|
||||
return new PushObject(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the push notification permission has been granted.
|
||||
* @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(): Promise<{ isEnabled: boolean }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new notification channel for Android O and above.
|
||||
* @param channel {Channel}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
createChannel(channel?: Channel): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a notification channel for Android O and above.
|
||||
* @param id {string}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
deleteChannel(id?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of currently configured channels.
|
||||
* @return {Promise<Channel[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
listChannels(): Promise<Channel[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PushapePush',
|
||||
plugin: 'pushape-cordova-push',
|
||||
pluginRef: 'PushNotification'
|
||||
})
|
||||
export class PushObject {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(options: PushapeOptions) {
|
||||
if (
|
||||
checkAvailability('PushNotification', 'init', 'PushNotification') === true
|
||||
) {
|
||||
if (typeof window !== 'undefined') {
|
||||
this._objectInstance = window.PushNotification.init(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener
|
||||
* @param event {string}
|
||||
* @return {Observable<EventResponse>}
|
||||
*/
|
||||
@CordovaInstance({
|
||||
observable: true,
|
||||
clearFunction: 'off',
|
||||
clearWithArgs: true,
|
||||
})
|
||||
on(event: PushEvent): Observable<EventResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unregister method is used when the application no longer wants to receive push notifications.
|
||||
* Beware that this cleans up all event handlers previously registered,
|
||||
* so you will need to re-register them if you want them to function again without an application reload.
|
||||
*/
|
||||
@CordovaInstance()
|
||||
unregister(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the badge count visible when the app is not running
|
||||
*
|
||||
* The count is an integer indicating what number should show up in the badge.
|
||||
* Passing 0 will clear the badge.
|
||||
* Each notification event contains a data.count value which can be used to set the badge to correct number.
|
||||
* @param count
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse',
|
||||
})
|
||||
setApplicationIconBadgeNumber(count?: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Get the current badge count visible when the app is not running
|
||||
* successHandler gets called with an integer which is the current badge count
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getApplicationIconBadgeNumber(): Promise<number> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS only
|
||||
* Tells the OS that you are done processing a background push notification.
|
||||
* successHandler gets called when background push processing is successfully completed.
|
||||
* @param [id]
|
||||
*/
|
||||
@CordovaInstance({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
finish(id?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the OS to clear all notifications from the Notification Center
|
||||
*/
|
||||
@CordovaInstance()
|
||||
clearAllNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The subscribe method is used when the application wants to subscribe a new topic to receive push notifications.
|
||||
* @param topic {string} Topic to subscribe to.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
subscribe(topic: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages.
|
||||
* @param topic {string} Topic to unsubscribe from.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
unsubscribe(topic: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* @beta
|
||||
* @name Rollbar
|
||||
* @description
|
||||
* This plugin adds Rollbar App monitoring to your application
|
||||
* This plugin adds [Rollbar](https://rollbar.com/) App monitoring to your application
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user