mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6112d724f2 | ||
|
|
2913a68d8f | ||
|
|
4d346437f0 | ||
|
|
904455df9e | ||
|
|
cac9872796 | ||
|
|
d4465681cf | ||
|
|
fd3a8de693 | ||
|
|
4c07af7782 | ||
|
|
2ad03fa89b | ||
|
|
ed37c68990 | ||
|
|
66da511526 | ||
|
|
817f0d11b9 | ||
|
|
c8d3afc91d | ||
|
|
3b18135ebf | ||
|
|
614ade447f | ||
|
|
1bcaa39ffd | ||
|
|
82939763ee | ||
|
|
15ed431819 | ||
|
|
7baeab9fee | ||
|
|
41895c165c | ||
|
|
80f4ced369 | ||
|
|
95a67a813d | ||
|
|
799cf94674 | ||
|
|
2b2eb88a64 | ||
|
|
7cad3f350f | ||
|
|
4c8ec5d1fc | ||
|
|
82b632d772 | ||
|
|
240feba76b | ||
|
|
e55a1e1117 | ||
|
|
8764440087 | ||
|
|
07b958ac4e | ||
|
|
dd39c2fa85 | ||
|
|
515b82d634 | ||
|
|
ecb0bb22ed | ||
|
|
3f1fa37a8d | ||
|
|
a74c894064 | ||
|
|
4d7e937d7a | ||
|
|
fc90795a2c | ||
|
|
129ba4dbe2 | ||
|
|
8582fac076 | ||
|
|
d0f665f6fc | ||
|
|
0254cf730e | ||
|
|
92a99145f8 | ||
|
|
a22ee6ed2b | ||
|
|
1aa89ae311 | ||
|
|
6f4d23d072 | ||
|
|
ecd451ceb3 | ||
|
|
bddc221b60 | ||
|
|
27e844cbc2 | ||
|
|
b8695220ea | ||
|
|
364b30af59 | ||
|
|
860d79828d | ||
|
|
9057dc2c93 | ||
|
|
5223dc7dd5 | ||
|
|
bb77620d0d | ||
|
|
b280ef4c55 | ||
|
|
8e79890251 |
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
1587
CHANGELOG.md
1587
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
14930
package-lock.json
generated
14930
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
package.json
37
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "5.17.0",
|
||||
"version": "5.21.3",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
@@ -18,8 +18,7 @@
|
||||
"lint": "gulp lint",
|
||||
"readmes": "gulp readmes",
|
||||
"docs-json": "ts-node -P scripts/tsconfig.json scripts/docs-json",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"postchangelog": "git commit -am \"chore(): update changelog\"",
|
||||
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
||||
"shipit": "npm run build && npm run readmes && npm run npmpub"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -29,37 +28,38 @@
|
||||
"@angular/core": "^8.2.14",
|
||||
"@types/cordova": "0.0.34",
|
||||
"@types/fs-extra": "^8.0.1",
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/jest": "^25.1.2",
|
||||
"@types/lodash": "^4.14.149",
|
||||
"@types/node": "^12.12.9",
|
||||
"@types/node": "^12.12.26",
|
||||
"@types/rimraf": "^2.0.3",
|
||||
"@types/webpack": "^4.41.0",
|
||||
"ajv": "^6.10.2",
|
||||
"@types/webpack": "^4.41.6",
|
||||
"ajv": "^6.11.0",
|
||||
"async-promise-queue": "^1.0.5",
|
||||
"conventional-changelog-cli": "^2.0.28",
|
||||
"cz-conventional-changelog": "^3.0.2",
|
||||
"conventional-changelog-cli": "^2.0.31",
|
||||
"cz-conventional-changelog": "^3.1.0",
|
||||
"dgeni": "^0.4.12",
|
||||
"dgeni-packages": "0.16.10",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-tslint": "^8.1.4",
|
||||
"jest": "^24.9.0",
|
||||
"jest": "^25.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"minimist": "1.2.0",
|
||||
"natives": "^1.1.6",
|
||||
"rimraf": "^3.0.0",
|
||||
"rxjs": "^6.5.3",
|
||||
"ts-jest": "^24.1.0",
|
||||
"ts-node": "^8.5.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^6.5.4",
|
||||
"ts-jest": "^25.2.0",
|
||||
"ts-node": "^8.6.2",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-ionic-rules": "0.0.21",
|
||||
"typedoc": "^0.15.2",
|
||||
"typedoc": "^0.16.9",
|
||||
"typescript": "~3.5.3",
|
||||
"typescript-tslint-plugin": "0.5.5",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"unminified-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack": "^4.41.5",
|
||||
"winston": "^3.2.1",
|
||||
"zone.js": "^0.9.1"
|
||||
},
|
||||
@@ -87,5 +87,8 @@
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "1.10.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function getDecoratorArgs(decorator: any) {
|
||||
const args = {};
|
||||
|
||||
properties.forEach(prop => {
|
||||
let val;
|
||||
let val: number | boolean;
|
||||
|
||||
switch (prop.initializer.kind) {
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
import * as ts from 'typescript';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
import * as ngc from '@angular/compiler-cli';
|
||||
import * as rimraf from 'rimraf';
|
||||
import { generateDeclarations } from './transpile';
|
||||
import { clone } from 'lodash';
|
||||
import { EmitFlags } from '@angular/compiler-cli';
|
||||
import { EmitFlags, createCompilerHost, CompilerOptions, CompilerHost, createProgram } from '@angular/compiler-cli';
|
||||
import { importsTransformer } from './transformers/imports';
|
||||
import { pluginClassTransformer } from './transformers/plugin-class';
|
||||
import { COMPILER_OPTIONS, PLUGIN_PATHS, ROOT } from './helpers';
|
||||
|
||||
export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
const options: ngc.CompilerOptions = clone(COMPILER_OPTIONS);
|
||||
const options: CompilerOptions = clone(COMPILER_OPTIONS);
|
||||
options.basePath = ROOT;
|
||||
options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
||||
options.module = ts.ModuleKind.ES2015;
|
||||
options.target = ts.ScriptTarget.ES5;
|
||||
options.lib = ['dom', 'es2017'];
|
||||
options.inlineSourceMap = true;
|
||||
options.importHelpers = true;
|
||||
options.inlineSources = true;
|
||||
options.enableIvy = false;
|
||||
|
||||
delete options.baseUrl;
|
||||
|
||||
const host: ngc.CompilerHost = ngc.createCompilerHost({ options });
|
||||
|
||||
return ngc.createProgram({
|
||||
const host: CompilerHost = createCompilerHost({ options });
|
||||
return createProgram({
|
||||
rootNames,
|
||||
options,
|
||||
host
|
||||
@@ -34,8 +35,9 @@ export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
export function transpileNgxCore() {
|
||||
getProgram([path.resolve(ROOT, 'src/@ionic-native/core/index.ts')]).emit({
|
||||
emitFlags: EmitFlags.Metadata,
|
||||
emitCallback: ({ program, writeFile, customTransformers, cancellationToken, targetSourceFile }) =>
|
||||
program.emit(targetSourceFile, writeFile, cancellationToken, true, customTransformers)
|
||||
emitCallback: ({ program, writeFile, customTransformers, cancellationToken, targetSourceFile }) => {
|
||||
return program.emit(targetSourceFile, writeFile, cancellationToken, true, customTransformers);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,10 +59,11 @@ export function generateDeclarationFiles() {
|
||||
|
||||
// remove reference to @ionic-native/core decorators
|
||||
export function modifyMetadata() {
|
||||
debugger;
|
||||
PLUGIN_PATHS.map(p => p.replace(path.join(ROOT, 'src'), path.join(ROOT, 'dist')).replace('index.ts', 'ngx/index.metadata.json'))
|
||||
.forEach(p => {
|
||||
const content = fs.readJSONSync(p);
|
||||
let _prop;
|
||||
let _prop: { members: { [x: string]: any[]; }; };
|
||||
for (const prop in content[0].metadata) {
|
||||
_prop = content[0].metadata[prop];
|
||||
removeIonicNativeDecorators(_prop);
|
||||
@@ -78,7 +81,7 @@ export function modifyMetadata() {
|
||||
|
||||
function removeIonicNativeDecorators(node: any) {
|
||||
if (node.decorators && node.decorators.length) {
|
||||
node.decorators = node.decorators.filter((d, i) => d.expression.module !== '@ionic-native/core');
|
||||
node.decorators = node.decorators.filter((d: { expression: { module: string; }; }) => d.expression.module !== '@ionic-native/core');
|
||||
}
|
||||
|
||||
if (node.decorators && !node.decorators.length) delete node.decorators;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import { Application } from 'typedoc';
|
||||
import { basename, dirname, resolve } from 'path';
|
||||
import { Application } from 'typedoc';
|
||||
import { runInNewContext } from 'vm';
|
||||
|
||||
import TypeDoc = require('typedoc');
|
||||
|
||||
interface Plugin {
|
||||
packageName: string;
|
||||
displayName: string;
|
||||
@@ -19,9 +21,13 @@ interface Plugin {
|
||||
const rootDir = resolve(__dirname, '../..');
|
||||
const typedocTmp = resolve(__dirname, 'typedoc.tmp.json');
|
||||
const pluginsDir = resolve(rootDir, 'src/@ionic-native/plugins');
|
||||
const typedoc = new Application({
|
||||
const typedoc = new Application();
|
||||
|
||||
typedoc.options.addReader(new TypeDoc.TSConfigReader());
|
||||
typedoc.options.addReader(new TypeDoc.TypeDocReader());
|
||||
|
||||
typedoc.bootstrap({
|
||||
mode: 'modules',
|
||||
tsconfig: resolve(rootDir, 'tsconfig.json'),
|
||||
ignoreCompilerErrors: true
|
||||
});
|
||||
|
||||
@@ -46,7 +52,9 @@ async function generateTypedoc(root: string, outputPath = typedocTmp) {
|
||||
function processPlugin(pluginModule): Plugin {
|
||||
const pluginClass = pluginModule.children.find(isPlugin);
|
||||
const decorator = getPluginDecorator(pluginClass);
|
||||
const packageName = `@ionic-native/${basename(dirname(pluginModule.originalName))}`;
|
||||
const packageName = `@ionic-native/${basename(
|
||||
dirname(pluginModule.originalName)
|
||||
)}`;
|
||||
const displayName = getTag(pluginClass, 'name');
|
||||
const usage = getTag(pluginClass, 'usage');
|
||||
const description = getTag(pluginClass, 'description');
|
||||
@@ -85,17 +93,17 @@ const getTag = (child: any, tagName: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
const isModule = (child: any): boolean =>
|
||||
child.kind === 1;
|
||||
const isModule = (child: any): boolean => child.kind === 1;
|
||||
|
||||
const isClass = (child: any): boolean =>
|
||||
child.kind === 128;
|
||||
const isClass = (child: any): boolean => child.kind === 128;
|
||||
|
||||
const isPlugin = (child: any): boolean =>
|
||||
isClass(child) && hasTags(child) && Array.isArray(child.decorators) && child.decorators.some(d => d.name === 'Plugin');
|
||||
isClass(child) &&
|
||||
hasTags(child) &&
|
||||
Array.isArray(child.decorators) &&
|
||||
child.decorators.some(d => d.name === 'Plugin');
|
||||
|
||||
const hasPlugin = (child: any): boolean =>
|
||||
child.children.some(isPlugin);
|
||||
const hasPlugin = (child: any): boolean => child.children.some(isPlugin);
|
||||
|
||||
const hasTags = (child: any): boolean =>
|
||||
child.comment && Array.isArray(child.comment.tags);
|
||||
|
||||
@@ -37,6 +37,7 @@ const PLUGIN_PEER_DEPENDENCIES = {
|
||||
rxjs: RXJS_VERSION
|
||||
};
|
||||
|
||||
|
||||
function getPackageJsonContent(name: string, peerDependencies = {}, dependencies = {}) {
|
||||
return merge(PACKAGE_JSON_BASE, {
|
||||
name: '@ionic-native/' + name,
|
||||
@@ -64,8 +65,9 @@ function prepare() {
|
||||
const pluginName = pluginPath.split(/[\/\\]+/).slice(-2)[0];
|
||||
const packageJsonContents = getPackageJsonContent(pluginName, PLUGIN_PEER_DEPENDENCIES);
|
||||
const dir = path.resolve(DIST, 'plugins', pluginName);
|
||||
|
||||
const ngxDir = path.join(dir, 'ngx');
|
||||
writePackageJson(packageJsonContents, dir);
|
||||
writePackageJson(packageJsonContents, ngxDir);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,24 +2,20 @@ import { checkAvailability } from './decorators/common';
|
||||
import { get } from './util';
|
||||
|
||||
export class IonicNativePlugin {
|
||||
static pluginName: string;
|
||||
|
||||
static pluginRef: string;
|
||||
|
||||
static plugin: string;
|
||||
|
||||
static repo: string;
|
||||
|
||||
static platforms: string[];
|
||||
|
||||
static install: string;
|
||||
static pluginName = '';
|
||||
static pluginRef = '';
|
||||
static plugin = '';
|
||||
static repo = '';
|
||||
static platforms: string[] = [];
|
||||
static install = '';
|
||||
|
||||
/**
|
||||
* Returns a boolean that indicates whether the plugin is installed
|
||||
* @return {boolean}
|
||||
*/
|
||||
static installed(): boolean {
|
||||
return checkAvailability(this.pluginRef) === true;
|
||||
const isAvailable = checkAvailability(this.pluginRef) === true;
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,27 +32,31 @@ export class IonicNativePlugin {
|
||||
* Returns the plugin's name
|
||||
*/
|
||||
static getPluginName(): string {
|
||||
return this.pluginName;
|
||||
const pluginName = this.pluginName;
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's reference
|
||||
*/
|
||||
static getPluginRef(): string {
|
||||
return this.pluginRef;
|
||||
const pluginRef = this.pluginRef;
|
||||
return pluginRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's install name
|
||||
*/
|
||||
static getPluginInstallName(): string {
|
||||
return this.plugin;
|
||||
const plugin = this.plugin;
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's supported platforms
|
||||
*/
|
||||
static getSupportedPlatforms(): string[] {
|
||||
return this.platforms || [];
|
||||
const platform = this.platforms;
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface AppUpdateOptions {
|
||||
authType: string;
|
||||
authType?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
skipPromptDialog?: boolean;
|
||||
skipProgressDialog?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -404,7 +404,7 @@ export interface BackgroundGeolocationConfig {
|
||||
*
|
||||
* @default 100
|
||||
*/
|
||||
syncThreshold?: string;
|
||||
syncThreshold?: number;
|
||||
|
||||
/**
|
||||
* Optional HTTP headers sent along in HTTP request.
|
||||
|
||||
@@ -487,4 +487,13 @@ export class CameraPreview extends IonicNativePlugin {
|
||||
getHorizontalFOV(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the characteristics of all available cameras
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getCameraCharacteristics(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,27 @@ export interface EmailComposerOptions {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.emailComposer.isAvailable().then((available: boolean) =>{
|
||||
* this.emailComposer.getClients().then((apps: []) => {
|
||||
* // Returns an array of configured email clients for the device
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.hasClient().then(app, (isValid: boolean) => {
|
||||
* if (isValid) {
|
||||
* // Now we know we have a valid email client configured
|
||||
* // Not specifying an app will return true if at least one email client is configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.hasAccount().then((isValid: boolean) => {
|
||||
* if (isValid) {
|
||||
* // Now we know we have a valid email account configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.emailComposer.isAvailable().then(app, (available: boolean) => {
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* // Now we know we can send an email, calls hasClient and hasAccount
|
||||
* // Not specifying an app will return true if at least one email client is configured
|
||||
* }
|
||||
* });
|
||||
*
|
||||
@@ -142,6 +160,68 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if an email account is configured on the device.
|
||||
*
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
hasAccount(): Promise<any> {
|
||||
return getPromise<boolean>((resolve) => {
|
||||
EmailComposer.getPlugin().hasAccount((result: boolean) => {
|
||||
if (result) {
|
||||
resolve(true);
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if a specific email client is installed on the device.
|
||||
*
|
||||
* @param {string} [app] App id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
|
||||
@CordovaCheck()
|
||||
hasClient(app?: string): Promise<any> {
|
||||
return getPromise<boolean>((resolve) => {
|
||||
if (app) {
|
||||
EmailComposer.getPlugin().hasClient(app, (result: boolean) => {
|
||||
if (result) {
|
||||
resolve(true);
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
EmailComposer.getPlugin().getClients((apps: string[]) => {
|
||||
resolve(apps.length && apps.length > 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of email clients installed on the device.
|
||||
*
|
||||
* @returns {Promise<string[]>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
@Cordova({ platforms: ['Android'] })
|
||||
getClients(): Promise<string[]> {
|
||||
return getPromise<string[]>(resolve => {
|
||||
EmailComposer.getPlugin().getClients((apps: any) => {
|
||||
if (Object.prototype.toString.call(apps) === '[object String]') {
|
||||
apps = [apps];
|
||||
}
|
||||
resolve(apps);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
@@ -150,24 +230,11 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return getPromise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
return getPromise<boolean>((resolve) => {
|
||||
Promise.all([this.hasAccount, this.hasClient(app)])
|
||||
.then((results) => {
|
||||
return resolve(results.length === 2 && results[0] && results[1]);
|
||||
});
|
||||
} else {
|
||||
EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -90,4 +90,13 @@ export class FirebaseAnalytics extends IonicNativePlugin {
|
||||
setCurrentScreen(name: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all analytics data for this instance from the device and resets the app instance ID
|
||||
* @return {Promise<void>} Returns a promise
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
resetAnalyticsData(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface IChannelOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FirebaseX } from '@ionic-native/firebase-x';
|
||||
* import { FirebaseX } from '@ionic-native/firebase-x/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private firebaseX: FirebaseX) { }
|
||||
@@ -302,6 +302,26 @@ export class FirebaseX extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable Crashlytics collection.
|
||||
* @param {boolean} enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable performance collection.
|
||||
* @param {boolean} enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setPerformanceCollectionEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
* @param {string} type
|
||||
@@ -387,10 +407,11 @@ export class FirebaseX extends IonicNativePlugin {
|
||||
* The error message will appear in the Logs section of the non-fatal error event.
|
||||
* Also logs the error message to the native device console.
|
||||
* @param {string} error
|
||||
* @param {object} (optional) a stack trace generated by stacktrace.js
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
logError(error: string): Promise<any> {
|
||||
logError(error: string, stackTrace?: object): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface HTTPResponse {
|
||||
/**
|
||||
* The status number of the response
|
||||
* The HTTP status number of the response or a negative internal error code.
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* The headers of the response
|
||||
* The headers of the response.
|
||||
*/
|
||||
headers: any;
|
||||
headers: {[ key: string ]: string };
|
||||
/**
|
||||
* The URL of the response. This property will be the final URL obtained after any redirects.
|
||||
*/
|
||||
@@ -30,8 +30,9 @@ export interface HTTPResponse {
|
||||
* Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
|
||||
*
|
||||
* Advantages over Javascript requests:
|
||||
* - Background threading - all requests are done in a background thread
|
||||
* - SSL Pinning
|
||||
* - SSL / TLS Pinning
|
||||
* - CORS restrictions do not apply
|
||||
* - Handling of HTTP code 401 - read more at [Issue CB-2415](https://issues.apache.org/jira/browse/CB-2415)
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -70,6 +71,21 @@ export interface HTTPResponse {
|
||||
})
|
||||
@Injectable()
|
||||
export class HTTP extends IonicNativePlugin {
|
||||
/**
|
||||
* This enum represents the internal error codes which can be returned in a HTTPResponse object.
|
||||
* @readonly
|
||||
*/
|
||||
@CordovaProperty()
|
||||
readonly ErrorCode: {
|
||||
GENERIC: number;
|
||||
SSL_EXCEPTION: number;
|
||||
SERVER_NOT_FOUND: number;
|
||||
TIMEOUT: number;
|
||||
UNSUPPORTED_URL: number;
|
||||
NOT_CONNECTED: number;
|
||||
POST_PROCESSING_FAILED: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* This returns an object representing a basic HTTP Authorization header of the form.
|
||||
* @param username {string} Username
|
||||
@@ -118,11 +134,12 @@ export class HTTP extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer. Can be urlencoded, utf8 or json
|
||||
* Set the data serializer which will be used for all future POST, PUT and PATCH requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer.
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setdataserializer
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDataSerializer(serializer: string): void {}
|
||||
setDataSerializer(serializer: 'urlencoded' | 'json' | 'utf8' | 'multipart' | 'raw'): void {}
|
||||
|
||||
/**
|
||||
* Add a custom cookie.
|
||||
@@ -172,26 +189,32 @@ export class HTTP extends IonicNativePlugin {
|
||||
setRequestTimeout(timeout: number): void {}
|
||||
|
||||
/**
|
||||
* Set SSL Cert handling mode, being one of the following values
|
||||
* default: default SSL cert handling using system's CA certs
|
||||
* legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android)
|
||||
* nocheck: disable SSL cert checking, trusting all certs (meant to be used only for testing purposes)
|
||||
* pinned: trust only provided certs
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setsslcertmode
|
||||
* @param {'default' | 'legacy' | 'nocheck' | 'pinned'} mode SSL Cert handling mode
|
||||
* Resolve if it should follow redirects automatically.
|
||||
* @returns {boolean} returns true if it is configured to follow redirects automatically
|
||||
*/
|
||||
@Cordova()
|
||||
setSSLCertMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
@Cordova({ sync: true })
|
||||
getFollowRedirect(): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable following redirects automatically.
|
||||
* @param disable {boolean} Set to true to disable following redirects automatically
|
||||
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
|
||||
* Configure if it should follow redirects automatically.
|
||||
* @param follow {boolean} Set to false to disable following redirects automatically
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setFollowRedirect(follow: boolean): void {}
|
||||
|
||||
/**
|
||||
* Set server trust mode, being one of the following values:
|
||||
* default: default SSL trustship and hostname verification handling using system's CA certs;
|
||||
* legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android);
|
||||
* nocheck: disable SSL certificate checking and hostname verification, trusting all certs (meant to be used only for testing purposes);
|
||||
* pinned: trust only provided certificates;
|
||||
* @see https://github.com/silkimen/cordova-plugin-advanced-http#setservertrustmode
|
||||
* @param {string} mode server trust mode
|
||||
*/
|
||||
@Cordova()
|
||||
disableRedirect(disable: boolean): Promise<void> {
|
||||
setServerTrustMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +223,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
post(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -212,7 +235,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -224,7 +247,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
put(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -236,7 +259,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
patch(url: string, body: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -248,7 +271,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
@@ -260,13 +283,25 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an OPTIONS request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
options(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
@@ -274,7 +309,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @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
|
||||
* @returns {Promise<any>} returns a FileEntry promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
uploadFile(url: string, body: any, headers: any, filePath: string | string[], name: string | string[]): Promise<any> {
|
||||
@@ -287,7 +322,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @param filePath {string} The path to download the file to, including the file name.
|
||||
* @returns {Promise<any>} returns a FileEntry promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<any>} returns a FileEntry promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<any> {
|
||||
@@ -308,16 +343,16 @@ export class HTTP extends IonicNativePlugin {
|
||||
* @param options.name {string} name(s) to be used during upload see uploadFile for detailed information
|
||||
* @param options.responseType {string} response type, defaults to text
|
||||
*
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
sendRequest(
|
||||
url: string,
|
||||
options: {
|
||||
method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'upload' | 'download';
|
||||
method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download';
|
||||
data?: { [index: string]: any };
|
||||
params?: { [index: string]: string | number };
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8';
|
||||
serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart';
|
||||
timeout?: number;
|
||||
headers?: { [index: string]: string };
|
||||
filePath?: string | string[];
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface ImagePickerOptions {
|
||||
* Max width to allow images to be
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* Max height to allow images to be
|
||||
*/
|
||||
@@ -22,6 +23,21 @@ export interface ImagePickerOptions {
|
||||
*/
|
||||
quality?: number;
|
||||
|
||||
/**
|
||||
* Videos allowed?
|
||||
*/
|
||||
allow_video?: boolean;
|
||||
|
||||
/**
|
||||
* the default is the message of the old plugin impl
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* the old plugin impl didn't have it, so passing null by default
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* Choose the format of the return value.
|
||||
* Defined in ImagePicker.OutputType. Default is FILE_URI.
|
||||
@@ -29,6 +45,11 @@ export interface ImagePickerOptions {
|
||||
* DATA_URL : 1, Return image as base64-encoded string
|
||||
*/
|
||||
outputType?: number;
|
||||
|
||||
/**
|
||||
* Disable the iOS popover as seen on iPad
|
||||
*/
|
||||
disable_popover?: boolean;
|
||||
}
|
||||
|
||||
export enum OutputType {
|
||||
|
||||
@@ -123,17 +123,19 @@ export interface InAppBrowserOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type InAppBrowserEventType = 'loadstart' | 'loadstop' | 'loaderror' | 'exit' | 'beforeload' | 'message';
|
||||
export type InAppBrowserEventType = 'loadstart' | 'loadstop' | 'loaderror' | 'exit' | 'beforeload' | 'message' | 'customscheme';
|
||||
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the event name */
|
||||
type: InAppBrowserEventType;
|
||||
type: string;
|
||||
/** the URL that was loaded. */
|
||||
url: string;
|
||||
/** the error code, only in the case of loaderror. */
|
||||
code: number;
|
||||
/** the error message, only in the case of loaderror. */
|
||||
message: string;
|
||||
/** the postMessage data, only in the case of message. */
|
||||
data: any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,6 +180,13 @@ export class InAppBrowserObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to be called after the "beforeload" event to continue the script
|
||||
* @param strUrl {String} The URL the InAppBrowser should navigate to.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
_loadAfterBeforeload(strUrl: string): void {}
|
||||
|
||||
/**
|
||||
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
|
||||
* if the InAppBrowser was already visible.
|
||||
@@ -239,6 +248,28 @@ export class InAppBrowserObject {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that allows you to listen to events happening in the browser.
|
||||
* @param event {string} 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> {
|
||||
return new Observable<InAppBrowserEvent>(
|
||||
(observer: Observer<InAppBrowserEvent>) => {
|
||||
this._objectInstance.addEventListener(
|
||||
event,
|
||||
observer.next.bind(observer)
|
||||
);
|
||||
return () =>
|
||||
this._objectInstance.removeEventListener(
|
||||
event,
|
||||
observer.next.bind(observer)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
115
src/@ionic-native/plugins/mlkit-translate/index.ts
Normal file
115
src/@ionic-native/plugins/mlkit-translate/index.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* This is the language object which will be returned by `downloadModel`, `deleteModel`, `getAvailableModels` and `getDownloadedModels` methods.
|
||||
*/
|
||||
export interface LanguageModel {
|
||||
/**
|
||||
* BCP-47 language code of the language. For example: en
|
||||
* For full list of languages codes, see https://firebase.google.com/docs/ml-kit/translation-language-support
|
||||
*/
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* Display name of the language. For example: English
|
||||
*/
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MLKitTranslate
|
||||
* @description
|
||||
* Plugin that implements MLKit Translation and Language Identification features.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MLKitTranslate } from '@ionic-native/ml-kit-translate';
|
||||
*
|
||||
*
|
||||
* constructor(private mlkitTranslate: MLKitTranslate) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.mlkitTranslate.translate('Hello', 'en', 'es')
|
||||
* .then((resultText: string) => console.log(res))
|
||||
* .catch((error: string) => console.error(error));
|
||||
*
|
||||
* @interfaces
|
||||
* LanguageModel
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MLKitTranslate',
|
||||
plugin: 'cordova-plugin-mlkit-translate',
|
||||
pluginRef: 'MLKitTranslate',
|
||||
repo: 'https://github.com/rigelglen/cordova-plugin-mlkit-translate',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class MLKitTranslate extends IonicNativePlugin {
|
||||
/**
|
||||
* Translates text from one language to another. Requires the source and target languages need to be downloaded.
|
||||
* If not the languages are downloaded in the background automatically.
|
||||
* @param text {string} text to be translated
|
||||
* @param targetLanguage {string} BCP-47 language code of the language to translate to
|
||||
* @param sourceLanguage {string=} (optional) BCP-47 language code of the language to translate to. If not provided, source language is inferred from text
|
||||
* @return {Promise<string>} Returns a promise that resolves with the translated text
|
||||
*/
|
||||
@Cordova()
|
||||
translate(
|
||||
text: string,
|
||||
targetLanguage: string,
|
||||
sourceLanguage?: string
|
||||
): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the language of a string of text.
|
||||
* @param text {string} text to be translated
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the identified language
|
||||
*/
|
||||
@Cordova()
|
||||
identifyLanguage(text: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of language models that have been downloaded to the device.
|
||||
* @return {Promise<LanguageModel[]>} Returns a promise that resolves with an array of languages that have been downloaded.
|
||||
*/
|
||||
@Cordova()
|
||||
getDownloadedModels(): Promise<LanguageModel[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of language models that can be downloaded.
|
||||
* @return {Promise<LanguageModel[]>} Returns a promise that resolves with an array of possible languages that can be downloaded.
|
||||
*/
|
||||
@Cordova()
|
||||
getAvailableModels(): Promise<LanguageModel[]> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a specified language model.
|
||||
* @param code {string} BCP-47 language code of the language to download
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the downloaded language.
|
||||
*/
|
||||
@Cordova()
|
||||
downloadModel(code: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a specified language model.
|
||||
* @param code {string} BCP-47 language code of the language to delete
|
||||
* @return {Promise<LanguageModel>} Returns a promise that resolves with the deleted language.
|
||||
*/
|
||||
@Cordova()
|
||||
deleteModel(code: string): Promise<LanguageModel> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -138,12 +138,13 @@ export class AuthenticationContext {
|
||||
* @param {String} extraQueryParameters
|
||||
* Extra query parameters (optional)
|
||||
* Parameters should be escaped before passing to this method (e.g. using 'encodeURI()')
|
||||
* @param {String} claims Claim parameter. Parameter should be used under conditional access scenarios (optional)
|
||||
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any): Promise<AuthenticationResult> {
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any, claims?: string): Promise<AuthenticationResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,3 +166,20 @@ export class AuthenticationContext {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class AuthenticationSettings {
|
||||
/**
|
||||
* Sets flag to use or skip authentication broker.
|
||||
* By default, the flag value is false and ADAL will not talk to broker.
|
||||
*
|
||||
* @param useBroker Flag to use or skip authentication broker
|
||||
*
|
||||
* @returns {Promise} Promise either fulfilled or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
static setUseBroker(useBroker: boolean): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
87
src/@ionic-native/plugins/pdf-generator/index.ts
Normal file
87
src/@ionic-native/plugins/pdf-generator/index.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface PDFGeneratorOptions {
|
||||
/**
|
||||
* The document size, e.g., A2, A3, or A4.
|
||||
* Only supported on iOS.
|
||||
* The default is 'A4'.
|
||||
*/
|
||||
documentSize?: string;
|
||||
|
||||
/**
|
||||
* Option to change to landscape orientation.
|
||||
* Default is 'portrait'.
|
||||
*/
|
||||
landscape?: 'landscape' | 'portrait';
|
||||
|
||||
/**
|
||||
* The type to be returned, either 'share' or 'base64'.
|
||||
* If 'share is chosen, the PDF is shared with the system capabilities.
|
||||
* Default is 'base64'
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The desired filename the resulting PDF should have.
|
||||
* Default is 'default.pdf'
|
||||
*/
|
||||
fileName?: string;
|
||||
|
||||
/**
|
||||
* Option to set the base URL for pathing.
|
||||
* Default is 'null'.
|
||||
*/
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name PDFGenerator
|
||||
* @description
|
||||
* Simple plugin to generate (offline) pdf. The plugin transforms HTML to PDF and also provide the mechanism to share the pdf to other apps like Mail, etc.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PDFGenerator } from '@ionic-native/pdf-generator';
|
||||
*
|
||||
* constructor(private pdfGenerator: PDFGenerator) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.pdfGenerator.fromURL(url, options).then(base64String => console.log(base64String));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PDFGenerator',
|
||||
plugin: 'cordova-pdf-generator',
|
||||
pluginRef: 'cordova.plugins.pdf',
|
||||
repo: 'https://github.com/cesarvr/pdf-generator',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PDFGenerator extends IonicNativePlugin {
|
||||
/**
|
||||
* Creates a PDF using a URL, it download the document into an in memory Webkit object, and renders it into a PDF.
|
||||
* @param url {string} URL to create a PDF from
|
||||
* @param options {PDFGeneratorOptions} options for PDF generation
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
fromURL(url: string, options?: PDFGeneratorOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a PDF using string with the HTML representation, it download the document into an in memory Webkit object, and renders it into a PDF.
|
||||
* @param data {string} HTML string representation to create a PDF from
|
||||
* @param options {PDFGeneratorOptions} options for PDF generation
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
fromData(data: string, options?: PDFGeneratorOptions): Promise<string> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { PreviewAnyFile } from '@ionic-native/preview-any-file';
|
||||
* import { PreviewAnyFile } from '@ionic-native/preview-any-file/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private previewAnyFile: PreviewAnyFile) { }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -231,6 +231,7 @@ export interface Channel {
|
||||
sound?: string;
|
||||
vibration?: boolean | number[];
|
||||
visibility?: Visibility;
|
||||
badge?: boolean;
|
||||
}
|
||||
|
||||
export type PushEvent = string;
|
||||
@@ -270,7 +271,11 @@ export type PushEvent = string;
|
||||
* id: "testchannel1",
|
||||
* description: "My first test channel",
|
||||
* // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
|
||||
* importance: 3
|
||||
* importance: 3,
|
||||
* //badge is used to if badge appears on the app icon see https://developer.android.com/reference/android/app/NotificationChannel.html#setShowBadge(boolean).
|
||||
* //false = no badge on app icon.
|
||||
* //true = badge on app icon
|
||||
* badge: false
|
||||
* }).then(() => console.log('Channel created'));
|
||||
*
|
||||
* // Delete a channel (Android O and above)
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaCheck, CordovaInstance, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
|
||||
import { CordovaCheck, CordovaInstance, getPromise, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface SecureStorageEchoOptions {
|
||||
android: {
|
||||
/**
|
||||
* See https://github.com/mibrito707/cordova-plugin-secure-storage-echo#sharing-data-android
|
||||
*/
|
||||
packageName?: string;
|
||||
/**
|
||||
* Sets the duration of time (seconds) for which the Private Encryption Key is authorized to be used after the user is successfully authenticated.
|
||||
* See https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder.html#setUserAuthenticationValidityDurationSeconds(int)
|
||||
*/
|
||||
userAuthenticationValidityDuration?: number;
|
||||
/**
|
||||
* Custom title for Confirm Credentials screen.
|
||||
* See https://developer.android.com/reference/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(java.lang.CharSequence,%20java.lang.CharSequence)
|
||||
*/
|
||||
unlockCredentialsTitle?: string;
|
||||
/**
|
||||
* Custom description for Confirm Credentials screen.
|
||||
*/
|
||||
unlockCredentialsDescription?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
@@ -137,13 +160,14 @@ export class SecureStorageEcho extends IonicNativePlugin {
|
||||
* @returns {Promise<SecureStorageEchoObject>}
|
||||
*/
|
||||
@CordovaCheck()
|
||||
create(store: string): Promise<SecureStorageEchoObject> {
|
||||
create(store: string, options?: SecureStorageEchoOptions): Promise<SecureStorageEchoObject> {
|
||||
return getPromise<SecureStorageEchoObject>((res: Function, rej: Function) => {
|
||||
const instance = new (SecureStorageEcho.getPlugin())(
|
||||
() => res(new SecureStorageEchoObject(instance)),
|
||||
rej,
|
||||
store
|
||||
);
|
||||
});
|
||||
const instance = new (SecureStorageEcho.getPlugin())(
|
||||
() => res(new SecureStorageEchoObject(instance)),
|
||||
rej,
|
||||
store,
|
||||
options
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidrequest
|
||||
*/
|
||||
export class ASAuthorizationAppleIDRequest {
|
||||
static readonly ASAuthorizationScopeFullName = 0;
|
||||
static readonly ASAuthorizationScopeEmail = 1;
|
||||
|
||||
requestedScopes?: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents/1412193-phoneticrepresentation
|
||||
*/
|
||||
@@ -116,7 +126,7 @@ export interface AppleSignInErrorResponse extends NSError {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse } from '@ionic-native/sign-in-with-apple/ngx';
|
||||
* import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse, ASAuthorizationAppleIDRequest } from '@ionic-native/sign-in-with-apple/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private signInWithApple: SignInWithApple) { }
|
||||
@@ -124,7 +134,12 @@ export interface AppleSignInErrorResponse extends NSError {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.signInWithApple.signin()
|
||||
* this.signInWithApple.signin({
|
||||
* requestedScopes: [
|
||||
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName,
|
||||
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail
|
||||
* ]
|
||||
* })
|
||||
* .then((res: AppleSignInResponse) => {
|
||||
* // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user
|
||||
* alert('Send token to apple for verification: ' + res.identityToken);
|
||||
@@ -151,11 +166,11 @@ export class SignInWithApple extends IonicNativePlugin {
|
||||
* Starts the authorization flows named during controller initialization
|
||||
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests
|
||||
* @return {Promise<AppleSignInResponse>} Returns a promise when authorization succeeds
|
||||
* @param arg0
|
||||
* @param {ASAuthorizationAppleIDRequest} options
|
||||
* @throws AppleSignInErrorResponse
|
||||
*/
|
||||
@Cordova()
|
||||
signin(arg0: object = null): Promise<AppleSignInResponse> {
|
||||
signin(options: ASAuthorizationAppleIDRequest = {}): Promise<AppleSignInResponse> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,20 +64,23 @@ export class SmartlookGlobalEventPropertyKey {
|
||||
/**
|
||||
* @name Smartlook
|
||||
* @description
|
||||
* Official Smartlook SDK plugin. For more information visit (www.smartlook.com).
|
||||
* Official Smartlook SDK plugin.
|
||||
* Full documentation can be found here: https://smartlook.github.io/docs/sdk/ionic/
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Smartlook } from '@ionic-native/smartlook/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private smartlook: Smartlook) { }
|
||||
* import { Smartlook, SmartlookSetupConfig } from '@ionic-native/smartlook/ngx';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.smartlook.setupAndStartRecording(new SmartlookSetupConfig("key"));
|
||||
*
|
||||
* @Component( ... )
|
||||
* export class AppComponent {
|
||||
* constructor(private smartlook: Smartlook) {
|
||||
* this.platform.ready().then(() => {
|
||||
* this.smartlook.setupAndStartRecording(new SmartlookSetupConfig("YOUR API KEY"));
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @classes
|
||||
* SmartlookSetupConfig
|
||||
|
||||
@@ -56,6 +56,11 @@ export enum LoginListenerType {
|
||||
* If there are multiple accounts active & no account is specified in the login(), then this value is returned indicating that a current account needs to be specified for the login().
|
||||
*/
|
||||
app_requires_current_account = 6
|
||||
|
||||
/**
|
||||
* This value indicates app can proceed with demo mode.
|
||||
*/
|
||||
login_demo = 7
|
||||
}
|
||||
|
||||
export enum LoginType {
|
||||
@@ -259,6 +264,10 @@ export class SettingsResult extends UnviredResult {
|
||||
|
||||
export class SyncResult extends UnviredResult {
|
||||
type: ResultType;
|
||||
/**
|
||||
* This code refers to the HTTP status code obtained during the network call.
|
||||
*/
|
||||
code: number;
|
||||
}
|
||||
|
||||
export class DbResult extends UnviredResult {
|
||||
@@ -347,6 +356,18 @@ export class LoginParameters {
|
||||
*/
|
||||
metadataJSON: string;
|
||||
|
||||
/**
|
||||
* Specify the demo data xml string for demo mode.
|
||||
*/
|
||||
demoData: string;
|
||||
|
||||
|
||||
/**
|
||||
* Set 'true' if the application supports demo mode otherwise set 'false'.
|
||||
*/
|
||||
demoModeRequired: boolean;
|
||||
|
||||
|
||||
/*
|
||||
* Set this value to true to persist web application database. By default, this value is false.
|
||||
*/
|
||||
@@ -638,6 +659,23 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This api initializes the Unvired Application.
|
||||
* @param loginParameters Set of parameters to be passed the loginWithDemoData()
|
||||
* For Example:
|
||||
* ```
|
||||
* let loginParameters = new LoginParameters()
|
||||
* loginParameters.appName = 'UNVIRED_DIGITAL_FORMS'
|
||||
* loginParameters.metadataPath = '../assets/metadata.json'
|
||||
* loginParameters.loginType = LoginType.unvired
|
||||
* loginParameters.demoData = "<tag></tag>"
|
||||
* ```
|
||||
*/
|
||||
@Cordova()
|
||||
loginWithDemoData(loginParameters: LoginParameters): Promise<LoginResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the last active user.
|
||||
*/
|
||||
@@ -803,10 +841,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
* Mobile: Or a Sqlite whereClause ( without the 'where' keyword )
|
||||
* Example:
|
||||
* ```
|
||||
* # Mobile: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* this.unviredSDK.dbSelect('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'")
|
||||
* # Mobile & Browser: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"})
|
||||
* ```
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -855,11 +891,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
* Mobile: Or a Sqlite whereClause ( without the 'where' keyword )
|
||||
* Example:
|
||||
* ```
|
||||
* Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* # Mobile
|
||||
* # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* this.unviredSDK.dbDelete('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'")
|
||||
* # Browser & Mobile
|
||||
* this.unviredSDK.dbDelete('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"})
|
||||
* ```
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -875,11 +908,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
* Mobile: Or a Sqlite where Clause ( without the 'where' keyword )
|
||||
* Example:
|
||||
* ```
|
||||
* Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* # Mobile
|
||||
* # Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56
|
||||
* this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'")
|
||||
* # Mobile & Browser
|
||||
* this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, {"FORM_ID": "5caed815892215034dacad56"})
|
||||
* ```
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -888,12 +918,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* Execute SQL Statement
|
||||
* Execute a SQL statement
|
||||
* @param query {string} SQL Statement.
|
||||
* Example:
|
||||
* ```
|
||||
* this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39')
|
||||
* this.unviredSDK.dbExecuteStatement("SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = '39'")
|
||||
* ```
|
||||
*/
|
||||
@Cordova()
|
||||
@@ -902,7 +931,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html )
|
||||
* @param savePoint {string} Name of savepoint
|
||||
* Example:
|
||||
@@ -916,7 +944,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* Release Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html )
|
||||
* @param savePoint {string} Name of savepoint
|
||||
* ```
|
||||
@@ -929,7 +956,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* Rollback Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html )
|
||||
* @param savePoint {string} Name of the savepoint
|
||||
* Example:
|
||||
@@ -943,7 +969,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* Begin database transaction.
|
||||
* For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html )
|
||||
* Example:
|
||||
@@ -957,7 +982,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported in mobile only.
|
||||
* End database transaction.
|
||||
* For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html )
|
||||
* Example:
|
||||
|
||||
878
src/@ionic-native/plugins/wifi-wizard-2/index.ts
Normal file
878
src/@ionic-native/plugins/wifi-wizard-2/index.ts
Normal file
@@ -0,0 +1,878 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaFunctionOverride, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface WifiConfig {
|
||||
SSID: string;
|
||||
isHiddenSSID: boolean;
|
||||
auth: {
|
||||
algorithm: string;
|
||||
password?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WifiScanResultsOptions {
|
||||
numLevels: number;
|
||||
}
|
||||
|
||||
export interface WifiScanOptions extends WifiScanResultsOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name WifiWizard2
|
||||
* @description
|
||||
* WifiWizard2 enables Wifi management for both Android and iOS applications within Cordova/Phonegap projects.
|
||||
*
|
||||
* This project is a fork of the WifiWizard plugin with fixes and updates, as well as patches taken from the Cordova Network Manager plugin.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { WifiWizard2 } from '@ionic-native/wifi-wizard-2/ngx';
|
||||
*
|
||||
*
|
||||
* constructor(private wifiWizard2: WifiWizard2) { }
|
||||
*
|
||||
*
|
||||
* # Global Functions
|
||||
* These are functions that can be used by both Android and iOS applications
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getConnectedSSID()
|
||||
* ```
|
||||
* - Returns connected network SSID (only if connected) in success callback, otherwise fail callback will be called (if not connected or unable to retrieve)
|
||||
* - This does **NOT** return the BSSID if unable to obtain SSID (like original WifiWizard did)
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getConnectedBSSID()
|
||||
* ```
|
||||
* - Same as above, except BSSID (mac) is returned
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.timeout(delay)
|
||||
* ```
|
||||
* - `delay` should be time in milliseconds to delay
|
||||
* - Helper async timeout delay, `delay` is optional, default is 2000ms = 2 seconds
|
||||
* - This method always returns a resolved promise after the delay, it will never reject or throw an error
|
||||
*
|
||||
* **Example inside async function**
|
||||
* ```typescript
|
||||
* async function example(){
|
||||
* await this.wifiWizard2.timeout(4000);
|
||||
* // do something after 4 seconds
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* **Example inside standard non-async function**
|
||||
* ```typescript
|
||||
* function example(){
|
||||
* this.wifiWizard2.timeout(4000).then( function(){
|
||||
* // do something after waiting 4 seconds
|
||||
* }):
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `TIMEOUT_WAITING_FOR_SCAN` on timeout waiting for scan 10 seconds +
|
||||
* - `SCAN_FAILED` if unable to start scan
|
||||
*
|
||||
* # iOS Functions
|
||||
* For functionality, you need to note the following:
|
||||
* - Connect/Disconnect only works for iOS11+
|
||||
* - Can't run in the simulator so you need to attach an actual device when building with xCode
|
||||
* - Will ensure 'HotspotConfiguration' and 'NetworkExtensions' capabilities are added to your xCode project
|
||||
* - To connect to open network omit `ssidPassword` or call with `false`
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.iOSConnectNetwork(ssid, ssidPassword)
|
||||
* ```
|
||||
* ```typescript
|
||||
* this.wifiWizard2.iOSDisconnectNetwork(ssid)
|
||||
* ```
|
||||
*
|
||||
* # Android Functions
|
||||
* - **WifiWizard2** *will automagically try to enable WiFi if it's disabled when calling any android related methods that require WiFi to be enabled*
|
||||
*
|
||||
* ## Connect vs Enable
|
||||
* When writing Android Java code, there is no `connect` methods, you basically either `enable` or `disable` a network. In the original versions of WifiWizard the `connect` method would basically just call `enable` in Android.
|
||||
* I have changed the way this works in WifiWizard2 version 3.0.0+, converting it to a helper method to eliminate having to call `formatWifiConfig` then `add` and then `enable` ... the `connect` method will now automatically call `formatWifiConfig`, then call `add` to either add or update the network configuration, and then call `enable`.
|
||||
* If the connect method is unable to update existing network configuration (added by user or other apps), but there is a valid network ID, it will still attempt to enable that network ID.
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.connect(ssid, bindAll, password, algorithm, isHiddenSSID)
|
||||
* ```
|
||||
* - `ssid` should be the SSID to connect to *required*
|
||||
* - `bindAll` should be set to `true` to tell Android to route all connections from your Android app, through the wifi connection (default is `false`) *optional*
|
||||
* - See `WifiWizard2.enable` for more details regarding `bindAll` feature
|
||||
* - `algorithm` and `password` is not required if connecting to an open network
|
||||
* - Currently `WPA` and `WEP` are only supported algorithms
|
||||
* - For `WPA2` just pass `WPA` as the algorithm
|
||||
* - Set `isHiddenSSID` to `true` if the network you're connecting to is hidden
|
||||
* - These arguments are the same as for `formatWifiConfig`
|
||||
* - This method essentially calls `formatWifiConfig` then `add` then `enable`
|
||||
* - If unable to update network configuration (was added by user or other app), but a valid network ID exists, this method will still attempt to enable the network
|
||||
* - Promise will not be returned until method has verified that connection to WiFi was in completed state (waits up to 60 seconds)
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
*
|
||||
* - `CONNECT_FAILED_TIMEOUT` unable to verify connection, timed out after 60 seconds
|
||||
* - `INVALID_NETWORK_ID_TO_CONNECT` Unable to connect based on generated wifi config
|
||||
* - `INTERPUT_EXCEPT_WHILE_CONNECTING` Interupt exception while waiting for connection
|
||||
*
|
||||
*
|
||||
*
|
||||
* ## Disconnect vs Disable
|
||||
* Same as above for Connect vs Enable, except in this situation, `disconnect` will first disable the network, and then attempt to remove it (if SSID is passed)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.disconnect(ssid)
|
||||
* ```
|
||||
* - `ssid` can either be an SSID (string) or a network ID (integer)
|
||||
* - `ssid` is **OPTIONAL** .. if not passed, will disconnect current WiFi (almost all Android versions now will just automatically reconnect to last wifi after disconnecting)
|
||||
* - If `ssid` is provided, this method will first attempt to `disable` and then `remove` the network
|
||||
* - If you do not want to remove network configuration, use `disable` instead
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `DISCONNECT_NET_REMOVE_ERROR` Android returned error when removing wifi configuration
|
||||
* - `DISCONNECT_NET_DISABLE_ERROR` Unable to connect based on generated wifi config
|
||||
* - `DISCONNECT_NET_ID_NOT_FOUND` Unable to determine network ID to disconnect/remove (from passed SSID)
|
||||
* - `ERROR_DISCONNECT` - Android error disconnecting wifi (only when SSID is not passed)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.formatWifiConfig(ssid, password, algorithm, isHiddenSSID)
|
||||
* ```
|
||||
* - `algorithm` and `password` is not required if connecting to an open network
|
||||
* - Currently `WPA` and `WEP` are only supported algorithms
|
||||
* - For `WPA2` just pass `WPA` as the algorithm
|
||||
* - Set `isHiddenSSID` to `true` if the network you're connecting to is hidden
|
||||
* ```typescript
|
||||
* this.wifiWizard2.formatWPAConfig(ssid, password, isHiddenSSID)
|
||||
* ```
|
||||
* - This is just a helper method that calls `WifiWizard2.formatWifiConfig( ssid, password, 'WPA', isHiddenSSID );`
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.add(wifi)
|
||||
* ```
|
||||
* - `wifi` must be an object formatted by `formatWifiConfig`, this **must** be done before calling `enable`
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `AUTH_TYPE_NOT_SUPPORTED` - Invalid auth type specified
|
||||
* - `ERROR_ADDING_NETWORK` - Android returned `-1` specifying error adding network
|
||||
* - `ERROR_UPDATING_NETWORK` - Same as above, except an existing network ID was found, and unable to update it
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.remove(ssid)
|
||||
* ```
|
||||
* - `ssid` can either be an SSID (string) or a network ID (integer)
|
||||
* - Please note, most newer versions of Android will only allow wifi to be removed if created by your application
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `UNABLE_TO_REMOVE` Android returned failure in removing network
|
||||
* - `REMOVE_NETWORK_NOT_FOUND` Unable to determine network ID from passed SSID
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.listNetworks()
|
||||
* ```
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.scan([options])
|
||||
* ```
|
||||
* - Same as calling `startScan` and then `getScanResults`, except this method will only resolve the promise after the scan completes and returns the results.
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.startScan()
|
||||
* ```
|
||||
* - It is recommended to just use the `scan` method instead of `startScan`
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `STARTSCAN_FAILED` Android returned failure in starting scan
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getScanResults([options])
|
||||
* ```
|
||||
* - `getScanResults` should only be called after calling `startScan` (it is recommended to use `scan` instead as this starts the scan, then returns the results)
|
||||
* - `[options]` is optional, if you do not want to specify, just pass `success` callback as first parameter, and `fail` callback as second parameter
|
||||
* - Retrieves a list of the available networks as an array of objects and passes them to the function listHandler. The format of the array is:
|
||||
* ```typescript
|
||||
* networks = [
|
||||
* { "level": signal_level, // raw RSSI value
|
||||
* "SSID": ssid, // SSID as string, with escaped double quotes: "\"ssid name\""
|
||||
* "BSSID": bssid // MAC address of WiFi router as string
|
||||
* "frequency": frequency of the access point channel in MHz
|
||||
* "capabilities": capabilities // Describes the authentication, key management, and encryption schemes supported by the access point.
|
||||
* "timestamp": timestamp // timestamp of when the scan was completed
|
||||
* "channelWidth":
|
||||
* "centerFreq0":
|
||||
* "centerFreq1":
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* - `channelWidth` `centerFreq0` and `centerFreq1` are only supported on API > 23 (Marshmallow), any older API will return null for these values
|
||||
*
|
||||
* An options object may be passed. Currently, the only supported option is `numLevels`, and it has the following behavior:
|
||||
*
|
||||
* - if `(n == true || n < 2)`, `*.getScanResults({numLevels: n})` will return data as before, split in 5 levels;
|
||||
* - if `(n > 1)`, `*.getScanResults({numLevels: n})` will calculate the signal level, split in n levels;
|
||||
* - if `(n == false)`, `*.getScanResults({numLevels: n})` will use the raw signal level;
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.isWifiEnabled()
|
||||
* ```
|
||||
* - Returns boolean value of whether Wifi is enabled or not
|
||||
* ```typescript
|
||||
* this.wifiWizard2.setWifiEnabled(enabled)
|
||||
* ```
|
||||
* - Pass `true` for `enabled` parameter to set Wifi enabled
|
||||
* - You do not need to call this function to set WiFi enabled to call other methods that require wifi enabled. This plugin will automagically enable WiFi if a method is called that requires WiFi to be enabled.
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `ERROR_SETWIFIENABLED` wifi state does not match call (enable or disable)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getConnectedNetworkID()
|
||||
* ```
|
||||
* - Returns currently connected network ID in success callback (only if connected), otherwise fail callback will be called
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `GET_CONNECTED_NET_ID_ERROR` Unable to determine currently connected network ID (may not be connected)
|
||||
*
|
||||
* ## New to 3.1.1+
|
||||
* ```typescript
|
||||
* this.wifiWizard2.resetBindAll()
|
||||
* ```
|
||||
* - Disable bindAll to WiFi network without disconnecting from WiFi
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.setBindAll()
|
||||
* ```
|
||||
* - Enable bindAll to WiFi network without disconnecting from WiFi
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.canConnectToInternet()
|
||||
* ```
|
||||
*
|
||||
* - Returns boolean, true or false, if device is able to connect to https://www.google.com via HTTP connection (since ping is unreliable)
|
||||
* - Unknown errors will still be thrown like all other async functions
|
||||
* - If you called `connect` or `enable` and passed `true` for `bindAll`, your application will force the ping through wifi connection.
|
||||
* - If you did not pass `true` (or passed `false`) for `bindAll`, and the wifi does not have internet connection, Android Lollipop+ (API 21+) will use cell connection to ping (due to Android using cell connection when wifi does not have internet) [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html)
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.canConnectToRouter()
|
||||
* ```
|
||||
* - As `canPingWifiRouter` is notoriously unreliable, this method uses HTTP connection to test if able to connect to router (as most routers should have web server running on port 80)
|
||||
* - Unknown errors will still be thrown like all other async functions
|
||||
* - This is useful for testing to make sure that your Android app is able to connect to the private network after connecting to WiFi
|
||||
* - This was added for testing the `bindAll` feature to support issues with Android Lollipop+ (API 21+) not routing calls through WiFi if WiFi does not have internet connection [See Android Blog](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html)
|
||||
* - Attempts to connect router IP HTTP server on port 80 (example: `http://192.168.0.1/` where `192.168.0.1` is the automatically detected IP address)
|
||||
*
|
||||
* ## New to 3.0.0+
|
||||
* ```typescript
|
||||
* this.wifiWizard2.isConnectedToInternet()
|
||||
* ```
|
||||
*
|
||||
* - Returns boolean, true or false, if device is able to ping 8.8.8.8
|
||||
* - Unknown errors will still be thrown like all other async functions
|
||||
* - If you called `connect` or `enable` and passed `true` for `bindAll`, your application will force the ping through wifi connection.
|
||||
* - If you did not pass `true` (or passed `false`) for `bindAll`, and the wifi does not have internet connection, Android Lollipop+ (API 21+) will use cell connection to ping (due to Android using cell connection when wifi does not have internet) [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.canPingWifiRouter()
|
||||
* ```
|
||||
*
|
||||
* - Returns boolean, true or false, if device is able to ping the connected WiFi router IP (obtained from DHCP info)
|
||||
* - Version 3.1.1+ uses HTTP connection to test if able to connect to router (as ping previous did not work)
|
||||
* - Unknown errors will still be thrown like all other async functions
|
||||
* - This is useful for testing to make sure that your Android app is able to connect to the private network after connecting to WiFi
|
||||
* - This was added for testing the `bindAll` feature to support issues with Android Lollipop+ (API 21+) not routing calls through WiFi if WiFi does not have internet connection [See Android Blog](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.enableWifi()
|
||||
* ```
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.disableWifi()
|
||||
* ```
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getWifiIP()
|
||||
* ```
|
||||
* - Returns IPv4 address of currently connected WiFi, or rejects promise if IP not found or wifi not connected
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getWifiRouterIP()
|
||||
* ```
|
||||
* - Returns IPv4 WiFi router IP from currently connected WiFi, or rejects promise if unable to determine, or wifi not connected
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `NO_VALID_IP_IDENTIFIED` if unable to determine a valid IP (ip returned from device is `0.0.0.0`)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getWifiIPInfo()
|
||||
* ```
|
||||
* - Returns a JSON object with IPv4 address and subnet `{"ip": "192.168.1.2", "subnet": "255.255.255.0" }` or rejected promise if not found or not connected
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `NO_VALID_IP_IDENTIFIED` if unable to determine a valid IP (ip returned from device is `0.0.0.0`)
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.reconnect()
|
||||
* ```
|
||||
* - Reconnect to the currently active access point, **if we are currently disconnected.**
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `ERROR_RECONNECT` Android returned error when reconnecting
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.reassociate()
|
||||
* ```
|
||||
* - Reconnect to the currently active access point, **even if we are already connected.**
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `ERROR_REASSOCIATE` Android returned error when reassociating
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.getSSIDNetworkID(ssid)
|
||||
* ```
|
||||
* - Get Android Network ID from passed SSID
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.disable(ssid)
|
||||
* ```
|
||||
* - `ssid` can either be an SSID (string) or a network ID (integer)
|
||||
* - Disable the passed SSID network
|
||||
* - Please note that most newer versions of Android will only allow you to disable networks created by your application
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `UNABLE_TO_DISABLE` Android returned failure in disabling network
|
||||
* - `DISABLE_NETWORK_NOT_FOUND` Unable to determine network ID from passed SSID to disable
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.requestPermission()
|
||||
* ```
|
||||
* - Request `ACCESS_FINE_LOCATION` permssion
|
||||
* - This Android permission is required to run `scan`, `startStart` and `getScanResults`
|
||||
* - You can request permission by running this function manually, or WifiWizard2 will automagically request permission when one of the functions above is called
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* - `PERMISSION_DENIED` user denied permission on device
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* this.wifiWizard2.enable(ssid, bindAll, waitForConnection)
|
||||
* ```
|
||||
* - `ssid` can either be an SSID (string) or a network ID (integer)
|
||||
* - `bindAll` should be set to `true` to tell Android to route all connections from your Android app, through the wifi connection
|
||||
* - Android Lollipop+ (API 21+) will not route connections to the WiFi device if it does not have internet connection. Passing `true` to `bindAll` will force Android to route connections from your Android app through Wifi, regardless of internet connection.
|
||||
* - If you are having problems connecting to a local IP through WiFi because it does not have internet, try enabling `bindAll` and this should fix the problem.
|
||||
* - During my testing, some versions of Android (5.0 - 7.1.2) would still route connections through WiFi without internet, but it was random that some versions would and would not work.
|
||||
* - Testing Android Oreo+ (8.0.0+) if wifi does not have internet, 100% of the time it would NOT route connections through WiFi, so you *must* enable this for Oreo or newer to route connections from your application through wifi without internet.
|
||||
* - When `bindAll` is enabled, *ALL* connections from your app will be routed through WiFi, until you call `disconnect` or `disable`
|
||||
* - See the Google Android Blog for [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html)
|
||||
* - This feature *ONLY* works for Android Lollipop+ (API 21+), if device is running API older than 21, `bindall` will be ignored (as API older than 21 does this by default)
|
||||
* - Enable the passed SSID network
|
||||
* - You **MUST** call `WifiWizard2.add(wifi)` before calling `enable` as the wifi configuration must exist before you can enable it (or previously used `connect` without calling `disconnect`)
|
||||
* - This method does NOT wait or verify connection to wifi network, pass `true` to `waitForConnection` to only return promise once connection is verified in COMPLETED state to specific `ssid`
|
||||
*
|
||||
* **Thrown Errors**
|
||||
*
|
||||
* `UNABLE_TO_ENABLE` - Android returned `-1` signifying failure enabling
|
||||
*
|
||||
* # Installation
|
||||
*
|
||||
* ## Master
|
||||
*
|
||||
* Run ```cordova plugin add https://github.com/tripflex/wifiwizard2```
|
||||
*
|
||||
* To install from the master branch (latest on GitHub)
|
||||
*
|
||||
* To install a specific branch (add `#tag` replacing `tag` with tag from this repo, example:
|
||||
* ```cordova plugin add https://github.com/tripflex/wifiwizard2#v3.1.1```
|
||||
*
|
||||
* Find available tags here:
|
||||
* https://github.com/tripflex/WifiWizard2/tags
|
||||
*
|
||||
*
|
||||
* If you are wanting to have the latest and greatest stable version, then run the 'Releases' command below.
|
||||
*
|
||||
* ## Releases
|
||||
* Run ```cordova plugin add cordova-plugin-wifiwizard2```
|
||||
*
|
||||
* ## Meteor
|
||||
* To install and use this plugin in a Meteor project, you have to specify the exact version from NPM repository:
|
||||
* [https://www.npmjs.com/package/cordova-plugin-wifiwizard2](https://www.npmjs.com/package/cordova-plugin-wifiwizard2)
|
||||
*
|
||||
* As of April 4th 2019, the latest version is 3.1.1:
|
||||
*
|
||||
* ```meteor add cordova:cordova-plugin-wifiwizard2@3.1.1```
|
||||
*
|
||||
* # Errors/Rejections
|
||||
* Methods now return formatted string errors as detailed below, instead of returning generic error messages. This allows you to check yourself what specific error was returned, and customize the error message.
|
||||
* In an upcoming release I may add easy ways to override generic messages, or set your own, but for now, errors returned can be found below each method/function.
|
||||
*
|
||||
* ## Generic **Thrown Errors**
|
||||
* `WIFI_NOT_ENABLED`
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'WifiWizard2',
|
||||
plugin: 'cordova-plugin-wifiwizard2',
|
||||
pluginRef: 'WifiWizard2',
|
||||
repo: 'https://github.com/tripflex/WifiWizard2',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class WifiWizard2 extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Connect to network on iOS device
|
||||
* @param ssid
|
||||
* @param ssidPassword Password if connecting to WPA/WPA2 network (omit or use false to connect to open network)
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
iOSConnectNetwork(ssid: string, ssidPassword: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from SSID on iOS device
|
||||
* @param ssid
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
iOSDisconnectNetwork(ssid: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add wifi network configuration
|
||||
* @param wifiConfig Must be object created by formatWifiConfig()
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
add(wifiConfig: WifiConfig): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove wifi network configuration
|
||||
* @param {string|number} [ssid]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
remove(ssid: string | number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect network with specified SSID
|
||||
*
|
||||
* This method will first add the wifi configuration, then enable the network, returning promise when connection is verified.
|
||||
*
|
||||
* @param {string|number} [ssid]
|
||||
* @param {boolean} [bindAll=false] - Whether or not to bind all connections from app, through WiFi connection
|
||||
* @param {string} [password=]
|
||||
* @param {string} [algorithm=NONE] - WPA, WPA (for WPA2), WEP or NONE (NONE by default)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
connect(ssid: string | number, bindAll?: boolean, password?: string, algorithm?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect (current if SSID not supplied)
|
||||
*
|
||||
* This method, if passed an SSID, will first disable the network, and then remove it from the device. To only "disconnect" (ie disable in android),
|
||||
* call WifiWizard2.disable() instead of disconnect.
|
||||
*
|
||||
* @param {string|number} [ssid=all]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
disconnect(ssid: string | number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Network
|
||||
* @param {string|number} [ssid]
|
||||
* @param {boolean} [bindAll=false] - Whether or not to bind all network requests to this wifi network
|
||||
* @param {boolean} [waitForConnection=false] - Whether or not to wait before resolving promise until connection to wifi is verified
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
enable(ssid: string | number, bindAll?: boolean, waitForConnection?: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Network
|
||||
* @param {string|number} [ssid]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
disable(ssid: string | number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconnect to the currently active access point, even if we are already connected.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
reassociate(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconnect to the currently active access point, if we are currently disconnected.
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
reconnect(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns currently configured networks
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
listNetworks(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start network scan and return results
|
||||
* @param options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
scan(options?: WifiScanOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start wifi network scan (results can be retrieved with getScanResults)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
startScan(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wifi scan results (must call startScan first, or just use scan())
|
||||
* @param options
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getScanResults(options: WifiScanResultsOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if WiFi is enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
isWifiEnabled(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or Disable WiFi
|
||||
* @param enabled
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
setWifiEnabled(enabled: boolean): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable WiFi
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
enableWifi(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable WiFi
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true,
|
||||
platforms: ['Android']
|
||||
})
|
||||
disableWifi(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind Network
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
resetBindAll(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind Network
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
setBindAll(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wifi Router IP from DHCP
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getWifiRouterIP(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wifi IP
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getWifiIP(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Wifi IP and Subnet Address
|
||||
*
|
||||
* This method returns a JSON object similar to: { "ip": "0.0.0.0", "subnet": "0.0.0.0" }
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getWifiIPInfo(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Network ID from SSID
|
||||
* @param {string|number} [ssid]
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getSSIDNetworkID(ssid: string | number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currently connected network ID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getConnectedNetworkID(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currently connected network SSID
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getConnectedSSID(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currently connected network BSSID/MAC
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
getConnectedBSSID(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current WiFi connection has connection to the internet
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
isConnectedToInternet(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we can ping current WiFi router IP address
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
canPingWifiRouter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we can connect via HTTP current WiFi router IP address
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
canConnectToRouter(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current WiFi connection can connect to internet (checks connection to google.com)
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
canConnectToInternet(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request ACCESS_FINE_LOCATION permission
|
||||
*
|
||||
* This permission is required by Android to return scan results, you can manually request it prior to running `scan`
|
||||
* or this plugin will automatically do it when the scan is ran.
|
||||
*
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
otherPromise: true
|
||||
})
|
||||
requestPermission(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format WiFi configuration for Android Devices
|
||||
* @param {string|number} [ssid]
|
||||
* @param {string} [password]
|
||||
* @param {string} [algorithm]
|
||||
* @param {boolean} [isHiddenSSID]
|
||||
* @returns {WifiConfig|boolean}
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
formatWifiConfig(ssid: string | number, password: string, algorithm: string, isHiddenSSID: boolean): WifiConfig | boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format WPA WiFi configuration for Android Devices
|
||||
* @param {string|number} [ssid]
|
||||
* @param {string} password
|
||||
* @param {boolean} isHiddenSSID
|
||||
* @returns {WifiConfig|boolean}
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
formatWPAConfig(ssid: string | number, password: string, isHiddenSSID: boolean): WifiConfig | boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format WiFi SSID String
|
||||
* @param ssid
|
||||
* @returns {*}
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
formatWifiString(ssid: string | number): string | number {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous Sleep/Timeout `await this.timeout()`
|
||||
* @param delay the amount of time to wait (default 2 seconds)
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
timeout(delay?: number): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -142,13 +142,15 @@ export class UserPreferencesMethods extends NestedObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name WonderPush
|
||||
* @name Push Notifications - WonderPush
|
||||
* @description
|
||||
*
|
||||
* Push notification delivery with the WonderPush service.
|
||||
* Send unlimited push notifications to iOS and Android devices.
|
||||
*
|
||||
* Get started in minutes: [Ionic Quickstart Guide](https://docs.wonderpush.com/docs/ionic-quickstart).
|
||||
*
|
||||
* Advanced segmentation, automation and personalization of push messages for €1 per 1000 subscribers.
|
||||
*
|
||||
* Requires the Cordova plugin `wonderpush-cordova-sdk`.
|
||||
*
|
||||
* [WonderPush push notifications](https://www.wonderpush.com) are the most effective way
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
"inlineSources": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": [
|
||||
"src/@ionic-native/core/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"src/@ionic-native/core/**/*.spec.ts"
|
||||
]
|
||||
"include": ["src/@ionic-native/core/**/*.ts"],
|
||||
"exclude": ["node_modules", "src/@ionic-native/core/**/*.spec.ts"]
|
||||
}
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
"inlineSources": true,
|
||||
"inlineSourceMap": true
|
||||
},
|
||||
"include": [
|
||||
"src/@ionic-native/plugins/**/*.ts"
|
||||
],
|
||||
"include": ["src/@ionic-native/plugins/**/*.ts"],
|
||||
"angularCompilerOptions": {
|
||||
"genDir": "aot"
|
||||
}
|
||||
},
|
||||
"plugins": [{ "name": "typescript-tslint-plugin" }]
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"ter-no-proto": false,
|
||||
"callable-types": false,
|
||||
"ordered-imports": false,
|
||||
"prefer-conditional-expression": false
|
||||
"prefer-conditional-expression": false,
|
||||
"max-classes-per-file": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user