mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
438 Commits
v5.0.0-bet
...
v5.15.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
49d7ca7375 | ||
|
|
8d91856103 | ||
|
|
5221c8cf41 | ||
|
|
d827db27b0 | ||
|
|
b9e46730e3 | ||
|
|
fcda5ffcab | ||
|
|
6fde61d69c | ||
|
|
c8ff885023 | ||
|
|
06654afae3 | ||
|
|
e1a25af0b5 | ||
|
|
419b68217e | ||
|
|
cd97375e63 | ||
|
|
b0dea6dc58 | ||
|
|
7e090cc6f2 | ||
|
|
c2029f7927 | ||
|
|
5b1bdc37e0 | ||
|
|
e3e8c85087 | ||
|
|
03c01c687e | ||
|
|
c0684cb3d8 | ||
|
|
9a85a5cd62 | ||
|
|
7ae2ad4e3e | ||
|
|
c5ae6362d7 | ||
|
|
8b53c04dc5 | ||
|
|
64230319a2 | ||
|
|
3d8cdde7eb | ||
|
|
e1b7aca3a9 | ||
|
|
9bdb2fac9d | ||
|
|
41c6bcafe6 | ||
|
|
d55d1d6f7f | ||
|
|
aed25a6642 | ||
|
|
daf04566a1 | ||
|
|
4cb2aee62b | ||
|
|
63124f35fd | ||
|
|
632dec28ae | ||
|
|
50e05349ec | ||
|
|
fd27136de7 | ||
|
|
2833da472a | ||
|
|
c5ceba1aae | ||
|
|
e1a490357d | ||
|
|
959a9135e4 | ||
|
|
fc0a238229 | ||
|
|
eeb68f1706 | ||
|
|
bceb428690 | ||
|
|
242240c711 | ||
|
|
e9911aa4ad | ||
|
|
04798c7354 | ||
|
|
3aedde55d8 | ||
|
|
92140cd2db | ||
|
|
184986f06b | ||
|
|
2ce2725b2a | ||
|
|
3d8455ae35 | ||
|
|
bf7ba9bd01 | ||
|
|
0883240f60 | ||
|
|
b6f340ae82 | ||
|
|
0612aef725 | ||
|
|
4bf7ba6085 | ||
|
|
707d40bd83 | ||
|
|
b4e0764d71 | ||
|
|
c1d7ce13dd | ||
|
|
999853eb32 | ||
|
|
dfd6714331 | ||
|
|
898c68bb5e | ||
|
|
674e80ee61 | ||
|
|
7e817a0223 | ||
|
|
2efc5b2e2c | ||
|
|
3f65ce1c7e | ||
|
|
2d49671282 | ||
|
|
a9dbb23b23 | ||
|
|
9250d49970 | ||
|
|
2397ef9d60 | ||
|
|
dbd8b4c080 | ||
|
|
1ba6f97082 | ||
|
|
c2f45616ac | ||
|
|
603d6943ef | ||
|
|
3226f76ef9 | ||
|
|
34ecd29d9f | ||
|
|
874be0bb04 | ||
|
|
9e6705df7f | ||
|
|
7c46d8c2fc | ||
|
|
651a40f784 | ||
|
|
f420d2b830 | ||
|
|
e374b52c59 | ||
|
|
7d3ddf89ae | ||
|
|
19b3e8f521 | ||
|
|
c14ea31a8a | ||
|
|
707ce1cad9 | ||
|
|
d33bcb0220 | ||
|
|
5df3de7dc0 | ||
|
|
d499a4db8d | ||
|
|
e2b25deff6 | ||
|
|
c3de8dfaba | ||
|
|
448e064012 | ||
|
|
8e405cc3d3 | ||
|
|
6ef854f4f1 | ||
|
|
ea3150e99a | ||
|
|
3edd62e56c | ||
|
|
7483c3554c | ||
|
|
b63102a5fa | ||
|
|
df7ec0146c | ||
|
|
20878516b4 | ||
|
|
b166cc51ea | ||
|
|
543fa64b35 | ||
|
|
dcac00e7ad | ||
|
|
006570483d | ||
|
|
b7594e201b | ||
|
|
1396b61215 | ||
|
|
4f8779a969 | ||
|
|
7145afa24f | ||
|
|
66316d29fe | ||
|
|
7dcd6b27a0 | ||
|
|
b98393462d | ||
|
|
f9011c89c8 | ||
|
|
4b4b2c45a0 | ||
|
|
43bfeb487a | ||
|
|
accfba8a40 | ||
|
|
dc4183da07 | ||
|
|
b61b33987f | ||
|
|
39b4b85631 | ||
|
|
669dd02285 | ||
|
|
a3bd19769f | ||
|
|
ff3ef094e0 | ||
|
|
2933d40cdc | ||
|
|
874ae88ff4 | ||
|
|
a02ca715e9 | ||
|
|
336b3ff89b | ||
|
|
2aa73b5546 | ||
|
|
99cebcba0b | ||
|
|
6c99ec8033 | ||
|
|
a167bd85aa | ||
|
|
487acd603b | ||
|
|
fb4d2640c1 | ||
|
|
4468b520ad | ||
|
|
1a2dc3ee73 | ||
|
|
00a1674fd6 | ||
|
|
2b14bd979e | ||
|
|
fcd6d26727 | ||
|
|
f95003cbe1 | ||
|
|
8e5f2e5ab3 | ||
|
|
307477da78 | ||
|
|
f691883a29 | ||
|
|
0d5d4f30a9 | ||
|
|
1457a1698b | ||
|
|
bfd46eed16 | ||
|
|
3eff280127 | ||
|
|
8116ddd139 | ||
|
|
a6bcc9affd | ||
|
|
c0d8c99e8d | ||
|
|
fe9655ed84 | ||
|
|
41c034cc19 | ||
|
|
89631a9fa6 | ||
|
|
04db233b33 | ||
|
|
10d222dcea | ||
|
|
640da1b618 | ||
|
|
aecb0f9460 | ||
|
|
d077c48205 | ||
|
|
49d27e816c | ||
|
|
3699fa9b50 | ||
|
|
ab4f1f5bbe | ||
|
|
51006a76a0 | ||
|
|
8bab32173a | ||
|
|
3ef9593704 | ||
|
|
ffae843c0f | ||
|
|
33e4392b63 | ||
|
|
9acbb9fcd6 | ||
|
|
c1e1c5cb79 | ||
|
|
0c7cfeeeb8 | ||
|
|
a7830693af | ||
|
|
b60d5d4851 | ||
|
|
0c4aeddd1b | ||
|
|
667de5ba26 | ||
|
|
2dc7ee8916 | ||
|
|
2c2c1e482c | ||
|
|
7c419b48ad | ||
|
|
0b9717636c | ||
|
|
10ac9ff9de | ||
|
|
90d75af9d1 | ||
|
|
3b3f942ed5 | ||
|
|
9601a64227 | ||
|
|
22fd49b5d3 | ||
|
|
890129bfda | ||
|
|
6a9a871758 | ||
|
|
ac467c50ac | ||
|
|
267149b16f | ||
|
|
7047920a2a | ||
|
|
aad814fcf1 | ||
|
|
03d6b2373c | ||
|
|
d82e675442 | ||
|
|
1e84e23fd9 | ||
|
|
f3f12cb306 | ||
|
|
b3bd0a83c7 | ||
|
|
03e4f0e439 | ||
|
|
a73146648f | ||
|
|
d90724ef70 | ||
|
|
be0dc3dac4 | ||
|
|
a0a64da518 | ||
|
|
591ee87e05 | ||
|
|
8db1dbef71 | ||
|
|
73ae92d77c | ||
|
|
3c2753df64 | ||
|
|
9035476833 | ||
|
|
5f5e605e66 | ||
|
|
ea6746d134 | ||
|
|
753fa4a7a4 | ||
|
|
ff784a4377 | ||
|
|
0764e28408 | ||
|
|
0197c88a03 | ||
|
|
5825932e03 | ||
|
|
bccc8ac379 | ||
|
|
3eb382d438 | ||
|
|
ca9a702808 | ||
|
|
3f415f9bef | ||
|
|
0c6d1eabe2 | ||
|
|
61fecf511b | ||
|
|
2ac52822b8 | ||
|
|
229b62c10b | ||
|
|
9b4fd02fa5 | ||
|
|
d10777a33b | ||
|
|
4f26069ca6 | ||
|
|
40571e5c99 | ||
|
|
83194f616b | ||
|
|
b1f4df530a | ||
|
|
4297c3d43e | ||
|
|
95d495b468 | ||
|
|
f0989d1b96 | ||
|
|
c113417878 | ||
|
|
cedd6df423 | ||
|
|
4b14ce2eec | ||
|
|
27d380ef4b | ||
|
|
bd5bd7ea9d | ||
|
|
c6713862c5 | ||
|
|
3b32e19bf1 | ||
|
|
4092831754 | ||
|
|
c2fe5f8336 | ||
|
|
3f9067d090 | ||
|
|
36a4e81fe4 | ||
|
|
79cb478c26 | ||
|
|
b635ba99ea |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ node_modules/
|
||||
.tmp
|
||||
aot/
|
||||
scripts/ionic-native-bower
|
||||
scripts/docs-json/*.json
|
||||
dist/
|
||||
src/@ionic-native/plugins/**/ngx
|
||||
*.d.ts
|
||||
|
||||
2128
CHANGELOG.md
2128
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.
|
||||
|
||||
```
|
||||
|
||||
@@ -11,13 +11,11 @@ Ionic Native wraps plugin callbacks in a Promise or Observable, providing a comm
|
||||
Run following command to install Ionic Native in your project.
|
||||
|
||||
```bash
|
||||
npm install @ionic-native/core@beta --save
|
||||
npm install @ionic-native/core --save
|
||||
```
|
||||
|
||||
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
|
||||
|
||||
**NOTE: to use Ionic Native v5, you must use the `@beta` tag when installing any NPM package.**
|
||||
|
||||
## Documentation
|
||||
|
||||
For the full Ionic Native documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).
|
||||
|
||||
@@ -3,7 +3,7 @@ jobs:
|
||||
build:
|
||||
working_directory: ~/ionic-native/
|
||||
docker:
|
||||
- image: node:8
|
||||
- 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:
|
||||
|
||||
@@ -32,9 +32,7 @@ gulp.task('lint', () => {
|
||||
|
||||
gulp.task('plugin:create', () => {
|
||||
if (flags.n && flags.n !== '') {
|
||||
const src = flags.m
|
||||
? './scripts/templates/wrap-min.tmpl'
|
||||
: './scripts/templates/wrap.tmpl',
|
||||
const src = flags.m ? './scripts/templates/wrap-min.tmpl' : './scripts/templates/wrap.tmpl',
|
||||
pluginName = flags.n,
|
||||
spaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1'),
|
||||
kebabCase = _.kebabCase(pluginName);
|
||||
|
||||
16638
package-lock.json
generated
16638
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
64
package.json
64
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "5.0.0-beta.22",
|
||||
"version": "5.15.1",
|
||||
"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)",
|
||||
@@ -17,49 +17,51 @@
|
||||
"npmpub": "ts-node -P scripts/tsconfig.json scripts/tasks/publish",
|
||||
"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\"",
|
||||
"shipit": "npm run build && npm run readmes && npm run npmpub"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/common": "^7.1.1",
|
||||
"@angular/compiler": "^7.1.1",
|
||||
"@angular/compiler-cli": "^7.1.1",
|
||||
"@angular/core": "^7.1.1",
|
||||
"@angular/common": "^8.2.11",
|
||||
"@angular/compiler": "^8.2.11",
|
||||
"@angular/compiler-cli": "^8.2.11",
|
||||
"@angular/core": "^8.2.11",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/fs-extra": "^5.0.4",
|
||||
"@types/jest": "^23.3.10",
|
||||
"@types/lodash": "^4.14.118",
|
||||
"@types/node": "^10.12.11",
|
||||
"@types/fs-extra": "^8.0.1",
|
||||
"@types/jest": "^24.0.19",
|
||||
"@types/lodash": "^4.14.144",
|
||||
"@types/node": "^12.11.1",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@types/webpack": "^4.4.20",
|
||||
"ajv": "^6.6.1",
|
||||
"async-promise-queue": "^1.0.4",
|
||||
"conventional-changelog-cli": "^2.0.11",
|
||||
"cz-conventional-changelog": "^2.1.0",
|
||||
"dgeni": "^0.4.10",
|
||||
"@types/webpack": "^4.39.3",
|
||||
"ajv": "^6.10.2",
|
||||
"async-promise-queue": "^1.0.5",
|
||||
"conventional-changelog-cli": "^2.0.25",
|
||||
"cz-conventional-changelog": "^3.0.2",
|
||||
"dgeni": "^0.4.12",
|
||||
"dgeni-packages": "0.16.10",
|
||||
"fs-extra": "^7.0.1",
|
||||
"gulp": "3.9.1",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-tslint": "^8.1.3",
|
||||
"jest": "^23.6.0",
|
||||
"lodash": "^4.17.11",
|
||||
"gulp-tslint": "^8.1.4",
|
||||
"jest": "^24.9.0",
|
||||
"lodash": "^4.17.15",
|
||||
"minimist": "1.2.0",
|
||||
"natives": "^1.1.6",
|
||||
"rimraf": "^2.6.2",
|
||||
"rxjs": "^6.3.3",
|
||||
"ts-jest": "^23.10.5",
|
||||
"ts-node": "^7.0.1",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-ionic-rules": "0.0.20",
|
||||
"typescript": "3.1.6",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"rimraf": "^3.0.0",
|
||||
"rxjs": "^6.5.3",
|
||||
"ts-jest": "^24.1.0",
|
||||
"ts-node": "^8.4.1",
|
||||
"tslint": "^5.20.0",
|
||||
"tslint-ionic-rules": "0.0.21",
|
||||
"typedoc": "^0.15.0",
|
||||
"typescript": "~3.5.3",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"unminified-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^4.26.1",
|
||||
"winston": "^3.1.0",
|
||||
"zone.js": "^0.8.26"
|
||||
"webpack": "^4.41.2",
|
||||
"winston": "^3.2.1",
|
||||
"zone.js": "^0.9.1"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
|
||||
@@ -37,10 +37,15 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
|
||||
|
||||
decorators.forEach(d => methods = getMethodsForDecorator(d).concat(methods));
|
||||
|
||||
const methodElements = methods.map(m => ts.createIdentifier(m));
|
||||
const methodNames = methodElements.map((el) => el.escapedText);
|
||||
|
||||
importStatement.importClause.namedBindings.elements = [
|
||||
ts.createIdentifier('IonicNativePlugin'),
|
||||
...methods.map(m => ts.createIdentifier(m)),
|
||||
...importStatement.importClause.namedBindings.elements.filter(el => keep.indexOf(el.name.text) !== -1)
|
||||
...methodElements,
|
||||
...importStatement.importClause.namedBindings.elements.filter(
|
||||
el => keep.indexOf(el.name.text) !== -1 && methodNames.indexOf(el.name.text) === -1
|
||||
)
|
||||
];
|
||||
|
||||
if (ngcBuild) {
|
||||
|
||||
101
scripts/docs-json/index.ts
Normal file
101
scripts/docs-json/index.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import { Application } from 'typedoc';
|
||||
import { basename, dirname, resolve } from 'path';
|
||||
import { runInNewContext } from 'vm';
|
||||
|
||||
interface Plugin {
|
||||
packageName: string;
|
||||
displayName: string;
|
||||
description: string;
|
||||
platforms: string[];
|
||||
usage: string;
|
||||
repo: string;
|
||||
installVariables: string[];
|
||||
cordovaPlugin: {
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
const rootDir = resolve(__dirname, '../..');
|
||||
const typedocTmp = resolve(__dirname, 'typedoc.tmp.json');
|
||||
const pluginsDir = resolve(rootDir, 'src/@ionic-native/plugins');
|
||||
const typedoc = new Application({
|
||||
mode: 'modules',
|
||||
tsconfig: resolve(rootDir, 'tsconfig.json'),
|
||||
ignoreCompilerErrors: true
|
||||
});
|
||||
|
||||
run(pluginsDir);
|
||||
|
||||
async function run(pluginsDir: string) {
|
||||
const typedocData = await generateTypedoc(pluginsDir);
|
||||
const modules = typedocData.children.filter(isModule);
|
||||
const plugins = modules.filter(hasPlugin).map(processPlugin);
|
||||
await fs.outputJson(resolve(__dirname, 'plugins.json'), plugins, {
|
||||
spaces: 2
|
||||
});
|
||||
}
|
||||
|
||||
async function generateTypedoc(root: string, outputPath = typedocTmp) {
|
||||
const pluginDirs = await fs.readdir(root);
|
||||
const paths = pluginDirs.map(dir => resolve(root, dir, 'index.ts'));
|
||||
typedoc.generateJson(paths, outputPath);
|
||||
return fs.readJson(outputPath);
|
||||
}
|
||||
|
||||
function processPlugin(pluginModule): Plugin {
|
||||
const pluginClass = pluginModule.children.find(isPlugin);
|
||||
const decorator = getPluginDecorator(pluginClass);
|
||||
const packageName = `@ionic-native/${basename(dirname(pluginModule.originalName))}`;
|
||||
const displayName = getTag(pluginClass, 'name');
|
||||
const usage = getTag(pluginClass, 'usage');
|
||||
const description = getTag(pluginClass, 'description');
|
||||
return {
|
||||
packageName,
|
||||
displayName,
|
||||
description,
|
||||
usage,
|
||||
platforms: decorator.platforms,
|
||||
repo: decorator.repo,
|
||||
installVariables: decorator.installVariables,
|
||||
cordovaPlugin: {
|
||||
name: decorator.plugin
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Typedoc only gives us the Plugin decorator internals
|
||||
* as a string. So, rather than try to parse that with a RegExp,
|
||||
* we evaluate it using Node's vm module.
|
||||
*/
|
||||
const getPluginDecorator = (child: any) => {
|
||||
if (isPlugin(child)) {
|
||||
const decorator = child.decorators.find(d => d.name === 'Plugin');
|
||||
return runInNewContext(`(${decorator.arguments.config})`);
|
||||
}
|
||||
};
|
||||
|
||||
const getTag = (child: any, tagName: string): string => {
|
||||
if (hasTags(child)) {
|
||||
const tag = child.comment.tags.find(t => t.tag === tagName);
|
||||
if (tag) {
|
||||
return tag.text;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const isModule = (child: any): boolean =>
|
||||
child.kind === 1;
|
||||
|
||||
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');
|
||||
|
||||
const hasPlugin = (child: any): boolean =>
|
||||
child.children.some(isPlugin);
|
||||
|
||||
const hasTags = (child: any): boolean =>
|
||||
child.comment && Array.isArray(child.comment.tags);
|
||||
3
scripts/docs-json/readme.md
Normal file
3
scripts/docs-json/readme.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# docs-json
|
||||
|
||||
This script reads and generates [typedoc](https://github.com/TypeStrong/typedoc) data for each of the plugins in `src/@ionic-native/plugins`. That data is then formatted and output as `plugins.json` in this directory.
|
||||
@@ -187,7 +187,7 @@ docType: "<$ doc.docType $>"
|
||||
<ol class="installation">
|
||||
<li>Install the Cordova and Ionic Native plugins:<br>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install | replace('<', '<').replace('>', '>') $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install @ionic-native/<$ doc.npmId $>@beta
|
||||
$ npm install @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
</li>
|
||||
<li><a href="https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module">Add this plugin to your app's module</a></li>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
```
|
||||
$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install @ionic-native/<$ doc.npmId $>@beta
|
||||
$ npm install @ionic-native/<$ doc.npmId $>
|
||||
```
|
||||
|
||||
## [Usage Documentation](https://ionicframework.com/docs/native/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@ionic-native/plugins/','') $>)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -34,4 +34,4 @@ function run {
|
||||
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc.sh
|
||||
source $(dirname $0)/utils.inc.sh
|
||||
|
||||
@@ -47,4 +47,4 @@ function run {
|
||||
fi
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc.sh
|
||||
source $(dirname $0)/utils.inc.sh
|
||||
|
||||
@@ -1,244 +1,241 @@
|
||||
# bash utils from angularjs
|
||||
|
||||
# This file provides:
|
||||
# - a default control flow
|
||||
# * initializes the environment
|
||||
# * call a function in your script based on the arguments
|
||||
# - named argument parsing and automatic generation of the "usage" for your script
|
||||
# - utility functions
|
||||
#
|
||||
# Usage:
|
||||
# - define the variable ARGS_DEF (see below) with the arguments for your script
|
||||
# - include this file using `source utils.inc` at the end of your script.
|
||||
#
|
||||
# Default control flow:
|
||||
# 0. Set the current directory to the directory of the script. By this
|
||||
# the script can be called from anywhere.
|
||||
# 1. Parse the named arguments
|
||||
# 2. [Redacted]
|
||||
# 3. If the parameter "verbose" is set, the `-x` flag will be set in bash.
|
||||
# 4. The function "init" will be called if it exists
|
||||
# 5. If the parameter "action" is set, it will call the function with the name of that parameter.
|
||||
# Otherwise the function "run" will be called.
|
||||
#
|
||||
# Named Argument Parsing:
|
||||
# - The variable ARGS_DEF defines the valid command arguments
|
||||
# * Required args syntax: --paramName=paramRegex
|
||||
# * Optional args syntax: [--paramName=paramRegex]
|
||||
# * e.g. ARG_DEFS=("--required_param=(.+)" "[--optional_param=(.+)]")
|
||||
# - Checks that:
|
||||
# * all arguments match to an entry in ARGS_DEF
|
||||
# * all required arguments are present
|
||||
# * all arguments match their regex
|
||||
# - Afterwards, every paramter value will be stored in a variable
|
||||
# with the name of the parameter in upper case (with dash converted to underscore).
|
||||
#
|
||||
# Special arguments that are always available:
|
||||
# - "--action=.*": This parameter will be used to dispatch to a function with that name when the
|
||||
# script is started
|
||||
|
||||
# - "--verbose=true": This will set the `-x` flag in bash so that all calls will be logged
|
||||
#
|
||||
# Utility functions:
|
||||
# - readJsonProp
|
||||
# - replaceJsonProp
|
||||
# - resolveDir
|
||||
# - getVar
|
||||
# - serVar
|
||||
# - isFunction
|
||||
|
||||
# always stop on errors
|
||||
set -e
|
||||
|
||||
function usage {
|
||||
echo "Usage: ${0} ${ARG_DEFS[@]}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
function parseArgs {
|
||||
local REQUIRED_ARG_NAMES=()
|
||||
|
||||
# -- helper functions
|
||||
function varName {
|
||||
# everything to upper case and dash to underscore
|
||||
echo ${1//-/_} | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
function readArgDefs {
|
||||
local ARG_DEF
|
||||
local AD_OPTIONAL
|
||||
local AD_NAME
|
||||
local AD_RE
|
||||
|
||||
# -- helper functions
|
||||
function parseArgDef {
|
||||
local ARG_DEF_REGEX="(\[?)--([^=]+)=(.*)"
|
||||
if [[ ! $1 =~ $ARG_DEF_REGEX ]]; then
|
||||
echo "Internal error: arg def has wrong format: $ARG_DEF"
|
||||
exit 1
|
||||
fi
|
||||
AD_OPTIONAL="${BASH_REMATCH[1]}"
|
||||
AD_NAME="${BASH_REMATCH[2]}"
|
||||
AD_RE="${BASH_REMATCH[3]}"
|
||||
if [[ $AD_OPTIONAL ]]; then
|
||||
# Remove last bracket for optional args.
|
||||
# Can't put this into the ARG_DEF_REGEX somehow...
|
||||
AD_RE=${AD_RE%?}
|
||||
fi
|
||||
}
|
||||
|
||||
# -- run
|
||||
for ARG_DEF in "${ARG_DEFS[@]}"
|
||||
do
|
||||
parseArgDef $ARG_DEF
|
||||
|
||||
local AD_NAME_UPPER=$(varName $AD_NAME)
|
||||
setVar "${AD_NAME_UPPER}_OPTIONAL" "$AD_OPTIONAL"
|
||||
setVar "${AD_NAME_UPPER}_RE" "$AD_RE"
|
||||
if [[ ! $AD_OPTIONAL ]]; then
|
||||
REQUIRED_ARG_NAMES+=($AD_NAME)
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function readAndValidateArgs {
|
||||
local ARG_NAME
|
||||
local ARG_VALUE
|
||||
local ARG_NAME_UPPER
|
||||
|
||||
# -- helper functions
|
||||
function parseArg {
|
||||
local ARG_REGEX="--([^=]+)=?(.*)"
|
||||
|
||||
if [[ ! $1 =~ $ARG_REGEX ]]; then
|
||||
echo "Can't parse argument $i"
|
||||
usage
|
||||
fi
|
||||
|
||||
ARG_NAME="${BASH_REMATCH[1]}"
|
||||
ARG_VALUE="${BASH_REMATCH[2]}"
|
||||
ARG_NAME_UPPER=$(varName $ARG_NAME)
|
||||
}
|
||||
|
||||
function validateArg {
|
||||
local AD_RE=$(getVar ${ARG_NAME_UPPER}_RE)
|
||||
|
||||
if [[ ! $AD_RE ]]; then
|
||||
echo "Unknown option: $ARG_NAME"
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ ! $ARG_VALUE =~ ^${AD_RE}$ ]]; then
|
||||
echo "Wrong format: $ARG_NAME"
|
||||
usage;
|
||||
fi
|
||||
|
||||
# validate that the "action" option points to a valid function
|
||||
if [[ $ARG_NAME == "action" ]] && ! isFunction $ARG_VALUE; then
|
||||
echo "No action $ARG_VALUE defined in this script"
|
||||
usage;
|
||||
fi
|
||||
}
|
||||
|
||||
# -- run
|
||||
for i in "$@"
|
||||
do
|
||||
parseArg $i
|
||||
validateArg
|
||||
setVar "${ARG_NAME_UPPER}" "$ARG_VALUE"
|
||||
done
|
||||
}
|
||||
|
||||
function checkMissingArgs {
|
||||
local ARG_NAME
|
||||
for ARG_NAME in "${REQUIRED_ARG_NAMES[@]}"
|
||||
do
|
||||
ARG_VALUE=$(getVar $(varName $ARG_NAME))
|
||||
|
||||
if [[ ! $ARG_VALUE ]]; then
|
||||
echo "Missing: $ARG_NAME"
|
||||
usage;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# -- run
|
||||
readArgDefs
|
||||
readAndValidateArgs "$@"
|
||||
checkMissingArgs
|
||||
|
||||
}
|
||||
|
||||
# getVar(varName)
|
||||
function getVar {
|
||||
echo ${!1}
|
||||
}
|
||||
|
||||
# setVar(varName, varValue)
|
||||
function setVar {
|
||||
eval "$1=\"$2\""
|
||||
}
|
||||
|
||||
# isFunction(name)
|
||||
# - to be used in an if, so return 0 if successful and 1 if not!
|
||||
function isFunction {
|
||||
if [[ $(type -t $1) == "function" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# readJsonProp(jsonFile, property)
|
||||
# - restriction: property needs to be on an own line!
|
||||
function readJsonProp {
|
||||
echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1)
|
||||
}
|
||||
|
||||
# replaceJsonProp(jsonFile, property, newValue)
|
||||
# - note: propertyRegex will be automatically placed into a
|
||||
# capturing group! -> all other groups start at index 2!
|
||||
function replaceJsonProp {
|
||||
replaceInFile $1 "\"$2\": \".*?\"" "\"$2\": \"$3\""
|
||||
}
|
||||
|
||||
# replaceInFile(file, findPattern, replacePattern)
|
||||
function replaceInFile {
|
||||
perl -pi -e "s/$2/$3/g;" $1
|
||||
}
|
||||
|
||||
# resolveDir(relativeDir)
|
||||
# - resolves a directory relative to the current script
|
||||
function resolveDir {
|
||||
echo $(cd $SCRIPT_DIR; cd $1; pwd)
|
||||
}
|
||||
|
||||
function main {
|
||||
# normalize the working dir to the directory of the script
|
||||
cd $(dirname $0);SCRIPT_DIR=$(pwd)
|
||||
|
||||
ARG_DEFS+=("[--verbose=(true|false)]")
|
||||
parseArgs "$@"
|
||||
|
||||
|
||||
# --verbose argument
|
||||
if [[ $VERBOSE == "true" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if isFunction init; then
|
||||
init "$@"
|
||||
fi
|
||||
|
||||
# jump to the function denoted by the --action argument,
|
||||
# otherwise call the "run" function
|
||||
if [[ $ACTION ]]; then
|
||||
$ACTION "$@"
|
||||
else
|
||||
run "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
||||
# bash utils from angularjs
|
||||
# This file provides:
|
||||
# - a default control flow
|
||||
# * initializes the environment
|
||||
# * call a function in your script based on the arguments
|
||||
# - named argument parsing and automatic generation of the "usage" for your script
|
||||
# - utility functions
|
||||
#
|
||||
# Usage:
|
||||
# - define the variable ARGS_DEF (see below) with the arguments for your script
|
||||
# - include this file using `source utils.inc` at the end of your script.
|
||||
#
|
||||
# Default control flow:
|
||||
# 0. Set the current directory to the directory of the script. By this
|
||||
# the script can be called from anywhere.
|
||||
# 1. Parse the named arguments
|
||||
# 2. [Redacted]
|
||||
# 3. If the parameter "verbose" is set, the `-x` flag will be set in bash.
|
||||
# 4. The function "init" will be called if it exists
|
||||
# 5. If the parameter "action" is set, it will call the function with the name of that parameter.
|
||||
# Otherwise the function "run" will be called.
|
||||
#
|
||||
# Named Argument Parsing:
|
||||
# - The variable ARGS_DEF defines the valid command arguments
|
||||
# * Required args syntax: --paramName=paramRegex
|
||||
# * Optional args syntax: [--paramName=paramRegex]
|
||||
# * e.g. ARG_DEFS=("--required_param=(.+)" "[--optional_param=(.+)]")
|
||||
# - Checks that:
|
||||
# * all arguments match to an entry in ARGS_DEF
|
||||
# * all required arguments are present
|
||||
# * all arguments match their regex
|
||||
# - Afterwards, every paramter value will be stored in a variable
|
||||
# with the name of the parameter in upper case (with dash converted to underscore).
|
||||
#
|
||||
# Special arguments that are always available:
|
||||
# - "--action=.*": This parameter will be used to dispatch to a function with that name when the
|
||||
# script is started
|
||||
# - "--verbose=true": This will set the `-x` flag in bash so that all calls will be logged
|
||||
#
|
||||
# Utility functions:
|
||||
# - readJsonProp
|
||||
# - replaceJsonProp
|
||||
# - resolveDir
|
||||
# - getVar
|
||||
# - serVar
|
||||
# - isFunction
|
||||
# always stop on errors
|
||||
set -e
|
||||
|
||||
function usage {
|
||||
echo "Usage: ${0} ${ARG_DEFS[@]}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
function parseArgs {
|
||||
local REQUIRED_ARG_NAMES=()
|
||||
|
||||
# -- helper functions
|
||||
function varName {
|
||||
# everything to upper case and dash to underscore
|
||||
echo ${1//-/_} | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
function readArgDefs {
|
||||
local ARG_DEF
|
||||
local AD_OPTIONAL
|
||||
local AD_NAME
|
||||
local AD_RE
|
||||
|
||||
# -- helper functions
|
||||
function parseArgDef {
|
||||
local ARG_DEF_REGEX="(\[?)--([^=]+)=(.*)"
|
||||
if [[ ! $1 =~ $ARG_DEF_REGEX ]]; then
|
||||
echo "Internal error: arg def has wrong format: $ARG_DEF"
|
||||
exit 1
|
||||
fi
|
||||
AD_OPTIONAL="${BASH_REMATCH[1]}"
|
||||
AD_NAME="${BASH_REMATCH[2]}"
|
||||
AD_RE="${BASH_REMATCH[3]}"
|
||||
if [[ $AD_OPTIONAL ]]; then
|
||||
# Remove last bracket for optional args.
|
||||
# Can't put this into the ARG_DEF_REGEX somehow...
|
||||
AD_RE=${AD_RE%?}
|
||||
fi
|
||||
}
|
||||
|
||||
# -- run
|
||||
for ARG_DEF in "${ARG_DEFS[@]}"
|
||||
do
|
||||
parseArgDef $ARG_DEF
|
||||
|
||||
local AD_NAME_UPPER=$(varName $AD_NAME)
|
||||
setVar "${AD_NAME_UPPER}_OPTIONAL" "$AD_OPTIONAL"
|
||||
setVar "${AD_NAME_UPPER}_RE" "$AD_RE"
|
||||
if [[ ! $AD_OPTIONAL ]]; then
|
||||
REQUIRED_ARG_NAMES+=($AD_NAME)
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function readAndValidateArgs {
|
||||
local ARG_NAME
|
||||
local ARG_VALUE
|
||||
local ARG_NAME_UPPER
|
||||
|
||||
# -- helper functions
|
||||
function parseArg {
|
||||
local ARG_REGEX="--([^=]+)=?(.*)"
|
||||
|
||||
if [[ ! $1 =~ $ARG_REGEX ]]; then
|
||||
echo "Can't parse argument $i"
|
||||
usage
|
||||
fi
|
||||
|
||||
ARG_NAME="${BASH_REMATCH[1]}"
|
||||
ARG_VALUE="${BASH_REMATCH[2]}"
|
||||
ARG_NAME_UPPER=$(varName $ARG_NAME)
|
||||
}
|
||||
|
||||
function validateArg {
|
||||
local AD_RE=$(getVar ${ARG_NAME_UPPER}_RE)
|
||||
|
||||
if [[ ! $AD_RE ]]; then
|
||||
echo "Unknown option: $ARG_NAME"
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ ! $ARG_VALUE =~ ^${AD_RE}$ ]]; then
|
||||
echo "Wrong format: $ARG_NAME"
|
||||
usage;
|
||||
fi
|
||||
|
||||
# validate that the "action" option points to a valid function
|
||||
if [[ $ARG_NAME == "action" ]] && ! isFunction $ARG_VALUE; then
|
||||
echo "No action $ARG_VALUE defined in this script"
|
||||
usage;
|
||||
fi
|
||||
}
|
||||
|
||||
# -- run
|
||||
for i in "$@"
|
||||
do
|
||||
parseArg $i
|
||||
validateArg
|
||||
setVar "${ARG_NAME_UPPER}" "$ARG_VALUE"
|
||||
done
|
||||
}
|
||||
|
||||
function checkMissingArgs {
|
||||
local ARG_NAME
|
||||
for ARG_NAME in "${REQUIRED_ARG_NAMES[@]}"
|
||||
do
|
||||
ARG_VALUE=$(getVar $(varName $ARG_NAME))
|
||||
|
||||
if [[ ! $ARG_VALUE ]]; then
|
||||
echo "Missing: $ARG_NAME"
|
||||
usage;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# -- run
|
||||
readArgDefs
|
||||
readAndValidateArgs "$@"
|
||||
checkMissingArgs
|
||||
|
||||
}
|
||||
|
||||
# getVar(varName)
|
||||
function getVar {
|
||||
echo ${!1}
|
||||
}
|
||||
|
||||
# setVar(varName, varValue)
|
||||
function setVar {
|
||||
eval "$1=\"$2\""
|
||||
}
|
||||
|
||||
# isFunction(name)
|
||||
# - to be used in an if, so return 0 if successful and 1 if not!
|
||||
function isFunction {
|
||||
if [[ $(type -t $1) == "function" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# readJsonProp(jsonFile, property)
|
||||
# - restriction: property needs to be on an own line!
|
||||
function readJsonProp {
|
||||
echo $(sed -En 's/.*"'$2'"[ ]*:[ ]*"(.*)".*/\1/p' $1)
|
||||
}
|
||||
|
||||
# replaceJsonProp(jsonFile, property, newValue)
|
||||
# - note: propertyRegex will be automatically placed into a
|
||||
# capturing group! -> all other groups start at index 2!
|
||||
function replaceJsonProp {
|
||||
replaceInFile $1 "\"$2\": \".*?\"" "\"$2\": \"$3\""
|
||||
}
|
||||
|
||||
# replaceInFile(file, findPattern, replacePattern)
|
||||
function replaceInFile {
|
||||
perl -pi -e "s/$2/$3/g;" $1
|
||||
}
|
||||
|
||||
# resolveDir(relativeDir)
|
||||
# - resolves a directory relative to the current script
|
||||
function resolveDir {
|
||||
echo $(cd $SCRIPT_DIR; cd $1; pwd)
|
||||
}
|
||||
|
||||
function main {
|
||||
# normalize the working dir to the directory of the script
|
||||
cd $(dirname $0);SCRIPT_DIR=$(pwd)
|
||||
|
||||
ARG_DEFS+=("[--verbose=(true|false)]")
|
||||
parseArgs "$@"
|
||||
|
||||
|
||||
# --verbose argument
|
||||
if [[ $VERBOSE == "true" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if isFunction init; then
|
||||
init "$@"
|
||||
fi
|
||||
|
||||
# jump to the function denoted by the --action argument,
|
||||
# otherwise call the "run" function
|
||||
if [[ $ACTION ]]; then
|
||||
$ACTION "$@"
|
||||
else
|
||||
run "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Logger } from '../logger';
|
||||
// tslint:disable-next-line:no-var-requires
|
||||
const MAIN_PACKAGE_JSON = require('../../package.json');
|
||||
const VERSION = MAIN_PACKAGE_JSON.version;
|
||||
const FLAGS = '--access public --tag beta';
|
||||
const FLAGS = '--access public';
|
||||
|
||||
const PACKAGE_JSON_BASE = {
|
||||
description: 'Ionic Native - Native plugins for ionic apps',
|
||||
@@ -29,14 +29,15 @@ const DIST = path.resolve(ROOT, 'dist/@ionic-native');
|
||||
|
||||
const PACKAGES = [];
|
||||
|
||||
const RXJS_VERSION = '*';
|
||||
const MIN_CORE_VERSION = '^5.1.0';
|
||||
const RXJS_VERSION = '^5.5.0 || ^6.5.0';
|
||||
|
||||
const PLUGIN_PEER_DEPENDENCIES = {
|
||||
'@ionic-native/core': VERSION, // TODO change this in production
|
||||
'@ionic-native/core': MIN_CORE_VERSION,
|
||||
rxjs: RXJS_VERSION
|
||||
};
|
||||
|
||||
function getPackageJsonContent(name, peerDependencies = {}, dependencies = {}) {
|
||||
function getPackageJsonContent(name: string, peerDependencies = {}, dependencies = {}) {
|
||||
return merge(PACKAGE_JSON_BASE, {
|
||||
name: '@ionic-native/' + name,
|
||||
dependencies,
|
||||
@@ -61,10 +62,7 @@ function prepare() {
|
||||
// write plugin package.json files
|
||||
PLUGIN_PATHS.forEach((pluginPath: string) => {
|
||||
const pluginName = pluginPath.split(/[\/\\]+/).slice(-2)[0];
|
||||
const packageJsonContents = getPackageJsonContent(
|
||||
pluginName,
|
||||
PLUGIN_PEER_DEPENDENCIES
|
||||
);
|
||||
const packageJsonContents = getPackageJsonContent(pluginName, PLUGIN_PEER_DEPENDENCIES);
|
||||
const dir = path.resolve(DIST, 'plugins', pluginName);
|
||||
|
||||
writePackageJson(packageJsonContents, dir);
|
||||
@@ -74,28 +72,27 @@ function prepare() {
|
||||
async function publish(ignoreErrors = false) {
|
||||
Logger.profile('Publishing');
|
||||
// upload 1 package per CPU thread at a time
|
||||
const worker = Queue.async.asyncify((pkg: any) =>
|
||||
new Promise<any>((resolve, reject) => {
|
||||
exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => {
|
||||
if (stdout) {
|
||||
Logger.verbose(stdout.trim());
|
||||
resolve(stdout);
|
||||
}
|
||||
if (err) {
|
||||
if (!ignoreErrors) {
|
||||
if (
|
||||
err.message.includes(
|
||||
'You cannot publish over the previously published version'
|
||||
)
|
||||
) {
|
||||
Logger.verbose('Ignoring duplicate version error.');
|
||||
return resolve();
|
||||
}
|
||||
reject(err);
|
||||
const worker = Queue.async.asyncify(
|
||||
(pkg: any) =>
|
||||
new Promise<any>((resolve, reject) => {
|
||||
exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => {
|
||||
if (stdout) {
|
||||
Logger.verbose(stdout.trim());
|
||||
resolve(stdout);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
if (err) {
|
||||
if (!ignoreErrors) {
|
||||
if (
|
||||
err.message.includes('You cannot publish over the previously published version')
|
||||
) {
|
||||
Logger.verbose('Ignoring duplicate version error.');
|
||||
return resolve();
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
export function checkReady() {
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
if (typeof process === 'undefined') {
|
||||
const win: any = typeof window !== 'undefined' ? window : {};
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
|
||||
// To help developers using cordova, we listen for the device ready event and
|
||||
// log an error if it didn't fire in a reasonable amount of time. Generally,
|
||||
// when this happens, developers should remove and reinstall plugins, since
|
||||
// an inconsistent plugin is often the culprit.
|
||||
const before = Date.now();
|
||||
// To help developers using cordova, we listen for the device ready event and
|
||||
// log an error if it didn't fire in a reasonable amount of time. Generally,
|
||||
// when this happens, developers should remove and reinstall plugins, since
|
||||
// an inconsistent plugin is often the culprit.
|
||||
const before = Date.now();
|
||||
|
||||
let didFireReady = false;
|
||||
document.addEventListener('deviceready', () => {
|
||||
console.log(
|
||||
`Ionic Native: deviceready event fired after ${Date.now() - before} ms`
|
||||
);
|
||||
didFireReady = true;
|
||||
});
|
||||
let didFireReady = false;
|
||||
win.document.addEventListener('deviceready', () => {
|
||||
console.log(`Ionic Native: deviceready event fired after ${Date.now() - before} ms`);
|
||||
didFireReady = true;
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && window.cordova) {
|
||||
console.warn(
|
||||
`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`
|
||||
);
|
||||
}
|
||||
}, DEVICE_READY_TIMEOUT);
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && win.cordova) {
|
||||
console.warn(
|
||||
`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`
|
||||
);
|
||||
}
|
||||
}, DEVICE_READY_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,9 @@ class MockInstancePluginObject {
|
||||
|
||||
class MockCordovaPlugin {
|
||||
static ping = jest.fn((arg: string) => 'pong');
|
||||
static pingAsync = jest.fn(
|
||||
(arg: string, success: Function, error: Function) => success('pong')
|
||||
);
|
||||
static pingAsync = jest.fn((arg: string, success: Function, error: Function) => success('pong'));
|
||||
ping = jest.fn((arg: string) => 'pong');
|
||||
pingAsync = jest.fn((arg: string, success: Function, error: Function) =>
|
||||
success('pong')
|
||||
);
|
||||
pingAsync = jest.fn((arg: string, success: Function, error: Function) => success('pong'));
|
||||
}
|
||||
|
||||
describe('Common decorator functions', () => {
|
||||
@@ -73,12 +69,8 @@ describe('Common decorator functions', () => {
|
||||
|
||||
test('original method should have received args', () => {
|
||||
expect(MockCordovaPlugin.pingAsync.mock.calls[0][0]).toBe('pingpong');
|
||||
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][1]).toBe(
|
||||
'function'
|
||||
);
|
||||
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][2]).toBe(
|
||||
'function'
|
||||
);
|
||||
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][1]).toBe('function');
|
||||
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][2]).toBe('function');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Observable, fromEvent } from 'rxjs';
|
||||
import { fromEvent, Observable } from 'rxjs';
|
||||
|
||||
import { CordovaOptions } from './interfaces';
|
||||
|
||||
@@ -7,9 +7,7 @@ declare const window: any;
|
||||
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
|
||||
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
|
||||
|
||||
export function getPromise<T>(
|
||||
callback: (resolve: Function, reject?: Function) => any
|
||||
): Promise<T> {
|
||||
export function getPromise<T>(callback: (resolve: Function, reject?: Function) => any): Promise<T> {
|
||||
const tryNativePromise = () => {
|
||||
if (Promise) {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
@@ -22,9 +20,10 @@ export function getPromise<T>(
|
||||
}
|
||||
};
|
||||
|
||||
if (window.angular) {
|
||||
if (typeof window !== 'undefined' && window.angular) {
|
||||
const doc = window.document;
|
||||
const injector = window.angular
|
||||
.element(document.querySelector('[ng-app]') || document.body)
|
||||
.element(doc.querySelector('[ng-app]') || doc.body)
|
||||
.injector();
|
||||
if (injector) {
|
||||
const $q = injector.get('$q');
|
||||
@@ -58,14 +57,7 @@ export function wrapPromise(
|
||||
(...args: any[]) => reject(args)
|
||||
);
|
||||
} else {
|
||||
pluginResult = callCordovaPlugin(
|
||||
pluginObj,
|
||||
methodName,
|
||||
args,
|
||||
opts,
|
||||
resolve,
|
||||
reject
|
||||
);
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
rej = reject;
|
||||
});
|
||||
@@ -79,12 +71,7 @@ export function wrapPromise(
|
||||
return p;
|
||||
}
|
||||
|
||||
function wrapOtherPromise(
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
args: any[],
|
||||
opts: any = {}
|
||||
) {
|
||||
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
if (pluginResult) {
|
||||
@@ -99,12 +86,7 @@ function wrapOtherPromise(
|
||||
});
|
||||
}
|
||||
|
||||
function wrapObservable(
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
args: any[],
|
||||
opts: any = {}
|
||||
) {
|
||||
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return new Observable(observer => {
|
||||
let pluginResult;
|
||||
|
||||
@@ -162,12 +144,12 @@ function wrapObservable(
|
||||
/**
|
||||
* Wrap the event with an observable
|
||||
* @private
|
||||
* @param event even name
|
||||
* @param event event name
|
||||
* @param element The element to attach the event listener to
|
||||
* @returns {Observable}
|
||||
*/
|
||||
function wrapEventObservable(event: string, element: any): Observable<any> {
|
||||
element = element ? get(window, element) : window;
|
||||
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || (typeof window !== 'undefined' ? window : {});
|
||||
return fromEvent(element, event);
|
||||
}
|
||||
|
||||
@@ -203,11 +185,8 @@ export function checkAvailability(
|
||||
|
||||
pluginInstance = getPlugin(pluginRef);
|
||||
|
||||
if (
|
||||
!pluginInstance ||
|
||||
(!!methodName && typeof pluginInstance[methodName] === 'undefined')
|
||||
) {
|
||||
if (!window.cordova) {
|
||||
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
|
||||
if (typeof window === 'undefined' || !window.cordova) {
|
||||
cordovaWarn(pluginName, methodName);
|
||||
return ERR_CORDOVA_NOT_AVAILABLE;
|
||||
}
|
||||
@@ -223,23 +202,14 @@ export function checkAvailability(
|
||||
* Checks if _objectInstance exists and has the method/property
|
||||
* @private
|
||||
*/
|
||||
export function instanceAvailability(
|
||||
pluginObj: any,
|
||||
methodName?: string
|
||||
): boolean {
|
||||
export function instanceAvailability(pluginObj: any, methodName?: string): boolean {
|
||||
return (
|
||||
pluginObj._objectInstance &&
|
||||
(!methodName ||
|
||||
typeof pluginObj._objectInstance[methodName] !== 'undefined')
|
||||
(!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined')
|
||||
);
|
||||
}
|
||||
|
||||
export function setIndex(
|
||||
args: any[],
|
||||
opts: any = {},
|
||||
resolve?: Function,
|
||||
reject?: Function
|
||||
): any {
|
||||
export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
|
||||
// ignore resolve and reject in case sync
|
||||
if (opts.sync) {
|
||||
return args;
|
||||
@@ -258,19 +228,12 @@ export function setIndex(
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
} else if (
|
||||
opts.callbackStyle === 'object' &&
|
||||
opts.successName &&
|
||||
opts.errorName
|
||||
) {
|
||||
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
|
||||
const obj: any = {};
|
||||
obj[opts.successName] = resolve;
|
||||
obj[opts.errorName] = reject;
|
||||
args.push(obj);
|
||||
} else if (
|
||||
typeof opts.successIndex !== 'undefined' ||
|
||||
typeof opts.errorIndex !== 'undefined'
|
||||
) {
|
||||
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
|
||||
const setSuccessIndex = () => {
|
||||
// If we've specified a success/error index
|
||||
if (opts.successIndex > args.length) {
|
||||
@@ -339,15 +302,15 @@ export function callInstance(
|
||||
args = setIndex(args, opts, resolve, reject);
|
||||
|
||||
if (instanceAvailability(pluginObj, methodName)) {
|
||||
return pluginObj._objectInstance[methodName].apply(
|
||||
pluginObj._objectInstance,
|
||||
args
|
||||
);
|
||||
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
|
||||
}
|
||||
}
|
||||
|
||||
export function getPlugin(pluginRef: string): any {
|
||||
return get(window, pluginRef);
|
||||
if (typeof window !== 'undefined') {
|
||||
return get(window, pluginRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function get(element: Element | Window, path: string) {
|
||||
@@ -362,11 +325,7 @@ export function get(element: Element | Window, path: string) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
export function pluginWarn(
|
||||
pluginName: string,
|
||||
plugin?: string,
|
||||
method?: string
|
||||
): void {
|
||||
export function pluginWarn(pluginName: string, plugin?: string, method?: string): void {
|
||||
if (method) {
|
||||
console.warn(
|
||||
'Native: tried calling ' +
|
||||
@@ -378,14 +337,10 @@ export function pluginWarn(
|
||||
' plugin is not installed.'
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`Native: tried accessing the ${pluginName} plugin but it's not installed.`
|
||||
);
|
||||
console.warn(`Native: tried accessing the ${pluginName} plugin but it's not installed.`);
|
||||
}
|
||||
if (plugin) {
|
||||
console.warn(
|
||||
`Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`
|
||||
);
|
||||
console.warn(`Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,20 +350,22 @@ export function pluginWarn(
|
||||
* @param method
|
||||
*/
|
||||
export function cordovaWarn(pluginName: string, method?: string): void {
|
||||
if (method) {
|
||||
console.warn(
|
||||
'Native: tried calling ' +
|
||||
pluginName +
|
||||
'.' +
|
||||
method +
|
||||
', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
'Native: tried accessing the ' +
|
||||
pluginName +
|
||||
' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
|
||||
);
|
||||
if (typeof process === 'undefined') {
|
||||
if (method) {
|
||||
console.warn(
|
||||
'Native: tried calling ' +
|
||||
pluginName +
|
||||
'.' +
|
||||
method +
|
||||
', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
'Native: tried accessing the ' +
|
||||
pluginName +
|
||||
' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,11 +376,7 @@ export type WrapFn = (...args: any[]) => any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const wrap = (
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
opts: CordovaOptions = {}
|
||||
): WrapFn => {
|
||||
export const wrap = (pluginObj: any, methodName: string, opts: CordovaOptions = {}): WrapFn => {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
@@ -443,11 +396,7 @@ export const wrap = (
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function wrapInstance(
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
opts: any = {}
|
||||
): Function {
|
||||
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}): Function {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
return callInstance(pluginObj, methodName, args, opts);
|
||||
@@ -515,14 +464,7 @@ export function wrapInstance(
|
||||
(...args: any[]) => reject(args)
|
||||
);
|
||||
} else {
|
||||
result = callInstance(
|
||||
pluginObj,
|
||||
methodName,
|
||||
args,
|
||||
opts,
|
||||
resolve,
|
||||
reject
|
||||
);
|
||||
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
if (result && result.then) {
|
||||
result.then(resolve, reject);
|
||||
@@ -543,14 +485,7 @@ export function wrapInstance(
|
||||
(...args: any[]) => reject(args)
|
||||
);
|
||||
} else {
|
||||
pluginResult = callInstance(
|
||||
pluginObj,
|
||||
methodName,
|
||||
args,
|
||||
opts,
|
||||
resolve,
|
||||
reject
|
||||
);
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
rej = reject;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
|
||||
import { checkAvailability, getPlugin } from './common';
|
||||
|
||||
function overrideFunction(pluginObj: any, methodName: string): Observable<any> {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { wrapInstance } from './common';
|
||||
import { CordovaOptions } from './interfaces';
|
||||
|
||||
export function cordovaInstance(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) {
|
||||
export function cordovaInstance(
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
config: CordovaOptions,
|
||||
args: IArguments | any[]
|
||||
) {
|
||||
args = Array.from(args);
|
||||
return wrapInstance(pluginObj, methodName, config).apply(this, args);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { wrap } from './common';
|
||||
import { CordovaOptions } from './interfaces';
|
||||
|
||||
export function cordova(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) {
|
||||
export function cordova(
|
||||
pluginObj: any,
|
||||
methodName: string,
|
||||
config: CordovaOptions,
|
||||
args: IArguments | any[]
|
||||
) {
|
||||
return wrap(pluginObj, methodName, config).apply(this, args);
|
||||
}
|
||||
|
||||
@@ -18,31 +18,45 @@ export class IonicNativePlugin {
|
||||
* Returns a boolean that indicates whether the plugin is installed
|
||||
* @return {boolean}
|
||||
*/
|
||||
static installed(): boolean { return checkAvailability(this.pluginRef) === true; }
|
||||
static installed(): boolean {
|
||||
return checkAvailability(this.pluginRef) === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original plugin object
|
||||
*/
|
||||
static getPlugin(): any { return get(window, this.pluginRef); }
|
||||
static getPlugin(): any {
|
||||
if (typeof window !== 'undefined') {
|
||||
return get(window, this.pluginRef);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's name
|
||||
*/
|
||||
static getPluginName(): string { return this.pluginName; }
|
||||
static getPluginName(): string {
|
||||
return this.pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's reference
|
||||
*/
|
||||
static getPluginRef(): string { return this.pluginRef; }
|
||||
static getPluginRef(): string {
|
||||
return this.pluginRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's install name
|
||||
*/
|
||||
static getPluginInstallName(): string { return this.plugin; }
|
||||
static getPluginInstallName(): string {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's supported platforms
|
||||
*/
|
||||
static getSupportedPlatforms(): string[] { return this.platforms || []; }
|
||||
|
||||
static getSupportedPlatforms(): string[] {
|
||||
return this.platforms || [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ declare const window: any;
|
||||
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
|
||||
*/
|
||||
export function initAngular1(plugins: any) {
|
||||
if (window.angular) {
|
||||
if (typeof window !== 'undefined' && window.angular) {
|
||||
const ngModule = window.angular.module('ionic.native', []);
|
||||
|
||||
for (const name in plugins) {
|
||||
|
||||
@@ -7,7 +7,9 @@ export function get(element: Element | Window, path: string) {
|
||||
const paths: string[] = path.split('.');
|
||||
let obj: any = element;
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
if (!obj) { return null; }
|
||||
if (!obj) {
|
||||
return null;
|
||||
}
|
||||
obj = obj[paths[i]];
|
||||
}
|
||||
return obj;
|
||||
@@ -17,9 +19,8 @@ export function get(element: Element | Window, path: string) {
|
||||
* @private
|
||||
*/
|
||||
export function getPromise(callback: Function = () => {}): Promise<any> {
|
||||
|
||||
const tryNativePromise = () => {
|
||||
if (window.Promise) {
|
||||
if (typeof Promise === 'function' || (typeof window !== 'undefined' && window.Promise)) {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
callback(resolve, reject);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,6 @@ declare const AbbyyRtrSdk: any;
|
||||
* default setting will be used.
|
||||
*/
|
||||
export interface TextCaptureOptions {
|
||||
|
||||
/**
|
||||
* The name of the license file. This file must be located in the
|
||||
* www/rtr_assets/ directory in your project.
|
||||
@@ -57,6 +56,11 @@ export interface TextCaptureOptions {
|
||||
* the latest recognition result.
|
||||
*/
|
||||
isStopButtonVisible?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the orientation, possible values 'landscape' or 'portrait'.
|
||||
*/
|
||||
orientation?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +68,6 @@ export interface TextCaptureOptions {
|
||||
* The callback you implement should parse this object and show results to user.
|
||||
*/
|
||||
export interface TextCaptureResult {
|
||||
|
||||
/**
|
||||
* An array of objects representing recognized lines of text.
|
||||
* These objects have the following keys:
|
||||
@@ -75,7 +78,7 @@ export interface TextCaptureResult {
|
||||
* · rect (string): position and size of the bounding rectangle,
|
||||
* a string of 4 integers separated with whitespaces ("x y width height").
|
||||
*/
|
||||
textLines: { text: string, quadrangle: string, rect?: string }[];
|
||||
textLines: { text: string; quadrangle: string; rect?: string }[];
|
||||
|
||||
/**
|
||||
* Additional information. This object has the following keys:
|
||||
@@ -91,10 +94,10 @@ export interface TextCaptureResult {
|
||||
* the array contains language identifiers (["English", "French", "German"]).
|
||||
*/
|
||||
resultInfo: {
|
||||
stabilityStatus: string,
|
||||
userAction: string,
|
||||
frameSize: string,
|
||||
recognitionLanguages: string[]
|
||||
stabilityStatus: string;
|
||||
userAction: string;
|
||||
frameSize: string;
|
||||
recognitionLanguages: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -114,7 +117,6 @@ export interface TextCaptureResult {
|
||||
* keys: you must specify either one of them, but not both at the same time.
|
||||
*/
|
||||
export interface DataCaptureOptions {
|
||||
|
||||
/**
|
||||
* The predefined data capture profile to use, for example: "MRZ".
|
||||
* Note: For the list of supported documents, see Specifications — Data
|
||||
@@ -134,10 +136,10 @@ export interface DataCaptureOptions {
|
||||
* the regular expression that should be matched when capturing a field.
|
||||
*/
|
||||
customDataCaptureScenario?: {
|
||||
name: string,
|
||||
description: string,
|
||||
recognitionLanguages: string[],
|
||||
fields: { regEx: string }[]
|
||||
name: string;
|
||||
description: string;
|
||||
recognitionLanguages: string[];
|
||||
fields: { regEx: string }[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -175,6 +177,11 @@ export interface DataCaptureOptions {
|
||||
* the latest recognition result.
|
||||
*/
|
||||
isStopButtonVisible?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the orientation, possible values 'landscape' or 'portrait'.
|
||||
*/
|
||||
orientation?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,7 +189,6 @@ export interface DataCaptureOptions {
|
||||
* implement should parse this object and show results to user.
|
||||
*/
|
||||
export interface DataCaptureResult {
|
||||
|
||||
/**
|
||||
* The data scheme which was applied during data capture.
|
||||
* The value is an object which has two keys:
|
||||
@@ -195,8 +201,8 @@ export interface DataCaptureResult {
|
||||
* present in the result.
|
||||
*/
|
||||
dataScheme?: {
|
||||
id: string,
|
||||
name: string
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -222,15 +228,15 @@ export interface DataCaptureResult {
|
||||
* of 4 integers separated with whitespaces ("x y width height").
|
||||
*/
|
||||
dataFields: {
|
||||
id: string,
|
||||
name: string,
|
||||
text: string,
|
||||
quadrangle: string,
|
||||
id: string;
|
||||
name: string;
|
||||
text: string;
|
||||
quadrangle: string;
|
||||
components: {
|
||||
text: string,
|
||||
quadrangle: string,
|
||||
rect: string
|
||||
}
|
||||
text: string;
|
||||
quadrangle: string;
|
||||
rect: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -245,9 +251,9 @@ export interface DataCaptureResult {
|
||||
* with 2 integers separated with a whitespace ("720 1280").
|
||||
*/
|
||||
resultInfo: {
|
||||
stabilityStatus: string,
|
||||
userAction: string,
|
||||
frameSize: string
|
||||
stabilityStatus: string;
|
||||
userAction: string;
|
||||
frameSize: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -297,7 +303,6 @@ export interface DataCaptureResult {
|
||||
})
|
||||
@Injectable()
|
||||
export class AbbyyRTR extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Opens a modal dialog with controls for the Text Capture scenario.
|
||||
* @param {TextCaptureOptions} options
|
||||
|
||||
461
src/@ionic-native/plugins/adjust/index.ts
Normal file
461
src/@ionic-native/plugins/adjust/index.ts
Normal file
@@ -0,0 +1,461 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export class AdjustEvent {
|
||||
private eventToken: string;
|
||||
private revenue: number;
|
||||
private currency: string;
|
||||
private transactionId: string;
|
||||
private callbackId: string;
|
||||
private callbackParameters: string[] = [];
|
||||
private partnerParameters: string[] = [];
|
||||
|
||||
constructor(eventToken: string) {
|
||||
this.eventToken = eventToken;
|
||||
}
|
||||
|
||||
setRevenue(revenue: number, currency: string): void {
|
||||
this.revenue = revenue;
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
addCallbackParameter(key: string, value: string): void {
|
||||
this.callbackParameters.push(key);
|
||||
this.callbackParameters.push(value);
|
||||
}
|
||||
|
||||
addPartnerParameter(key: string, value: string): void {
|
||||
this.partnerParameters.push(key);
|
||||
this.partnerParameters.push(value);
|
||||
}
|
||||
|
||||
setTransactionId(transactionId: string) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
setCallbackId(callbackId: string) {
|
||||
this.callbackId = callbackId;
|
||||
}
|
||||
}
|
||||
|
||||
export class AdjustConfig {
|
||||
private appToken: string;
|
||||
private environment: AdjustEnvironment;
|
||||
private sdkPrefix: string;
|
||||
private delayStart = 0.0;
|
||||
private logLevel: AdjustLogLevel = null;
|
||||
private defaultTracker: string = null;
|
||||
private sendInBackground: boolean = null;
|
||||
private shouldLaunchDeeplink: boolean = null;
|
||||
private eventBufferingEnabled: boolean = null;
|
||||
private userAgent: string = null;
|
||||
private isDeviceKnown: boolean = null;
|
||||
private secretId: number = null;
|
||||
private info1: number = null;
|
||||
private info2: number = null;
|
||||
private info3: number = null;
|
||||
private info4: number = null;
|
||||
private processName: string = null; // Android only
|
||||
|
||||
private attributionCallback: (attribution: AdjustAttribution) => void = null;
|
||||
private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null;
|
||||
private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null;
|
||||
private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null;
|
||||
private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null;
|
||||
private deferredDeeplinkCallback: (uri: string) => void = null;
|
||||
|
||||
constructor(appToken: string, environment: AdjustEnvironment) {
|
||||
this.appToken = appToken;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
setAppSecret(secretId: number, info1: number, info2: number, info3: number, info4: number): void {
|
||||
this.secretId = secretId;
|
||||
this.info1 = info1;
|
||||
this.info2 = info2;
|
||||
this.info3 = info3;
|
||||
this.info4 = info4;
|
||||
}
|
||||
|
||||
setDelayStart(delayStart: number) {
|
||||
this.delayStart = delayStart;
|
||||
}
|
||||
|
||||
setLogLevel(logLevel: AdjustLogLevel) {
|
||||
this.logLevel = logLevel;
|
||||
}
|
||||
|
||||
setDefaultTracker(defaultTracker: string) {
|
||||
this.defaultTracker = defaultTracker;
|
||||
}
|
||||
|
||||
setSendInBackground(sendInBackground: boolean) {
|
||||
this.sendInBackground = sendInBackground;
|
||||
}
|
||||
|
||||
setShouldLaunchDeeplink(shouldLaunchDeeplink: boolean) {
|
||||
this.shouldLaunchDeeplink = shouldLaunchDeeplink;
|
||||
}
|
||||
|
||||
setEventBufferingEnabled(eventBufferingEnabled: boolean) {
|
||||
this.eventBufferingEnabled = eventBufferingEnabled;
|
||||
}
|
||||
|
||||
setUserAgent(userAgent: string) {
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
||||
setDeviceKnown(isDeviceKnown: boolean) {
|
||||
this.isDeviceKnown = isDeviceKnown;
|
||||
}
|
||||
|
||||
setProcessName(processName: string) {
|
||||
this.processName = processName;
|
||||
}
|
||||
|
||||
setAttributionCallbackListener(attributionCallback: (attribution: AdjustAttribution) => void) {
|
||||
this.attributionCallback = attributionCallback;
|
||||
}
|
||||
|
||||
setEventTrackingSucceededCallbackListener(
|
||||
eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void
|
||||
) {
|
||||
this.eventTrackingSucceededCallback = eventTrackingSucceededCallback;
|
||||
}
|
||||
|
||||
setEventTrackingFailedCallbackListener(
|
||||
eventTrackingFailedCallback: (event: AdjustEventFailure) => void
|
||||
) {
|
||||
this.eventTrackingFailedCallback = eventTrackingFailedCallback;
|
||||
}
|
||||
|
||||
setSessionTrackingSucceededCallbackListener(
|
||||
sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void
|
||||
) {
|
||||
this.sessionTrackingSucceededCallback = sessionTrackingSucceededCallback;
|
||||
}
|
||||
|
||||
setSessionTrackingFailedCallbackListener(
|
||||
sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void
|
||||
) {
|
||||
this.sessionTrackingFailedCallback = sessionTrackingFailedCallback;
|
||||
}
|
||||
|
||||
setDeferredDeeplinkCallbackListener(deferredDeeplinkCallback: (uri: string) => void) {
|
||||
this.deferredDeeplinkCallback = deferredDeeplinkCallback;
|
||||
}
|
||||
|
||||
private getAttributionCallback() {
|
||||
return this.attributionCallback;
|
||||
}
|
||||
|
||||
private getEventTrackingSucceededCallback() {
|
||||
return this.eventTrackingSucceededCallback;
|
||||
}
|
||||
|
||||
private getEventTrackingFailedCallback() {
|
||||
return this.eventTrackingFailedCallback;
|
||||
}
|
||||
|
||||
private getSessionTrackingSucceededCallback() {
|
||||
return this.sessionTrackingSucceededCallback;
|
||||
}
|
||||
|
||||
private getSessionTrackingFailedCallback() {
|
||||
return this.sessionTrackingFailedCallback;
|
||||
}
|
||||
|
||||
private getDeferredDeeplinkCallback() {
|
||||
return this.deferredDeeplinkCallback;
|
||||
}
|
||||
|
||||
private hasAttributionListener() {
|
||||
return this.attributionCallback !== null;
|
||||
}
|
||||
|
||||
private hasEventTrackingSucceededListener() {
|
||||
return this.eventTrackingSucceededCallback !== null;
|
||||
}
|
||||
|
||||
private hasEventTrackingFailedListener() {
|
||||
return this.eventTrackingFailedCallback !== null;
|
||||
}
|
||||
|
||||
private hasSessionTrackingSucceededListener() {
|
||||
return this.sessionTrackingSucceededCallback !== null;
|
||||
}
|
||||
|
||||
private hasSessionTrackingFailedListener() {
|
||||
return this.sessionTrackingFailedCallback !== null;
|
||||
}
|
||||
|
||||
private hasDeferredDeeplinkCallbackListener() {
|
||||
return this.deferredDeeplinkCallback !== null;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AdjustAttribution {
|
||||
trackerToken: string;
|
||||
trackerName: string;
|
||||
network: string;
|
||||
campaign: string;
|
||||
adgroup: string;
|
||||
creative: string;
|
||||
clickLabel: string;
|
||||
adid: string;
|
||||
}
|
||||
|
||||
export interface AdjustSessionSuccess {
|
||||
message: string;
|
||||
timestamp: string;
|
||||
adid: string;
|
||||
jsonResponse: string;
|
||||
}
|
||||
|
||||
export interface AdjustSessionFailure {
|
||||
message: string;
|
||||
timestamp: string;
|
||||
adid: string;
|
||||
willRetry: boolean;
|
||||
jsonResponse: string;
|
||||
}
|
||||
|
||||
export interface AdjustEventSuccess {
|
||||
message: string;
|
||||
timestamp: string;
|
||||
adid: string;
|
||||
eventToken: string;
|
||||
callbackId: string;
|
||||
jsonResponse: string;
|
||||
}
|
||||
|
||||
export interface AdjustEventFailure {
|
||||
message: string;
|
||||
timestamp: string;
|
||||
adid: string;
|
||||
eventToken: string;
|
||||
willRetry: boolean;
|
||||
callbackId: string;
|
||||
jsonResponse: string;
|
||||
}
|
||||
|
||||
export enum AdjustEnvironment {
|
||||
Sandbox = 'sandbox',
|
||||
Production = 'production'
|
||||
}
|
||||
|
||||
export enum AdjustLogLevel {
|
||||
Verbose = 'VERBOSE',
|
||||
Debug = 'DEBUG',
|
||||
Info = 'INFO',
|
||||
Warn = 'WARN',
|
||||
Error = 'ERROR',
|
||||
Assert = 'ASSERT',
|
||||
Suppress = 'SUPPRESS'
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Adjust
|
||||
* @description
|
||||
* This is the Ionic Cordova SDK of Adjust™. You can read more about Adjust™ at adjust.com.
|
||||
*
|
||||
* Requires Cordova plugin: `com.adjust.sdk`. For more info, please see the [Adjust Cordova SDK](https://github.com/adjust/cordova_sdk)
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Adjust, AdjustConfig, AdjustEnvironment } from '@ionic-native/adjust/ngx';
|
||||
*
|
||||
* constructor(private adjust: Adjust) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const config = new AdjustConfig('APP-TOKEN-HERE', AdjustEnvironment.Sandbox);
|
||||
* config.logLevel = AdjustLogLevel.Verbose;
|
||||
* // Set other config properties.
|
||||
* adjust.create(config);
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* AdjustAttribution
|
||||
* AdjustSessionSuccess
|
||||
* AdjustSessionFailure
|
||||
* AdjustEventSuccess
|
||||
* AdjustEventFailure
|
||||
* @classes
|
||||
* AdjustEvent
|
||||
* AdjustConfig
|
||||
* @enums
|
||||
* AdjustEnvironment
|
||||
* AdjustLogLevel
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Adjust',
|
||||
plugin: 'com.adjust.sdk',
|
||||
pluginRef: 'Adjust',
|
||||
repo: 'https://github.com/adjust/cordova_sdk',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Adjust extends IonicNativePlugin {
|
||||
/**
|
||||
* This method initializes Adjust SDK
|
||||
* @param {AdjustConig} config Adjust config object used as starting options
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
create(config: AdjustConfig): void {}
|
||||
|
||||
/**
|
||||
* This method tracks an event
|
||||
* @param {AdjustEvent} event Adjust event object to be tracked
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
trackEvent(event: AdjustEvent): void {}
|
||||
|
||||
/**
|
||||
* This method sets offline mode on or off
|
||||
* @param {boolean} enabled set to true for offline mode on
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setOfflineMode(enabled: boolean): void {}
|
||||
|
||||
/**
|
||||
* By making this call, the Adjust SDK will try to find if there is any new attribution info inside of the deep link and if any, it will be sent to the Adjust backend.
|
||||
* @param {string} url URL of the deeplink
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
appWillOpenUrl(url: string): void {}
|
||||
|
||||
/**
|
||||
* You can disable/enable the Adjust SDK from tracking by invoking this method
|
||||
* @param {boolean} enabled set to false to disable SDK
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setEnabled(enabled: boolean): void {}
|
||||
|
||||
/**
|
||||
* To send us the push notification token, add the following call to Adjust whenever you get your token in the app or when it gets updated.
|
||||
* Push tokens are used for Audience Builder and client callbacks, and they are required for the upcoming uninstall tracking feature.
|
||||
* @param {string} pushToken push token value
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setPushToken(pushToken: string): void {}
|
||||
|
||||
/**
|
||||
* Check if the Adjust SDK is currently enabled by calling this function
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isEnabled(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* In accordance with article 17 of the EU's General Data Protection Regulation (GDPR), you can notify Adjust when a user has exercised their right to be forgotten.
|
||||
* Calling the following method will instruct the Adjust SDK to communicate the user's choice to be forgotten to the Adjust backend
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
gdprForgetMe(): void {}
|
||||
|
||||
/**
|
||||
* Function used to get Google AdId
|
||||
* @return {Promise<string>} Returns a promise with google AdId value
|
||||
*/
|
||||
@Cordova()
|
||||
getGoogleAdId(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you need to obtain the Amazon Advertising ID, you can make a call to this function.
|
||||
* @return {Promise<string>} Returns a promise with anazib adv. ID
|
||||
*/
|
||||
@Cordova()
|
||||
getAmazonAdId(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the IDFA, call this function
|
||||
* @return {Promise<string>} Returns a promise with IDFA string value
|
||||
*/
|
||||
@Cordova()
|
||||
getIdfa(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* For every device with your app installed on it, the Adjust backend generates a unique Adjust device identifier (adid).
|
||||
* In order to obtain this identifier, call this function
|
||||
* @return {Promise<string>} Returns a promise with adid value
|
||||
*/
|
||||
@Cordova()
|
||||
getAdid(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to access information about a user's current attribution whenever you need it, you can make a call to this function
|
||||
* @return {Promise<AdjustAttribution>} Returns a promise with AdjustAttribution object
|
||||
*/
|
||||
@Cordova()
|
||||
getAttribution(): Promise<AdjustAttribution> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the information about version of the SDK used
|
||||
* @return {Promise<string>} Returns a promise with sdk version information
|
||||
*/
|
||||
@Cordova()
|
||||
getSdkVersion(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to add session callback parameters
|
||||
* @param key key
|
||||
* @param value value
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
addSessionCallbackParameter(key: string, value: string): void {}
|
||||
|
||||
/**
|
||||
* Remove a specific session callback parameter by passing the desiring key to this method
|
||||
* @param key key
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeSessionCallbackParameter(key: string): void {}
|
||||
|
||||
/**
|
||||
* If all keys and values from the session callback parameters have to be removed, call this method
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
resetSessionCallbackParameters(): void {}
|
||||
|
||||
/**
|
||||
* Method used to add session partner parameters
|
||||
* @param key key
|
||||
* @param value value
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
addSessionPartnerParameter(key: string, value: string): void {}
|
||||
|
||||
/**
|
||||
* Remove a specific session partner parameter by passing the desiring key to this method
|
||||
* @param key key
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeSessionPartnerParameter(key: string): void {}
|
||||
|
||||
/**
|
||||
* If all keys and values from the session partner parameters have to be removed, call this method
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
resetSessionPartnerParameters(): void {}
|
||||
|
||||
/**
|
||||
* This method call will make the Adjust SDK send the initial install session and any events created, if they were not sent after delay start was set and it's delay expired.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
sendFirstPackages(): void {}
|
||||
}
|
||||
456
src/@ionic-native/plugins/admob/index.ts
Normal file
456
src/@ionic-native/plugins/admob/index.ts
Normal file
@@ -0,0 +1,456 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface AdmobOptions {
|
||||
/**
|
||||
* Your publisher id code from your AdMob account
|
||||
*/
|
||||
publisherId: string;
|
||||
|
||||
/**
|
||||
* (Optional) Your interstitial id code from your AdMob account. Defaults to publisherId
|
||||
*/
|
||||
interstitialAdId?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Your rewarded id code from your AdMob account. Defaults to publisherId
|
||||
*/
|
||||
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
|
||||
*/
|
||||
tappxIdiOS?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Your tappx id for Android apps. Admob is configured, it is also used to backfill your lost inventory when there are no Admob ads available
|
||||
*/
|
||||
tappxIdAndroid?: string;
|
||||
|
||||
/**
|
||||
* (Optional) If any of tappxId is present, it tells the percentage of traffic diverted to tappx. Defaults to 0.5 (50% of the traffic will be requested to Tappx)
|
||||
*/
|
||||
tappxShare?: number;
|
||||
|
||||
/**
|
||||
* (Optional) Indicates whether to put banner ads at top when set to true or at bottom when set to false. Defaults to false
|
||||
*/
|
||||
bannerAtTop?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Indicates the size of banner ads
|
||||
*/
|
||||
adSize?: string;
|
||||
|
||||
/**
|
||||
* (Optional) Allow banner overlap webview. Default false
|
||||
*/
|
||||
overlap?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Set to true to avoid ios7 status bar overlap. Default false
|
||||
*/
|
||||
offsetStatusBar?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Set to true to receive test ads (do not test with real ads as your account may be banned). Defaults to false
|
||||
*/
|
||||
isTesting?: boolean;
|
||||
|
||||
/**
|
||||
* (Options) A JSON object with additional {key: value} pairs
|
||||
*/
|
||||
adExtras?: any;
|
||||
|
||||
/**
|
||||
* (Optional) Auto show banner ads when available (onAdLoaded event is called). Defaults to true
|
||||
*/
|
||||
autoShowBanner?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Auto show interstitial asd when available (onAdLoaded event is called). Defaults to true
|
||||
*/
|
||||
autoShowInterstitial?: boolean;
|
||||
|
||||
/**
|
||||
* (Optional) Auto show rewarded ads when available (onAdLoaded event is called). Defaults to true
|
||||
*/
|
||||
autoShowRewarded?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Admob
|
||||
* @description
|
||||
* Most complete Admob plugin with support for [Tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) ads.
|
||||
* Monetize your apps and games with AdMob ads, using latest Google AdMob SDK. With this plugin you can show AdMob ads easily!
|
||||
*
|
||||
* **Supports:**
|
||||
* - Banner ads (top and bottom)
|
||||
* - Interstitial ads
|
||||
* - Rewarded ads
|
||||
* - [Tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) ads
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Admob, AdmobOptions } from '@ionic-native/admob/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private admob: Admob) {
|
||||
* // Admob options config
|
||||
* const admobOptions: AdmobOptions = {
|
||||
* publisherId: 'XXX-XXXX-XXXX',
|
||||
* interstitialAdId: 'XXX-XXXX-XXXX',
|
||||
* rewardedAdId: 'XXX-XXXX-XXXX',
|
||||
* isTesting: true,
|
||||
* autoShowBanner: false,
|
||||
* autoShowInterstitial: false,
|
||||
* autoShowRewarded: false,
|
||||
* adSize: this.admob.AD_SIZE.BANNER
|
||||
* };
|
||||
*
|
||||
* // Set admob options
|
||||
* this.admob.setOptions(admobOptions)
|
||||
* .then(() => console.log('Admob options have been successfully set'))
|
||||
* .catch(err => console.error('Error setting admob options:', err));
|
||||
* }
|
||||
*
|
||||
*
|
||||
*
|
||||
* // (Optionally) Load banner ad, in order to have it ready to show
|
||||
* this.admob.createBannerView()
|
||||
* .then(() => console.log('Banner ad loaded'))
|
||||
* .catch(err => console.error('Error loading banner ad:', err));
|
||||
*
|
||||
*
|
||||
* // Show banner ad (createBannerView must be called before and onAdLoaded() event raised)
|
||||
* this.admob.onAdLoaded().subscribe((ad) => {
|
||||
* if (ad.adType === this.admob.AD_TYPE.BANNER) {
|
||||
* this.admob.showBannerAd()
|
||||
* .then(() => console.log('Banner ad shown'))
|
||||
* .catch(err => console.error('Error showing banner ad:', err));
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Hide banner ad, but do not destroy it, so it can be shown later on
|
||||
* // See destroyBannerView in order to hide and destroy banner ad
|
||||
* this.admob.showBannerAd(false)
|
||||
* .then(() => console.log('Banner ad hidden'))
|
||||
* .catch(err => console.error('Error hiding banner ad:', err));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Request an interstitial ad, in order to be shown later on
|
||||
* // It is possible to autoshow it via options parameter, see docs
|
||||
* this.admob.requestInterstitialAd()
|
||||
* .then(() => console.log('Interstitial ad loaded'))
|
||||
* .catch(err => console.error('Error loading interstitial ad:', err));
|
||||
*
|
||||
*
|
||||
* // Show an interstitial ad (requestInterstitialAd must be called before)
|
||||
* this.admob.onAdLoaded().subscribe((ad) => {
|
||||
* if (ad.adType === this.admob.AD_TYPE.INTERSTITIAL) {
|
||||
* this.admob.showInterstitialAd()
|
||||
* .then(() => console.log('Interstitial ad shown'))
|
||||
* .catch(err => console.error('Error showing interstitial ad:', err));
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Request a rewarded ad
|
||||
* this.admob.requestRewardedAd()
|
||||
* .then(() => console.log('Rewarded ad loaded'))
|
||||
* .catch(err => console.error('Error loading rewarded ad:', err));
|
||||
*
|
||||
*
|
||||
* // Show rewarded ad (requestRewardedAd must be called before)
|
||||
* this.admob.onAdLoaded().subscribe((ad) => {
|
||||
* if (ad.adType === this.admob.AD_TYPE.REWARDED) {
|
||||
* this.admob.showRewardedAd()
|
||||
* .then(() => console.log('Rewarded ad shown'))
|
||||
* .catch(err => console.error('Error showing rewarded ad:', err));
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Hide and destroy banner or interstitial ad
|
||||
* this.admob.destroyBannerView()
|
||||
* .then(() => console.log('Banner or interstitial ad destroyed'))
|
||||
* .catch(err => console.error('Error destroying banner or interstitial ad:', err));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On Ad loaded event
|
||||
* this.admob.onAdLoaded().subscribe((ad) => {
|
||||
* if (ad.adType === this.admob.AD_TYPE.BANNER) {
|
||||
* console.log('Banner ad is loaded');
|
||||
* this.admob.showBannerAd();
|
||||
* } else if (ad.adType === this.admob.AD_TYPE.INTERSTITIAL) {
|
||||
* console.log('Interstitial ad is loaded');
|
||||
* this.admob.showInterstitialAd();
|
||||
* } else if (ad.adType === this.admob.AD_TYPE.REWARDED) {
|
||||
* console.log('Rewarded ad is loaded');
|
||||
* this.admob.showRewardedAd();
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On ad failed to load
|
||||
* this.admob.onAdFailedToLoad().subscribe(err => console.log('Error loading ad:', err));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On interstitial ad opened
|
||||
* this.admob.onAdOpened().subscribe(() => console.log('Interstitial ad opened'));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On interstitial ad closed
|
||||
* this.admob.onAdClosed().subscribe(() => console.log('Interstitial ad closed'));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On ad clicked and left application
|
||||
* this.admob.onAdLeftApplication().subscribe(() => console.log('Ad lefted application'));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On user ad rewarded
|
||||
* this.admob.onRewardedAd().subscribe(() => console.log('The user has been rewarded'));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On rewarded ad video started
|
||||
* this.admob.onRewardedAdVideoStarted().subscribe(() => console.log('Rewarded ad vieo started'));
|
||||
*
|
||||
*
|
||||
*
|
||||
* // On rewarded ad video completed
|
||||
* this.admob.onRewardedAdVideoCompleted().subscribe(() => console.log('Rewarded ad video completed'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Admob',
|
||||
plugin: 'cordova-admob',
|
||||
pluginRef: 'admob',
|
||||
repo: 'https://github.com/appfeel/admob-google-cordova',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Admob extends IonicNativePlugin {
|
||||
/**
|
||||
* This enum represents AdMob's supported ad sizes.
|
||||
* Use one of these constants as adSize option when calling createBannerView
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly AD_SIZE: {
|
||||
BANNER: string;
|
||||
IAB_MRECT: string;
|
||||
IAB_BANNER: string;
|
||||
IAB_LEADERBOARD: string;
|
||||
SMART_BANNER: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* This enum represents AdMob's supported ad types
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly AD_TYPE: {
|
||||
BANNER: string;
|
||||
INTERSTITIAL: string;
|
||||
REWARDED: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the options to start displaying ads.
|
||||
* Although it is not required to call this method, as options can be specified in other methods, it is highly recommended
|
||||
* @param options {AdmobOptions} Some param to configure something
|
||||
* @return {Promise<any>} Returns a promise that resolves when the options are set
|
||||
*/
|
||||
@Cordova()
|
||||
setOptions(options: AdmobOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new banner ad view. Call this method in order to be able to start showing banners
|
||||
* @param options {AdmobOptions} (Optional) Setup options
|
||||
* @return {Promise<any>} Returns a promise that resolves when the banner view is created
|
||||
*/
|
||||
@Cordova()
|
||||
createBannerView(options?: AdmobOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show banner ads. You must call createBannerView first, otherwise it will result in failure callback and no ads will be shown
|
||||
* @param show {boolean} (Optional) Indicates whether to show or hide banner ads. Defaults to `true`
|
||||
* @return {Promise<any>} Returns a promise that resolves when the banner shown or hidden
|
||||
*/
|
||||
@Cordova()
|
||||
showBannerAd(show?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide and destroy banner view. Call this method when you want to destroy banner view.
|
||||
* It is not necessary to call this method when the app closed, as it will be automatically called by the plugin
|
||||
*/
|
||||
@Cordova()
|
||||
destroyBannerView() {}
|
||||
|
||||
/**
|
||||
* Request an interstitial ad
|
||||
* If `options.autoShowInterstitial` is set to `true` (default), the ad will automatically be displayed.
|
||||
* Otherwise you need to subscribe to `onAdLoaded()` event and call `showInterstitialAd()` after it will be raised specifying that an interstitial ad is available.
|
||||
* If you already called `requestInterstitialAd()` but the interstitial has never been shown, the successive calls to `requestInterstitialAd()` will result in the ad being inmediately available (the one that was obtained on the first call)
|
||||
* @param options {AdmobOptions} (Optional) Setup options
|
||||
* @return {Promise<any>} Returns a promise that resolves when the interstitial ad is loaded
|
||||
*/
|
||||
@Cordova()
|
||||
requestInterstitialAd(options?: AdmobOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an interstitial ad. Call it after `requestInterstitialAd()` and `onAdLoaded()` event raised.
|
||||
* @return {Promise<any>} Returns a promise that resolves when the interstitial ad is shown
|
||||
*/
|
||||
@Cordova()
|
||||
showInterstitialAd(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request an rewarded ad
|
||||
* If `options.autoShowRewarded` is set to `true` (default), the ad will automatically be displayed.
|
||||
* Otherwise you need to subscribe to `onAdLoaded()` enent and call `showRewardedAd()` after it will be raised specifying that a rewarded ad is available.
|
||||
* If you already called `requestRewardedAd()` but the rewarded has never been shown, the successive calls to `requestRewardedAd()` will result in the ad being inmediately available (the one that was obtained on the first call)
|
||||
* @param options {AdmobOptions} (Optional) Setup options
|
||||
* @return {Promise<any>} Returns a promise that resolves when the rewarded ad is loaded
|
||||
*/
|
||||
@Cordova()
|
||||
requestRewardedAd(options?: AdmobOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a rewarded ad
|
||||
* @return {Promise<any>} Returns a promise that resolves when the rewarded ad is shown
|
||||
*/
|
||||
@Cordova()
|
||||
showRewardedAd(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an ad is received
|
||||
* @returns {Observable<any>} Returns an observable when an ad is received
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onAdLoaded',
|
||||
element: document
|
||||
})
|
||||
onAdLoaded(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an ad request failed
|
||||
* @returns {Observable<any>} Returns an observable when an ad request is failed
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onAdFailedToLoad',
|
||||
element: document
|
||||
})
|
||||
onAdFailedToLoad(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an ad opens an overlay that covers the screen.
|
||||
* Please note that onPause cordova event is raised when an interstitial is shown
|
||||
* @returns {Observable<any>} Returns an observable when an ad is opened
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onAdOpened',
|
||||
element: document
|
||||
})
|
||||
onAdOpened(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user is about to return to the application after clicking on an ad.
|
||||
* Please note that onResume cordova event is raised when an interstitial is closed
|
||||
* @returns {Observable<any>} Returns an observable when an ad is closed
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onAdClosed',
|
||||
element: document
|
||||
})
|
||||
onAdClosed(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user leaves the application after clicking an ad (e.g., to go to the browser)
|
||||
* @returns {Observable<any>} Returns an observable when an ad leaves the application
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onAdLeftApplication',
|
||||
element: document
|
||||
})
|
||||
onAdLeftApplication(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user has been rewarded by an ad
|
||||
* @returns {Observable<any>} Returns an observable when the user rewards an ad
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onRewardedAd',
|
||||
element: document
|
||||
})
|
||||
onRewardedAd(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the video of a rewarded ad started
|
||||
* @returns {Observable<any>} Returns an observable when the video is started
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onRewardedAdVideoStarted',
|
||||
element: document
|
||||
})
|
||||
onRewardedAdVideoStarted(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the video of a rewarded ad has completed
|
||||
* @returns {Observable<any>} Returns an observable when the video is completed
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'appfeel.cordova.admob.onRewardedAdVideoCompleted',
|
||||
element: document
|
||||
})
|
||||
onRewardedAdVideoCompleted(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
248
src/@ionic-native/plugins/analytics-firebase/index.ts
Normal file
248
src/@ionic-native/plugins/analytics-firebase/index.ts
Normal file
@@ -0,0 +1,248 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Analytics Firebase
|
||||
* @description
|
||||
* Google Analytics Firebase plugin for Ionic Native apps.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AnalyticsFirebase } from '@ionic-native/analytics-firebase';
|
||||
*
|
||||
*
|
||||
* constructor(private analyticsFirebase: AnalyticsFirebase) { }
|
||||
*
|
||||
* // Track an event with default events and params
|
||||
* const eventParams = {};
|
||||
* eventParams[this.analyticsFirebase.DEFAULT_PARAMS.LEVEL] = 29;
|
||||
* this.analyticsFirebase.logEvent(this.analyticsFirebase.DEFAULT_EVENTS.LEVEL_UP, eventParams)
|
||||
* .then(() => console.log('Event successfully tracked'))
|
||||
* .catch(err => console.log('Error tracking event:', err));
|
||||
*
|
||||
* // Track an event with custom events and params
|
||||
* const eventParams = {};
|
||||
* eventParams['my-prop'] = 29;
|
||||
* this.analyticsFirebase.logEvent('my-event', eventParams)
|
||||
* .then(() => console.log('Event successfully tracked'))
|
||||
* .catch(err => console.log('Error tracking event:', err));
|
||||
*
|
||||
*
|
||||
* // Reset analytics data
|
||||
* this.analyticsFirebase.resetAnalyticsData()
|
||||
* .then(() => console.log('Analytics data have been reset'))
|
||||
* .catch(err => console.log('Error resetting analytics data:', err));
|
||||
*
|
||||
*
|
||||
* // Track a screen view
|
||||
* this.analyticsFirebase.setCurrentScreen('Home')
|
||||
* .then(() => console.log('View successfully tracked'))
|
||||
* .catch(err => console.log('Error tracking view:', err));
|
||||
*
|
||||
*
|
||||
* // Set user id
|
||||
* this.analyticsFirebase.setUserId('USER-ID')
|
||||
* .then(() => console.log('User id successfully set'))
|
||||
* .catch(err => console.log('Error setting user id:', err));
|
||||
*
|
||||
*
|
||||
* // Set user property from default properties
|
||||
* this.analyticsFirebase.setUserProperty('KEY', 'VALUE')
|
||||
* .then(() => console.log('User property successfully set'))
|
||||
* .catch(err => console.log('Error setting user property:', err));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AnalyticsFirebase',
|
||||
plugin: 'cordova-plugin-analytics',
|
||||
pluginRef: 'analytics',
|
||||
repo: 'https://github.com/appfeel/analytics-google',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class AnalyticsFirebase extends IonicNativePlugin {
|
||||
/**
|
||||
* This enum represents AnalyticsFirebase default events.
|
||||
* Use one of these default events or a custom event
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly DEFAULT_EVENTS: {
|
||||
ADD_PAYMENT_INFO: string;
|
||||
ADD_TO_CART: string;
|
||||
ADD_TO_WISHLIST: string;
|
||||
APP_OPEN: string;
|
||||
BEGIN_CHECKOUT: string;
|
||||
CAMPAIGN_DETAILS: string;
|
||||
CHECKOUT_PROGRESS: string;
|
||||
EARN_VIRTUAL_CURRENCY: string;
|
||||
ECOMMERCE_PURCHASE: string;
|
||||
GENERATE_LEAD: string;
|
||||
JOIN_GROUP: string;
|
||||
LEVEL_END: string;
|
||||
LEVEL_START: string;
|
||||
LEVEL_UP: string;
|
||||
LOGIN: string;
|
||||
POST_SCORE: string;
|
||||
PRESENT_OFFER: string;
|
||||
PURCHASE_REFUND: string;
|
||||
REMOVE_FROM_CART: string;
|
||||
SEARCH: string;
|
||||
SELECT_CONTENT: string;
|
||||
SET_CHECKOUT_OPTION: string;
|
||||
SHARE: string;
|
||||
SIGN_UP: string;
|
||||
SPEND_VIRTUAL_CURRENCY: string;
|
||||
TUTORIAL_BEGIN: string;
|
||||
TUTORIAL_COMPLETE: string;
|
||||
UNLOCK_ACHIEVEMENT: string;
|
||||
VIEW_ITEM: string;
|
||||
VIEW_ITEM_LIST: string;
|
||||
VIEW_SEARCH_RESULTS: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* This enum represents AnalyticsFirebase default params.
|
||||
* Use one of these default params or a custom param
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly DEFAULT_PARAMS: {
|
||||
ACHIEVEMENT_ID: string;
|
||||
ACLID: string;
|
||||
AFFILIATION: string;
|
||||
CAMPAIGN: string;
|
||||
CHARACTER: string;
|
||||
CHECKOUT_OPTION: string;
|
||||
CHECKOUT_STEP: string;
|
||||
CONTENT: string;
|
||||
CONTENT_TYPE: string;
|
||||
COUPON: string;
|
||||
CP1: string;
|
||||
CREATIVE_NAME: string;
|
||||
CREATIVE_SLOT: string;
|
||||
CURRENCY: string;
|
||||
DESTINATION: string;
|
||||
END_DATE: string;
|
||||
FLIGHT_NUMBER: string;
|
||||
GROUP_ID: string;
|
||||
INDEX: string;
|
||||
ITEM_BRAND: string;
|
||||
ITEM_CATEGORY: string;
|
||||
ITEM_ID: string;
|
||||
ITEM_LIST: string;
|
||||
ITEM_LOCATION_ID: string;
|
||||
ITEM_NAME: string;
|
||||
ITEM_VARIANT: string;
|
||||
LEVEL: string;
|
||||
LEVEL_NAME: string;
|
||||
LOCATION: string;
|
||||
MEDIUM: string;
|
||||
METHOD: string;
|
||||
NUMBER_OF_NIGHTS: string;
|
||||
NUMBER_OF_PASSENGERS: string;
|
||||
NUMBER_OF_ROOMS: string;
|
||||
ORIGIN: string;
|
||||
PRICE: string;
|
||||
QUANTITY: string;
|
||||
SCORE: string;
|
||||
SEARCH_TERM: string;
|
||||
SHIPPING: string;
|
||||
SOURCE: string;
|
||||
START_DATE: string;
|
||||
SUCCESS: string;
|
||||
TAX: string;
|
||||
TERM: string;
|
||||
TRANSACTION_ID: string;
|
||||
TRAVEL_CLASS: string;
|
||||
VALUE: string;
|
||||
VIRTUAL_CURRENCY_NAME: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs an app event. The event can have up to 25 parameters.
|
||||
* Events with the same name must have the same parameters.
|
||||
* Up to 500 event names are supported.
|
||||
* Using predefined [FirebaseAnalytics.Event](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event.html) and/or [FirebaseAnalytics.Param](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param.html) is recommended for optimal reporting.
|
||||
*
|
||||
* @param eventName {string} The event name
|
||||
* @param eventParams {object} (Optional) The event params
|
||||
* @return {Promise<any>} Returns a promise that resolves when the event is logged
|
||||
*/
|
||||
@Cordova()
|
||||
logEvent(eventName: string, eventParams?: object): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all analytics data for this app from the device and resets the app instance id
|
||||
* @return {Promise<any>} Returns a promise that resolves when the analytics data is cleared
|
||||
*/
|
||||
@Cordova()
|
||||
resetAnalyticsData(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether analytics collection is enabled for this app on this device. This setting is persisted across app sessions. By default it is enabled
|
||||
* @param screenName {boolean} The value of the collection
|
||||
* @return {Promise<any>} Returns a promise that resolves when the collection is enabled/disabled
|
||||
*/
|
||||
@Cordova()
|
||||
setAnalyticsCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current screen name, which specifies the current visual context in your app.
|
||||
* This helps identify the areas in your app where users spend their time and how they interact with your app
|
||||
* @param screenName {string} The screen name
|
||||
* @return {Promise<any>} Returns a promise that resolves when the current screen is setted
|
||||
*/
|
||||
@Cordova()
|
||||
setCurrentScreen(screenName: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds)
|
||||
* @param screenName {number} The duration in milliseconds
|
||||
* @return {Promise<any>} Returns a promise that resolves when the minimum session duration is set
|
||||
*/
|
||||
@Cordova()
|
||||
setMinimumSessionDuration(milliseconds: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes)
|
||||
* @param screenName {number} The duration in milliseconds
|
||||
* @return {Promise<any>} Returns a promise that resolves when the session timeout duration is set
|
||||
*/
|
||||
@Cordova()
|
||||
setSessionTimeoutDuration(milliseconds: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user ID property. This feature must be used in accordance with Google's Privacy Policy
|
||||
* @param userId {string} The user id
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user id is setted
|
||||
*/
|
||||
@Cordova()
|
||||
setUserId(userId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a user property to a given value. Up to 25 user property names are supported. Once set, user property values persist throughout the app lifecycle and across sessions
|
||||
* @param userPropertyName {string} The user property name
|
||||
* @param userPropertyValue {string} The user property value
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user property setted
|
||||
*/
|
||||
@Cordova()
|
||||
setUserProperty(userPropertyName: string, userPropertyValue: string): 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;
|
||||
}
|
||||
}
|
||||
66
src/@ionic-native/plugins/app-launcher/index.ts
Normal file
66
src/@ionic-native/plugins/app-launcher/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AppLauncherOptions {
|
||||
uri?: string;
|
||||
packageName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name App Launcher
|
||||
* @description
|
||||
* Simple Cordova plugin to see if other apps are installed and launch them.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AppLauncher, AppLauncherOptions } from '@ionic-native/app-launcher/ngx';
|
||||
* import { Platform } from '@ionic/angular';
|
||||
*
|
||||
* constructor(private appLauncher: AppLauncher, private platform: Platform) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const options: AppLauncherOptions = {
|
||||
* }
|
||||
*
|
||||
* if(this.platform.is('ios')) {
|
||||
* options.uri = 'fb://'
|
||||
* } else {
|
||||
* options.packageName = 'com.facebook.katana'
|
||||
* }
|
||||
*
|
||||
* this.appLauncher.canLaunch(options)
|
||||
* .then((canLaunch: boolean) => console.log('Facebook is available'))
|
||||
* .catch((error: any) => console.error('Facebook is not available'));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppLauncher',
|
||||
plugin: 'cordova-plugin-app-launcher',
|
||||
pluginRef: 'window.plugins.launcher',
|
||||
repo: 'https://github.com/nchutchind/cordova-plugin-app-launcher',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class AppLauncher extends IonicNativePlugin {
|
||||
/**
|
||||
* Check if any apps are installed that can launch via a specified URI or Package Name.
|
||||
* @param options App Launcher options
|
||||
* @return {Promise<any>} Returns a promise that resolves if the app is installed
|
||||
*/
|
||||
@Cordova()
|
||||
canLaunch(options: AppLauncherOptions): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the app via a specified URI or Package Name
|
||||
* @param options App Launcher options
|
||||
* @return {Promise<any>} Returns a promise that resolves the launched app
|
||||
*/
|
||||
@Cordova()
|
||||
launch(options: AppLauncherOptions): 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 {
|
||||
|
||||
@@ -7,11 +7,28 @@ export interface EncryptedCardData {
|
||||
wrappedKey: string;
|
||||
}
|
||||
|
||||
export interface SignatureCertificatesData {
|
||||
certificateSubCA: string;
|
||||
certificateLeaf: string;
|
||||
nonce: string;
|
||||
nonceSignature: string;
|
||||
}
|
||||
|
||||
export interface CardData {
|
||||
cardholderName: string;
|
||||
primaryAccountNumberSuffix: string;
|
||||
localizedDescription?: string;
|
||||
paymentNetwork: string;
|
||||
paymentNetwork?: string;
|
||||
}
|
||||
|
||||
export interface PairedDevicesFlags {
|
||||
isInWallet: boolean;
|
||||
isInWatch: boolean;
|
||||
FPANID: string;
|
||||
}
|
||||
|
||||
export interface WatchExistData {
|
||||
isWatchPaired: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,55 +43,107 @@ export interface CardData {
|
||||
*
|
||||
* constructor(private appleWallet: AppleWallet) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.appleWallet.available()
|
||||
* .then((res) => {
|
||||
* // res is a boolean value, either true or false
|
||||
* console.log("Is Apple Wallet available? ", res);
|
||||
* // Simple call to determine if the current device supports Apple Pay and has a supported card installed.
|
||||
* this.appleWallet.isAvailable()
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((message) => {
|
||||
* console.error("ERROR AVAILBLE>> ", message);
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let data: cardData = {
|
||||
* cardholderName: 'Test User',
|
||||
* primaryAccountNumberSuffix: '1234',
|
||||
* localizedDescription: 'Description of payment card',
|
||||
* paymentNetwork: 'VISA'
|
||||
* }
|
||||
*
|
||||
* // Simple call to check Card Eligibility
|
||||
* this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string)
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // 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.checkPairedDevices()
|
||||
* .then((res: WatchExistData) => {
|
||||
* // 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
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
|
||||
* // This method provides the data needed to create a request to add your payment pass (credit/debit card). After a successful callback, pass the certificate chain to your issuer server-side using our callback delegate method `AppleWallet.completeAddPaymentPass`. The issuer server-side should returns an encrypted JSON payload containing the encrypted card data, which is required to be get the final response
|
||||
*
|
||||
* this.appleWallet.startAddPaymentPass(data: cardData)
|
||||
* .then((res) => {
|
||||
* console.log("startAddPaymentPass success response ", res);
|
||||
* .then((res: SignatureCertificatesData) => {
|
||||
* // User proceed and successfully asked to add card to his wallet
|
||||
* // Use the callback response JSON payload to complete addition process
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* console.error("startAddPaymentPass ERROR response", err);
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let data: encryptedCardData = {
|
||||
* activationData: 'encoded Base64 activationData from your server',
|
||||
* encryptedPassData: 'encoded Base64 encryptedPassData from your server',
|
||||
* wrappedKey: 'encoded Base64 wrappedKey from your server',
|
||||
* }
|
||||
*
|
||||
* this.appleWallet.encryptedCardData(data: encryptedCardData)
|
||||
* .then((res) => {
|
||||
* console.log("completeAddCardToAppleWallet success response ", res);
|
||||
* this.appleWallet.completeAddPaymentPass(data: encryptedCardData)
|
||||
* .then((res: string) => {
|
||||
* // Expect res to be string either 'success' or 'error'
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* console.error("completeAddCardToAppleWallet ERROR response", err);
|
||||
* // Catch {{err}} here
|
||||
* // Error and can not add the card, or something wrong happend
|
||||
* // PKAddPaymentPassViewController will be dismissed
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
* @Interfaces
|
||||
* EncryptedCardData
|
||||
* SignatureCertificatesData
|
||||
* CardData
|
||||
* PairedDevicesFlags
|
||||
* WatchExistData
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppleWallet',
|
||||
@@ -86,31 +155,70 @@ export interface CardData {
|
||||
@Injectable()
|
||||
export class AppleWallet extends IonicNativePlugin {
|
||||
/**
|
||||
* Detects if the current device supports Apple Wallet
|
||||
* @return {Promise<boolean>} Returns a promise
|
||||
* Simple call to determine if the current device supports Apple Pay and has a supported card installed.
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
available(): Promise<boolean> {
|
||||
isAvailable(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check Card Eligibility
|
||||
* @param {string} primaryAccountIdentifier
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkCardEligibility(primaryAccountIdentifier: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to checkCardEligibilityBySuffix
|
||||
* @param {string} cardSuffix
|
||||
* @return {Promise<PairedDevicesFlags>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkCardEligibilityBySuffix(cardSuffix: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button
|
||||
* @return {Promise<WatchExistData>}
|
||||
*/
|
||||
@Cordova()
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
|
||||
* @param {cardData} data
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<SignatureCertificatesData>}
|
||||
*/
|
||||
@Cordova()
|
||||
startAddPaymentPass(data: CardData): Promise<any> {
|
||||
startAddPaymentPass(data: CardData): Promise<SignatureCertificatesData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call contains the card data needed to add a card to Apple Pay.
|
||||
* Simple completion handler that takes encrypted card data returned from your server side, in order to get the final response from Apple to know if the card is added succesfully or not.
|
||||
* @param {encryptedCardData} data
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
completeAddPaymentPass(data: EncryptedCardData): Promise<any> {
|
||||
completeAddPaymentPass(data: EncryptedCardData): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
141
src/@ionic-native/plugins/audio-management/index.ts
Normal file
141
src/@ionic-native/plugins/audio-management/index.ts
Normal file
@@ -0,0 +1,141 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Audio Management
|
||||
* @description
|
||||
* A Cordova plugin to manage volume of audio streams for: ring, music, notification and system. Possible
|
||||
* ringer values for those streams are: silent, vibrate and normal.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AudioManagement } from '@ionic-native/audio-management/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(public audioman: AudioManagement) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* setAudioMode() {
|
||||
* this.audioman.setAudioMode(AudioManagement.AudioMode.NORMAL)
|
||||
* .then(() => {
|
||||
* console.log('Device audio mode is now NORMAL');
|
||||
* })
|
||||
* .catch((reason) => {
|
||||
* console.log(reason);
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* getAudioMode() {
|
||||
* this.audioman.getAudioMode()
|
||||
* .then((value: AudioManagement.AudioModeReturn) => {
|
||||
* console.log('Device audio mode is ' + value.label + ' (' + value.audioMode + ')');
|
||||
* })
|
||||
* .catch((reason) => {
|
||||
* console.log(reason);
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* AudioModeReturn
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AudioManagement',
|
||||
plugin: 'clovelced-plugin-audiomanagement',
|
||||
pluginRef: 'AudioManagement',
|
||||
repo: 'https://github.com/clovelCed/cordova-plugin-audiomanagement',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class AudioManagement extends IonicNativePlugin {
|
||||
/**
|
||||
* Sets the `AudioManagement.AudioMode` for the device.
|
||||
*
|
||||
* @param {AudioManagement.AudioMode} mode the device can be set to: Silent, Normal, Vibrate
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
setAudioMode(mode: AudioManagement.AudioMode): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current `AudioManagement.AudioMode` of the device. Thenable returns an object with
|
||||
* `label` and `audioMode` values.
|
||||
*
|
||||
* @returns {Promise<AudioManagement.AudioModeReturn>}
|
||||
*/
|
||||
@Cordova()
|
||||
getAudioMode(): Promise<AudioManagement.AudioModeReturn> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified `AudioManagement.VolumeType` for the device with the value from `volume`.
|
||||
*
|
||||
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to set
|
||||
* @param {number} volume the volume value
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
setVolume(type: AudioManagement.VolumeType, volume: number): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the specified `AudioManagement.VolumeType`'s `volume`. Thenable returns an object with
|
||||
* a numeric property for volume, `volume`.
|
||||
*
|
||||
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get
|
||||
* @returns {Promise<{volume: number}>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
getVolume(type: AudioManagement.VolumeType): Promise<{ volume: number }> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the specified `AudioManagement.VolumeType`'s maximum `volume`. Thenable returns an
|
||||
* object with a numeric property, `maxVolume`.
|
||||
*
|
||||
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get
|
||||
* @returns {Promise<{maxVolume: number}>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
getMaxVolume(type: AudioManagement.VolumeType): Promise<{ maxVolume: number }> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace AudioManagement {
|
||||
export enum AudioMode {
|
||||
SILENT = 0,
|
||||
VIBRATE,
|
||||
NORMAL
|
||||
}
|
||||
|
||||
export enum VolumeType {
|
||||
RING = 0,
|
||||
MUSIC,
|
||||
NOTIFICATION,
|
||||
SYSTEM
|
||||
}
|
||||
|
||||
export interface AudioModeReturn {
|
||||
audioMode: AudioManagement.AudioMode;
|
||||
label: string;
|
||||
}
|
||||
}
|
||||
@@ -2,253 +2,490 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export enum BackgroundGeolocationLocationCode {
|
||||
PERMISSION_DENIED = 1,
|
||||
LOCATION_UNAVAILABLE = 2,
|
||||
TIMEOUT = 3
|
||||
}
|
||||
|
||||
export enum BackgroundGeolocationNativeProvider {
|
||||
gps = 'gps',
|
||||
network = 'network',
|
||||
passive = 'passive',
|
||||
fused = 'fused'
|
||||
}
|
||||
|
||||
export enum BackgroundGeolocationLocationProvider {
|
||||
DISTANCE_FILTER_PROVIDER = 0,
|
||||
ACTIVITY_PROVIDER = 1,
|
||||
RAW_PROVIDER = 2
|
||||
}
|
||||
|
||||
export enum BackgroundGeolocationEvents {
|
||||
http_authorization = 'http_authorization', // Triggered when server responded with "<code>401 Unauthorized</code>" to post/sync request.
|
||||
abort_requested = 'abort_requested', // Triggered when server responded with "<code>285 Updates Not Required</code>" to post/sync request.
|
||||
background = 'background', // Triggered when app entered background state and (not visible to the user).
|
||||
foreground = 'foreground', // Triggered when app entered foreground state and (visible to the user).
|
||||
authorization = 'authorization', // Triggered when user changes authorization/permissions for the app or toggles location services.
|
||||
error = 'error', // Register error listener.
|
||||
stop = 'stop', // Triggered when background service has been stopped succesfully.
|
||||
start = 'start', // Event is triggered when background service has been started succesfully.
|
||||
activity = 'activity', // Register activity monitoring listener.
|
||||
stationary = 'stationary', // Register stationary location event listener.
|
||||
location = 'location' // Register location event listener.
|
||||
}
|
||||
|
||||
export enum BackgroundGeolocationAuthorizationStatus {
|
||||
NOT_AUTHORIZED = 0,
|
||||
AUTHORIZED = 1,
|
||||
AUTHORIZED_FOREGROUND = 2
|
||||
}
|
||||
|
||||
export enum BackgroundGeolocationLogLevel {
|
||||
TRACE = 'TRACE',
|
||||
DEBUG = 'DEBUG',
|
||||
INFO = 'INFO',
|
||||
WARN = 'WARN',
|
||||
ERROR = 'ERROR'
|
||||
}
|
||||
|
||||
export interface BackgroundGeolocationLogEntry {
|
||||
/** ID of log entry as stored in db. */
|
||||
id: number;
|
||||
|
||||
/** Timestamp in milliseconds since beginning of UNIX epoch. */
|
||||
timestamp: number;
|
||||
|
||||
/** Log level */
|
||||
level: BackgroundGeolocationLogLevel;
|
||||
|
||||
/** Log message */
|
||||
message: string;
|
||||
|
||||
/** Recorded stacktrace. (Android only, on iOS part of message) */
|
||||
stackTrace: string;
|
||||
}
|
||||
|
||||
export interface ServiceStatus {
|
||||
/** TRUE if service is running. */
|
||||
isRunning: boolean;
|
||||
|
||||
/** TRUE if location services are enabled */
|
||||
locationServicesEnabled: boolean;
|
||||
|
||||
/**
|
||||
* Authorization status.
|
||||
*
|
||||
* Posible values:
|
||||
* NOT_AUTHORIZED, AUTHORIZED, AUTHORIZED_FOREGROUND
|
||||
*
|
||||
* @example
|
||||
* if (authorization == BackgroundGeolocation.NOT_AUTHORIZED) {...}
|
||||
*/
|
||||
authorization: BackgroundGeolocationAuthorizationStatus;
|
||||
}
|
||||
|
||||
export interface BackgroundGeolocation {
|
||||
code: BackgroundGeolocationLocationCode;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface BackgroundGeolocationCurrentPositionConfig {
|
||||
timeout: number;
|
||||
maximumAge: number;
|
||||
enableHighAccuracy: boolean;
|
||||
}
|
||||
|
||||
export interface BackgroundGeolocationResponse {
|
||||
/**
|
||||
* ID of location as stored in DB (or null)
|
||||
*/
|
||||
locationId: number;
|
||||
/** ID of location as stored in DB (or null) */
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* Service provider
|
||||
* Native provider reponsible for location.
|
||||
*
|
||||
* Possible values:
|
||||
* "gps", "network", "passive" or "fused"
|
||||
*/
|
||||
serviceProvider: string;
|
||||
provider: BackgroundGeolocationNativeProvider;
|
||||
|
||||
/**
|
||||
* true if location recorded as part of debug
|
||||
*/
|
||||
debug: boolean;
|
||||
/** Configured location provider. */
|
||||
locationProvider: BackgroundGeolocationLocationProvider;
|
||||
|
||||
/**
|
||||
* UTC time of this fix, in milliseconds since January 1, 1970.
|
||||
*/
|
||||
/** UTC time of this fix, in milliseconds since January 1, 1970. */
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* latitude, in degrees.
|
||||
*/
|
||||
/** Latitude, in degrees. */
|
||||
latitude: number;
|
||||
|
||||
/**
|
||||
* longitude, in degrees.
|
||||
*/
|
||||
/** Longitude, in degrees. */
|
||||
longitude: number;
|
||||
|
||||
/**
|
||||
* estimated accuracy of this location, in meters.
|
||||
*/
|
||||
/** Estimated accuracy of this location, in meters. */
|
||||
accuracy: number;
|
||||
|
||||
/**
|
||||
* speed if it is available, in meters/second over ground.
|
||||
* Speed if it is available, in meters/second over ground.
|
||||
*
|
||||
* Note: Not all providers are capable of providing speed.
|
||||
* Typically network providers are not able to do so.
|
||||
*/
|
||||
speed: number;
|
||||
|
||||
/**
|
||||
* altitude if available, in meters above the WGS 84 reference ellipsoid.
|
||||
*/
|
||||
/** Altitude if available, in meters above the WGS 84 reference ellipsoid. */
|
||||
altitude: number;
|
||||
|
||||
/**
|
||||
* accuracy of the altitude if available.
|
||||
*/
|
||||
altitudeAccuracy: number;
|
||||
|
||||
/**
|
||||
* bearing, in degrees.
|
||||
*/
|
||||
/** Bearing, in degrees. */
|
||||
bearing: number;
|
||||
|
||||
/**
|
||||
* A Coordinates object defining the current location
|
||||
* True if location was recorded by mock provider. (ANDROID ONLY)
|
||||
*
|
||||
* Note: this property is not enabled by default!
|
||||
* You can enable it "postTemplate" configure option.
|
||||
*/
|
||||
coords: Coordinates;
|
||||
isFromMockProvider?: boolean;
|
||||
|
||||
/**
|
||||
* A timestamp representing the time at which the location was retrieved.
|
||||
* True if device has mock locations enabled. (ANDROID ONLY)
|
||||
*
|
||||
* Note: this property is not enabled by default!
|
||||
* You can enable it "postTemplate" configure option.
|
||||
*/
|
||||
timestamp: number;
|
||||
mockLocationsEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface BackgroundGeolocationConfig {
|
||||
/**
|
||||
* Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower
|
||||
* the number, the more power devoted to GeoLocation resulting in higher
|
||||
* accuracy readings. 1000 results in lowest power drain and least accurate
|
||||
* readings. @see Apple docs (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instp/CLLocationManager/desiredAccuracy)
|
||||
*/
|
||||
desiredAccuracy: number;
|
||||
|
||||
/**
|
||||
* Stationary radius in meters. When stopped, the minimum distance the device
|
||||
* must move beyond the stationary location for aggressive background-tracking
|
||||
* to engage.
|
||||
*/
|
||||
stationaryRadius: number;
|
||||
|
||||
/**
|
||||
* When enabled, the plugin will emit sounds for life-cycle events of
|
||||
* background-geolocation! See debugging sounds table.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum distance (measured in meters) a device must move horizontally
|
||||
* before an update event is generated. @see Apple docs. (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instp/CLLocationManager/distanceFilter)
|
||||
*/
|
||||
distanceFilter: number;
|
||||
|
||||
/**
|
||||
* IOS, ANDROID ONLY
|
||||
* Enable this in order to force a stop() when the application terminated
|
||||
* (e.g. on iOS, double-tap home button, swipe away the app).o
|
||||
* Set location provider
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Start background service on device boot.
|
||||
* Platform: all
|
||||
* Available providers:
|
||||
* DISTANCE_FILTER_PROVIDER,
|
||||
* ACTIVITY_PROVIDER
|
||||
* RAW_PROVIDER
|
||||
*
|
||||
* Defaults to false
|
||||
*/
|
||||
startOnBoot?: boolean;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* If false location service will not be started in foreground and no notification will be shown.
|
||||
*
|
||||
* Defaults to true
|
||||
*/
|
||||
startForeground?: boolean;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_DISTANCE_FILTER_PROVIDER:
|
||||
* The minimum time interval between location updates in milliseconds.
|
||||
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
|
||||
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
|
||||
* for more information
|
||||
* When using BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER:
|
||||
* Rate in milliseconds at which your app prefers to receive location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getInterval())
|
||||
*/
|
||||
interval?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Custom notification title in the drawer.
|
||||
*/
|
||||
notificationTitle?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Custom notification text in the drawer.
|
||||
*/
|
||||
notificationText?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* The accent color to use for notification. Eg. #4CAF50.
|
||||
*/
|
||||
notificationIconColor?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* The filename of a custom notification icon. See android quirks.
|
||||
* NOTE: Only available for API Level >=21.
|
||||
*/
|
||||
notificationIconLarge?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* The filename of a custom notification icon. See android quirks.
|
||||
* NOTE: Only available for API Level >=21.
|
||||
*/
|
||||
notificationIconSmall?: string;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
|
||||
* @default DISTANCE_FILTER_PROVIDER
|
||||
* @example
|
||||
* { locationProvider: LocationProvider.RAW_PROVIDER }
|
||||
*/
|
||||
locationProvider?: number;
|
||||
|
||||
/**
|
||||
* IOS ONLY
|
||||
* [AutomotiveNavigation, OtherNavigation, Fitness, Other] Presumably,
|
||||
* this affects iOS GPS algorithm. @see Apple docs for more information
|
||||
* (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instp/CLLocationManager/activityType)
|
||||
* Desired accuracy in meters.
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
* Possible values:
|
||||
* HIGH_ACCURACY,
|
||||
* MEDIUM_ACCURACY,
|
||||
* LOW_ACCURACY,
|
||||
* PASSIVE_ACCURACY
|
||||
* Note: Accuracy has direct effect on power drain. Lower accuracy = lower power drain.
|
||||
*
|
||||
* @default MEDIUM_ACCURACY
|
||||
* @example
|
||||
* { desiredAccuracy: BackgroundGeolocationAccuracy.LOW }
|
||||
*/
|
||||
desiredAccuracy?: number;
|
||||
|
||||
/**
|
||||
* Stationary radius in meters.
|
||||
*
|
||||
* When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.
|
||||
* Platform: all
|
||||
* Provider: DISTANCE_FILTER
|
||||
*
|
||||
* @default 50
|
||||
*/
|
||||
stationaryRadius?: number;
|
||||
|
||||
/**
|
||||
* When enabled, the plugin will emit sounds for life-cycle events of background-geolocation! See debugging sounds table.
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: DISTANCE_FILTER, RAW
|
||||
*
|
||||
* @default 500
|
||||
* @see {@link https://apple.co/2oHo2CV|Apple docs}
|
||||
*/
|
||||
distanceFilter?: number;
|
||||
|
||||
/**
|
||||
* Enable this in order to force a stop() when the application terminated.
|
||||
* E.g. on iOS, double-tap home button, swipe away the app.
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
stopOnTerminate?: boolean;
|
||||
|
||||
/**
|
||||
* Start background service on device boot.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
startOnBoot?: boolean;
|
||||
|
||||
/**
|
||||
* The minimum time interval between location updates in milliseconds.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*
|
||||
* @default 60000
|
||||
* @see {@link https://bit.ly/1x00RUu|Android docs}
|
||||
*/
|
||||
interval?: number;
|
||||
|
||||
/**
|
||||
* Fastest rate in milliseconds at which your app can handle location updates.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: ACTIVITY
|
||||
*
|
||||
* @default 120000
|
||||
* @see {@link https://bit.ly/1x00RUu|Android docs}
|
||||
*/
|
||||
fastestInterval?: number;
|
||||
|
||||
/**
|
||||
* Rate in milliseconds at which activity recognition occurs.
|
||||
* Larger values will result in fewer activity detections while improving battery life.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: ACTIVITY
|
||||
*
|
||||
* @default 10000
|
||||
*/
|
||||
activitiesInterval?: number;
|
||||
|
||||
/**
|
||||
* @deprecated Stop location updates, when the STILL activity is detected.
|
||||
*/
|
||||
stopOnStillActivity?: boolean;
|
||||
|
||||
/**
|
||||
* Enable/disable local notifications when tracking and syncing locations.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
notificationsEnabled?: boolean;
|
||||
|
||||
/**
|
||||
* Allow location sync service to run in foreground state.
|
||||
* Foreground state also requires a notification to be presented to the user.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
startForeground?: boolean;
|
||||
|
||||
/**
|
||||
* Custom notification title in the drawer.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
* @default "Background tracking"
|
||||
*/
|
||||
notificationTitle?: string;
|
||||
|
||||
/**
|
||||
* Custom notification text in the drawer.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*
|
||||
* @default "ENABLED"
|
||||
*/
|
||||
notificationText?: string;
|
||||
|
||||
/**
|
||||
* The accent color (hex triplet) to use for notification.
|
||||
* Eg. <code>#4CAF50</code>.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*/
|
||||
notificationIconColor?: string;
|
||||
|
||||
/**
|
||||
* The filename of a custom notification icon.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*/
|
||||
notificationIconLarge?: string;
|
||||
|
||||
/**
|
||||
* The filename of a custom notification icon.
|
||||
*
|
||||
* Platform: Android
|
||||
* Provider: all
|
||||
*/
|
||||
notificationIconSmall?: string;
|
||||
|
||||
/**
|
||||
* Activity type.
|
||||
* Presumably, this affects iOS GPS algorithm.
|
||||
*
|
||||
* Possible values:
|
||||
* "AutomotiveNavigation", "OtherNavigation", "Fitness", "Other"
|
||||
*
|
||||
* Platform: iOS
|
||||
* Provider: all
|
||||
*
|
||||
* @default "OtherNavigation"
|
||||
* @see {@link https://apple.co/2oHofpH|Apple docs}
|
||||
*/
|
||||
activityType?: string;
|
||||
|
||||
/**
|
||||
* IOS ONLY
|
||||
* Pauses location updates when app is paused
|
||||
* Pauses location updates when app is paused.
|
||||
*
|
||||
* Defaults to true
|
||||
* Platform: iOS
|
||||
* Provider: all
|
||||
*
|
||||
* @default false
|
||||
* @see {@link https://apple.co/2CbjEW2|Apple docs}
|
||||
*/
|
||||
pauseLocationUpdates?: boolean;
|
||||
|
||||
/**
|
||||
* Switch to less accurate significant changes and region monitory when in background.
|
||||
*
|
||||
* Platform: iOS
|
||||
* Provider: all
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
saveBatteryOnBackground?: boolean;
|
||||
|
||||
/**
|
||||
* Server url where to send HTTP POST with recorded locations
|
||||
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
* Server url where to send fail to post locations
|
||||
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*/
|
||||
syncUrl?: string;
|
||||
|
||||
/**
|
||||
* Specifies how many previously failed locations will be sent to server at once
|
||||
* Specifies how many previously failed locations will be sent to server at once.
|
||||
*
|
||||
* Defaults to 100
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*
|
||||
* @default 100
|
||||
*/
|
||||
syncThreshold?: number;
|
||||
syncThreshold?: string;
|
||||
|
||||
/**
|
||||
* Optional HTTP headers sent along in HTTP request
|
||||
* Optional HTTP headers sent along in HTTP request.
|
||||
*
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*/
|
||||
httpHeaders?: any;
|
||||
|
||||
/**
|
||||
* IOS ONLY
|
||||
* Switch to less accurate significant changes and region monitory when in background (default)
|
||||
* Limit maximum number of locations stored into db.
|
||||
*
|
||||
* Defaults to 100
|
||||
*/
|
||||
saveBatteryOnBackground?: boolean;
|
||||
|
||||
/**
|
||||
* Limit maximum number of locations stored into db
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*
|
||||
* Defaults to 10000
|
||||
* @default 10000
|
||||
*/
|
||||
maxLocations?: number;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
* Customization post template.
|
||||
*
|
||||
* Fastest rate in milliseconds at which your app can handle location updates.
|
||||
* @see Android docs (https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#getFastestInterval())
|
||||
* Platform: all
|
||||
* Provider: all
|
||||
*/
|
||||
fastestInterval?: number;
|
||||
postTemplate?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life.
|
||||
*/
|
||||
activitiesInterval?: number;
|
||||
/**
|
||||
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
|
||||
*
|
||||
* Possible values:
|
||||
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
|
||||
* ANDROID_ACTIVITY_PROVIDER: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
export declare enum BackgroundGeolocationProvider {
|
||||
ANDROID_DISTANCE_FILTER_PROVIDER = 0,
|
||||
ANDROID_ACTIVITY_PROVIDER = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* ANDROID ONLY with BackgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER
|
||||
*
|
||||
* stop() is forced, when the STILL activity is detected (default is true)
|
||||
*/
|
||||
stopOnStillActivity?: boolean;
|
||||
/**
|
||||
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
|
||||
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
|
||||
* 1000 results in lowest power drain and least accurate readings.
|
||||
*
|
||||
* Possible values:
|
||||
* HIGH: 0
|
||||
* MEDIUM: 10
|
||||
* LOW: 100
|
||||
* PASSIVE: 1000
|
||||
*
|
||||
* enum {number}
|
||||
*/
|
||||
export declare enum BackgroundGeolocationAccuracy {
|
||||
HIGH = 0,
|
||||
MEDIUM = 10,
|
||||
LOW = 100,
|
||||
PASSIVE = 1000
|
||||
}
|
||||
|
||||
/**
|
||||
* Used in the switchMode function
|
||||
*
|
||||
* Possible values:
|
||||
* BACKGROUND: 0
|
||||
* FOREGROUND: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
export declare enum BackgroundGeolocationMode {
|
||||
BACKGROUND = 0,
|
||||
FOREGROUND = 1
|
||||
}
|
||||
|
||||
export declare enum BackgroundGeolocationIOSActivity {
|
||||
AutomotiveNavigation = 'AutomotiveNavigation',
|
||||
OtherNavigation = 'OtherNavigation',
|
||||
Fitness = 'Fitness',
|
||||
Other = 'Other'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +499,7 @@ export interface BackgroundGeolocationConfig {
|
||||
* 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/ngx';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationEvents, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
@@ -274,17 +511,19 @@ export interface BackgroundGeolocationConfig {
|
||||
* distanceFilter: 30,
|
||||
* debug: true, // enable this hear sounds for background-geolocation life-cycle.
|
||||
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* this.backgroundGeolocation.configure(config)
|
||||
* .subscribe((location: BackgroundGeolocationResponse) => {
|
||||
* .then(() => {
|
||||
*
|
||||
* console.log(location);
|
||||
* 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,
|
||||
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
|
||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
* this.backgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
* // and the background-task may be completed. You must do this regardless if your operations are successful or not.
|
||||
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
|
||||
* this.backgroundGeolocation.finish(); // FOR IOS ONLY
|
||||
* });
|
||||
*
|
||||
* });
|
||||
*
|
||||
@@ -301,74 +540,21 @@ export interface BackgroundGeolocationConfig {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundGeolocation',
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation',
|
||||
pluginRef: 'backgroundGeolocation',
|
||||
plugin: '@mauron85/cordova-plugin-background-geolocation',
|
||||
pluginRef: 'BackgroundGeolocation',
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
/**
|
||||
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
|
||||
*
|
||||
* Possible values:
|
||||
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
|
||||
* ANDROID_ACTIVITY_PROVIDER: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
LocationProvider: any = {
|
||||
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
|
||||
ANDROID_ACTIVITY_PROVIDER: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
|
||||
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
|
||||
* 1000 results in lowest power drain and least accurate readings.
|
||||
*
|
||||
* Possible values:
|
||||
* HIGH: 0
|
||||
* MEDIUM: 10
|
||||
* LOW: 100
|
||||
* PASSIVE: 1000
|
||||
*
|
||||
* enum {number}
|
||||
*/
|
||||
Accuracy: any = {
|
||||
HIGH: 0,
|
||||
MEDIUM: 10,
|
||||
LOW: 100,
|
||||
PASSIVE: 1000
|
||||
};
|
||||
|
||||
/**
|
||||
* Used in the switchMode function
|
||||
*
|
||||
* Possible values:
|
||||
* BACKGROUND: 0
|
||||
* FOREGROUND: 1
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
Mode: any = {
|
||||
BACKGROUND: 0,
|
||||
FOREGROUND: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Configure the plugin.
|
||||
*
|
||||
* @param options {BackgroundGeolocationConfig} options An object of type Config
|
||||
* @return {Observable<BackgroundGeolocationResponse>}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
observable: true
|
||||
})
|
||||
configure(
|
||||
options: BackgroundGeolocationConfig
|
||||
): Observable<BackgroundGeolocationResponse> {
|
||||
@Cordova()
|
||||
configure(options: BackgroundGeolocationConfig): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -475,7 +661,7 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
/**
|
||||
* Method can be used to detect user changes in location services settings.
|
||||
* If user enable or disable location services then success callback will be executed.
|
||||
* In case or error (SettingNotFoundException) fail callback will be executed.
|
||||
* In case or (SettingNotFoundException) fail callback will be executed.
|
||||
* @returns {Observable<number>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -573,7 +759,136 @@ export class BackgroundGeolocation extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getLogEntries(limit: number): Promise<any> {
|
||||
getLogEntries(
|
||||
limit: number,
|
||||
fromId: number,
|
||||
minLevel: BackgroundGeolocationLogLevel
|
||||
): Promise<BackgroundGeolocationLogEntry[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
|
||||
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getConfig(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* One time location check to get current location of the device.
|
||||
* {timeout: Maximum time in milliseconds device will wait for location,
|
||||
* maximumAge: Maximum age in milliseconds of a possible cached location that is acceptable to return;
|
||||
* enableHighAccuracy: if true and if the device is able to provide a more accurate position, it will do so}
|
||||
*
|
||||
* @param {BackgroundGeolocationCurrentPositionConfig} options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
getCurrentLocation(
|
||||
options?: BackgroundGeolocationCurrentPositionConfig
|
||||
): Promise<BackgroundGeolocationResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check status of the service
|
||||
*/
|
||||
@Cordova()
|
||||
checkStatus(): Promise<ServiceStatus> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start background task (iOS only)
|
||||
*
|
||||
* To perform any long running operation on iOS
|
||||
* you need to create background task
|
||||
* IMPORTANT: task has to be ended by endTask
|
||||
*
|
||||
* @returns {Promise<number>} taskKey
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['IOS']
|
||||
})
|
||||
startTask(): Promise<number> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* End background task indentified by taskKey (iOS only)
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['IOS']
|
||||
})
|
||||
endTask(taskKey: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* A special task that gets executed when the app is terminated, but
|
||||
* the plugin was configured to continue running in the background
|
||||
* (option <code>stopOnTerminate: false</code>).
|
||||
*
|
||||
* In this scenario the Activity was killed by the system and all registered
|
||||
* event listeners will not be triggered until the app is relaunched.
|
||||
*
|
||||
* @example
|
||||
* BackgroundGeolocation.headlessTask(function(event) {
|
||||
*
|
||||
* if (event.name === 'location' || event.name === 'stationary') {
|
||||
* var xhr = new XMLHttpRequest();
|
||||
* xhr.open('POST', 'http://192.168.81.14:3000/headless');
|
||||
* xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
* xhr.send(JSON.stringify(event.params));
|
||||
* }
|
||||
*
|
||||
* return 'Processing event: ' + event.name; // will be logged
|
||||
* });
|
||||
* @param func
|
||||
*/
|
||||
@Cordova()
|
||||
headlessTask(func: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force sync of pending locations.
|
||||
* Option <code>syncThreshold</code> will be ignored and all pending locations will be immediately posted to <code>syncUrl</code> in single batch.
|
||||
*
|
||||
* Platform: Android, iOS
|
||||
*/
|
||||
@Cordova()
|
||||
forceSync(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register event listener.
|
||||
*
|
||||
* Triggered when server responded with "<code>285 Updates Not Required</code>" to post/sync request.
|
||||
* @param event
|
||||
* @param callbackFn
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
on(event: BackgroundGeolocationEvents): Observable<BackgroundGeolocationResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister all event listeners for given event.
|
||||
*
|
||||
* If parameter <code>event</code> is not provided then all event listeners will be removed.
|
||||
*/
|
||||
@Cordova()
|
||||
removeAllListeners(event?: BackgroundGeolocationEvents): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
187
src/@ionic-native/plugins/baidu-push/index.ts
Normal file
187
src/@ionic-native/plugins/baidu-push/index.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
declare const baiduPush: any;
|
||||
|
||||
export interface BaiduResponse<T> {
|
||||
/**
|
||||
* The corresponding Baidu SDK method called.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* The error code corresponding to Baidu's request.
|
||||
*/
|
||||
errorCode?: string;
|
||||
/**
|
||||
* Registration data revelvant to subsequent actions.
|
||||
*/
|
||||
data: T;
|
||||
}
|
||||
|
||||
export interface RegistrationData {
|
||||
/**
|
||||
* The ID registered to Baidu for the app.
|
||||
*/
|
||||
appId: string;
|
||||
/**
|
||||
* The ID registered to Baidu for the device.
|
||||
*/
|
||||
userId: string;
|
||||
/**
|
||||
* The channel ID registered to Baidu for the app.
|
||||
*/
|
||||
channelId: string;
|
||||
}
|
||||
|
||||
export interface UnregistrationData {
|
||||
/**
|
||||
* The ID corresponding to the Baidu request.
|
||||
*/
|
||||
requestId: string;
|
||||
}
|
||||
|
||||
export interface TagData {
|
||||
/**
|
||||
* The ID corresponding to the Baidu request.
|
||||
*/
|
||||
requestId: string;
|
||||
/**
|
||||
* The channel ID registered to Baidu for the app.
|
||||
*/
|
||||
channelId: string;
|
||||
/**
|
||||
* The list of successfully set/deleted tags.
|
||||
*/
|
||||
sucessTags: string[];
|
||||
/**
|
||||
* The list of unsuccessfully set/deleted tags.
|
||||
*/
|
||||
failTags: string[];
|
||||
}
|
||||
|
||||
export interface NotificationData {
|
||||
/**
|
||||
* The title of the notification.
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* The description of the notification.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Custom content for the notification.
|
||||
*/
|
||||
customContentString?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Baidu Push
|
||||
* @description
|
||||
* This plugin faciliates the use of Baidu Push notifications.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { BaiduPush } from '@ionic-native/baidu-push/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private baiduPush: BaiduPush) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.baiduPush.startWork('xxxxxx')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* BaiduResponse
|
||||
* RegistrationData
|
||||
* UnregistrationData
|
||||
* TagData
|
||||
* NotificationData
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BaiduPush',
|
||||
plugin: 'cordova-plugin-push-baidu',
|
||||
pluginRef: 'baiduPush',
|
||||
repo: 'https://github.com/Ti-webdev/cordova-plugin-push-baidu.git',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class BaiduPush extends IonicNativePlugin {
|
||||
/**
|
||||
* This method registers the device to Baidu Cloud Push services.
|
||||
* @param {string} apiKey Baidu Cloud Push API key.
|
||||
* @return {Promise<BaiduResponse<RegistrationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova()
|
||||
startWork(apiKey: string): Promise<BaiduResponse<RegistrationData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method unregisters the device to Baidu Cloud Push services.
|
||||
* @return {Promise<BaiduResponse<UnregistrationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova()
|
||||
stopWork(): Promise<BaiduResponse<UnregistrationData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method re-binds the device to Baidu Cloud Push services.
|
||||
* @return {Promise<BaiduResponse<RegistrationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova()
|
||||
resumeWork(): Promise<BaiduResponse<RegistrationData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets tags in the Baidu Cloud Push services.
|
||||
* @param tags {any} tags The tags to set.
|
||||
* @return {Promise<BaiduResponse<TagData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova()
|
||||
setTags(tags: any): Promise<BaiduResponse<TagData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets tags in the Baidu Cloud Push services.
|
||||
* @param tags {any} tags The tags to set.
|
||||
* @return {Promise<BaiduResponse<TagData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova()
|
||||
delTags(tags: any): Promise<BaiduResponse<TagData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when a notification is recieved on the foreground.
|
||||
* @return {Promise<BaiduResponse<NotificationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
onMessage(): Observable<BaiduResponse<NotificationData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the user taps a notification.
|
||||
* @return {Promise<BaiduResponse<NotificationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
onNotificationClicked(): Observable<BaiduResponse<NotificationData>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when a notification is recieved.
|
||||
* @return {Promise<BaiduResponse<NotificationData>>} Returns a Promise that resolves with a BaiduResponse.
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
onNotificationArrived(): Observable<BaiduResponse<NotificationData>> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
2910
src/@ionic-native/plugins/blinkid/index.ts
Normal file
2910
src/@ionic-native/plugins/blinkid/index.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -339,7 +339,7 @@ export interface InitializeResult {
|
||||
/** Service's UUID */
|
||||
service: string;
|
||||
/** Characteristic UUID */
|
||||
characterisitc: string;
|
||||
characteristic: string;
|
||||
/** This integer value will be incremented every read/writeRequested */
|
||||
requestId: number;
|
||||
/** Offset value */
|
||||
@@ -431,20 +431,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 +480,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 +559,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
connect(params: {
|
||||
address: string;
|
||||
autoConnect?: boolean;
|
||||
}): Observable<{ status: DeviceInfo }> {
|
||||
}): Observable< DeviceInfo > {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -579,10 +579,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 +592,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 +609,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 +617,7 @@ export class BluetoothLE extends IonicNativePlugin {
|
||||
discover(params: {
|
||||
address: string;
|
||||
clearCache?: boolean;
|
||||
}): Promise<{ device: Device }> {
|
||||
}): Promise<Device> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -626,13 +626,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 +747,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 +758,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 +1057,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,13 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
onBackButton(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return in use device camera fov
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getHorizontalFOV(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,13 @@ export enum Direction {
|
||||
*
|
||||
* Requires the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
|
||||
*
|
||||
* [Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add '<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist"><string>You can take photos</string></config-file> inside of the <platform name='ios> section
|
||||
* [Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add
|
||||
* ```xml
|
||||
* <config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
|
||||
* <string>You can take photos</string>
|
||||
* </config-file>
|
||||
* ```
|
||||
* inside of the <platform name='ios> section
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -205,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,6 +577,43 @@ export class CleverTap extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************
|
||||
* Notification Inbox methods
|
||||
****************************/
|
||||
/**
|
||||
* Call this method to initialize the App Inbox
|
||||
*/
|
||||
@Cordova()
|
||||
initializeInbox(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method to get the count of unread Inbox messages
|
||||
*/
|
||||
@Cordova()
|
||||
getInboxMessageUnreadCount(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method to get the count of total Inbox messages
|
||||
*/
|
||||
@Cordova()
|
||||
getInboxMessageCount(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method to open the App Inbox
|
||||
* @param styleConfig : any or empty object
|
||||
*/
|
||||
@Cordova()
|
||||
showInbox(styleConfig: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
* Developer Options
|
||||
******************/
|
||||
|
||||
59
src/@ionic-native/plugins/colored-browser-tabs/index.ts
Normal file
59
src/@ionic-native/plugins/colored-browser-tabs/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @name Colored Browser Tabs
|
||||
* @description
|
||||
* This plugin opens Chrome Custom Tabs on Android or SafariViewController on iOS
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ColoredBrowserTabs } from '@ionic-native/colored-browser-tabs/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private browserTabs: ColoredBrowserTabs) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.browserTabs.openTab('www.example.url', '#ffffff')
|
||||
* .subscribe()
|
||||
*
|
||||
* this.browserTabs.openTabWithAnimation('www.example.url', 'slide_x', '#ffffff')
|
||||
* .subscribe()
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ColoredBrowserTabs',
|
||||
plugin: 'cordova-plugin-colored-browser-tabs',
|
||||
pluginRef: 'ColoredBrowserTabs',
|
||||
repo: 'https://github.com/TobyEb/cordova-plugin-colored-browser-tabs',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class ColoredBrowserTabs extends IonicNativePlugin {
|
||||
/**
|
||||
* Call this method to open the tab
|
||||
* @param url - the url you want to open
|
||||
* @param color - the color with which you want to define the toolbar color
|
||||
* @return {Observable<any>} Returns a Observable that resolves when something happens
|
||||
*/
|
||||
@Cordova({ observable: true, successIndex: 2, errorIndex: 3 })
|
||||
openTab(url: string, color?: string): Observable<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Call this method to open the tab
|
||||
* @param url - the url you want to open
|
||||
* @param anim - the animation you want for enter and exit, you can choose between slide_x / slide_y and fade
|
||||
* only works in Android, iOS just shows the default animation
|
||||
* @param color - the color with which you want to define the toolbar color
|
||||
* @return {Observable<any>} Returns a Observable that resolves when something happens
|
||||
*/
|
||||
@Cordova({ observable: true, successIndex: 3, errorIndex: 4 })
|
||||
openTabWithAnimation(url: string, anim: string, color?: string): Observable<any> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
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'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ export interface FingerprintOptions {
|
||||
* ...
|
||||
*
|
||||
* this.faio.show({
|
||||
* clientId: 'Fingerprint-Demo',
|
||||
* clientSecret: 'password', //Only necessary for Android
|
||||
* clientId: 'Fingerprint-Demo', //Android: Used for encryption. iOS: used for dialogue if no `localizedReason` is given.
|
||||
* clientSecret: 'o7aoOMYUbyxaD23oFAnJ' //Necessary for Android encrpytion of keys. Use random secret key.
|
||||
* disableBackup:true, //Only for Android(optional)
|
||||
* localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
* localizedReason: 'Please authenticate' //Only for iOS
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
182
src/@ionic-native/plugins/firebase-crashlytics/index.ts
Normal file
182
src/@ionic-native/plugins/firebase-crashlytics/index.ts
Normal file
@@ -0,0 +1,182 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Firebase Crashlytics
|
||||
* @description
|
||||
* A Google Firebase Crashlytics plugin to enable capture of crash reports.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseCrashlytics } from '@ionic-native/firebase-crashlytics/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseCrashlytics: FirebaseCrashlytics) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* const crashlytics = this.firebaseCrashlytics.initialize();
|
||||
* crashlytics.logException('my caught exception');
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FirebaseCrashlytics',
|
||||
plugin: 'cordova-plugin-firebase-crashlytics',
|
||||
pluginRef: 'FirebaseCrashlytics',
|
||||
repo: 'https://github.com/ReallySmallSoftware/cordova-plugin-firebase-crashlytics',
|
||||
install: 'ionic cordova plugin add cordova-plugin-firebase-crashlytics --variable ANDROID_FIREBASE_CORE_VERSION=16.0.0',
|
||||
installVariables: ['ANDROID_FIREBASE_CORE_VERSION'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseCrashlytics extends IonicNativePlugin {
|
||||
/**
|
||||
* Simply add the plugin to get the default Crashlytics functionality. Note that crashes and logged exceptions will only be reported when the application restarts. In order to log caught exceptions the following can be used:
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
initialise(): any {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a forced crash. Visible in console after restart of application.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
crash(): void {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a priority message. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {number} priority
|
||||
* @param {string} tag
|
||||
* @param {string} message
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
logPriority(priority: number, tag: string, message: string): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} message
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
log(message: string): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log when a handled exception has happened. Visible in console after restart of application.
|
||||
*
|
||||
* @param {string} message
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
logException(message: string): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra key/value string value. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setString(key: string, value: string): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra key/value bool value. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {boolean} value
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setBool(key: string, value: boolean): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra key/value double value. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {number} value
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setDouble(key: string, value: number): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra key/value float value. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {number} value
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setFloat(key: string, value: number): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra key/value integer value. Will only be logged in the event of a crash.
|
||||
*
|
||||
* @param {string} key
|
||||
* @param {number} value
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setInt(key: string, value: number): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the identifier for the user. Take care when using this method and ensure you privacy policy is updated accordingly.
|
||||
*
|
||||
* @param {string} identifier
|
||||
* @returns {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
setUserIdentifier(identifier: string): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -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,27 @@ 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 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;
|
||||
}
|
||||
|
||||
|
||||
527
src/@ionic-native/plugins/firebase-x/index.ts
Normal file
527
src/@ionic-native/plugins/firebase-x/index.ts
Normal file
@@ -0,0 +1,527 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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';
|
||||
*
|
||||
*
|
||||
* 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 device 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 notified when a token is refreshed.
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
onTokenRefresh(): 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
logError(error: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a verification ID and send a SMS with a verification code. Use them to construct a credential to sign in the user (in your app).
|
||||
*
|
||||
* More info:
|
||||
* https://github.com/dpa99c/cordova-plugin-firebasex#verifyphonenumber
|
||||
* https://firebase.google.com/docs/auth/android/phone-auth
|
||||
* https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCredential
|
||||
* https://firebase.google.com/docs/reference/js/firebase.User#linkWithCredential
|
||||
*
|
||||
* NOTE: This will only work on physical devices.
|
||||
*
|
||||
* iOS will return: credential (string)
|
||||
*
|
||||
* Android will return:
|
||||
* credential.verificationId (object and with key verificationId)
|
||||
* credential.instantVerification (boolean) credential.code (string)
|
||||
* (note that this key only exists if instantVerification is true)
|
||||
*
|
||||
* You need to use device plugin in order to access the right key.
|
||||
* IMPORTANT NOTE: Android supports auto-verify and instant device verification.
|
||||
* Therefore in that case it doesn't make sense to ask for an sms code as you won't receive one.
|
||||
* In this case you'll get a credential.verificationId and a credential.code where code is the auto received verification code
|
||||
* that would normally be sent via sms. To log in using this procedure you must pass this code to
|
||||
* PhoneAuthProvider.credential(verificationId, code). You'll find an implementation example further below.
|
||||
*
|
||||
* When using node.js Firebase Admin-SDK, follow this tutorial:
|
||||
* https://firebase.google.com/docs/auth/admin/create-custom-tokens
|
||||
*
|
||||
* Pass back your custom generated token and call
|
||||
* firebase.auth().signInWithCustomToken(customTokenFromYourServer);
|
||||
* instead of
|
||||
* firebase.auth().signInWithCredential(credential)
|
||||
*
|
||||
* YOU HAVE TO COVER THIS PROCESS, OR YOU WILL HAVE ABOUT 5% OF USERS STICKING ON YOUR SCREEN, NOT RECEIVING ANYTHING
|
||||
* If this process is too complex for you, use this awesome plugin
|
||||
* https://github.com/chemerisuk/cordova-plugin-firebase-authentication
|
||||
* It's not perfect but it fits for the most use cases and doesn't require calling your endpoint, as it has native phone auth support.
|
||||
*
|
||||
* Android
|
||||
* To use this auth you need to configure your app SHA hash in the android app configuration in the firebase console.
|
||||
* See https://developers.google.com/android/guides/client-auth to know how to get SHA app hash.
|
||||
*
|
||||
* iOS
|
||||
* Setup your push notifications first, and verify that they are arriving on your physical device before you test this method.
|
||||
* Use the APNs auth key to generate the .p8 file and upload it to firebase. When you call this method,
|
||||
* FCM sends a silent push to the device to verify it.
|
||||
*
|
||||
* @param {string} phoneNumber The phone number, including '+' and country code
|
||||
* @param {number} timeoutDuration (Android only) The timeout in sec - no more SMS will be sent to this number until this timeout expires
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
verifyPhoneNumber(
|
||||
phoneNumber: string,
|
||||
timeoutDuration = 0
|
||||
): 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;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,9 @@ import { Observable } from 'rxjs';
|
||||
* .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.firebase.onNotificationOpen()
|
||||
* .subscribe(data => console.log(`User opened a notification ${data}`));
|
||||
*
|
||||
* this.firebase.onTokenRefresh()
|
||||
* .subscribe((token: string) => console.log(`Got a new token ${token}`));
|
||||
*
|
||||
@@ -335,4 +338,15 @@ export class Firebase extends IonicNativePlugin {
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
114
src/@ionic-native/plugins/gao-de-location/index.ts
Normal file
114
src/@ionic-native/plugins/gao-de-location/index.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Gao De Location
|
||||
* @description
|
||||
* Because the original GPS positioning uses Google Browser positioning, and Google withdraws from China, resulting in GPS Android positioning can not be positioned.
|
||||
* Gaode location can directly return address informationGaode location can directly return address information
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { GaoDeLocation } from '@ionic-native/gao-de-location/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private gaoDeLocation: GaoDeLocation) { }
|
||||
*
|
||||
* this.gaoDeLocation.getCurrentPosition()
|
||||
* .then((res: PositionOptions) => console.log(res))
|
||||
* .catch((error) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GaoDeLocation',
|
||||
plugin: 'cordova-plugin-gaodelocation-chenyu',
|
||||
pluginRef: 'GaoDe',
|
||||
repo: 'https://github.com/waliu/cordova-plugin-gaodelocation-chenyu.git',
|
||||
install: 'ionic cordova plugin add cordova-plugin-gaodelocation-chenyu --variable ANDROID_API_KEY=your android key --variable IOS_API_KEY=your ios key',
|
||||
installVariables: ['ANDROID_API_KEY', 'IOS_API_KEY'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class GaoDeLocation extends IonicNativePlugin {
|
||||
/**
|
||||
* Get longitude and latitude, country, province, city, postal code, specific address, region
|
||||
* @returns {Promise<PositionOptions>}
|
||||
*/
|
||||
@Cordova()
|
||||
getCurrentPosition(): Promise<PositionOptions> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export class Geofence extends IonicNativePlugin {
|
||||
*/
|
||||
onNotificationClicked(): Observable<any> {
|
||||
return new Observable<any>(observer => {
|
||||
window &&
|
||||
typeof window !== 'undefined' &&
|
||||
window.geofence &&
|
||||
(window.geofence.onNotificationClicked = observer.next.bind(observer));
|
||||
return () => (window.geofence.onNotificationClicked = () => {});
|
||||
|
||||
@@ -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.
|
||||
@@ -154,7 +221,7 @@ export interface Player {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'GooglePlayGamesServices',
|
||||
plugin: 'cordova-plugin-play-games-service',
|
||||
plugin: 'cordova-plugin-play-games-services',
|
||||
pluginRef: 'plugins.playGamesServices',
|
||||
repo: 'https://github.com/artberri/cordova-plugin-play-games-services',
|
||||
platforms: ['Android'],
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ export class Health extends IonicNativePlugin {
|
||||
*
|
||||
* Quirks of isAuthorized()
|
||||
*
|
||||
* In iOS, this function will only check authorization status for writeable data.
|
||||
* In iOS, this function will only check authorization status for writable data.
|
||||
* Read-only data will always be considered as not authorized. This is an intended behaviour of HealthKit.
|
||||
*
|
||||
* @param {string[] | HealthDataType[]} datatypes a list of data types you want to check access of, same as in requestAuthorization
|
||||
|
||||
@@ -77,10 +77,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64EncodedUsernameAndPassword'}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
getBasicAuthHeader(
|
||||
username: string,
|
||||
password: string
|
||||
): { Authorization: string } {
|
||||
getBasicAuthHeader(username: string, password: string): { Authorization: string } {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -177,13 +174,14 @@ export class HTTP extends IonicNativePlugin {
|
||||
/**
|
||||
* 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' | 'nocheck' | 'pinned'} mode SSL Cert handling mode
|
||||
* @param {'default' | 'legacy' | 'nocheck' | 'pinned'} mode SSL Cert handling mode
|
||||
*/
|
||||
@Cordova()
|
||||
setSSLCertMode(mode: 'default' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
setSSLCertMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -274,18 +272,12 @@ 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
|
||||
* @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
|
||||
* @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 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;
|
||||
}
|
||||
|
||||
@@ -298,12 +290,41 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @returns {Promise<any>} returns a FileEntry promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
downloadFile(
|
||||
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
* @param options {Object} options for individual request
|
||||
* @param options.method {string} request method
|
||||
* @param options.data {Object} payload to be send to the server (only applicable on post, put or patch methods)
|
||||
* @param options.params {Object} query params to be appended to the URL (only applicable on get, head, delete, upload or download methods)
|
||||
* @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} 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
|
||||
*/
|
||||
@Cordova()
|
||||
sendRequest(
|
||||
url: string,
|
||||
body: any,
|
||||
headers: any,
|
||||
filePath: string
|
||||
): Promise<any> {
|
||||
options: {
|
||||
method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'upload' | 'download';
|
||||
data?: { [index: string]: any };
|
||||
params?: { [index: string]: string | number };
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8';
|
||||
timeout?: number;
|
||||
headers?: { [index: string]: string };
|
||||
filePath?: string | string[];
|
||||
name?: string | string[];
|
||||
responseType?: 'text' | 'arraybuffer' | 'blob' | 'json';
|
||||
}
|
||||
): Promise<HTTPResponse> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,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,84 +10,124 @@ 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. */
|
||||
/** 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';
|
||||
/**
|
||||
* 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';
|
||||
/* (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. */
|
||||
/**
|
||||
* (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';
|
||||
/**
|
||||
* (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';
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
type: string;
|
||||
/** the event name */
|
||||
type: InAppBrowserEventType;
|
||||
/** the URL that was loaded. */
|
||||
url: string;
|
||||
/** the error code, only in the case of loaderror. */
|
||||
@@ -129,7 +169,9 @@ export class InAppBrowserObject {
|
||||
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
} catch (e) {
|
||||
window.open(url, target);
|
||||
if (typeof window !== 'undefined') {
|
||||
window.open(url, target);
|
||||
}
|
||||
console.warn(
|
||||
'Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.'
|
||||
);
|
||||
@@ -178,11 +220,11 @@ export class InAppBrowserObject {
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event {string} Name of the event
|
||||
* @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: string): Observable<InAppBrowserEvent> {
|
||||
on(event: InAppBrowserEventType): Observable<InAppBrowserEvent> {
|
||||
return new Observable<InAppBrowserEvent>(
|
||||
(observer: Observer<InAppBrowserEvent>) => {
|
||||
this._objectInstance.addEventListener(
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -122,16 +53,91 @@ export interface IAPProduct {
|
||||
|
||||
owned: boolean;
|
||||
|
||||
downloading: boolean;
|
||||
downloading?: boolean;
|
||||
|
||||
downloaded: boolean;
|
||||
downloaded?: boolean;
|
||||
|
||||
additionalData: any;
|
||||
lastRenewalDate?: Date;
|
||||
|
||||
transaction: any;
|
||||
expiryDate?: Date;
|
||||
|
||||
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,23 +155,41 @@ export interface IAPProduct {
|
||||
}
|
||||
|
||||
export interface IAPProductEvents {
|
||||
/** Called when product data is loaded from the store. */
|
||||
loaded: (callback: IAPQueryCallback) => void;
|
||||
/** Called when any change occured to a product. */
|
||||
updated: (callback: IAPQueryCallback) => void;
|
||||
/** Called when an order failed. The `err` parameter is an IAPError object. */
|
||||
error: (callback: IAPQueryCallback) => void;
|
||||
/** Called when a product order is approved. */
|
||||
approved: (callback: IAPQueryCallback) => void;
|
||||
/** Called when a non-consumable product or subscription is owned. */
|
||||
owned: (callback: IAPQueryCallback) => void;
|
||||
/** Called when a product order is cancelled by the user. */
|
||||
cancelled: (callback: IAPQueryCallback) => void;
|
||||
/** Called when an order is refunded by the user. */
|
||||
refunded: (callback: IAPQueryCallback) => void;
|
||||
/** Called when product has just been registered. */
|
||||
registered: (callback: IAPQueryCallback) => void;
|
||||
/** Called when the product details have been successfully loaded. */
|
||||
valid: (callback: IAPQueryCallback) => void;
|
||||
/** Called when the product cannot be loaded from the store. */
|
||||
invalid: (callback: IAPQueryCallback) => void;
|
||||
/** Called when an order has just been requested. */
|
||||
requested: (callback: IAPQueryCallback) => void;
|
||||
/** Called when the purchase process has been initiated. */
|
||||
initiated: (callback: IAPQueryCallback) => void;
|
||||
/** Called when the purchase process has completed. */
|
||||
finished: (callback: IAPQueryCallback) => void;
|
||||
/** Called when receipt validation successful. */
|
||||
verified: (callback: IAPQueryCallback) => void;
|
||||
/** Called when receipt verification failed. */
|
||||
unverified: (callback: IAPQueryCallback) => void;
|
||||
/** Called when validation find a subscription to be expired. */
|
||||
expired: (callback: IAPQueryCallback) => void;
|
||||
/** Called when content download is started. */
|
||||
downloading: (product: IAPProduct, progress: any, time_remaining: any) => void;
|
||||
/** Called when content download has successfully completed. */
|
||||
downloaded: (callback: IAPQueryCallback) => void;
|
||||
}
|
||||
|
||||
@@ -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,20 @@ 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()
|
||||
log: {
|
||||
@@ -387,7 +761,7 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
* @param product {IAPProductOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
register(product: IAPProductOptions): void {}
|
||||
register(product: IAPProductOptions | IAPProductOptions[]): void {}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -421,6 +795,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 +825,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
|
||||
@@ -32,11 +45,21 @@ import { Observable } from 'rxjs';
|
||||
})
|
||||
@Injectable()
|
||||
export class Keyboard extends IonicNativePlugin {
|
||||
/**
|
||||
* Check keyboard status visible or not.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@CordovaProperty()
|
||||
isVisible: boolean;
|
||||
|
||||
/**
|
||||
* 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 {}
|
||||
|
||||
/**
|
||||
@@ -65,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.
|
||||
@@ -93,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>}
|
||||
@@ -118,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_company_admin' | 'w_share';
|
||||
|
||||
/**
|
||||
* @name LinkedIn
|
||||
* @description
|
||||
* A Cordova plugin that lets you use LinkedIn Native SDKs for Android and iOS.
|
||||
*
|
||||
* Please see the [plugin's repo](https://github.com/zyramedia/cordova-plugin-linkedin#installation) for detailed installation steps.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { LinkedIn } from '@ionic-native/linkedin/ngx';
|
||||
*
|
||||
* constructor(private linkedin: LinkedIn) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // check if there is an active session
|
||||
* this.linkedin.hasActiveSession().then((active) => console.log('has active session?', active));
|
||||
*
|
||||
* // login
|
||||
* const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
|
||||
* this.linkedin.login(scopes, true)
|
||||
* .then(() => console.log('Logged in!'))
|
||||
* .catch(e => console.log('Error logging in', e));
|
||||
*
|
||||
*
|
||||
* // get connections
|
||||
* this.linkedin.getRequest('people/~')
|
||||
* .then(res => console.log(res))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
* // share something on profile
|
||||
* const body = {
|
||||
* comment: 'Hello world!',
|
||||
* visibility: {
|
||||
* code: 'anyone'
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* this.linkedin.postRequest('~/shares', body)
|
||||
* .then(res => console.log(res))
|
||||
* .catch(e => console.log(e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LinkedIn',
|
||||
plugin: 'cordova-plugin-linkedin',
|
||||
pluginRef: 'cordova.plugins.LinkedIn',
|
||||
repo: 'https://github.com/zyra/cordova-plugin-linkedin',
|
||||
install: 'ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
|
||||
installVariables: ['APP_ID'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class LinkedIn extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Login with the LinkedIn App
|
||||
* @param scopes {string[]} Scopes to authorize
|
||||
* @param promptToInstall {boolean} set to true to prompt the user to download the LinkedIn app if it's not installed
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
login(scopes: LinkedInLoginScopes[], promptToInstall: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current session
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
logout(): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a get request
|
||||
* @param path {string} request path
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getRequest(path: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a post request
|
||||
* @param path {string} request path
|
||||
* @param body {Object} request body
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
postRequest(path: string, body: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a member's profile
|
||||
* @param memberId {string} Member id
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
openProfile(memberId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there is already an existing active session. This should be used to avoid unnecessary login.
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether there is an active session
|
||||
*/
|
||||
@Cordova()
|
||||
hasActiveSession(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there is an active session and returns the access token if it exists.
|
||||
* @return {Promise<any>} returns a promise that resolves with an object that contains an access token if there is an active session
|
||||
*/
|
||||
@Cordova()
|
||||
getActiveSession(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
53
src/@ionic-native/plugins/lottie-splash-screen/index.ts
Normal file
53
src/@ionic-native/plugins/lottie-splash-screen/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Lottie Splash Screen
|
||||
* @description
|
||||
* Cordova plugin to show bodymovin/Lottie animations as the splash screen with Airbnb's Lottie wrapper
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { LottieSplashScreen } from '@ionic-native/lottie-splash-screen/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private lottieSplashScreen: LottieSplashScreen) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.lottieSplashScreen.show('www/lottie/animation.json', false, 1024, 768)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LottieSplashScreen',
|
||||
plugin: 'cordova-plugin-lottie-splashscreen',
|
||||
pluginRef: 'lottie.splashscreen',
|
||||
repo: 'https://github.com/timbru31/cordova-plugin-lottie-splashscreen',
|
||||
install: '',
|
||||
installVariables: [],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class LottieSplashScreen extends IonicNativePlugin {
|
||||
/**
|
||||
* This function shows a Lottie splash screen. If no arguments are given, it defaults to the config.xml values, however you can pass (new) options here to change the behavior on runtime. (For easier reading the TypeScript notation is used)
|
||||
* @param location {string} Location of the Lottie JSON file that should be loaded.
|
||||
* @param remote {number} Toggles Lottie's remote mode which allows files to be downloaded/displayed from URLs. Example:
|
||||
* @param width {number} Width of the container that's rendering the Lottie animation
|
||||
* @param height {number} Height of the container that's rendering the Lottie animation
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
show(location?: string, remote?: boolean, width?: number, height?: number): void {}
|
||||
|
||||
/**
|
||||
* This methods hides the current active Lottie splashscreen and destroys the views.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
hide(): void {}
|
||||
}
|
||||
140
src/@ionic-native/plugins/luxand/index.ts
Normal file
140
src/@ionic-native/plugins/luxand/index.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface LuxandConfig {
|
||||
/** The licence key got from Luxand */
|
||||
licence: string;
|
||||
/** The internal database name the tracker should use */
|
||||
dbname: string;
|
||||
/** the number of retry when registering of identifying a face */
|
||||
loginTryCount: number;
|
||||
}
|
||||
|
||||
export interface OMLFacialData {
|
||||
/** The status message */
|
||||
status: string;
|
||||
/** The message returned by the plugin */
|
||||
message: string;
|
||||
/** The unique name generated and associated to a face when registering */
|
||||
name: string;
|
||||
/** The unique id Luxand Face SDK tracker associate to a face in it's internal database */
|
||||
id: number;
|
||||
/** Extra information about the face including age, expressions */
|
||||
extra: {
|
||||
AGE?: any;
|
||||
GENDER?: any;
|
||||
EYESOPENED?: any;
|
||||
SMILE: any;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Luxand
|
||||
* @description
|
||||
* This plugin let you integrat Luxand Face SDK into your ionic projects, so you can implements face authentication easily in your applications.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Luxand } from '@ionic-native/luxand';
|
||||
*
|
||||
*
|
||||
* constructor(private luxand: Luxand) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* //init Luxand Face SDK
|
||||
*
|
||||
* this.luxand.init({
|
||||
* licence: "",
|
||||
* dbname: "data.dat",
|
||||
* loginTryCount: 3
|
||||
* })
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* // register a face
|
||||
* this.luxand.register({
|
||||
* timeout: 20000//20 seconds
|
||||
* })
|
||||
* .then(r=>{
|
||||
* console.log("Your FACE ID:", r.id);
|
||||
* console.log("Your AGE:", r.extra.AGE);
|
||||
* console.log("Your GENDER:", r.extra.GENDER);
|
||||
* console.log("SIMILING:", r.extra.SMILE>35? "YES": "NO");
|
||||
* console.log("EYE OPENED:", r.extra.EYESOPENED>45? "YES": "NO");
|
||||
* })
|
||||
* .catch(err=>{
|
||||
* if(err.messgae === "Already registered") {
|
||||
* //extra data available
|
||||
* console.log("Your AGE:", r.extra.AGE);
|
||||
* console.log("Your GENDER:", r.extra.GENDER);
|
||||
* console.log("SIMILING:", r.extra.SMILE>35? "YES": "NO");
|
||||
* console.log("EYE OPENED:", r.extra.EYESOPENED>45? "YES": "NO");
|
||||
* }
|
||||
* })
|
||||
* //to login using a face
|
||||
* this.luxand.login({
|
||||
* timeout: 20000
|
||||
* }).then(r=>console.log(r))
|
||||
* .catch(err=>console.log(err));
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* OMLFacialData
|
||||
* LuxandConfig
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Luxand',
|
||||
plugin: 'codova-plugin-luxand',
|
||||
pluginRef: 'window.Luxand',
|
||||
repo: 'https://github.com/molobala/cordova-plugin-luxand',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Luxand extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Initialize Luxand SDK
|
||||
* @param config {LuxandConfig} LuxandConfig configuration object to use to init the SDK
|
||||
* @return {Promise<any>} // Returns a promise that resolves if Luxand FaceSDK is initialized succesffully
|
||||
*/
|
||||
@Cordova()
|
||||
init(config: LuxandConfig): Promise<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Identify methode, try to register a face in internal data base
|
||||
* @param params {any} Allow to specify the timeout value
|
||||
* @return {Promise<OMLFacialData>} // Returns a promise that resolve if a face has been detected and saved by the tracker in the internal database
|
||||
*/
|
||||
@Cordova()
|
||||
register(params: {timeout: number}): Promise<OMLFacialData> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Login method, try to authenticated a face
|
||||
* @param params {any} Allow to specify the timeout value
|
||||
* @return {Promise<OMLFacialData>}
|
||||
*/
|
||||
@Cordova()
|
||||
login(params: {timeout: number}): Promise<OMLFacialData> {
|
||||
return; // Returns a promise that resolve if a face is recognize successfully
|
||||
}
|
||||
/**
|
||||
* clear method, try to remove a face from internal database
|
||||
* @param id {number}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
clear(id: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* clearMemory method, try to clear internal database
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
clearMemory(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
96
src/@ionic-native/plugins/magnetometer/index.ts
Normal file
96
src/@ionic-native/plugins/magnetometer/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface MagnetometerReading {
|
||||
/**
|
||||
* X reading of magnetometer. (Number)
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* Y reading of magnetometer. (Number)
|
||||
*/
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* Z reading of magnetometer. (Number)
|
||||
*/
|
||||
z: number;
|
||||
|
||||
/**
|
||||
* Calculated total - always positive of magnetometer. (Number)
|
||||
*/
|
||||
magnitude: number;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Device eMagnetometer
|
||||
* @description
|
||||
* Requires Cordova plugin: `cordova-plugin-magnetometer`. For more info, please see the [Device Orientation docs](https://github.com/sdesalas/cordova-plugin-magnetometer).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* // DeviceOrientationCompassHeading is an interface for compass
|
||||
* import { Magnetometer, MagnetometerReading } from '@ionic-native/device-orientation/ngx';
|
||||
*
|
||||
* constructor(private magnetometer: Magnetometer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Get the device current compass heading
|
||||
* this.deviceOrientation.getReading().then(
|
||||
* (data: MagnetometerReading) => console.log(data),
|
||||
* (error: any) => console.log(error)
|
||||
* );
|
||||
*
|
||||
* // Watch the device compass heading change
|
||||
* var subscription = this.deviceOrientation.watchReadings().subscribe(
|
||||
* (data: MagnetometerReading) => console.log(data)
|
||||
* );
|
||||
*
|
||||
* // Stop watching heading change
|
||||
* subscription.unsubscribe();
|
||||
* ```
|
||||
* @interfaces
|
||||
* MagnetometerReading
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Magnetometer',
|
||||
plugin: 'cordova-plugin-magnetometer',
|
||||
pluginRef: 'cordova.plugins.magnetometer',
|
||||
repo: 'https://github.com/sdesalas/cordova-plugin-magnetometer',
|
||||
platforms: [
|
||||
'Android',
|
||||
'iOS',
|
||||
]
|
||||
})
|
||||
@Injectable()
|
||||
export class Magnetometer extends IonicNativePlugin {
|
||||
/**
|
||||
* Get the current compass reading.
|
||||
* @returns {Promise<MagnetometerReading>}
|
||||
*/
|
||||
@Cordova()
|
||||
getReading(): Promise<MagnetometerReading> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device current heading at a regular interval
|
||||
*
|
||||
* Stop the watch by unsubscribing from the observable
|
||||
* @param {DeviceOrientationCompassOptions} [options] Options for compass. Frequency and Filter. Optional
|
||||
* @returns {Observable<DeviceOrientationCompassHeading>} Returns an observable that contains the compass heading
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
observable: true,
|
||||
clearFunction: 'stop'
|
||||
})
|
||||
watchReadings(
|
||||
): Observable<MagnetometerReading> {
|
||||
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) { }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface NdefRecord {
|
||||
export interface NdefTag {
|
||||
canMakeReadOnly: boolean;
|
||||
id: number[];
|
||||
isWriteable: boolean;
|
||||
isWritable: boolean;
|
||||
maxSize: number;
|
||||
ndefMessage: NdefRecord[];
|
||||
techTypes: string[];
|
||||
@@ -196,7 +196,7 @@ export class NFC extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
makeReadyOnly(): Promise<any> {
|
||||
makeReadOnly(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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 {}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,27 @@ export interface PhotoViewerOptions {
|
||||
* Set to false to disable the share button (Android only). Default: true
|
||||
*/
|
||||
share?: boolean;
|
||||
/**
|
||||
* Add HTTP headers to the request. Useful for authenticated pages.
|
||||
* The value is a string in a JSON format. Default: ''
|
||||
*/
|
||||
headers?: string;
|
||||
/**
|
||||
* Option for close button visibility when share false [ONLY FOR iOS]
|
||||
*/
|
||||
closeButton?: boolean;
|
||||
/**
|
||||
* If you need to copy image to reference before show then set it true [ONLY FOR iOS]
|
||||
*/
|
||||
copyToReference?: boolean;
|
||||
/**
|
||||
* Enable or Disable Picasso Options ( Only Android ): fit, centerInside, centerCrop.
|
||||
*/
|
||||
piccasoOptions?: {
|
||||
fit?: boolean;
|
||||
centerInside?: boolean;
|
||||
centerCrop?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,6 +43,8 @@ export interface PhotoViewerOptions {
|
||||
* this.photoViewer.show('https://mysite.com/path/to/image.jpg');
|
||||
*
|
||||
* this.photoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
|
||||
*
|
||||
* this.photoViewer.show('https://mysecuresite.com/path/to/image.jpg', 'My image title', {share: false, headers: '{username:foo,password:bar}'});
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
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';
|
||||
*
|
||||
*
|
||||
* 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,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;
|
||||
}
|
||||
}
|
||||
418
src/@ionic-native/plugins/purchases/index.ts
Normal file
418
src/@ionic-native/plugins/purchases/index.ts
Normal file
@@ -0,0 +1,418 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* @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/purchases-ios/releases) |
|
||||
* | 📮 | Great support - [Help Center](https://docs.revenuecat.com/discuss) |
|
||||
* | 🤩 | 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. Displaying Available Products
|
||||
*
|
||||
* _Purchases_ will automatically fetch the latest _active_ entitlements and get the product information from Apple or Google. This means when users launch your purchase screen, products will already be loaded.
|
||||
*
|
||||
* Below is an example of fetching entitlements and launching an upsell screen.
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.getEntitlements()
|
||||
* .subscribe(entitlements => ,
|
||||
* error => );
|
||||
* ```
|
||||
*
|
||||
* #### 4. Make a purchase
|
||||
*
|
||||
* When it comes time to make a purchase, _Purchases_ has a simple method, `makePurchase`. The code sample below shows the process of purchasing a product and confirming it unlocks the "my_entitlement_identifier" content.
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.makePurchase("product_id")
|
||||
* .subscribe(response => {
|
||||
* if (response.purchaserInfo.activeEntitlements.includes("my_entitlement_identifier")) {
|
||||
* // Unlock content
|
||||
* }
|
||||
* },
|
||||
* ({ error, userCancelled }) => // Error making purchase. You can check error.userCancelled to check if user cancelled the purchase
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* `makePurchase` handles the underlying framework interaction and automatically validates purchases with Apple and Google through our secure servers. This helps reduce in-app purchase fraud and decreases the complexity of your app. Receipt tokens are stored remotely and always kept up-to-date.
|
||||
*
|
||||
* #### 5. Get Subscription Status
|
||||
*
|
||||
* _Purchases_ makes it easy to check what active subscriptions the current user has. This can
|
||||
* be done two ways within the `.purchaserInfo` method:
|
||||
*
|
||||
* 1. Checking active Entitlements - this lets you see what entitlements ([from RevenueCat dashboard](https://app.revenuecat.com))
|
||||
* are active for the user.
|
||||
* 2. Checking the active subscriptions - this lets you see what product ids (from iTunes Connect or Play Store) are active for the user.
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.getPurchaserInfo()
|
||||
* .subscribe(info => {
|
||||
* // Option 1: Check if user has access to entitlement (from RevenueCat dashboard)
|
||||
* const isPro =
|
||||
* info.activeEntitlements !== "undefined" &&
|
||||
* info.activeEntitlements.includes("pro");
|
||||
* // Option 2: Check if user has active subscription (from App Store Connect or Play Store)
|
||||
* const isPro =
|
||||
* info.activeSubscriptions !== "undefined" &&
|
||||
* info.activeSubscriptions.includes("my_product_identifier");
|
||||
* },
|
||||
* error => );
|
||||
* ```
|
||||
*
|
||||
* > Since the SDK updates and caches the latest PurchaserInfo when the app becomes active, the completion block in `.purchaserInfo` won't need to make a network request in most cases.
|
||||
*
|
||||
* ### Restoring Purchases
|
||||
*
|
||||
* Restoring purchases is a mechanism by which your user can restore their in-app purchases, reactivating any content that had previously been purchased from the same store account (Apple or Google).
|
||||
*
|
||||
* If two different App User IDs try to restore transactions from the same underlying store account (Apple or Google) RevenueCat will create an alias between the two App User IDs and count them as the same user going forward.
|
||||
*
|
||||
* This is a common if your app does not have accounts and is relying on RevenueCat's random App User IDs.
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.restore()
|
||||
* .subscribe(info => {
|
||||
* //... check purchaserInfo to see if entitlement is now active
|
||||
* },
|
||||
* error => );
|
||||
* ```
|
||||
* > If you've provided your own App User ID, calling restoreTransactions could alias the logged in user to another generated App User ID that has made a purchase on the same device.
|
||||
*
|
||||
* > By default, RevenueCat will not let you reuse an App or Play Store account that already has an active subscription. If you set allowSharingAppStoreAccount = True the SDK will be permissive in accepting shared accounts, creating aliases as needed.
|
||||
*
|
||||
* > By default allowSharingAppStoreAccount is True for RevenueCat random App User IDs but must be enabled manually if you want to allow permissive sharing for your own App User IDs.
|
||||
*
|
||||
* ## Debugging
|
||||
*
|
||||
* You can enabled detailed debug logs by setting `debugLogsEnabled = true`. You can set this **before** you configure Purchases.
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.setDebugLogsEnabled(true);
|
||||
* this.purchases.setup("my_api_key", "my_app_user_id");
|
||||
* ```
|
||||
*
|
||||
* **OS_ACTIVITY_MODE**
|
||||
* > On iOS, disabling `OS_ACTIVITY_MODE` in your XCode scheme will block debug logs from printing in the console. If you have debug logs enabled, but don't see any output, go to `Product -> Scheme -> Edit Scheme...` in Xcode and uncheck the `OS_ACTIVITY_MODE` environment variable.
|
||||
*
|
||||
* Example output:
|
||||
* ```
|
||||
* [Purchases] - DEBUG: Debug logging enabled.
|
||||
* [Purchases] - DEBUG: SDK Version - 2.0.0
|
||||
* [Purchases] - DEBUG: Initial App User ID - (null)
|
||||
* [Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>
|
||||
* [Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>/products
|
||||
* [Purchases] - DEBUG: No cached entitlements, fetching
|
||||
* [Purchases] - DEBUG: Vending purchaserInfo from cache
|
||||
* [Purchases] - DEBUG: applicationDidBecomeActive
|
||||
* [Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>/products 200
|
||||
* ```
|
||||
* ## Entitlements
|
||||
*
|
||||
* An entitlement represents features or content that a user is "entitled" to. With Entitlements, you can set up your available in-app products remotely and control their availability without the need to update your app. For more information on configuring entitlements, look at our [entitlements documetation](https://docs.revenuecat.com/docs/entitlements).
|
||||
*
|
||||
* ## Sample App
|
||||
*
|
||||
* We've added an [example](https://github.com/RevenueCat/purchases-ionic-example) showing a simple example using _Purchases_ with the RevenueCat backend. Note that the pre-registered in app purchases in the demo apps are for illustration purposes only and may not be valid in App Store Connect. [Set up your own purchases](https://docs.revenuecat.com/docs/entitlements) with RevenueCat when running the example.
|
||||
*
|
||||
* #### Additional iOS Setup
|
||||
*
|
||||
* ##### Add Strip Frameworks Phase
|
||||
* The App Store, in it's infinite wisdom, still rejects fat frameworks, so we need to strip our framework before it is deployed. To do this, add the following script phase to your build.
|
||||
* 1. In Xcode, in project manager, select your app target.
|
||||
* 2. Open the `Build Phases` tab
|
||||
* 3. Add a new `Run Script`, name it `Strip Frameworks`
|
||||
* 4. Add the following command `"${PROJECT_DIR}/../../node_modules/cordova-plugin-purchases/src/ios/strip-frameworks.sh"` (quotes included)
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Next Steps
|
||||
* - Head over to our **[online documentation](https://docs.revenuecat.com/docs)** for complete setup guides
|
||||
* - If you haven't already, make sure your products are configured correctly in the RevenueCat dashboard by checking out our [guide on entitlements](https://docs.revenuecat.com/docs/entitlements)
|
||||
* - If you want to use your own user identifiers, read about [setting app user ids](https://docs.revenuecat.com/docs/user-ids)
|
||||
* - If you're moving to RevenueCat from another system, see our guide on [migrating your existing subscriptions](https://docs.revenuecat.com/docs/migrating-existing-subscriptions)
|
||||
* - Once you're ready to test your integration, you can follow our guides on [testing purchases](https://docs.revenuecat.com/docs/testing-purchases)
|
||||
*
|
||||
* ## Reporting Issues
|
||||
*
|
||||
* You can use Github Issues to report any bugs and issues with _Purchases_. Here is some advice for users that want to report an issue:
|
||||
*
|
||||
* 1. Make sure that you are using the latest version of _Purchases_. The issue that you are about to report may be already fixed in the latest master branch version: https://github.com/revenuecat/cordova-plugin-purchases/tree/master.
|
||||
* 2. Providing reproducible steps for the issue will shorten the time it takes for it to be fixed - a Gist is always welcomed!
|
||||
* 3. Since some issues are Sandbox specific, specifying what environment you encountered the issue might help.
|
||||
*
|
||||
* ## Technical Support or Questions
|
||||
*
|
||||
* If you have questions or need help integrating _Purchases_ please [contact us](https://www.revenuecat.com/contact) or email _support@revenuecat.com_ instead of opening an issue.
|
||||
*
|
||||
* ## Feature Requests
|
||||
*
|
||||
* If there is something you'd like to see included or feel anything is missing you can add a feature to our [public roadmap](https://trello.com/b/RZRnWRbI/revenuecat-product-roadmap). If the feature already exists, or you see something else you'd like, upvote it.
|
||||
*
|
||||
* ## Pricing
|
||||
*
|
||||
* _Purchases_ SDK is free to use but some features require a paid plan. You can find more about that on our website on the [pricing plan page](https://www.revenuecat.com/pricing).
|
||||
*
|
||||
* @interfaces
|
||||
* RCPurchaserInfo
|
||||
* RCProduct
|
||||
* RCMakePurchaseResponse
|
||||
* RCError
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Purchases',
|
||||
plugin: 'cordova-plugin-purchases',
|
||||
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 {
|
||||
/**
|
||||
* Sets up Purchases with your API key and an app user id.
|
||||
* @param apiKey {string} RevenueCat API Key. Needs to be a String
|
||||
* @param appUserID {string?} A unique id for identifying the user
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setup(apiKey: string, appUserID: string): 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 diabled
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setAllowSharingStoreAccount(allowSharing: boolean): void {}
|
||||
|
||||
/**
|
||||
* Add a dict of attribution information
|
||||
* @param data { Object.<string, any> } Attribution data from any of the attribution networks in ATTRIBUTION_NETWORKS
|
||||
* @param network {ATTRIBUTION_NETWORKS} Which network, see ATTRIBUTION_NETWORKS
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
addAttributionData(
|
||||
data: { [key: string]: any },
|
||||
network: ATTRIBUTION_NETWORKS
|
||||
): void {}
|
||||
|
||||
/**
|
||||
* Gets the map of entitlements -> offerings -> products
|
||||
*
|
||||
* @return {Observable<Map<String, Map<String, Product>>>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
getEntitlements(): Observable<Map<String, Map<String, RCProduct>>> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the product info
|
||||
* @param productIdentifiers {string[]} Array of product identifiers
|
||||
* @param type {ProductType} Optional type of products to fetch, can be inapp or subs. Subs by default
|
||||
*
|
||||
* @return {Observable<Array>} Will return an [RCError] if the products are not properly configured in RevenueCat or if there is another error retrieving them.
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2,
|
||||
observable: true
|
||||
})
|
||||
getProducts(
|
||||
productIdentifiers: string[],
|
||||
type: ProductType = ProductType.SUBS
|
||||
): Observable<[RCProduct]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a purchase
|
||||
* @param productIdentifier {string} The product identifier of the product you want to purchase.
|
||||
* @param oldSkus {string[]} Optional array of skus you wish to upgrade from.
|
||||
* @param type {String} Optional type of product, can be inapp or subs. Subs by default
|
||||
*
|
||||
* @return {Observable<MakePurchaseResponse>} An [RCError] is thrown when user cancels. On error `usercancelled` will be true if user cancelled
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2,
|
||||
observable: true
|
||||
})
|
||||
makePurchase(
|
||||
productIdentifier: string,
|
||||
oldSkus: string[] = [],
|
||||
type: ProductType = ProductType.SUBS
|
||||
): Observable<RCMakePurchaseResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
|
||||
*
|
||||
* @return {Observable<PurchaserInfo>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
restoreTransactions(): Observable<RCPurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appUserID that is currently in placed in the SDK
|
||||
*
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
@Cordova()
|
||||
getAppUserID(): Promise<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 {Observable<PurchaserInfo>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
createAlias(newAppUserID: string): Observable<RCPurchaserInfo> {
|
||||
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 {Observable<PurchaserInfo>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
identify(newAppUserID: string): Observable<RCPurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
|
||||
*
|
||||
* @return {Observable<PurchaserInfo>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
reset(): Observable<RCPurchaserInfo> {
|
||||
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 {Observable<PurchaserInfo>} Errors are of type [RCError]
|
||||
*/
|
||||
@Cordova({ observable: true })
|
||||
getPurchaserInfo(): Observable<RCPurchaserInfo> {
|
||||
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<RCPurchaserInfo> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/Disables debugs logs
|
||||
* @param enabled {boolean} true to enable debug logs, false to disable
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDebugLogsEnabled(enabled: boolean): void {}
|
||||
}
|
||||
|
||||
export enum ProductType {
|
||||
SUBS = 'subs',
|
||||
INAPP = 'inapp'
|
||||
}
|
||||
|
||||
export enum ATTRIBUTION_NETWORKS {
|
||||
APPLE_SEARCH_ADS = 0,
|
||||
ADJUST = 1,
|
||||
APPSFLYER = 2,
|
||||
BRANCH = 3,
|
||||
TENJIN = 4
|
||||
}
|
||||
|
||||
export interface RCProduct {
|
||||
identifier: string;
|
||||
description: string;
|
||||
title: string;
|
||||
price: number;
|
||||
price_string: string;
|
||||
intro_price?: string;
|
||||
intro_price_string?: string;
|
||||
intro_price_period?: string;
|
||||
intro_price_cycles?: number;
|
||||
currency_code: string;
|
||||
}
|
||||
|
||||
export interface RCPurchaserInfo {
|
||||
activeEntitlements: string[];
|
||||
activeSubscriptions: string[];
|
||||
allPurchasedProductIdentifiers: string[];
|
||||
latestExpirationDate?: string;
|
||||
allExpirationDates: { [key: string]: string | null };
|
||||
expirationsForActiveEntitlements: { [key: string]: string | null };
|
||||
}
|
||||
|
||||
export interface RCMakePurchaseResponse {
|
||||
productIdentifier: string;
|
||||
purchaserInfo: RCPurchaserInfo;
|
||||
}
|
||||
|
||||
export interface RCError {
|
||||
code: number;
|
||||
message: string;
|
||||
underlyingErrorMessage?: string;
|
||||
}
|
||||
@@ -389,7 +389,9 @@ export class PushObject {
|
||||
if (
|
||||
checkAvailability('PushNotification', 'init', 'PushNotification') === true
|
||||
) {
|
||||
this._objectInstance = window.PushNotification.init(options);
|
||||
if (typeof window !== 'undefined') {
|
||||
this._objectInstance = window.PushNotification.init(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user