mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
188 Commits
| 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 | ||
|
|
dcd95582d2 | ||
|
|
354af9fe6f |
2019
CHANGELOG.md
2019
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.
|
||||
|
||||
```
|
||||
|
||||
@@ -3,7 +3,7 @@ jobs:
|
||||
build:
|
||||
working_directory: ~/ionic-native/
|
||||
docker:
|
||||
- image: node:10
|
||||
- image: node:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
key: node_modules_{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Install node modules
|
||||
command: npm i
|
||||
command: npm ci
|
||||
- save_cache:
|
||||
key: node_modules_{{ checksum "package.json" }}
|
||||
paths:
|
||||
|
||||
8048
package-lock.json
generated
8048
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "5.4.0",
|
||||
"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)",
|
||||
@@ -23,45 +23,45 @@
|
||||
"shipit": "npm run build && npm run readmes && npm run npmpub"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/common": "^7.2.12",
|
||||
"@angular/compiler": "^7.2.12",
|
||||
"@angular/compiler-cli": "^7.2.12",
|
||||
"@angular/core": "^7.2.12",
|
||||
"@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.5",
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/lodash": "^4.14.123",
|
||||
"@types/node": "^10.14.4",
|
||||
"@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.27",
|
||||
"ajv": "^6.10.0",
|
||||
"async-promise-queue": "^1.0.4",
|
||||
"conventional-changelog-cli": "^2.0.12",
|
||||
"cz-conventional-changelog": "^2.1.0",
|
||||
"@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.4",
|
||||
"jest": "^24.7.1",
|
||||
"lodash": "^4.17.11",
|
||||
"jest": "^24.9.0",
|
||||
"lodash": "^4.17.15",
|
||||
"minimist": "1.2.0",
|
||||
"natives": "^1.1.6",
|
||||
"rimraf": "^2.6.3",
|
||||
"rxjs": "^6.4.0",
|
||||
"ts-jest": "^24.0.2",
|
||||
"ts-node": "^8.0.3",
|
||||
"tslint": "^5.15.0",
|
||||
"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.14.2",
|
||||
"typescript": "3.2.4",
|
||||
"uglifyjs-webpack-plugin": "^2.1.2",
|
||||
"typedoc": "^0.15.0",
|
||||
"typescript": "~3.5.3",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"unminified-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack": "^4.41.2",
|
||||
"winston": "^3.2.1",
|
||||
"zone.js": "^0.8.29"
|
||||
"zone.js": "^0.9.1"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
|
||||
@@ -10,6 +10,7 @@ interface Plugin {
|
||||
platforms: string[];
|
||||
usage: string;
|
||||
repo: string;
|
||||
installVariables: string[];
|
||||
cordovaPlugin: {
|
||||
name: string;
|
||||
};
|
||||
@@ -56,6 +57,7 @@ function processPlugin(pluginModule): Plugin {
|
||||
usage,
|
||||
platforms: decorator.platforms,
|
||||
repo: decorator.repo,
|
||||
installVariables: decorator.installVariables,
|
||||
cordovaPlugin: {
|
||||
name: decorator.plugin
|
||||
}
|
||||
|
||||
@@ -6,35 +6,27 @@ const config = require('./config.json'),
|
||||
Dgeni = require('dgeni');
|
||||
|
||||
module.exports = gulp => {
|
||||
gulp.task('docs', [], () => {
|
||||
gulp.task('docs', () => {
|
||||
try {
|
||||
const ionicPackage = require('./dgeni/dgeni-config')(
|
||||
projectPackage.version
|
||||
),
|
||||
const ionicPackage = require('./dgeni/dgeni-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
|
||||
return dgeni
|
||||
.generate()
|
||||
.then(docs => console.log(docs.length + ' docs generated'));
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' docs generated'));
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('readmes', [], function() {
|
||||
gulp.task('readmes', () => {
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, '..', '..', 'README.md'),
|
||||
path.resolve(__dirname, '..', '..', config.pluginDir, 'core', 'README.md')
|
||||
);
|
||||
|
||||
try {
|
||||
const ionicPackage = require('./dgeni/dgeni-readmes-config')(
|
||||
projectPackage.version
|
||||
),
|
||||
const ionicPackage = require('./dgeni/dgeni-readmes-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni
|
||||
.generate()
|
||||
.then(docs => console.log(docs.length + ' README files generated'));
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' README files generated'));
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ const DIST = path.resolve(ROOT, 'dist/@ionic-native');
|
||||
const PACKAGES = [];
|
||||
|
||||
const MIN_CORE_VERSION = '^5.1.0';
|
||||
const RXJS_VERSION = '^6.3.0';
|
||||
const RXJS_VERSION = '^5.5.0 || ^6.5.0';
|
||||
|
||||
const PLUGIN_PEER_DEPENDENCIES = {
|
||||
'@ionic-native/core': MIN_CORE_VERSION,
|
||||
|
||||
@@ -149,7 +149,7 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
* @returns {Observable}
|
||||
*/
|
||||
function wrapEventObservable(event: string, element: any): Observable<any> {
|
||||
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || typeof window !== 'undefined' || {};
|
||||
element = (typeof window !== 'undefined' && element) ? get(window, element) : element || (typeof window !== 'undefined' ? window : {});
|
||||
return fromEvent(element, event);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* constructor(private alipay: Alipay) {
|
||||
*
|
||||
* //alipayOrder is a string that has been generated and signed by the server side.
|
||||
* this.alipay.pay(alipayOrder)
|
||||
* this.alipay.pay(alipayOrder, success, error)
|
||||
* .then(result => {
|
||||
* console.log(result); // Success
|
||||
* })
|
||||
@@ -30,7 +30,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
@Plugin({
|
||||
pluginName: 'Alipay',
|
||||
plugin: 'cordova-plugin-gubnoi-alipay',
|
||||
pluginRef: 'Alipay',
|
||||
pluginRef: 'cordova.plugins.alipay',
|
||||
repo: 'https://github.com/jing-zhou/cordova-plugin-alipay',
|
||||
install: 'ionic cordova plugin add cordova-plugin-gubnoi-alipay --variable APP_ID=your_app_id',
|
||||
installVariables: ['APP_ID'],
|
||||
@@ -44,7 +44,7 @@ export class Alipay extends IonicNativePlugin {
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
|
||||
*/
|
||||
@Cordova()
|
||||
pay(order: string): Promise<any> {
|
||||
pay(order: string, success?: (res?: any) => void, error?: (err?: any) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,20 +204,20 @@ export class AndroidPermissions extends IonicNativePlugin {
|
||||
/**
|
||||
* Check permission
|
||||
* @param {string} permission The name of the permission
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<AndroidPermissionResponse>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
checkPermission(permission: string): Promise<any> {
|
||||
checkPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permission
|
||||
* @param {string} permission The name of the permission to request
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<AndroidPermissionResponse>}
|
||||
*/
|
||||
@Cordova()
|
||||
requestPermission(permission: string): Promise<any> {
|
||||
requestPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,10 +234,14 @@ export class AndroidPermissions extends IonicNativePlugin {
|
||||
/**
|
||||
* This function still works now, will not support in the future.
|
||||
* @param {string} permission The name of the permission
|
||||
* @return {Promise<any>} Returns a promise
|
||||
* @return {Promise<AndroidPermissionResponse>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
hasPermission(permission: string): Promise<any> {
|
||||
hasPermission(permission: string): Promise<AndroidPermissionResponse> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AndroidPermissionResponse {
|
||||
hasPermission: boolean;
|
||||
}
|
||||
|
||||
51
src/@ionic-native/plugins/anyline/index.ts
Normal file
51
src/@ionic-native/plugins/anyline/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AnylineOptions {
|
||||
// Valid License Key
|
||||
licenseKey: string;
|
||||
|
||||
// Scanning options
|
||||
config: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Anyline
|
||||
* @description
|
||||
* Anyline provides an easy-to-use SDK for applications to enable Optical Character Recognition (OCR) on mobile devices.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Anyline } from '@ionic-native/anyline/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private anyline: Anyline) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.anyline.scan(options)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Anyline',
|
||||
plugin: 'io-anyline-cordova',
|
||||
pluginRef: 'Anyline',
|
||||
repo: 'https://github.com/Anyline/anyline-ocr-cordova-module',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Anyline extends IonicNativePlugin {
|
||||
/**
|
||||
* Scan
|
||||
* @param options {AnylineOptions} Scanning options
|
||||
* @return {Promise<any>} Returns a promise that resolves when Code is captured
|
||||
*/
|
||||
@Cordova()
|
||||
scan(options: AnylineOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,12 @@ export interface AppRateCustomLocale {
|
||||
|
||||
/** Feedback prompt title */
|
||||
feedbackPromptTitle?: string;
|
||||
|
||||
/** Feedback prompt message */
|
||||
appRatePromptMessage?: string;
|
||||
|
||||
/** Feedback prompt message */
|
||||
feedbackPromptMessage?: string;
|
||||
}
|
||||
|
||||
export interface AppRateCallbacks {
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface CardData {
|
||||
paymentNetwork?: string;
|
||||
}
|
||||
|
||||
export interface EligibilityData {
|
||||
export interface PairedDevicesFlags {
|
||||
isInWallet: boolean;
|
||||
isInWatch: boolean;
|
||||
FPANID: string;
|
||||
@@ -31,10 +31,6 @@ export interface WatchExistData {
|
||||
isWatchPaired: boolean;
|
||||
}
|
||||
|
||||
export interface CardPrimarySuffixData {
|
||||
primaryAccountSuffix: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Apple Wallet
|
||||
* @description
|
||||
@@ -60,14 +56,13 @@ export interface CardPrimarySuffixData {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call to check existence and ellibagility to add a card
|
||||
* this.appleWallet.isCardExistInWalletOrWatch(data: CardPrimarySuffixData)
|
||||
* .then((res: EligibilityData) => {
|
||||
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
|
||||
* // Simple call to check Card Eligibility
|
||||
* this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string)
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
@@ -77,10 +72,36 @@ export interface CardPrimarySuffixData {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call to checkCardEligibilityBySuffix
|
||||
* this.appleWallet.checkCardEligibilityBySuffix(cardSuffix: string)
|
||||
* .then((res: boolean) => {
|
||||
* // Expect res to be boolean
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button
|
||||
* this.appleWallet.isPairedWatchExist()
|
||||
* this.appleWallet.checkPairedDevices()
|
||||
* .then((res: WatchExistData) => {
|
||||
* // object contains boolean value that ensure that there is already a paired Watch
|
||||
* // object contains boolean flags showing paired devices
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Simple call to check paired devices with a card by its suffix
|
||||
* this.appleWallet.checkPairedDevicesBySuffix(cardSuffix: string)
|
||||
* .then((res: PairedDevicesFlags) => {
|
||||
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* // Catch {{err}} here
|
||||
@@ -121,9 +142,8 @@ export interface CardPrimarySuffixData {
|
||||
* EncryptedCardData
|
||||
* SignatureCertificatesData
|
||||
* CardData
|
||||
* EligibilityData
|
||||
* PairedDevicesFlags
|
||||
* WatchExistData
|
||||
* CardPrimarySuffixData
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppleWallet',
|
||||
@@ -144,12 +164,22 @@ export class AppleWallet extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check existence and ellibagility to add a card
|
||||
* @param {CardPrimarySuffixData} data
|
||||
* @return {Promise<EligibilityData>}
|
||||
* Simple call to check Card Eligibility
|
||||
* @param {string} primaryAccountIdentifier
|
||||
* @return {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isCardExistInWalletOrWatch(data: CardPrimarySuffixData): Promise<EligibilityData> {
|
||||
checkCardEligibility(primaryAccountIdentifier: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to checkCardEligibilityBySuffix
|
||||
* @param {string} cardSuffix
|
||||
* @return {Promise<PairedDevicesFlags>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkCardEligibilityBySuffix(cardSuffix: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -158,7 +188,17 @@ export class AppleWallet extends IonicNativePlugin {
|
||||
* @return {Promise<WatchExistData>}
|
||||
*/
|
||||
@Cordova()
|
||||
isPairedWatchExist(): Promise<WatchExistData> {
|
||||
checkPairedDevices(): Promise<WatchExistData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple call to check paired devices with a card by its suffix
|
||||
* @param {string} cardSuffix
|
||||
* @return {Promise<PairedDevicesFlags>}
|
||||
*/
|
||||
@Cordova()
|
||||
checkPairedDevicesBySuffix(cardSuffix: string): Promise<PairedDevicesFlags> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
|
||||
*
|
||||
* ```typescript
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationEvents, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
@@ -516,7 +516,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
* this.backgroundGeolocation.configure(config)
|
||||
* .then(() => {
|
||||
*
|
||||
* this.backgroundGeolocation.on('location').subscribe((location: BackgroundGeolocationResponse) => {
|
||||
* this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {
|
||||
* console.log(location);
|
||||
*
|
||||
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
|
||||
@@ -540,7 +540,7 @@ export declare enum BackgroundGeolocationIOSActivity {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'BackgroundGeolocation',
|
||||
plugin: 'cordova-plugin-mauron85-background-geolocation@alpha',
|
||||
plugin: '@mauron85/cordova-plugin-background-geolocation',
|
||||
pluginRef: 'BackgroundGeolocation',
|
||||
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
|
||||
platforms: ['Android', 'iOS']
|
||||
|
||||
@@ -173,8 +173,6 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
* Register callback for given event.
|
||||
* > Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
|
||||
* @param event {string} Event name
|
||||
* @param callback {function} The function to be exec as callback.
|
||||
* @param scope {object} The callback function's scope.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -182,7 +180,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
clearFunction: 'un',
|
||||
clearWithArgs: true
|
||||
})
|
||||
on(event: string, callback: (...args: any[]) => void, scope?: object): Observable<any> {
|
||||
on(event: string): Observable<any> {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,6 +198,13 @@ export interface DocumentVerificationOverlaySettingsCtor {
|
||||
new(): DocumentVerificationOverlaySettings;
|
||||
}
|
||||
|
||||
export interface BlinkCardOverlaySettings extends OverlaySettings {
|
||||
glareMessage: string;
|
||||
}
|
||||
export interface BlinkCardOverlaySettingsCtor {
|
||||
new(): BlinkCardOverlaySettings;
|
||||
}
|
||||
|
||||
export interface RecognizerResult {
|
||||
resultState: RecognizerResultState;
|
||||
}
|
||||
@@ -837,47 +844,26 @@ export interface EgyptIdFrontRecognizer extends Recognizer<EgyptIdFrontRecognize
|
||||
}
|
||||
export interface EgyptIdFrontRecognizerCtor extends RecognizerCtor<EgyptIdFrontRecognizer> {}
|
||||
|
||||
export interface ElitePaymentCardBackRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
fullDocumentImage: string;
|
||||
inventoryNumber: string;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface ElitePaymentCardBackRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardBackRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardBackRecognizer extends Recognizer<ElitePaymentCardBackRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractValidThru: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
|
||||
export interface ElitePaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
export interface BlinkCardEliteRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
digitalSignature: string;
|
||||
digitalSignatureVersion: string;
|
||||
documentDataMatch: boolean;
|
||||
fullDocumentImage: string;
|
||||
fullDocumentBackImage: string;
|
||||
fullDocumentFrontImage: string;
|
||||
inventoryNumber: string;
|
||||
owner: string;
|
||||
scanningFirstSideDone: boolean;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface ElitePaymentCardCombinedRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardCombinedRecognizerResult> {}
|
||||
export interface BlinkCardEliteRecognizerResultCtor extends RecognizerResultCtor<BlinkCardEliteRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardCombinedRecognizer extends Recognizer<ElitePaymentCardCombinedRecognizerResult> {
|
||||
export interface BlinkCardEliteRecognizer extends Recognizer<BlinkCardEliteRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
@@ -886,20 +872,7 @@ export interface ElitePaymentCardCombinedRecognizer extends Recognizer<ElitePaym
|
||||
returnFullDocumentImage: boolean;
|
||||
signResult: boolean;
|
||||
}
|
||||
|
||||
export interface ElitePaymentCardFrontRecognizerResult extends RecognizerResult {
|
||||
fullDocumentImage: string;
|
||||
owner: string;
|
||||
}
|
||||
export interface ElitePaymentCardFrontRecognizerResultCtor extends RecognizerResultCtor<ElitePaymentCardFrontRecognizerResult> {}
|
||||
|
||||
export interface ElitePaymentCardFrontRecognizer extends Recognizer<ElitePaymentCardFrontRecognizerResult> {
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractOwner: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
}
|
||||
export interface BlinkCardEliteRecognizerCtor extends RecognizerCtor<BlinkCardEliteRecognizer> {}
|
||||
|
||||
export interface EudlRecognizerResult extends RecognizerResult {
|
||||
address: string;
|
||||
@@ -1731,24 +1704,7 @@ export interface NewZealandDlFrontRecognizer extends Recognizer<NewZealandDlFron
|
||||
}
|
||||
export interface NewZealandDlFrontRecognizerCtor extends RecognizerCtor<NewZealandDlFrontRecognizer> {}
|
||||
|
||||
export interface PaymentCardBackRecognizerResult extends RecognizerResult {
|
||||
cvv: string;
|
||||
fullDocumentImage: string;
|
||||
inventoryNumber: string;
|
||||
}
|
||||
export interface PaymentCardBackRecognizerResultCtor extends RecognizerResultCtor<PaymentCardBackRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardBackRecognizer extends Recognizer<PaymentCardBackRecognizerResult> {
|
||||
anonymizeCvv: boolean;
|
||||
detectGlare: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
export interface PaymentCardBackRecognizerCtor extends RecognizerCtor<PaymentCardBackRecognizer> {}
|
||||
|
||||
export interface PaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
export interface BlinkCardRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
cvv: string;
|
||||
digitalSignature: string;
|
||||
@@ -1757,16 +1713,19 @@ export interface PaymentCardCombinedRecognizerResult extends RecognizerResult {
|
||||
fullDocumentBackImage: string;
|
||||
fullDocumentFrontImage: string;
|
||||
inventoryNumber: string;
|
||||
issuer: string;
|
||||
owner: string;
|
||||
scanningFirstSideDone: boolean;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface PaymentCardCombinedRecognizerResultCtor extends RecognizerResultCtor<PaymentCardCombinedRecognizerResult> {}
|
||||
export interface BlinkCardRecognizerResultCtor extends RecognizerResultCtor<BlinkCardRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardCombinedRecognizer extends Recognizer<PaymentCardCombinedRecognizerResult> {
|
||||
export interface BlinkCardRecognizer extends Recognizer<BlinkCardRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeCvv: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractCvv: boolean;
|
||||
extractInventoryNumber: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
@@ -1775,27 +1734,7 @@ export interface PaymentCardCombinedRecognizer extends Recognizer<PaymentCardCom
|
||||
returnFullDocumentImage: boolean;
|
||||
signResult: boolean;
|
||||
}
|
||||
export interface PaymentCardCombinedRecognizerCtor extends RecognizerCtor<PaymentCardCombinedRecognizer> {}
|
||||
|
||||
export interface PaymentCardFrontRecognizerResult extends RecognizerResult {
|
||||
cardNumber: string;
|
||||
fullDocumentImage: string;
|
||||
owner: string;
|
||||
validThru: Date;
|
||||
}
|
||||
export interface PaymentCardFrontRecognizerResultCtor extends RecognizerResultCtor<PaymentCardFrontRecognizerResult> {}
|
||||
|
||||
export interface PaymentCardFrontRecognizer extends Recognizer<PaymentCardFrontRecognizerResult> {
|
||||
anonymizeCardNumber: boolean;
|
||||
anonymizeOwner: boolean;
|
||||
detectGlare: boolean;
|
||||
extractOwner: boolean;
|
||||
extractValidThru: boolean;
|
||||
fullDocumentImageDpi: number;
|
||||
fullDocumentImageExtensionFactors: ImageExtensionFactors;
|
||||
returnFullDocumentImage: boolean;
|
||||
}
|
||||
export interface PaymentCardFrontRecognizerCtor extends RecognizerCtor<PaymentCardFrontRecognizer> {}
|
||||
export interface BlinkCardRecognizerCtor extends RecognizerCtor<BlinkCardRecognizer> {}
|
||||
|
||||
export interface Pdf417RecognizerResult extends RecognizerResult {
|
||||
barcodeType: string;
|
||||
@@ -2738,6 +2677,40 @@ export interface UsdlCombinedRecognizerCtor extends RecognizerCtor<UsdlCombinedR
|
||||
* this.barcodeStringData = barcodeRecognizer.result.stringData;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const overlaySettings = new this.blinkId.BlinkCardOverlaySettings();
|
||||
* const recognizer = new this.blinkId.BlinkCardRecognizer();
|
||||
* recognizer.returnFullDocumentImage = false;
|
||||
* recognizer.detectGlare = true;
|
||||
* recognizer.extractCvv = true;
|
||||
* recognizer.extractValidThru = true;
|
||||
* recognizer.extractOwner = true;
|
||||
*
|
||||
* const recognizerCollection = new this.blinkId.RecognizerCollection([recognizer]);
|
||||
* const canceled = await this.blinkId.scanWithCamera(
|
||||
* overlaySettings,
|
||||
* recognizerCollection,
|
||||
* {
|
||||
* ios: '', //iOS License Key
|
||||
* android: '' //Android License Key
|
||||
* },
|
||||
* );
|
||||
*
|
||||
* if (!canceled) {
|
||||
* if (recognizer.result.resultState === RecognizerResultState.valid) {
|
||||
* const results = recognizer.result;
|
||||
*
|
||||
* if (results.resultState === RecognizerResultState.valid) {
|
||||
* const ccInfo = {
|
||||
* cardNumber: Number(results.cardNumber),
|
||||
* expirationMonth: Number(results.validThru.month),
|
||||
* expirationYear: Number(results.validThru.year),
|
||||
* cvv: Number(results.cvv)
|
||||
* };
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -2753,7 +2726,7 @@ export interface UsdlCombinedRecognizerCtor extends RecognizerCtor<UsdlCombinedR
|
||||
export class BlinkId extends IonicNativePlugin {
|
||||
/**
|
||||
* Opens the camera dialog and attempts to scan a barcode/document
|
||||
* @param overlaySettings {OverlaySettings} for camera overla customization
|
||||
* @param overlaySettings {OverlaySettings} for camera overlay customization
|
||||
* @param recognizerCollection {RecognizerCollection} collection of recognizers to scan with
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@@ -2773,6 +2746,7 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() BarcodeOverlaySettings: BarcodeOverlaySettingsCtor;
|
||||
@CordovaProperty() DocumentOverlaySettings: DocumentOverlaySettingsCtor;
|
||||
@CordovaProperty() DocumentVerificationOverlaySettings: DocumentVerificationOverlaySettingsCtor;
|
||||
@CordovaProperty() BlinkCardOverlaySettings: BlinkCardOverlaySettingsCtor;
|
||||
|
||||
@CordovaProperty() RecognizerCollection: RecognizerCollectionCtor;
|
||||
|
||||
@@ -2795,6 +2769,10 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() AustriaIdFrontRecognizer: AustriaIdFrontRecognizerCtor;
|
||||
@CordovaProperty() AustriaPassportRecognizerResult: AustriaPassportRecognizerResultCtor;
|
||||
@CordovaProperty() AustriaPassportRecognizer: AustriaPassportRecognizerCtor;
|
||||
@CordovaProperty() BlinkCardEliteRecognizer: BlinkCardEliteRecognizerCtor;
|
||||
@CordovaProperty() BlinkCardEliteRecognizerResult: BlinkCardEliteRecognizerResultCtor;
|
||||
@CordovaProperty() BlinkCardRecognizerResult: BlinkCardRecognizerResultCtor;
|
||||
@CordovaProperty() BlinkCardRecognizer: BlinkCardRecognizerCtor;
|
||||
@CordovaProperty() ColombiaDlFrontRecognizerResult: ColombiaDlFrontRecognizerResultCtor;
|
||||
@CordovaProperty() ColombiaIdBackRecognizerResult: ColombiaIdBackRecognizerResultCtor;
|
||||
@CordovaProperty() ColombiaIdBackRecognizer: ColombiaIdBackRecognizerCtor;
|
||||
@@ -2812,9 +2790,6 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() DocumentFaceRecognizerResult: DocumentFaceRecognizerResultCtor;
|
||||
@CordovaProperty() EgyptIdFrontRecognizerResult: EgyptIdFrontRecognizerResultCtor;
|
||||
@CordovaProperty() EgyptIdFrontRecognizer: EgyptIdFrontRecognizerCtor;
|
||||
@CordovaProperty() ElitePaymentCardBackRecognizerResult: ElitePaymentCardBackRecognizerResultCtor;
|
||||
@CordovaProperty() ElitePaymentCardCombinedRecognizerResult: ElitePaymentCardCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() ElitePaymentCardFrontRecognizerResult: ElitePaymentCardFrontRecognizerResultCtor;
|
||||
@CordovaProperty() EudlRecognizerResult: EudlRecognizerResultCtor;
|
||||
@CordovaProperty() GermanyCombinedRecognizerResult: GermanyCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() GermanyCombinedRecognizer: GermanyCombinedRecognizerCtor;
|
||||
@@ -2868,12 +2843,6 @@ export class BlinkId extends IonicNativePlugin {
|
||||
@CordovaProperty() MyKadFrontRecognizer: MyKadFrontRecognizerCtor;
|
||||
@CordovaProperty() NewZealandDlFrontRecognizerResult: NewZealandDlFrontRecognizerResultCtor;
|
||||
@CordovaProperty() NewZealandDlFrontRecognizer: NewZealandDlFrontRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardBackRecognizerResult: PaymentCardBackRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardBackRecognizer: PaymentCardBackRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardCombinedRecognizerResult: PaymentCardCombinedRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardCombinedRecognizer: PaymentCardCombinedRecognizerCtor;
|
||||
@CordovaProperty() PaymentCardFrontRecognizerResult: PaymentCardFrontRecognizerResultCtor;
|
||||
@CordovaProperty() PaymentCardFrontRecognizer: PaymentCardFrontRecognizerCtor;
|
||||
@CordovaProperty() Pdf417RecognizerResult: Pdf417RecognizerResultCtor;
|
||||
@CordovaProperty() Pdf417Recognizer: Pdf417RecognizerCtor;
|
||||
@CordovaProperty() PolandCombinedRecognizerResult: PolandCombinedRecognizerResultCtor;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,11 +211,11 @@ export class Camera extends IonicNativePlugin {
|
||||
* Convenience constant
|
||||
*/
|
||||
PictureSourceType = {
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
||||
PHOTOLIBRARY: 0,
|
||||
/** Take picture from camera */
|
||||
CAMERA: 1,
|
||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||
SAVEDPHOTOALBUM: 2
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export class Chooser extends IonicNativePlugin {
|
||||
* base64-encoded data: URI, MIME type, display name, and original URI.
|
||||
*/
|
||||
@Cordova()
|
||||
getFile(accept: string): Promise<ChooserResult | undefined> {
|
||||
getFile(accept?: string): Promise<ChooserResult | undefined> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export class FirebaseCrashlytics extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
initialize(): void {
|
||||
initialise(): any {
|
||||
return; // We add return; here to avoid any IDE / Compiler errors
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,41 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface IFirebaseMessage {
|
||||
aps: any;
|
||||
gcm: any;
|
||||
export interface IFirebaseGCMMessage {
|
||||
gcm: {
|
||||
body: string;
|
||||
title: string;
|
||||
sound: string;
|
||||
icon: string;
|
||||
tag: string;
|
||||
color: string;
|
||||
clickAction: string;
|
||||
};
|
||||
'google.message_id': string;
|
||||
'google.sent_time': number;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface IFirebaseAPSMessage {
|
||||
aps: {
|
||||
alert: {
|
||||
title: string;
|
||||
body: string;
|
||||
};
|
||||
badge?: number;
|
||||
};
|
||||
'gcm.message_id': 'string';
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type IFirebaseMessage = IFirebaseAPSMessage | IFirebaseGCMMessage;
|
||||
|
||||
export interface IRequestPermissionOptions {
|
||||
forceShow?: boolean;
|
||||
}
|
||||
|
||||
export type FirebaseMessagingTokenType = 'apns-buffer' | 'apns-string';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Firebase Messaging
|
||||
@@ -36,7 +66,7 @@ export interface IFirebaseMessage {
|
||||
plugin: 'cordova-plugin-firebase-messaging',
|
||||
pluginRef: 'cordova.plugins.firebase.messaging',
|
||||
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-messaging',
|
||||
platforms: ['Android', 'iOS']
|
||||
platforms: ['Android', 'iOS'],
|
||||
})
|
||||
@Injectable()
|
||||
export class FirebaseMessaging extends IonicNativePlugin {
|
||||
@@ -61,22 +91,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;
|
||||
}
|
||||
}
|
||||
@@ -343,6 +343,9 @@ export class Firebase extends IonicNativePlugin {
|
||||
* Clear all pending notifications from the drawer
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android']
|
||||
})
|
||||
clearAllNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
94
src/@ionic-native/plugins/foreground-service/index.ts
Normal file
94
src/@ionic-native/plugins/foreground-service/index.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Foreground Service
|
||||
* @description
|
||||
* This plugin allows for android devices to continue running services in the background, using a
|
||||
* foreground ongoing notification. This is targeted towards use with plugins such as
|
||||
* 'cordova-geolocation' that will not run while the app is in the background on android API 26+.
|
||||
*
|
||||
* For android API 28+, the following xml snippet should be inserted into ```config.xml```:
|
||||
*
|
||||
* ```
|
||||
* ...
|
||||
* <platform name="android">
|
||||
* <config-file parent="/*" target="AndroidManifest.xml">
|
||||
* <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
* </config-file>
|
||||
* ...
|
||||
* ```
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ForegroundService } from '@ionic-native/foreground-service/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(public foregroundService: ForegroundService) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* startService() {
|
||||
* // Notification importance is optional, the default is 1 - Low (no sound or vibration)
|
||||
* this.foregroundService.start('GPS Running', 'Background Service', 'drawable/fsicon');
|
||||
* }
|
||||
*
|
||||
* stopService() {
|
||||
* // Disable the foreground service
|
||||
* this.foregroundService.stop();
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ForegroundService',
|
||||
plugin: 'cordova-plugin-foreground-service',
|
||||
pluginRef: 'cordova.plugins.foregroundService',
|
||||
repo: 'https://github.com/DavidBriglio/cordova-plugin-foreground-service',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class ForegroundService extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Enables the foreground service
|
||||
*
|
||||
* @param {string} title (content title) A brief headline for the notification
|
||||
* @param {string} text (content text) Supporting information
|
||||
* @param {string} icon The drawable icon can be any drawable image that exists in the resource folder. This means you must copy the icon you want to use into the platforms/android/app/src/main/res/drawable folder set. If no icon can be found using the icon name parameter, a default star icon will be used.
|
||||
*
|
||||
* For an example, if the `fsicon.png` (see xml below) resides here: ```src/assets/icon/fsicon.png```. Then ```icon``` parameter value would be ```'drawable/fsicon'```. In order for this example to work, the following xml snippet must be in ```config.xml```.
|
||||
*
|
||||
* ```
|
||||
* <platform name="android">
|
||||
* <resource-file src="www/assets/icon/fsicon.png" target="app/src/main/res/drawable/fsicon.png" />
|
||||
* ...
|
||||
* ```
|
||||
* @param {number} importance Notification importance dictates how the notification is initially presented:
|
||||
*
|
||||
* Value | Importance | Description | Examples
|
||||
* --- | --- | --- | ---
|
||||
* 1|IMPORTANCE_LOW|Does not make a sound or heads-up display (plugin's default)|New content the user has subscribed to, social network invitations
|
||||
* 2|IMPORTANCE_DEFAULT|Makes a sound, but no heads-up display|Traffic alerts, task reminders
|
||||
* 3|IMPORTANCE_HIGH|Makes a sound and heads-up display|Text messages, alarms, phone calls
|
||||
*
|
||||
* @param {number} id The notification id is a customizable integer that is used to reference the notification that will be launched. This is customizable to avoid conflicting with any other notifications. If this is not included, a [*unique*] default id will be used.
|
||||
*
|
||||
* @see https://material.io/design/platform-guidance/android-notifications.html
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
start(title: string, text: string, icon?: string, importance: 1 | 2 | 3 = 1, id = 0): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the foreground service
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
stop(): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
61
src/@ionic-native/plugins/full-screen-image/index.ts
Normal file
61
src/@ionic-native/plugins/full-screen-image/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Full Screen Image
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FullScreenImage } from '@ionic-native/full-screen-image';
|
||||
*
|
||||
*
|
||||
* constructor(private fullScreenImage: FullScreenImage) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fullScreenImage.showImageURL('/assets/...')
|
||||
* .then((data: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.fullScreenImage.showImageBase64('iVBORw0KGgoAAAANSUhEUgAAA...')
|
||||
* .then((data: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FullScreenImage',
|
||||
plugin: 'es.keensoft.fullscreenimage',
|
||||
pluginRef: 'FullScreenImage',
|
||||
repo: 'https://github.com/keensoft/FullScreenImage-Cordova-Plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class FullScreenImage extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Opens an image from a URL or path
|
||||
* @param url {string} url or image path
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showImageURL(url: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an image from a base64 string
|
||||
* @param base64String {string} base64 string
|
||||
* @param name? {string} image name
|
||||
* @param type? {string} image extension
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showImageBase64(base64String: string, name?: string, type?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -90,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
|
||||
@@ -133,11 +167,19 @@ 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);
|
||||
* console.log('Player score', data);
|
||||
* });
|
||||
*
|
||||
* // Show the native leaderboards window.
|
||||
@@ -152,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.
|
||||
@@ -234,6 +287,20 @@ 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.
|
||||
@@ -277,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,12 +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;
|
||||
}
|
||||
|
||||
@@ -304,8 +304,9 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values
|
||||
* @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value
|
||||
* @param options.headers {Object} headers object (key value pair), will be merged with global values
|
||||
* @param options.filePath {string} filePath to be used during upload and download see uploadFile and downloadFile for detailed information
|
||||
* @param options.name {string} name to be used during upload see uploadFile for detailed information
|
||||
* @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information
|
||||
* @param options.name {string} name(s) to be used during upload see uploadFile for detailed information
|
||||
* @param options.responseType {string} response type, defaults to text
|
||||
*
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@@ -319,8 +320,9 @@ export class HTTP extends IonicNativePlugin {
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8';
|
||||
timeout?: number;
|
||||
headers?: { [index: string]: string };
|
||||
filePath?: string;
|
||||
name?: 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. */
|
||||
@@ -180,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,75 +1,6 @@
|
||||
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;
|
||||
@@ -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',
|
||||
@@ -238,6 +587,13 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
@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;
|
||||
|
||||
@@ -349,6 +705,8 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
DOWNLOADED: string;
|
||||
|
||||
|
||||
/* validation error codes */
|
||||
|
||||
@CordovaProperty()
|
||||
INVALID_PAYLOAD: number;
|
||||
|
||||
@@ -358,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: {
|
||||
@@ -394,7 +761,7 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
* @param product {IAPProductOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
register(product: IAPProductOptions): void {}
|
||||
register(product: IAPProductOptions | IAPProductOptions[]): void {}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -428,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;
|
||||
@@ -435,11 +825,49 @@ export class InAppPurchase2 extends IonicNativePlugin {
|
||||
|
||||
@Cordova()
|
||||
ready(callback: Function): void { return; }
|
||||
|
||||
/**
|
||||
* After you're done registering your store's product and events handlers,
|
||||
* time to call `store.refresh()`.
|
||||
*
|
||||
* This will initiate all the complex behind-the-scene work, to load product
|
||||
* data from the servers and restore whatever already have been
|
||||
* purchased by the user.
|
||||
*
|
||||
* Note that you can call this method again later during the application
|
||||
* execution to re-trigger all that hard-work. It's kind of expensive in term of
|
||||
* processing, so you'd better consider it twice.
|
||||
*
|
||||
* One good way of doing it is to add a "Refresh Purchases" button in your
|
||||
* applications settings. This way, if delivery of a purchase failed or
|
||||
* if a user wants to restore purchases he made from another device, he'll
|
||||
* have a way to do just that.
|
||||
*
|
||||
* **example usage**
|
||||
*
|
||||
* ```typescript
|
||||
* // ...
|
||||
* // register products and events handlers here
|
||||
* // ...
|
||||
* //
|
||||
* // then and only then, call refresh.
|
||||
* this.store.refresh();
|
||||
* ```
|
||||
*
|
||||
* **restore purchases**
|
||||
*
|
||||
* Add a "Refresh Purchases" button to call the `store.refresh()` method, like:
|
||||
*
|
||||
* `<button onclick="<pseudo_code>this.store.refresh()</pseudo_code>">Restore Purchases</button>`
|
||||
*
|
||||
* To make the restore purchases work as expected, please make sure that
|
||||
* the "approved" event listener had be registered properly,
|
||||
* and in the callback `product.finish()` should be called.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
refresh(): void {
|
||||
}
|
||||
|
||||
/** Opens the Manage Subscription page (AppStore, Play, Microsoft, ...). */
|
||||
@Cordova({ sync: true })
|
||||
manageSubscriptions(): void {}
|
||||
|
||||
|
||||
@@ -61,6 +61,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
logout(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param secureHash {string}
|
||||
@@ -141,6 +150,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
displayHelpCenter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise
|
||||
@@ -188,4 +206,15 @@ export class Intercom extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param token {string}
|
||||
* @return {Promise<any>} Returns a promise
|
||||
*/
|
||||
@Cordova()
|
||||
sendPushTokenToIntercom(token: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, IonicNativePlugin, CordovaProperty, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export enum KeyboardStyle {
|
||||
Light = 'light',
|
||||
Dark = 'dark'
|
||||
}
|
||||
|
||||
export enum KeyboardResizeMode {
|
||||
Native = 'native',
|
||||
Ionic = 'ionic',
|
||||
Body = 'body',
|
||||
None = 'none'
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name Keyboard
|
||||
* @description
|
||||
@@ -43,7 +56,10 @@ export class Keyboard extends IonicNativePlugin {
|
||||
* Hide the keyboard accessory bar with the next, previous and done buttons.
|
||||
* @param hide {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
hideFormAccessoryBar(hide: boolean): void {}
|
||||
|
||||
/**
|
||||
@@ -72,7 +88,27 @@ export class Keyboard extends IonicNativePlugin {
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
setResizeMode(mode: string): void {}
|
||||
setResizeMode(mode: KeyboardResizeMode): void {}
|
||||
|
||||
/**
|
||||
* Programatically set Keyboard style
|
||||
* @param mode {string}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
setKeyboardStyle(style: KeyboardStyle): void {}
|
||||
|
||||
/**
|
||||
* Programatically enable or disable the WebView scroll
|
||||
* @param mode {string}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
disableScroll(disable: boolean): void {}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
|
||||
@@ -100,6 +136,19 @@ export class Keyboard extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard did show. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'keyboardDidShow',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
onKeyboardDidShow(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
@@ -125,4 +174,17 @@ export class Keyboard extends IonicNativePlugin {
|
||||
onKeyboardWillHide(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an observable that notifies you when the keyboard did hide. Unsubscribe to observable to cancel event watch.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'keyboardDidHide',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
onKeyboardDidHide(): Observable<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ import { Observable } from 'rxjs';
|
||||
*
|
||||
* ```typescript
|
||||
* this.purchases.getEntitlements()
|
||||
* .subscribe(entitlements => )
|
||||
* .subscribe(entitlements => ,
|
||||
* error => );
|
||||
* ```
|
||||
*
|
||||
@@ -67,7 +67,7 @@ import { Observable } from 'rxjs';
|
||||
* // Unlock content
|
||||
* }
|
||||
* },
|
||||
* error => // Error making purchase. You can check error.userCancelled to check if user cancelled the purchase
|
||||
* ({ error, userCancelled }) => // Error making purchase. You can check error.userCancelled to check if user cancelled the purchase
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
@@ -271,7 +271,7 @@ export class Purchases extends IonicNativePlugin {
|
||||
* @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. error.usercancelled will be true if user cancelled
|
||||
* @return {Observable<MakePurchaseResponse>} An [RCError] is thrown when user cancels. On error `usercancelled` will be true if user cancelled
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
@@ -413,7 +413,6 @@ export interface RCMakePurchaseResponse {
|
||||
|
||||
export interface RCError {
|
||||
code: number;
|
||||
domain: string;
|
||||
message: string;
|
||||
userCancelled?: string;
|
||||
underlyingErrorMessage?: string;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
* @beta
|
||||
* @name Rollbar
|
||||
* @description
|
||||
* This plugin adds Rollbar App monitoring to your application
|
||||
* This plugin adds [Rollbar](https://rollbar.com/) App monitoring to your application
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
@@ -82,7 +82,8 @@ export class ScreenOrientation extends IonicNativePlugin {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'orientationchange'
|
||||
event: 'orientationchange',
|
||||
element: 'window'
|
||||
})
|
||||
onChange(): Observable<void> {
|
||||
return;
|
||||
|
||||
@@ -124,9 +124,9 @@ export class SecureStorageObject {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SecureStorage',
|
||||
plugin: 'cordova-plugin-secure-storage',
|
||||
plugin: 'cordova-plugin-secure-storage-echo',
|
||||
pluginRef: 'cordova.plugins.SecureStorage',
|
||||
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
|
||||
repo: 'https://github.com/mibrito707/cordova-plugin-secure-storage-echo',
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
249
src/@ionic-native/plugins/smartlook/index.ts
Normal file
249
src/@ionic-native/plugins/smartlook/index.ts
Normal file
@@ -0,0 +1,249 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export class SmartlookSetupConfig {
|
||||
private smartlookAPIKey: string;
|
||||
private fps: number;
|
||||
|
||||
constructor(smartlookAPIKey: string, fps?: number) {
|
||||
this.smartlookAPIKey = smartlookAPIKey;
|
||||
this.fps = fps;
|
||||
}
|
||||
}
|
||||
|
||||
export class SmartlookUserIdentifier {
|
||||
private identifier: string;
|
||||
private sessionProperties: {};
|
||||
|
||||
constructor(identifier: string, sessionProperties?: {}) {
|
||||
this.identifier = identifier;
|
||||
this.sessionProperties = sessionProperties;
|
||||
}
|
||||
}
|
||||
|
||||
export class SmartlookCustomEvent {
|
||||
private name: string;
|
||||
private eventProperties: {};
|
||||
|
||||
constructor(name: string, eventProperties?: {}) {
|
||||
this.name = name;
|
||||
this.eventProperties = eventProperties;
|
||||
}
|
||||
}
|
||||
|
||||
export class SmartlookGlobalEventProperties {
|
||||
private globalEventProperties: {};
|
||||
private immutable: boolean;
|
||||
|
||||
constructor(globalEventProperties: {}, immutable: boolean) {
|
||||
this.globalEventProperties = globalEventProperties;
|
||||
this.immutable = immutable;
|
||||
}
|
||||
}
|
||||
|
||||
export class SmartlookGlobalEventProperty {
|
||||
private key: string;
|
||||
private value: string;
|
||||
private immutable: boolean;
|
||||
|
||||
constructor(key: string, value: string, immutable: boolean) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.immutable = immutable;
|
||||
}
|
||||
}
|
||||
|
||||
export class SmartlookGlobalEventPropertyKey {
|
||||
private key: string;
|
||||
|
||||
constructor(key: string) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Smartlook
|
||||
* @description
|
||||
* Official Smartlook SDK plugin. For more information visit (www.smartlook.com).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Smartlook } from '@ionic-native/smartlook/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private smartlook: Smartlook) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.smartlook.setupAndStartRecording(new SmartlookSetupConfig("key"));
|
||||
*
|
||||
* ```
|
||||
* @classes
|
||||
* SmartlookSetupConfig
|
||||
* SmartlookUserIdentifier
|
||||
* SmartlookCustomEvent
|
||||
* SmartlookGlobalEventProperties
|
||||
* SmartlookGlobalEventProperty
|
||||
* SmartlookGlobalEventPropertyKey
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Smartlook',
|
||||
plugin: 'https://github.com/smartlook/cordova-smartlook.git',
|
||||
pluginRef: 'cordova.plugins.SmartlookPlugin',
|
||||
repo: 'https://github.com/smartlook/cordova-smartlook.git',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class Smartlook extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Setup and start Smartlook SDK recording.
|
||||
* @param config SmartlookSetupConfig object.
|
||||
* @param config.smartlookAPIKey (required) Smartlook API key (you can obtain it in your dashboard).
|
||||
* @param config.fps (optional) recorded video framerate (allowed values 2-10 fps).
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setupAndStartRecording(config: SmartlookSetupConfig): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup/initialize Smartlook SDK. This method DOESN'T start the recording (@see start())
|
||||
* @param config SmartlookSetupConfig object.
|
||||
* @param config.smartlookAPIKey (required) Smartlook API key (you can obtain it in your dashboard).
|
||||
* @param config.fps (optional) recorded video framerate (allowed values 2-10 fps).
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setup(config: SmartlookSetupConfig): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start SDK recording.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
startRecording(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop SDK recording. Recording will start again when you call start().
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
stopRecording(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if SDK is currently recording.
|
||||
* @return {Promise<boolean>} Returns a promise with isRecording boolean.
|
||||
*/
|
||||
@Cordova()
|
||||
isRecording(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* When you start sensitive mode SDK records blank videos (single color) but SDK still sends analytic events.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
startFullscreenSensitiveMode(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop sensitive mode -> SDK records video.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
stopFullscreenSensitiveMode(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if fullscreen sensitive mode is active.
|
||||
* @return {Promise<boolean>} Returns a promise with isFullscreenSensitiveModeActive boolean.
|
||||
*/
|
||||
@Cordova()
|
||||
isFullscreenSensitiveModeActive(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify user.
|
||||
* @param identifier SmartlookUserIdentifier object.
|
||||
* @param identifier.idenfier (required) id that can be used to identify user and his records.
|
||||
* You will see this Id in Smartlook dashboard so you can pair records with concrete user.
|
||||
* @param identifier.sessionProperties (optional) custom session properties object.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setUserIdentifier(identifier: SmartlookUserIdentifier): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Track custom event.
|
||||
* @param event SmartlookCustomEvent object.
|
||||
* @param event.name (required) string used to identify event.
|
||||
* @param event.eventProperties (optional) event properties object.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
trackCustomEvent(event: SmartlookCustomEvent): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Track custom event.
|
||||
* @param timedEvent SmartlookCustomEvent object.
|
||||
* @param timedEvent.name (required) string used to identify timed event.
|
||||
* @param timedEvent.eventProperties (optional) timed event properties object. These properties will
|
||||
* be merged with properties of tracked event (with lower priority).
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
startTimedCustomEvent(timedEvent: SmartlookCustomEvent): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set global event properties that will be added to every tracked event.
|
||||
* @param properties SmartlookGlobalEventProperties object.
|
||||
* @param properties.globalEventProperties (required) global event properties object.
|
||||
* @param properties.immutable (required) If set to TRUE these properties have higher priority
|
||||
* than mutable ones and also they cannot be changed (only removed).
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setGlobalEventProperties(properties: SmartlookGlobalEventProperties): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if SDK is currently recording.
|
||||
* @param property SmartlookGlobalEventProperty object.
|
||||
* @param property.key global property key.
|
||||
* @param property.value global property value.
|
||||
* @param property.immutable (required) If set to TRUE these properties have higher priority
|
||||
* than mutable ones and also they cannot be changed (only removed).
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setGlobalEventProperty(property: SmartlookGlobalEventProperty): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove property from global event properties.
|
||||
* @param property SmartlookGlobalEventPropertyKey object.
|
||||
* @param property.key global property key.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeGlobalEventProperty(property: SmartlookGlobalEventPropertyKey): void {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all properties from global event properties.
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeAllGlobalEventProperties(): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
56
src/@ionic-native/plugins/sms-retriever/index.ts
Normal file
56
src/@ionic-native/plugins/sms-retriever/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Sms Retriever
|
||||
* @description
|
||||
* This plugin retrives the SMS which arrive without requiring READ permissions.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { SmsRetriever } from '@ionic-native/sms-retriever';
|
||||
*
|
||||
*
|
||||
* constructor(private smsRetriever: SmsRetriever) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.smsRetriever.getAppHash()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
* this.smsRetriever.startWatching()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SmsRetriever',
|
||||
plugin: 'cordova-plugin-sms-retriever-manager',
|
||||
pluginRef: 'cordova.plugins.smsRetriever',
|
||||
repo: 'https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master',
|
||||
install: 'ionic cordova plugin add cordova-plugin-sms-retriever-manager --variable PLAY_SERVICES_VERSION="15.0.1"',
|
||||
installVariables: ['PLAY_SERVICES_VERSION'],
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class SmsRetriever extends IonicNativePlugin {
|
||||
/**
|
||||
* This function start wathching message arrive event and retrive message text.
|
||||
* @return {Promise<string>} Returns a promise that resolves when retrives SMS text or TIMEOUT after 5 min.
|
||||
*/
|
||||
@Cordova()
|
||||
startWatching(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to get hash string of APP.
|
||||
* @return {Promise<string>} Returns a promise that resolves when successfully generate hash of APP.
|
||||
*/
|
||||
@Cordova()
|
||||
getAppHash(): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
139
src/@ionic-native/plugins/spotify-auth/index.ts
Normal file
139
src/@ionic-native/plugins/spotify-auth/index.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* OAuth configuration data.
|
||||
*/
|
||||
export interface Config {
|
||||
/** The client ID as per the Spotify dev console. */
|
||||
clientId: string;
|
||||
|
||||
/** The redirect URI as entered in the Spotify dev console. */
|
||||
redirectUrl: string;
|
||||
|
||||
/**
|
||||
* Safety margin time (in milliseconds) for the token refresh.
|
||||
*
|
||||
* The plugin applies a safety margin to the token lifetime in order
|
||||
* to give the token user enough time to perform all operations needed.
|
||||
*
|
||||
* Otherwise the plugin might hand out a token that is already expired
|
||||
* before it could ever be used.
|
||||
*
|
||||
* The safety margin defaults to 30s.
|
||||
*/
|
||||
refreshSafetyMargin?: number;
|
||||
|
||||
/** Requested OAuth scopes. */
|
||||
scopes: string[];
|
||||
|
||||
/** The token exchange URL. */
|
||||
tokenExchangeUrl: string;
|
||||
|
||||
/** The token refresh URL. */
|
||||
tokenRefreshUrl: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The authorization data.
|
||||
*/
|
||||
export interface AuthorizationData {
|
||||
/** A valid access token. */
|
||||
accessToken: string;
|
||||
|
||||
/** The encrypted refresh token. */
|
||||
encryptedRefreshToken: string;
|
||||
|
||||
/** The date (from UTC, in milliseconds) when the given access token expires. */
|
||||
expiresAt: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Spotify Auth
|
||||
* @description
|
||||
* Cordova plugin for authenticating with Spotify
|
||||
* > https://github.com/Festify/cordova-spotify-oauth
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { SpotifyAuth } from '@ionic-native/spotify-auth';
|
||||
*
|
||||
* // [...]
|
||||
*
|
||||
* constructor(private spotifyAuth: SpotifyAuth) { }
|
||||
*
|
||||
* // [...]
|
||||
*
|
||||
* const config = {
|
||||
* clientId: "<SPOTIFY CLIENT ID>",
|
||||
* redirectUrl: "<REDIRECT URL, MUST MATCH WITH AUTH ENDPOINT AND SPOTIFY DEV CONSOLE>",
|
||||
* scopes: ["streaming"], // see Spotify Dev console for all scopes
|
||||
* tokenExchangeUrl: "<URL OF TOKEN EXCHANGE HTTP ENDPOINT>",
|
||||
* tokenRefreshUrl: "<URL OF TOKEN REFRESH HTTP ENDPOINT>",
|
||||
* };
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.spotifyAuth.authorize(config)
|
||||
* .then(({ accessToken, expiresAt }) => {
|
||||
* console.log(`Got an access token, its ${accessToken}!`);
|
||||
* console.log(`Its going to expire in ${expiresAt - Date.now()}ms.`);
|
||||
* });
|
||||
*
|
||||
* // [...]
|
||||
*
|
||||
* this.spotifyAuth.forget().then(() => console.log("We're logged out!"));
|
||||
*
|
||||
* // [...]
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SpotifyAuth',
|
||||
plugin: 'cordova-spotify-oauth',
|
||||
pluginRef: 'cordova.plugins.spotifyAuth',
|
||||
repo: 'https://github.com/Festify/cordova-spotify-oauth',
|
||||
install: 'ionic cordova plugin add cordova-spotify-oauth --variable LOCAL_STORAGE_KEY="SpotifyOAuthData"',
|
||||
installVariables: ['LOCAL_STORAGE_KEY'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class SpotifyAuth extends IonicNativePlugin {
|
||||
/**
|
||||
* Obtains valid authorization data.
|
||||
*
|
||||
* This method performs the necessary steps in order to obtain a valid
|
||||
* access token. It performs the OAuth dance prompting the user to log in,
|
||||
* exchanges the obtained authorization code for an access and a refresh
|
||||
* token, caches those, and returns both to the developer.
|
||||
*
|
||||
* When it is invoked again, it will first check whether the cached access
|
||||
* token is still valid (including a configurable safety margin) and the
|
||||
* scopes equal, and return the token directly if that is the case. Otherwise,
|
||||
* the method will transparently refresh the token (or obtain a new one if
|
||||
* the scopes changed) and return that.
|
||||
*
|
||||
* Bottom line - always call this if you need a valid access token in your code.
|
||||
*
|
||||
* @param cfg {Config} configuration
|
||||
* @return {Promise<AuthorizationData>}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: false
|
||||
})
|
||||
authorize(cfg: Config): Promise<AuthorizationData> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all cached data so that `authorize` performs the full
|
||||
* oauth dance again.
|
||||
*
|
||||
* This is akin to a "logout".
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
forget(): void { }
|
||||
}
|
||||
74
src/@ionic-native/plugins/ssh-connect/index.ts
Normal file
74
src/@ionic-native/plugins/ssh-connect/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name SSH Connect
|
||||
* @description
|
||||
* Cordova plugin to make connections and execute commands through SSH
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { SSHConnect } from '@ionic-native/ssh-connect/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private sshConnect: SSHConnect) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.sshConnect.connect('user', 'password', 'host', port)
|
||||
* .then(resp => console.log(resp))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* this.sshConnect.executeCommand('command')
|
||||
* .then(resp => console.log(resp))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* this.sshConnect.disconnect()
|
||||
* .then(resp => console.log(resp))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SSHConnect',
|
||||
plugin: 'cordova-plugin-ssh-connect',
|
||||
pluginRef: 'cordova.plugins.sshConnect',
|
||||
repo: 'https://github.com/JosePerez27/cordova-plugin-ssh-connect',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class SSHConnect extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Establish a remote ssh connection
|
||||
* @param {user} user The remote host user
|
||||
* @param {password} password The remote host password
|
||||
* @param {host} host The remote device to connect
|
||||
* @param {port} port The SSH port for connection (usually port 22)
|
||||
* @return {Promise<any>} Returns an promise that resolves with the success of the connection
|
||||
*/
|
||||
@Cordova()
|
||||
connect(user: string, password: string, host: string, port: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a command on the remote host connected by ssh
|
||||
* @param {command} command The command to execute
|
||||
* @return {Promise<any>} Returns an promise that resolves with the printed text on the remote console
|
||||
*/
|
||||
@Cordova()
|
||||
executeCommand(command: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the SSH session
|
||||
* @return {Promise<any>} Returns an promise that resolves with the success of the disconnection
|
||||
*/
|
||||
@Cordova()
|
||||
disconnect(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
192
src/@ionic-native/plugins/sum-up/index.ts
Normal file
192
src/@ionic-native/plugins/sum-up/index.ts
Normal file
@@ -0,0 +1,192 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface SumUpResponse {
|
||||
// Code to identify the message
|
||||
code: number;
|
||||
|
||||
// Message for readable usage
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface SumUpLoginStatus {
|
||||
// Code, to check if an error occured
|
||||
code: number;
|
||||
|
||||
// Booleand value whether the user is logged in or not
|
||||
isLoggedIn: boolean;
|
||||
}
|
||||
|
||||
export interface SumUpPayment {
|
||||
// Unique transaction code
|
||||
transaction_code: string;
|
||||
|
||||
// Card type -> like MAESTRO
|
||||
card_type: string;
|
||||
|
||||
// Merchant code for identification
|
||||
merchant_code: string;
|
||||
|
||||
// Amount of the payment
|
||||
amount: number;
|
||||
|
||||
// Tip amount -> default 0
|
||||
tip_amount: number;
|
||||
|
||||
// Vat amount -> default 0
|
||||
vat_amount: number;
|
||||
|
||||
// Currency code -> like EUR
|
||||
currency: string;
|
||||
|
||||
// Payment status -> successful or error
|
||||
status: string;
|
||||
|
||||
// Type -> Card or nfc
|
||||
payment_type: string;
|
||||
|
||||
// Entry mode -> Like chip or contactless
|
||||
entry_mode: string;
|
||||
|
||||
// Number of installments -> default 1
|
||||
installments: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name SumUp
|
||||
* @description
|
||||
* Plugin to communicate with a SumUp payment terminal
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { SumUp } from '@ionic-native/sum-up';
|
||||
*
|
||||
*
|
||||
* constructor(private sumUp: SumUp) { }
|
||||
*
|
||||
* this.sumUp.login("ACCESS_TOKEN")
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.auth("ACCESS_TOKEN")
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.getSettings()
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.logout()
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.isLoggedIn()
|
||||
* .then((res: SumUpLoginStatus) => console.log(res))
|
||||
* .catch((error: SumUpLoginStatus) => console.error(error));
|
||||
*
|
||||
* this.sumUp.prepare()
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.closeConnection()
|
||||
* .then((res: SumUpResponse) => console.log(res))
|
||||
* .catch((error: SumUpResponse) => console.error(error));
|
||||
*
|
||||
* this.sumUp.pay(10.0, "EUR")
|
||||
* .then((res: SumUpPayment) => console.log(res))
|
||||
* .catch((error: SumUpPayment) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'SumUp',
|
||||
plugin: 'cordova-sumup-plugin',
|
||||
pluginRef: 'window.SumUp',
|
||||
repo: 'https://github.com/mariusbackes/cordova-plugin-sumup',
|
||||
install:
|
||||
'cordova plugin add cordova-sumup-plugin --variable SUMUP_API_KEY=INSERT_YOUR_KEY',
|
||||
installVariables: ['SUMUP_API_KEY'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class SumUp extends IonicNativePlugin {
|
||||
/**
|
||||
* Login a user with an optional access token.
|
||||
* If the access token is provided and valid, the user is logged in autmatically.
|
||||
* Otherwise the user has to type in the credentials
|
||||
* @param accessToken {string}
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
login(accessToken?: string): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticates the account with the given access token. Parameter accessToken is required.
|
||||
* @param accessToken {string}
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
auth(accessToken: string): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new window with the all account settings of an logged in user.
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
getSettings(): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout a user from the account.
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
logout(): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user is logged in or not and returns an object with the field isLoggedIn which is a boolean value.
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
isLoggedIn(): Promise<SumUpLoginStatus> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the terminal for a payment. Checks whether the CardReader is ready to transmit and
|
||||
* if an instance of the CardReaderManager is available.
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
prepare(): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to close the connection to the card terminal.
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
closeConnection(): Promise<SumUpResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a native SumUp window to proceed a payment. Parameter amount and currencycode are required.
|
||||
* If the Payment was successful it returns an SumUpPayment object with information about the payment.
|
||||
* @param amount {number}
|
||||
* @param currencycode {string}
|
||||
* @return {Promise<SumUpResponse>} Return a SumUpResponse object
|
||||
*/
|
||||
@Cordova()
|
||||
pay(amount: number, currencycode: string): Promise<SumUpPayment> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
72
src/@ionic-native/plugins/theme-detection/index.ts
Normal file
72
src/@ionic-native/plugins/theme-detection/index.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface ThemeDetectionResponse {
|
||||
// Boolean value about the status of the request
|
||||
value: boolean;
|
||||
|
||||
// Message for readable usage
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Theme Detection
|
||||
* @description
|
||||
* Cordova plugin to detect whether dark mode is enabled or not
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ThemeDetection } from '@ionic-native/theme-detection';
|
||||
*
|
||||
*
|
||||
* constructor(private themeDetection: ThemeDetection) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.themeDetection.isAvailable()
|
||||
* .then((res: ThemeDetectionResponse) => {
|
||||
* if(res.value) {
|
||||
* this.themeDetection.isDarkModeEnabled().then((res: ThemeDetectionResponse) => {
|
||||
* console.log(res);
|
||||
* })
|
||||
* .catch((error: any) => console.error(error));
|
||||
* }
|
||||
* })
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ThemeDetection',
|
||||
plugin: 'cordova-plugin-theme-detection',
|
||||
pluginRef: 'cordova.plugins.ThemeDetection',
|
||||
repo: 'https://github.com/mariusbackes/cordova-plugin-theme-detection',
|
||||
install: 'cordova plugin add cordova-plugin-theme-detection',
|
||||
installVariables: [],
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class ThemeDetection extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<ThemeDetectionResponse>}
|
||||
* Returns a promise with an object that has a boolean property which gives information if the detection is available or not
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<ThemeDetectionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<ThemeDetectionResponse>}
|
||||
* Returns a promise with an object that has a boolean property which gives information if dark mode is enabled or not
|
||||
*/
|
||||
@Cordova()
|
||||
isDarkModeEnabled(): Promise<ThemeDetectionResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
1211
src/@ionic-native/plugins/unvired-cordova-sdk/index.ts
Normal file
1211
src/@ionic-native/plugins/unvired-cordova-sdk/index.ts
Normal file
File diff suppressed because it is too large
Load Diff
819
src/@ionic-native/plugins/urbanairship/index.ts
Normal file
819
src/@ionic-native/plugins/urbanairship/index.ts
Normal file
@@ -0,0 +1,819 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface TagGroupEditor {
|
||||
addTags(): void;
|
||||
removeTags(): void;
|
||||
apply(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for notification types.
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
export enum NotificationType {
|
||||
none = 0,
|
||||
badge = 1,
|
||||
sound = 2,
|
||||
alert = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for presentation options.
|
||||
* @readonly
|
||||
* @enum {number}
|
||||
*/
|
||||
export enum PresentationOptions {
|
||||
none = 0,
|
||||
badge = 1,
|
||||
sound = 2,
|
||||
alert = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* @name UrbanAirShip
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { UrbanAirShip } from '@ionic-native/urbanairship/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private urbanAirShip: UrbanAirShip) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.urbanAirShip.takeOff(config)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'UrbanAirShip',
|
||||
plugin: 'urbanairship-cordova',
|
||||
pluginRef: 'window.UAirship',
|
||||
repo: 'https://www.npmjs.com/package/urbanairship-cordova',
|
||||
install: 'ionic cordova plugin add urbanairship-cordova',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class UrbanAirShip extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Re-attaches document event listeners in this webview
|
||||
*/
|
||||
@Cordova()
|
||||
reattach(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initailizes Urban Airship.
|
||||
*
|
||||
* The plugin will automatically call takeOff during the next app init in
|
||||
* order to properly handle incoming push. If takeOff is called multiple times
|
||||
* in a session, or if the config is different than the previous sesssion, the
|
||||
* new config will not be used until the next app start.
|
||||
*
|
||||
* @param {object} config The Urban Airship config.
|
||||
* @param {object} config.development The Urban Airship development config.
|
||||
* @param {string} config.development.appKey The development appKey.
|
||||
* @param {string} config.development.appSecret The development appSecret.
|
||||
* @param {object} config.production The Urban Airship production config.
|
||||
* @param {string} config.production.appKey The production appKey.
|
||||
* @param {string} config.production.appSecret The production appSecret.
|
||||
*/
|
||||
@Cordova()
|
||||
takeOff(config: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Android notification config. Values not set will fallback to any values set in the config.xml.
|
||||
*
|
||||
* @param {object} config The notification config.
|
||||
* @param {string} [config.icon] The name of the drawable resource to use as the notification icon.
|
||||
* @param {string} [config.largeIcon] The name of the drawable resource to use as the notification large icon.
|
||||
* @param {string} [config.accentColor] The notification accent color. Format is #AARRGGBB.
|
||||
*/
|
||||
@Cordova()
|
||||
setAndroidNotificationConfig(config: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default behavior when the message center is launched from a push
|
||||
* notification. If set to false the message center must be manually launched.
|
||||
*
|
||||
* @param {boolean} enabled true to automatically launch the default message center, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setAutoLaunchDefaultMessageCenter(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables user notifications.
|
||||
*
|
||||
* @param {boolean} enabled true to enable notifications, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setUserNotificationsEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user notifications are enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if user notifications is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isUserNotificationsEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if app notifications are enabled or not. Its possible to have `userNotificationsEnabled`
|
||||
* but app notifications being disabled if the user opted out of notifications.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if app notifications is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isAppNotificationsEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel ID.
|
||||
*
|
||||
* @param {function(ID)} success The function to call on success.
|
||||
* @param {string} success.ID The channel ID string
|
||||
* @param {failureCallback} [failure] The function to call on failure.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getChannelID(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last notification that launched the application.
|
||||
*
|
||||
* @param {Boolean} clear true to clear the notification.
|
||||
* @param {function(push)} success The function to call on success.
|
||||
* @param {object} success.push The push message object containing data associated with a push notification.
|
||||
* @param {string} success.push.message The push alert message.
|
||||
* @param {object} success.push.extras Any push extras.
|
||||
* @param {number} [success.push.notification_id] The Android notification ID.
|
||||
* @param {failureCallback} [failure] The function to call on failure.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getLaunchNotification(clear: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last received deep link.
|
||||
*
|
||||
* @param {Boolean} clear true to clear the deep link.
|
||||
* @param {function(push)} success The function to call on success.
|
||||
* @param {string} success.deepLink The deep link.
|
||||
* @param {failureCallback} [failure] The function to call on failure.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getDeepLink(clear: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tags as an array.
|
||||
*
|
||||
* @param {function(tags)} success The function to call on success.
|
||||
* @param {array} success.tags The tags as an array.
|
||||
* @param {failureCallback} [failure] The function to call on failure.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getTags(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tags.
|
||||
*
|
||||
* @param {Array} tags an array of strings.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setTags(tags: string[]): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the alias.
|
||||
*
|
||||
* @deprecated Deprecated since 6.7.0 - to be removed in a future version of the plugin - please use getNamedUser
|
||||
*
|
||||
* @param {function(currentAlias)} success The function to call on success.
|
||||
* @param {string} success.currentAlias The alias as a string.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getAlias(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the alias.
|
||||
*
|
||||
* @deprecated Deprecated since 6.7.0 - to be removed in a future version of the plugin - please use setNamedUser
|
||||
*
|
||||
* @param {String} alias string
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setAlias(alias: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if quiet time is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if quiet time is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isQuietTimeEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables quiet time.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable quiet time, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setQuietTimeEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the device is currently in quiet time.
|
||||
*
|
||||
* @param {function(inQuietTime)} success Success callback.
|
||||
* @param {boolean} success.inQuietTime Flag indicating if quiet time is currently in effect.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isInQuietTime(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quiet time as an object with the following:
|
||||
* "startHour": Number,
|
||||
* "startMinute": Number,
|
||||
* "endHour": Number,
|
||||
* "endMinute": Number
|
||||
*
|
||||
* @param {function(quietTime)} success The function to call on success.
|
||||
* @param {object} success.quietTime The quietTime object represents a timespan during
|
||||
* which notifications should be silenced.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getQuietTime(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the quiet time.
|
||||
*
|
||||
* @param {Number} startHour for quiet time.
|
||||
* @param {Number} startMinute for quiet time.
|
||||
* @param {Number} endHour for quiet time.
|
||||
* @param {Number} endMinute for quiet time.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setQuietTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables analytics.
|
||||
*
|
||||
* Disabling analytics will delete any locally stored events
|
||||
* and prevent any events from uploading. Features that depend on analytics being
|
||||
* enabled may not work properly if it's disabled (reports, region triggers,
|
||||
* location segmentation, push to local time).
|
||||
*
|
||||
* @param {Boolean} enabled true to enable analytics, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setAnalyticsEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if analytics is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if analytics is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isAnalyticsEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the named user ID.
|
||||
*
|
||||
* @param {function(namedUser)} success The function to call on success.
|
||||
* @param {string} success.namedUser The named user ID as a string.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getNamedUser(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the named user ID.
|
||||
*
|
||||
* @param {String} namedUser identifier string.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setNamedUser(namedUser: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs an Urban Airship action.
|
||||
*
|
||||
* @param {String} actionName action as a string.
|
||||
* @param {*} actionValue
|
||||
* @param {function(result)} [success] The function to call on success.
|
||||
* @param {object} success.result The result's value.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
runAction(actionName: string, actionValue: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an editor to modify the named user tag groups.
|
||||
*
|
||||
* @return {TagGroupEditor} A tag group editor instance.
|
||||
*/
|
||||
@Cordova()
|
||||
editNamedUserTagGroups(): TagGroupEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an editor to modify the channel tag groups.
|
||||
*
|
||||
* @return {TagGroupEditor} A tag group editor instance.
|
||||
*/
|
||||
@Cordova()
|
||||
editChannelTagGroups(): TagGroupEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an associated identifier for the Connect data stream.
|
||||
*
|
||||
* @param key Custom key for identifier.
|
||||
* @param identifier The identifier value.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setAssociatedIdentifier(key: string, identifier: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
// Location
|
||||
|
||||
/**
|
||||
* Enables or disables Urban Airship location services.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable location, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setLocationEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if location is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if location is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isLocationEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables background location.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable background location, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setBackgroundLocationEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if background location is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if background location updates are enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isBackgroundLocationEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the message center.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
displayMessageCenter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss the message center.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
dismissMessageCenter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss the inbox message.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
dismissInboxMessage(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss the inbox message in the overlay.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
dismissOverlayInboxMessage(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the array of inbox messages. Each message will have the following properties:
|
||||
* "id": string - The messages ID. Needed to display, mark as read, or delete the message.
|
||||
* "title": string - The message title.
|
||||
* "sentDate": number - The message sent date in milliseconds.
|
||||
* "listIconUrl": string, optional - The icon url for the message.
|
||||
* "isRead": boolean - The unread/read status of the message.
|
||||
* "extras": object - String to String map of any message extras.
|
||||
*
|
||||
* @param {function(messages)} success The function to call on success.
|
||||
* @param {array} success.messages The array of inbox messages.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getInboxMessages(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks an inbox message read.
|
||||
*
|
||||
* @param {String} messageId The ID of the message to mark as read.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
markInboxMessageRead(messageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an inbox message.
|
||||
*
|
||||
* @param {String} messageId The ID of the message to delete.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
deleteInboxMessage(messageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the inbox message using a full screen view.
|
||||
*
|
||||
* @param {String} messageId The ID of the message to display.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
displayInboxMessage(messageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the inbox to refresh. This is normally not needed as the inbox
|
||||
* will automatically refresh on foreground or when a push arrives thats
|
||||
* associated with a message, but it can be useful when providing a refresh
|
||||
* button for the message listing.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
refreshInbox(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the inbox message using an overlay display.
|
||||
*
|
||||
* @param {String} messageId The ID of the message to display.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
overlayInboxMessage(messageId: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a notification by identifier.
|
||||
*
|
||||
* @param {string} identifier The notification identifier.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
*/
|
||||
@Cordova()
|
||||
clearNotification(identifier: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all notifications posted by the application.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
clearNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets currently active notifications.
|
||||
*
|
||||
* Note: On Android this functionality is only supported on Android M or higher.
|
||||
*
|
||||
* @param {function(messages)} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
*/
|
||||
@Cordova()
|
||||
getActiveNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
// iOS only
|
||||
|
||||
/**
|
||||
* Enables or disables auto badge. Defaults to `NO`.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable auto badge, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setAutobadgeEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the badge number.
|
||||
*
|
||||
* @param count number specified badge to set.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setBadgeNumber(count: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current badge number.
|
||||
*
|
||||
* @param {function(badgeNumber)} success The function to call on success.
|
||||
* @param {int} success.badgeNumber The current application badge number.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
getBadgeNumber(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the badge.
|
||||
*
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
resetBadge(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the iOS notification types. Specify the combination of
|
||||
* badges, sound and alerts that are desired.
|
||||
*
|
||||
* @param types specified notification types.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setNotificationTypes(types: NotificationType): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the iOS presentation options. Specify the combination of
|
||||
* badges, sound and alerts that are desired.
|
||||
*
|
||||
* @param options types specified presentation options.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setPresentationOptions(options: PresentationOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Android only
|
||||
|
||||
/**
|
||||
* Checks if notification sound is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if sound is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isSoundEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables notification sound.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable sound, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setSoundEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if notification vibration is enabled or not.
|
||||
*
|
||||
* @param {function(enabled)} success Success callback.
|
||||
* @param {boolean} success.enabled Flag indicating if vibration is enabled or not.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
isVibrateEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables notification vibration.
|
||||
*
|
||||
* @param {Boolean} enabled true to enable vibration, false to disable.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
setVibrateEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom event.
|
||||
*
|
||||
* @param {object} event The custom event object.
|
||||
* @param {string} event.name The event's name.
|
||||
* @param {number} [event.value] The event's value.
|
||||
* @param {string} [event.transactionId] The event's transaction ID.
|
||||
* @param {object} [event.properties] The event's properties. Only numbers, booleans, strings, and array of strings are supported.
|
||||
* @param {function} [success] Success callback.
|
||||
* @param {function(message)} [failure] Failure callback.
|
||||
* @param {string} failure.message The error message.
|
||||
*/
|
||||
@Cordova()
|
||||
addCustomEvent(event: object): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import { Observable } from 'rxjs';
|
||||
|
||||
export interface Response {
|
||||
status: number;
|
||||
body: string;
|
||||
body?: string;
|
||||
path?: string;
|
||||
headers: { [key: string]: string};
|
||||
}
|
||||
|
||||
|
||||
210
src/@ionic-native/plugins/web-socket-server/index.ts
Normal file
210
src/@ionic-native/plugins/web-socket-server/index.ts
Normal file
@@ -0,0 +1,210 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
declare const window: any;
|
||||
|
||||
export interface WebSocketInterfaces {
|
||||
[key: string]: WebSocketInterface;
|
||||
}
|
||||
|
||||
export interface WebSocketInterface {
|
||||
ipv4Addresses: string[];
|
||||
ipv6Addresses: string[];
|
||||
}
|
||||
|
||||
export interface WebSocketOptions {
|
||||
origins?: string[];
|
||||
protocols?: string[];
|
||||
tcpNoDelay?: boolean;
|
||||
}
|
||||
|
||||
export interface WebSocketIdentifier {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface WebSocketServerDetails {
|
||||
addr: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
export interface WebSocketFailure extends WebSocketServerDetails {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface WebSocketMessage {
|
||||
conn: WebSocketConnection;
|
||||
msg: string;
|
||||
}
|
||||
|
||||
export interface WebSocketClose {
|
||||
conn: WebSocketConnection;
|
||||
code: number;
|
||||
reason: string;
|
||||
wasClean: boolean;
|
||||
}
|
||||
|
||||
export interface WebSocketConnection extends WebSocketIdentifier {
|
||||
remoteAttr: string;
|
||||
state: 'open' | 'closed';
|
||||
httpFields: HttpFields;
|
||||
resource: string;
|
||||
}
|
||||
|
||||
export interface HttpFields {
|
||||
'Accept-Encoding': string;
|
||||
'Accept-Language': string;
|
||||
'Cache-Control': string;
|
||||
Connection: string;
|
||||
Host: string;
|
||||
Origin: string;
|
||||
Pragma: string;
|
||||
'Sec-WebSocket-Extensions': string;
|
||||
'Sec-WebSocket-Key': string;
|
||||
'Sec-WebSocket-Version': string;
|
||||
Upgrade: string;
|
||||
'User-Agent': string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name WebSocket Server
|
||||
* @description
|
||||
* This plugin allows you to run a single, lightweight, barebone WebSocket Server.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { WebSocketServer } from '@ionic-native/web-socket-server';
|
||||
*
|
||||
* constructor(private wsserver: WebSocketServer) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // start websocket server
|
||||
* this.wsserver.start(8888, {}).subscribe({
|
||||
* next: server => console.log(`Listening on ${server.addr}:${server.port}`),
|
||||
* error: error => console.log(`Unexpected error`, error);
|
||||
* });
|
||||
*
|
||||
* // watch for any messages
|
||||
* this.wsserver.watchMessage().subscribe(result => {
|
||||
* console.log(`Received message ${result.msg} from ${result.conn.uuid}`);
|
||||
* });
|
||||
*
|
||||
* // send message to connection with specified uuid
|
||||
* this.wsserver.send({ uuid: '8e7c4f48-de68-4b6f-8fca-1067a353968d' }, 'Hello World');
|
||||
*
|
||||
* // stop websocket server
|
||||
* this.wsserver.stop().then(server => {
|
||||
* console.log(`Stop listening on ${server.addr}:${server.port}`);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'WebSocketServer',
|
||||
plugin: 'cordova-plugin-websocket-server',
|
||||
pluginRef: 'cordova.plugins.wsserver',
|
||||
repo: 'https://github.com/becvert/cordova-plugin-websocket-server',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class WebSocketServer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Return this device's interfaces
|
||||
* @return {Promise<WebSocketInterfaces>}
|
||||
*/
|
||||
@Cordova()
|
||||
getInterfaces(): Promise<WebSocketInterfaces> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start websocket server
|
||||
* @param port {number} Local port on which the service runs. (0 means any free port)
|
||||
* @param options {WebSocketOptions} Additional options for websocket
|
||||
* @return {Observable<WebSocketServerDetails>} Returns Observable where all generic error can be catched (mostly JSONExceptions)
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
clearFunction: 'stop'
|
||||
})
|
||||
start(port: number, options: WebSocketOptions): Observable<WebSocketServerDetails> {
|
||||
return;
|
||||
}
|
||||
|
||||
private onFunctionToObservable<T>(fnName: string) {
|
||||
return new Observable<T>(observer => {
|
||||
const id = window.cordova.plugins.wsserver[fnName](
|
||||
observer.next.bind(observer),
|
||||
observer.error.bind(observer)
|
||||
);
|
||||
|
||||
return () => window.cordova.plugins.wsserver.removeCallback(id);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches for new messages
|
||||
* @return {Observable<WebSocketMessage>}
|
||||
*/
|
||||
watchMessage(): Observable<WebSocketMessage> {
|
||||
return this.onFunctionToObservable('onMessage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches for new opened connections
|
||||
* @return {Observable<WebSocketConnection>}
|
||||
*/
|
||||
watchOpen(): Observable<WebSocketConnection> {
|
||||
return this.onFunctionToObservable('onOpen');
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches for closed connections
|
||||
* @return {Observable<WebSocketClose>}
|
||||
*/
|
||||
watchClose(): Observable<WebSocketClose> {
|
||||
return this.onFunctionToObservable('onClose');
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches for any websocket failures
|
||||
* @return {Observable<WebSocketFailure>}
|
||||
*/
|
||||
watchFailure(): Observable<WebSocketFailure> {
|
||||
return this.onFunctionToObservable('onFailure');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop websocket server and closes all connections
|
||||
* @return {Promise<WebSocketServerDetails>}
|
||||
*/
|
||||
@Cordova()
|
||||
stop(): Promise<WebSocketServerDetails> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Message to a connected device
|
||||
* @param conn {WebSocketIdentifier} Connection to send message to
|
||||
* @param msg {string} Message to send
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
send(conn: WebSocketIdentifier, msg: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close specific connection using uuid
|
||||
* @param conn {WebSocketIdentifier} Connection to close
|
||||
* @param code {number} Close code, determines if it was clean
|
||||
* @param reason {string} Reason for closing
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
close(conn: WebSocketIdentifier, code: number, reason: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,7 @@ export class Wechat extends IonicNativePlugin {
|
||||
* this.wechat.auth.then((res) => { alert(res.code); });
|
||||
* </code>
|
||||
*/
|
||||
@Cordova()
|
||||
auth(scope: any, state: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
@@ -116,6 +117,7 @@ export class Wechat extends IonicNativePlugin {
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
@Cordova()
|
||||
sendPaymentRequest(params: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
@@ -143,6 +145,7 @@ export class Wechat extends IonicNativePlugin {
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
@Cordova()
|
||||
jumpToWechat(url: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
@@ -160,6 +163,7 @@ export class Wechat extends IonicNativePlugin {
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
@Cordova()
|
||||
chooseInvoiceFromWX(params: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
605
src/@ionic-native/plugins/wonderpush/index.ts
Normal file
605
src/@ionic-native/plugins/wonderpush/index.ts
Normal file
@@ -0,0 +1,605 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin, getPromise } from '@ionic-native/core';
|
||||
|
||||
export interface WonderPushDelegate {
|
||||
urlForDeepLink(url: string, callback: (url?: string) => void): void;
|
||||
}
|
||||
|
||||
export interface WonderPushChannel {
|
||||
id: string;
|
||||
groupId?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
bypassDnd?: boolean;
|
||||
showBadge?: boolean;
|
||||
importance?: number;
|
||||
lights?: boolean;
|
||||
lightColor?: number;
|
||||
vibrate?: boolean;
|
||||
sound?: boolean;
|
||||
soundUri?: string;
|
||||
lockscreenVisibility?: number;
|
||||
vibrateInSilentMode?: boolean;
|
||||
color?: number;
|
||||
localOnly?: boolean;
|
||||
}
|
||||
|
||||
export interface WonderPushChannelGroup {
|
||||
id: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
class NestedObject {
|
||||
pluginObj: any;
|
||||
constructor(pluginObj: any) {
|
||||
this.pluginObj = pluginObj;
|
||||
}
|
||||
|
||||
wrap<T>(functionName: string, args: any[]): Promise<T> {
|
||||
const plugin = WonderPush.getPlugin();
|
||||
const userPreferences = plugin ? plugin.UserPreferences : null;
|
||||
if (!plugin || !userPreferences || !userPreferences[functionName]) {
|
||||
return getPromise<T>((res, rej) => {
|
||||
rej(new Error('Could not find plugin'));
|
||||
});
|
||||
}
|
||||
return getPromise<T>((res, rej) => {
|
||||
userPreferences[functionName].apply(userPreferences, [ ...args, res]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class UserPreferencesMethods extends NestedObject {
|
||||
/**
|
||||
* Get the default channel id
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
getDefaultChannelId(): Promise<string> {
|
||||
return this.wrap<string | null>('getDefaultChannelId', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default channel id
|
||||
* @param {string} id
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
setDefaultChannelId(id: string): Promise<any> {
|
||||
return this.wrap('setDefaultChannelId', [id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a channel group
|
||||
* @param {string} groupId
|
||||
* @returns {Promise<WonderPushChannelGroup | null>}
|
||||
*/
|
||||
getChannelGroup(groupId: string): Promise<WonderPushChannelGroup | null> {
|
||||
return this.wrap<WonderPushChannelGroup | null>('getChannelGroup', [groupId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a channel
|
||||
* @param {string} channelId
|
||||
* @returns {Promise<WonderPushChannel | null>}
|
||||
*/
|
||||
getChannel(channelId: string): Promise<WonderPushChannel | null> {
|
||||
return this.wrap<WonderPushChannel | null>('getChannel', [channelId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create, update and remove channel existing groups to match the given channel groups
|
||||
* @param {WonderPushChannelGroup[]} channelGroups
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
setChannelGroups(channelGroups: WonderPushChannelGroup[]): Promise<any> {
|
||||
return this.wrap('setChannelGroups', [channelGroups]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create, update and remove channels to match the given channels
|
||||
* @param {WonderPushChannel[]} channels
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
setChannels(channels: WonderPushChannel[]): Promise<any> {
|
||||
return this.wrap('setChannels', [channels]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or update a channel group
|
||||
* @param {WonderPushChannelGroup} channelGroup
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
putChannelGroup(channelGroup: WonderPushChannelGroup): Promise<any> {
|
||||
return this.wrap('putChannelGroup', [channelGroup]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or update a channel
|
||||
* @param {WonderPushChannel} channel
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
putChannel(channel: WonderPushChannel): Promise<any> {
|
||||
return this.wrap('putChannel', [channel]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a channel group
|
||||
* @param {string} groupId
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
removeChannelGroup(groupId: string): Promise<any> {
|
||||
return this.wrap('removeChannelGroup', [groupId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a channel
|
||||
* @param {string} channelId
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
removeChannel(channelId: string): Promise<any> {
|
||||
return this.wrap('removeChannel', [channelId]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name WonderPush
|
||||
* @description
|
||||
*
|
||||
* Push notification delivery with the WonderPush service.
|
||||
*
|
||||
* Get started in minutes: [Ionic Quickstart Guide](https://docs.wonderpush.com/docs/ionic-quickstart).
|
||||
*
|
||||
* Requires the Cordova plugin `wonderpush-cordova-sdk`.
|
||||
*
|
||||
* [WonderPush push notifications](https://www.wonderpush.com) are the most effective way
|
||||
* to retain your users and grow your audience while remaining fully GDPR compliant.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { WonderPush } from '@ionic-native/wonderpush';
|
||||
*
|
||||
*
|
||||
* constructor(private wonderPush: WonderPush) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Subscribe user
|
||||
* this.wonderPush.subscribeToNotifications()
|
||||
* .then(() => console.log("User subscribed to notifications"))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
*
|
||||
* // Send an event (a purchase in this example)
|
||||
* this.wonderPush.sendEvent('purchase', {
|
||||
* float_price: 12.99,
|
||||
* string_sku: "X123456"
|
||||
* });
|
||||
*
|
||||
* // Tag users (as customers)
|
||||
* this.wonderPush.addTag('customer');
|
||||
*
|
||||
* // Personalize
|
||||
* // 1. Store user details.
|
||||
* // 2. Use those details to create segments.
|
||||
* // 3. Include those details in your notifications.
|
||||
* this.wonderPush.putProperties({
|
||||
* string_name: 'John D.',
|
||||
* int_age: 24
|
||||
* });
|
||||
*
|
||||
* // GDPR
|
||||
* // 1. set REQUIRES_USER_CONSENT=true to enable GDPR compliance.
|
||||
* // 2. WonderPush doesn't start until setUserConsent(true) is called.
|
||||
* const onClick = (userConsent: boolean) => this.wonderPush.setUserConsent(userConsent);
|
||||
*
|
||||
* // Listen to notification clicks
|
||||
* document.addEventListener('wonderpush.notificationOpen', function(event) {
|
||||
* console.log('Notification opened', event.notification);
|
||||
* if (event.notificationType === 'data') {
|
||||
* console.log('Silent notification', event.notification);
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @interfaces
|
||||
* WonderPushChannel
|
||||
* WonderPushChannelGroup
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'WonderPush',
|
||||
plugin: 'wonderpush-cordova-sdk',
|
||||
pluginRef: 'WonderPush',
|
||||
repo: 'https://github.com/wonderpush/wonderpush-cordova-sdk',
|
||||
install: 'ionic cordova plugin add wonderpush-cordova-sdk --variable CLIENT_ID=YOUR_CLIENT_ID --variable CLIENT_SECRET=YOUR_CLIENT_SECRET ',
|
||||
installVariables: ['CLIENT_ID', 'CLIENT_SECRET'],
|
||||
platforms: ['Android', 'iOS'],
|
||||
})
|
||||
@Injectable()
|
||||
export class WonderPush extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Sets the user id, used to identify a single identity across multiple devices,
|
||||
* and to correctly identify multiple users on a single device.
|
||||
*
|
||||
* If not called, the last used user id it assumed. Defaulting to `null` if none is known.
|
||||
*
|
||||
* Upon changing userId, the access token is wiped, so avoid unnecessary calls, like calling with `null`
|
||||
* just before calling with a user id.
|
||||
*
|
||||
* @param {?string} userId - The user id, unique to your application.
|
||||
* Use `null` for anonymous users.
|
||||
*
|
||||
* You are strongly encouraged to use your own unique internal identifier.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
|
||||
@Cordova()
|
||||
setUserId(userId: string | null): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the SDK is ready to operate.
|
||||
*
|
||||
* The SDK is ready when it is initialized and has fetched an access token.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
isReady(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls native SDK logging.
|
||||
* @param {boolean} enabled - Whether to enable logs.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setLogging(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up a delegate for tighter integration, or removes it.
|
||||
* @param {?WonderPushDelegate} delegate - The delegate to set, or `null` to remove it.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setDelegate(delegate: WonderPushDelegate | null): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current delegate.
|
||||
* @returns {Promise<WonderPushDelegate | null>} A promise with the delegate of null
|
||||
*/
|
||||
@Cordova()
|
||||
getDelegate(): Promise<WonderPushDelegate | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the userId currently in use, `null` by default.
|
||||
* @returns {Promise<string | null>} A promise with the user ID or null
|
||||
*/
|
||||
@Cordova()
|
||||
getUserId(): Promise<string | null > {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the installationId identifying your application on a device, bond to a specific userId.
|
||||
* If you want to store this information on your servers, keep the corresponding userId with it.
|
||||
* Will return `null` until the SDK is properly initialized.
|
||||
* @returns {Promise<string | null>} A promise with the installation ID or null
|
||||
*/
|
||||
@Cordova()
|
||||
getInstallationId(): Promise<string | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique device identifier
|
||||
* @returns {Promise<string | null>} A promise with the device ID or null
|
||||
*/
|
||||
@Cordova()
|
||||
getDeviceId(): Promise<string | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the push token.
|
||||
* @returns {Promise<string | null>} A promise with the push token or `null`
|
||||
*/
|
||||
@Cordova()
|
||||
getPushToken(): Promise<string | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently used access token.
|
||||
* Returns `null` until the SDK is properly initialized.
|
||||
* This together with your client secret gives entire control to the current installation and associated user, you should not disclose it unnecessarily.
|
||||
* @returns {Promise<string | null>}
|
||||
*/
|
||||
@Cordova()
|
||||
getAccessToken(): Promise<string | null> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an event to be tracked to WonderPush.
|
||||
*
|
||||
* @param {string} type - The event type, or name. Event types starting with an `@` character are reserved.
|
||||
* @param {?object} [attributes] - An object containing custom properties to be attached to the event.
|
||||
* The keys should be prefixed according to the type of their values.
|
||||
* You can find the details in the [Concepts > Custom fields](https://www.wonderpush.com/docs/guide/custom-fields) section of the documentation.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
trackEvent(type: string, attributes: { [key: string]: any }): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one or more tags to the installation.
|
||||
* @param {string|string[]} tag - The tags to add to the installation. You can use either a single string argument or an array of strings.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
addTag(tag: string | string[]): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more tags from the installation.
|
||||
* @param {string|string[]} tag - The tags to remove from the installation. You can use either a single string argument or an array of strings.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
removeTag(tag: string | string[]): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all tags from the installation.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
removeAllTags(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the tags of the installation.
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
getTags(): Promise<string[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the installation has the given tag attached to it.
|
||||
* @param {string} tag - The tag to test.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
hasTag(tag: string): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value to a given installation property.
|
||||
*
|
||||
* The previous value is replaced entirely.
|
||||
* Setting `undefined` or `null` has the same effect as {@link cordova.plugins.WonderPush#unsetProperty}.
|
||||
*
|
||||
* @param {string} field - The name of the property to set
|
||||
* @param value
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setProperty(field: string, value: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the value of a given installation property.
|
||||
*
|
||||
* The previous value is replaced with `null`.
|
||||
*
|
||||
* @param {string} field - The name of the property
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
unsetProperty(field: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the value to a given installation property.
|
||||
*
|
||||
* The stored value is made an array if not already one.
|
||||
* If the given value is an array, all its values are added.
|
||||
* If a value is already present in the stored value, it won't be added.
|
||||
*
|
||||
* @param {string} field - The name of the property
|
||||
* @param value
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
addProperty(field: string, value: any): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the value from a given installation property.
|
||||
*
|
||||
* The stored value is made an array if not already one.
|
||||
* If the given value is an array, all its values are removed.
|
||||
* If a value is present multiple times in the stored value, they will all be removed.
|
||||
*
|
||||
* @param {string} field - The name of the property
|
||||
* @param value
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
removeProperty(field: string, value: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a given installation property.
|
||||
*
|
||||
* If the property stores an array, only the first value is returned.
|
||||
* This way you don't have to deal with potential arrays if that property is not supposed to hold one.
|
||||
* Returns `null` if the property is absent or has an empty array value.
|
||||
*
|
||||
* @param {string} field - The name of the property to read values from
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getPropertyValue(field: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the values of a given installation property.
|
||||
*
|
||||
* If the property does not store an array, an array is returned nevertheless.
|
||||
* This way you don't have to deal with potential scalar values if that property is supposed to hold an array.
|
||||
* Returns an empty array instead of `null` if the property is absent.
|
||||
* Returns an array wrapping any scalar value held by the property.
|
||||
*
|
||||
* @param {string} field - The name of the property to read values from
|
||||
* @returns {Promise<any[]>}
|
||||
*/
|
||||
@Cordova()
|
||||
getPropertyValues(field: string): Promise<any[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest known custom properties attached to the current installation object stored by WonderPush.
|
||||
* @returns {Promise<{[p: string]: any}>}
|
||||
*/
|
||||
@Cordova()
|
||||
getProperties(): Promise<{[key: string]: any}> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the properties attached to the current installation object stored by WonderPush.
|
||||
*
|
||||
* In order to remove a value, use `null`.
|
||||
*
|
||||
* @param {{[p: string]: any}} properties. The keys should be prefixed according to the type of their values. You can find the details in the [Segmentation > Properties](https://docs.wonderpush.com/docs/properties#section-custom-properties) section of the documentation.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
putProperties(properties: {[key: string]: any}): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes to push notification and registers the device token with WondePush.
|
||||
*
|
||||
* On iOS, you **must** call the following method at least once to make the notification visible to the user.
|
||||
*
|
||||
* - You can call this method multiple times. The user is only prompted for permission by iOS once.
|
||||
* - There is no need to call this method if the permission has already been granted, but it does not harm either.
|
||||
* - If the permission has been denied in the OS, the user will stay soft opt-out.
|
||||
*
|
||||
* Because in iOS you only have *one* chance for prompting the user, you should find a good timing for that.
|
||||
* For a start, you can systematically call it when the application starts, so that the user will be prompted directly at the first launch.
|
||||
*
|
||||
* @return {Promise<any>} Returns a promise that resolves upon successful subscription
|
||||
*/
|
||||
@Cordova()
|
||||
subscribeToNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the notifications are enabled.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
isSubscribedToNotifications(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes from push notification.
|
||||
* This method marks the user as soft opt-out.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
unsubscribeFromNotifications(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads user consent state.
|
||||
* Returns undefined if no explicit consent was set.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova()
|
||||
getUserConsent(): Promise<boolean> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides or withdraws user consent.
|
||||
* If the `requiresUserConsent` initialization option is true,
|
||||
* the whole SDK is paused and no data is sent to WonderPush, until consent is provided.
|
||||
* @param {boolean} consent -
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setUserConsent(consent: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any local storage and ask the WonderPush servers to delete any data associated with the all local installations and related users.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
clearAllData(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the WonderPush servers to delete any event associated with the all local installations.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
clearEventsHistory(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the WonderPush servers to delete any custom data associated with the all local installations and related users.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
clearPreferences(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the download of all user remote and local data.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
downloadAllData(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
UserPreferences = new UserPreferencesMethods(this);
|
||||
}
|
||||
Reference in New Issue
Block a user