refactor(): applied new lint rules

This commit is contained in:
Daniel 2018-03-23 10:42:10 +01:00
parent 28e95ea66e
commit d7829e4012
35 changed files with 1140 additions and 793 deletions

View File

@ -1,3 +1,5 @@
import * as _ from 'lodash';
export function checkReady() {
const DEVICE_READY_TIMEOUT = 5000;
@ -9,13 +11,17 @@ export function checkReady() {
let didFireReady = false;
document.addEventListener('deviceready', () => {
console.log(`Ionic Native: deviceready event fired after ${(Date.now() - before)} ms`);
console.log(
`Ionic Native: deviceready event fired after ${Date.now() - before} ms`
);
didFireReady = true;
});
setTimeout(() => {
if (!didFireReady && !!window.cordova) {
console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
if (!didFireReady && !_.isUndefined(window.cordova)) {
console.warn(
`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`
);
}
}, DEVICE_READY_TIMEOUT);
}

View File

@ -1,44 +1,74 @@
import { CordovaOptions } from './interfaces';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
import * as _ from 'lodash';
import { Observable } from 'rxjs/Observable';
import { CordovaOptions } from './interfaces';
declare const window: any;
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
export function getPromise<T>(callback: (resolve: Function, reject?: Function) => any): Promise<T> {
export function getPromise<T>(
callback: (resolve: Function, reject?: Function) => any
): Promise<T> {
const tryNativePromise = () => {
if (Promise) {
return new Promise<T>((resolve, reject) => {
callback(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.');
console.error(
'No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.'
);
}
};
if (window.angular) {
const injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector();
const injector = window.angular
.element(document.querySelector('[ng-app]') || document.body)
.injector();
if (injector) {
let $q = injector.get('$q');
const $q = injector.get('$q');
return $q((resolve: Function, reject: Function) => {
callback(resolve, reject);
});
}
console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.');
console.warn(
`Angular 1 was detected but $q couldn't be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won't trigger an automatic digest when promises resolve.`
);
}
return tryNativePromise();
}
export function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: CordovaOptions = {}) {
export function wrapPromise(
pluginObj: any,
methodName: string,
args: any[],
opts: CordovaOptions = {}
) {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
pluginResult = callCordovaPlugin(
pluginObj,
methodName,
args,
opts,
(...args: any[]) => resolve(args),
(...args: any[]) => reject(args)
);
} else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
pluginResult = callCordovaPlugin(
pluginObj,
methodName,
args,
opts,
resolve,
reject
);
}
rej = reject;
});
@ -46,13 +76,18 @@ export function wrapPromise(pluginObj: any, methodName: string, args: any[], opt
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
p.catch(() => {});
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
}
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
function wrapOtherPromise(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {}
) {
return getPromise((resolve: Function, reject: Function) => {
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
@ -67,14 +102,33 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts:
});
}
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
function wrapObservable(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {}
) {
return new Observable(observer => {
let pluginResult;
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
pluginResult = callCordovaPlugin(
pluginObj,
methodName,
args,
opts,
(...args: any[]) => observer.next(args),
(...args: any[]) => observer.error(args)
);
} else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
pluginResult = callCordovaPlugin(
pluginObj,
methodName,
args,
opts,
observer.next.bind(observer),
observer.error.bind(observer)
);
}
if (pluginResult && pluginResult.error) {
@ -85,12 +139,23 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
try {
if (opts.clearFunction) {
if (opts.clearWithArgs) {
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
return callCordovaPlugin(
pluginObj,
opts.clearFunction,
args,
opts,
observer.next.bind(observer),
observer.error.bind(observer)
);
}
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
}
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.warn(
'Unable to clear the previous observable watch for',
pluginObj.constructor.getPluginName(),
methodName
);
console.warn(e);
}
};
@ -113,16 +178,26 @@ function wrapEventObservable(event: string, element: any): Observable<any> {
return Observable.fromEvent(element, event);
}
/**
* Checks if plugin/cordova is available
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
export function checkAvailability(
pluginRef: string,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
pluginObj: any,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
plugin: any,
methodName?: string,
pluginName?: string
): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage;
if (typeof plugin === 'string') {
@ -135,7 +210,10 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
pluginInstance = getPlugin(pluginRef);
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
if (
!pluginInstance ||
(!!methodName && typeof pluginInstance[methodName] === 'undefined')
) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return ERR_CORDOVA_NOT_AVAILABLE;
@ -152,11 +230,23 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
* Checks if _objectInstance exists and has the method/property
* @private
*/
export function instanceAvailability(pluginObj: any, methodName?: string): boolean {
return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined');
export function instanceAvailability(
pluginObj: any,
methodName?: string
): boolean {
return (
pluginObj._objectInstance &&
(!methodName ||
typeof pluginObj._objectInstance[methodName] !== 'undefined')
);
}
export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Function): any {
export function setIndex(
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
): any {
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
@ -175,12 +265,19 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
resolve(result);
}
});
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
let obj: any = {};
} else if (
opts.callbackStyle === 'object' &&
opts.successName &&
opts.errorName
) {
const obj: any = {};
obj[opts.successName] = resolve;
obj[opts.errorName] = reject;
args.push(obj);
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
} else if (
typeof opts.successIndex !== 'undefined' ||
typeof opts.errorIndex !== 'undefined'
) {
const setSuccessIndex = () => {
// If we've specified a success/error index
if (opts.successIndex > args.length) {
@ -206,8 +303,6 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
setSuccessIndex();
setErrorIndex();
}
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
@ -217,7 +312,14 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
return args;
}
export function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) {
export function callCordovaPlugin(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
) {
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
args = setIndex(args, opts, resolve, reject);
@ -230,17 +332,24 @@ export function callCordovaPlugin(pluginObj: any, methodName: string, args: any[
} else {
return availabilityCheck;
}
}
export function callInstance(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) {
export function callInstance(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
) {
args = setIndex(args, opts, resolve, reject);
if (instanceAvailability(pluginObj, methodName)) {
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
return pluginObj._objectInstance[methodName].apply(
pluginObj._objectInstance,
args
);
}
}
export function getPlugin(pluginRef: string): any {
@ -250,21 +359,39 @@ export function getPlugin(pluginRef: string): any {
export function get(element: Element | Window, path: string) {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i: number = 0; i < paths.length; i++) {
if (!obj) { return null; }
for (let i = 0; i < paths.length; i++) {
if (!obj) {
return null;
}
obj = obj[paths[i]];
}
return obj;
}
export function pluginWarn(pluginName: string, plugin?: string, method?: string): void {
export function pluginWarn(
pluginName: string,
plugin?: string,
method?: string
): void {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
console.warn(
'Native: tried calling ' +
pluginName +
'.' +
method +
', but the ' +
pluginName +
' plugin is not installed.'
);
} else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
console.warn(
`Native: tried accessing the ${pluginName} plugin but it's not installed.`
);
}
if (plugin) {
console.warn('Install the ' + pluginName + ' plugin: \'ionic cordova plugin add ' + plugin + '\'');
console.warn(
`Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`
);
}
}
@ -275,16 +402,30 @@ export function pluginWarn(pluginName: string, plugin?: string, method?: string)
*/
export function cordovaWarn(pluginName: string, method?: string): void {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
console.warn(
'Native: tried calling ' +
pluginName +
'.' +
method +
', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
);
} else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
console.warn(
'Native: tried accessing the ' +
pluginName +
' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
);
}
}
/**
* @private
*/
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
export const wrap = function(
pluginObj: any,
methodName: string,
opts: CordovaOptions = {}
) {
return (...args: any[]) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
@ -304,22 +445,36 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
/**
* @private
*/
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
export function wrapInstance(
pluginObj: any,
methodName: string,
opts: any = {}
) {
return (...args: any[]) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
} else if (opts.observable) {
return new Observable(observer => {
let pluginResult;
if (opts.destruct) {
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
pluginResult = callInstance(
pluginObj,
methodName,
args,
opts,
(...args: any[]) => observer.next(args),
(...args: any[]) => observer.error(args)
);
} else {
pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
pluginResult = callInstance(
pluginObj,
methodName,
args,
opts,
observer.next.bind(observer),
observer.error.bind(observer)
);
}
if (pluginResult && pluginResult.error) {
@ -329,38 +484,75 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
return () => {
try {
if (opts.clearWithArgs) {
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
return callInstance(
pluginObj,
opts.clearFunction,
args,
opts,
observer.next.bind(observer),
observer.error.bind(observer)
);
}
return callInstance(pluginObj, opts.clearFunction, []);
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.warn(
'Unable to clear the previous observable watch for',
pluginObj.constructor.getPluginName(),
methodName
);
console.warn(e);
}
};
});
} else if (opts.otherPromise) {
return getPromise((resolve: Function, reject: Function) => {
let result;
if (opts.destruct) {
result = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
result = callInstance(
pluginObj,
methodName,
args,
opts,
(...args: any[]) => resolve(args),
(...args: any[]) => reject(args)
);
} else {
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
result = callInstance(
pluginObj,
methodName,
args,
opts,
resolve,
reject
);
}
if (result && !!result.then) {
if (result && !_.isUndefined(result.then)) {
result.then(resolve, reject);
} else {
reject();
}
});
} else {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
if (opts.destruct) {
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
pluginResult = callInstance(
pluginObj,
methodName,
args,
opts,
(...args: any[]) => resolve(args),
(...args: any[]) => reject(args)
);
} else {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
pluginResult = callInstance(
pluginObj,
methodName,
args,
opts,
resolve,
reject
);
}
rej = reject;
});
@ -368,12 +560,10 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
p.catch(() => {});
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
}
};
}

View File

@ -1,12 +1,14 @@
import * as _ from 'lodash';
export function instancePropertyGet(pluginObj: any, key: string) {
if (!!pluginObj._objectInstance && !!pluginObj._objectInstance[key]) {
if (!_.isUndefined(pluginObj._objectInstance) && !_.isUndefined(pluginObj._objectInstance[key])) {
return pluginObj._objectInstance[key];
}
return null;
}
export function instancePropertySet(pluginObj: any, key: string, value: any) {
if (!!pluginObj._objectInstance && !!pluginObj._objectInstance[key]) {
if (!_.isUndefined(pluginObj._objectInstance) && !_.isUndefined(pluginObj._objectInstance[key])) {
pluginObj._objectInstance[key] = value;
}
}

View File

@ -10,8 +10,8 @@ export function initAngular1(plugins: any) {
const ngModule = window.angular.module('ionic.native', []);
for (const name in plugins) {
let serviceName = '$cordova' + name;
let cls = plugins[name];
const serviceName = '$cordova' + name;
const cls = plugins[name];
(function(serviceName, cls, name) {
ngModule.service(serviceName, [function() {

View File

@ -6,7 +6,7 @@ declare const window: any;
export function get(element: Element | Window, path: string) {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i: number = 0; i < paths.length; i++) {
for (let i = 0; i < paths.length; i++) {
if (!obj) { return null; }
obj = obj[paths[i]];
}

View File

@ -3,7 +3,6 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface BackgroundGeolocationResponse {
/**
* ID of location as stored in DB (or null)
*/
@ -71,7 +70,6 @@ export interface BackgroundGeolocationResponse {
}
export interface BackgroundGeolocationConfig {
/**
* Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower
* the number, the more power devoted to GeoLocation resulting in higher
@ -108,19 +106,19 @@ export interface BackgroundGeolocationConfig {
*/
stopOnTerminate?: boolean;
/**
* ANDROID ONLY
* Start background service on device boot.
/**
* ANDROID ONLY
* Start background service on device boot.
*
* Defaults to false
* Defaults to false
*/
startOnBoot?: boolean;
/**
* ANDROID ONLY
/**
* ANDROID ONLY
* If false location service will not be started in foreground and no notification will be shown.
*
* Defaults to true
* Defaults to true
*/
startForeground?: boolean;
@ -155,17 +153,17 @@ export interface BackgroundGeolocationConfig {
*/
notificationIconColor?: string;
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
*/
notificationIconLarge?: string;
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
*/
notificationIconSmall?: string;
@ -183,50 +181,50 @@ export interface BackgroundGeolocationConfig {
*/
activityType?: string;
/**
* IOS ONLY
* Pauses location updates when app is paused
/**
* IOS ONLY
* Pauses location updates when app is paused
*
* Defaults to true
* Defaults to true
*/
pauseLocationUpdates?: boolean;
/**
* Server url where to send HTTP POST with recorded locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
/**
* Server url where to send HTTP POST with recorded locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
*/
url?: string;
/**
* Server url where to send fail to post locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
/**
* Server url where to send fail to post locations
* @see https://github.com/mauron85/cordova-plugin-background-geolocation#http-locations-posting
*/
syncUrl?: string;
/**
* Specifies how many previously failed locations will be sent to server at once
* Specifies how many previously failed locations will be sent to server at once
*
* Defaults to 100
* Defaults to 100
*/
syncThreshold?: number;
/**
* Optional HTTP headers sent along in HTTP request
/**
* Optional HTTP headers sent along in HTTP request
*/
httpHeaders?: any;
/**
* IOS ONLY
* IOS ONLY
* Switch to less accurate significant changes and region monitory when in background (default)
*
* Defaults to 100
* Defaults to 100
*/
saveBatteryOnBackground?: boolean;
/**
* Limit maximum number of locations stored into db
/**
* Limit maximum number of locations stored into db
*
* Defaults to 10000
* Defaults to 10000
*/
maxLocations?: number;
@ -310,15 +308,14 @@ export interface BackgroundGeolocationConfig {
})
@Injectable()
export class BackgroundGeolocation extends IonicNativePlugin {
/**
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
/**
* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers
*
* Possible values:
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
* ANDROID_ACTIVITY_PROVIDER: 1
* ANDROID_DISTANCE_FILTER_PROVIDER: 0,
* ANDROID_ACTIVITY_PROVIDER: 1
*
* @enum {number}
* @enum {number}
*/
LocationProvider: any = {
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
@ -326,17 +323,17 @@ export class BackgroundGeolocation extends IonicNativePlugin {
};
/**
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
* 1000 results in lowest power drain and least accurate readings.
* Desired accuracy in meters. Possible values [0, 10, 100, 1000].
* The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings.
* 1000 results in lowest power drain and least accurate readings.
*
* Possible values:
* HIGH: 0
* MEDIUM: 10
* LOW: 100
* HIGH: 0
* MEDIUM: 10
* LOW: 100
* PASSIVE: 1000
*
* enum {number}
* enum {number}
*/
Accuracy: any = {
HIGH: 0,
@ -345,14 +342,14 @@ export class BackgroundGeolocation extends IonicNativePlugin {
PASSIVE: 1000
};
/**
* Used in the switchMode function
/**
* Used in the switchMode function
*
* Possible values:
* BACKGROUND: 0
* FOREGROUND: 1
* FOREGROUND: 1
*
* @enum {number}
* @enum {number}
*/
Mode: any = {
BACKGROUND: 0,
@ -369,7 +366,9 @@ export class BackgroundGeolocation extends IonicNativePlugin {
callbackOrder: 'reverse',
observable: true
})
configure(options: BackgroundGeolocationConfig): Observable<BackgroundGeolocationResponse> {
configure(
options: BackgroundGeolocationConfig
): Observable<BackgroundGeolocationResponse> {
return;
}
@ -465,15 +464,13 @@ export class BackgroundGeolocation extends IonicNativePlugin {
* Display app settings to change permissions
*/
@Cordova({ sync: true })
showAppSettings(): void {
}
showAppSettings(): void {}
/**
* Display device location settings
*/
@Cordova({ sync: true })
showLocationSettings(): void {
}
showLocationSettings(): void {}
/**
* Method can be used to detect user changes in location services settings.
@ -515,8 +512,8 @@ export class BackgroundGeolocation extends IonicNativePlugin {
return;
}
/**
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
/**
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
* @returns {Promise<any>}
*/
@Cordova()
@ -552,11 +549,11 @@ export class BackgroundGeolocation extends IonicNativePlugin {
* Calling switchMode you can override plugin behavior and force plugin to switch into other mode.
*
* In FOREGROUND mode plugin uses iOS local manager to receive locations and behavior is affected by option.desiredAccuracy and option.distanceFilter.
* In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only.
* In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only.
*
* BackgroundGeolocation.Mode.FOREGROUND
* BackgroundGeolocation.Mode.BACKGROUND
**
* BackgroundGeolocation.Mode.BACKGROUND
*
* @param modeId {number}
* @returns {Promise<any>}
*/
@ -567,16 +564,15 @@ export class BackgroundGeolocation extends IonicNativePlugin {
return;
}
/**
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
/**
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
* @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information.
*
* @param limit {number} Limits the number of entries
* @param limit {number} Limits the number of entries
* @returns {Promise<any>}
*/
@Cordova()
getLogEntries(limit: number): Promise<any> {
return;
}
}

View File

@ -55,7 +55,7 @@ export interface BackgroundModeConfiguration {
* @description
* Cordova plugin to prevent the app from going to sleep while in background.
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode
*@usage
* @usage
* ```typescript
* import { BackgroundMode } from '@ionic-native/background-mode';
*

View File

@ -508,7 +508,7 @@ export class BLE extends IonicNativePlugin {
*
* @param {string} deviceId UUID or MAC address of the peripheral
*
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
readRSSI(deviceId: string): Promise<any> {

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface CardIOOptions {
/**
* Set to true to require expiry date
*/
@ -82,11 +81,9 @@ export interface CardIOOptions {
* Once a card image has been captured but before it has been processed, this value will determine whether to continue processing as usual.
*/
supressScan?: boolean;
}
export interface CardIOResponse {
/**
* Card type
*/
@ -126,7 +123,6 @@ export interface CardIOResponse {
* Cardholder name
*/
cardholderName: string;
}
/**
@ -135,9 +131,9 @@ export interface CardIOResponse {
* @usage
* Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the <your app name>Info.plist file. Add the following lines in the main <dict> element.
* ```xml
*<key>NSCameraUsageDescription</key>
*<string>To scan credit cards.</string>
*```
* <key>NSCameraUsageDescription</key>
* <string>To scan credit cards.</string>
* ```
* ```typescript
* import { CardIO } from '@ionic-native/card-io';
*
@ -173,7 +169,6 @@ export interface CardIOResponse {
})
@Injectable()
export class CardIO extends IonicNativePlugin {
/**
* Check whether card scanning is currently available. (May vary by
* device, OS version, network connectivity, etc.)
@ -203,5 +198,4 @@ export class CardIO extends IonicNativePlugin {
version(): Promise<string> {
return;
}
}

View File

@ -81,8 +81,8 @@ export class Contact implements IContactProperties {
@InstanceCheck()
clone(): Contact {
let newContact: any = new Contact();
for (let prop in this) {
const newContact: any = new Contact();
for (const prop in this) {
if (prop === 'id') return;
newContact[prop] = this[prop];
}
@ -342,8 +342,8 @@ export class Contacts extends IonicNativePlugin {
* @hidden
*/
function processContact(contact: any) {
let newContact = new Contact();
for (let prop in contact) {
const newContact = new Contact();
for (const prop in contact) {
if (typeof contact[prop] === 'function') continue;
newContact[prop] = contact[prop];
}

View File

@ -152,7 +152,7 @@ export interface FileTransferError {
* // error
* })
* }
**
*
* download() {
* const url = 'http://www.example.com/file.pdf';
* fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ export interface IDynamicLink {
* Preferences GoogleIOSClientId and GoogleAndroidClientId are used to setup dynamic links when you have an app for several platforms.
* You can find values at your GoogleService-Info.plist (key ANDROID_CLIENT_ID) and google-services.json (key client[0].oauth_client[0].client_id).
*
*config.xml:
* config.xml:
* ```xml
* <platform name="android">
* <preference name="GoogleIOSClientId" value="..." />

View File

@ -202,7 +202,7 @@ export class Geolocation extends IonicNativePlugin {
watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
return new Observable<Geoposition>(
(observer: any) => {
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
const watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
return () => navigator.geolocation.clearWatch(watchId);
}
);

View File

@ -20,7 +20,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
* this.ga.startTrackerWithId('YOUR_TRACKER_ID')
* .then(() => {
* console.log('Google analytics is ready now');
this.ga.trackView('test');
* this.ga.trackView('test');
* // Tracker is ready
* // You can now track pages or set additional information such as AppVersion or UserId
* })

View File

@ -91,7 +91,7 @@ export class Gyroscope extends IonicNativePlugin {
watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
return new Observable<GyroscopeOrientation>(
(observer: any) => {
let watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
const watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
return () => navigator.gyroscope.clearWatch(watchId);
}
);

View File

@ -3,9 +3,9 @@ import { Injectable } from '@angular/core';
export interface HealthKitOptions {
/**
* HKWorkoutActivityType constant
* Read more here: https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKWorkout_Class/#//apple_ref/c/tdef/HKWorkoutActivityType
*/
* HKWorkoutActivityType constant
* Read more here: https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKWorkout_Class/#//apple_ref/c/tdef/HKWorkoutActivityType
*/
activityType?: string;
/**
@ -19,14 +19,14 @@ export interface HealthKitOptions {
amount?: number;
/**
* specifies if the data returned by querySampleType() should be sorted by
* end date in ascending order, default is false
*/
* specifies if the data returned by querySampleType() should be sorted by
* end date in ascending order, default is false
*/
ascending?: boolean;
/**
*
*/
*
*/
correlationType?: string;
/**
@ -70,13 +70,13 @@ export interface HealthKitOptions {
extraData?: any;
/**
* limits the maximum number of records returned by querySampleType()
*/
* limits the maximum number of records returned by querySampleType()
*/
limit?: number;
/**
*
*/
*
*/
metadata?: any;
/**
@ -153,7 +153,6 @@ export interface HealthKitOptions {
})
@Injectable()
export class HealthKit extends IonicNativePlugin {
/**
* Check if HealthKit is supported (iOS8+, not on iPad)
* @returns {Promise<any>}
@ -357,6 +356,4 @@ export class HealthKit extends IonicNativePlugin {
queryCorrelationType(options: HealthKitOptions): Promise<any> {
return;
}
}

View File

@ -239,7 +239,7 @@ export class Health extends IonicNativePlugin {
* been given at some point in the past.
*
* Quirks of requestAuthorization()
*
* In Android, it will try to get authorization from the Google Fit APIs.
* It is necessary that the app's package name and the signing key are registered in the Google API console.
* In Android, be aware that if the activity is destroyed (e.g. after a rotation) or is put in background,

View File

@ -85,7 +85,7 @@ export interface HotCodePushEventData {
details?: {
error?: HotCodePushError;
};
};
}
/**
* @name Hot Code Push

View File

@ -1,5 +1,10 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import {
Cordova,
CordovaCheck,
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare const cordova: any;
@ -29,7 +34,11 @@ export interface Beacon {
* ProximityFar
* ProximityUnknown
*/
proximity: 'ProximityImmediate' | 'ProximityNear' | 'ProximityFar' | 'ProximityUnknown';
proximity:
| 'ProximityImmediate'
| 'ProximityNear'
| 'ProximityFar'
| 'ProximityUnknown';
/**
* Transmission Power of the beacon. A constant emitted by the beacon which indicates what's the expected RSSI at a distance of 1 meter to the beacon.
@ -46,7 +55,6 @@ export interface Beacon {
* The accuracy of the ranging.
*/
accuracy: number;
}
export interface BeaconRegion {
@ -104,7 +112,6 @@ export interface CircularRegion {
export type Region = BeaconRegion | CircularRegion;
export interface IBeaconPluginResult {
/**
* The name of the delegate function that produced the PluginResult object.
*/
@ -287,7 +294,6 @@ export interface IBeaconDelegate {
})
@Injectable()
export class IBeacon extends IonicNativePlugin {
/**
* Instances of this class are delegates between the {@link LocationManager} and
* the code that consumes the messages generated on in the native layer.
@ -296,87 +302,81 @@ export class IBeacon extends IonicNativePlugin {
*/
@CordovaCheck({ sync: true })
Delegate(): IBeaconDelegate {
let delegate = new cordova.plugins.locationManager.Delegate();
const delegate = new cordova.plugins.locationManager.Delegate();
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didChangeAuthorizationStatus = cb;
}
);
delegate.didChangeAuthorizationStatus = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didChangeAuthorizationStatus = cb);
});
};
delegate.didDetermineStateForRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didDetermineStateForRegion = cb;
}
);
delegate.didDetermineStateForRegion = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didDetermineStateForRegion = cb);
});
};
delegate.didEnterRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didEnterRegion = cb;
}
);
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didEnterRegion = cb);
});
};
delegate.didExitRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didExitRegion = cb;
}
);
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didExitRegion = cb);
});
};
delegate.didRangeBeaconsInRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didRangeBeaconsInRegion = cb;
}
);
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didRangeBeaconsInRegion = cb);
});
};
delegate.didStartMonitoringForRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didStartMonitoringForRegion = cb;
}
);
delegate.didStartMonitoringForRegion = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.didStartMonitoringForRegion = cb);
});
};
delegate.monitoringDidFailForRegionWithError = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.monitoringDidFailForRegionWithError = cb;
}
);
delegate.monitoringDidFailForRegionWithError = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.monitoringDidFailForRegionWithError = cb);
});
};
delegate.peripheralManagerDidStartAdvertising = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.peripheralManagerDidStartAdvertising = cb;
}
);
delegate.peripheralManagerDidStartAdvertising = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.peripheralManagerDidStartAdvertising = cb);
});
};
delegate.peripheralManagerDidUpdateState = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.peripheralManagerDidUpdateState = cb;
}
);
delegate.peripheralManagerDidUpdateState = (
pluginResult?: IBeaconPluginResult
) => {
return new Observable<IBeaconPluginResult>((observer: any) => {
const cb = (data: IBeaconPluginResult) => observer.next(data);
return (delegate.peripheralManagerDidUpdateState = cb);
});
};
cordova.plugins.locationManager.setDelegate(delegate);
@ -396,8 +396,20 @@ export class IBeacon extends IonicNativePlugin {
* @returns {BeaconRegion} Returns the BeaconRegion that was created
*/
@CordovaCheck({ sync: true })
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
BeaconRegion(
identifer: string,
uuid: string,
major?: number,
minor?: number,
notifyEntryStateOnDisplay?: boolean
): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(
identifer,
uuid,
major,
minor,
notifyEntryStateOnDisplay
);
}
/**
@ -534,7 +546,6 @@ export class IBeacon extends IonicNativePlugin {
return;
}
/**
* Start ranging the specified beacon region.
*
@ -598,7 +609,6 @@ export class IBeacon extends IonicNativePlugin {
return;
}
/**
* See the documentation of {@code requestWhenInUseAuthorization} for further details.
*
@ -772,5 +782,4 @@ export class IBeacon extends IonicNativePlugin {
appendToDeviceLog(message: string): Promise<void> {
return;
}
}

View File

@ -1,14 +1,19 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import {
CordovaInstance,
InstanceCheck,
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
declare const cordova: Cordova & { InAppBrowser: any; };
declare const cordova: Cordova & { InAppBrowser: any };
export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
location?: 'yes' | 'no';
/** Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
/*Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete.
* Omit or set to no (default) to have the browser open and load normally. */
hidden?: 'yes' | 'no';
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */
@ -17,7 +22,7 @@ export interface InAppBrowserOptions {
clearsessioncache?: 'yes';
/** (Android Only) set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */
zoom?: 'yes' | 'no';
/** Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
/*Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history.
* If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. */
hardwareback?: 'yes' | 'no';
/** Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). */
@ -36,8 +41,10 @@ export interface InAppBrowserOptions {
toolbar?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
enableViewportScale?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no) */
/*
* (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface.
* The HTML's video element must also include the webkit-playsinline attribute (defaults to no)
*/
allowInlineMediaPlayback?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */
keyboardDisplayRequiresUserAction?: 'yes' | 'no';
@ -49,7 +56,7 @@ export interface InAppBrowserOptions {
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */
toolbarposition?: 'top' | 'bottom';
/** (Windows only) Set to yes to create the browser control without a border around it.
/* (Windows only) Set to yes to create the browser control without a border around it.
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes';
@ -74,7 +81,6 @@ export interface InAppBrowserEvent extends Event {
* @hidden
*/
export class InAppBrowserObject {
private _objectInstance: any;
/**
@ -88,20 +94,24 @@ export class InAppBrowserObject {
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
constructor(
url: string,
target?: string,
options?: string | InAppBrowserOptions
) {
try {
if (options && typeof options !== 'string') {
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
options = Object.keys(options)
.map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`)
.join(',');
}
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url, target);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
console.warn(
'Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.'
);
}
}
@ -110,23 +120,20 @@ export class InAppBrowserObject {
* if the InAppBrowser was already visible.
*/
@CordovaInstance({ sync: true })
show(): void {
}
show(): void {}
/**
* Closes the InAppBrowser window.
*/
@CordovaInstance({ sync: true })
close(): void {
}
close(): void {}
/**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden.
*/
@CordovaInstance({ sync: true })
hide(): void {
}
hide(): void {}
/**
* Injects JavaScript code into the InAppBrowser window.
@ -134,7 +141,7 @@ export class InAppBrowserObject {
* @returns {Promise<any>}
*/
@CordovaInstance()
executeScript(script: { file?: string, code?: string }): Promise<any> {
executeScript(script: { file?: string; code?: string }): Promise<any> {
return;
}
@ -144,7 +151,7 @@ export class InAppBrowserObject {
* @returns {Promise<any>}
*/
@CordovaInstance()
insertCSS(css: { file?: string, code?: string }): Promise<any> {
insertCSS(css: { file?: string; code?: string }): Promise<any> {
return;
}
@ -155,10 +162,19 @@ export class InAppBrowserObject {
*/
@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));
});
return new Observable<InAppBrowserEvent>(
(observer: Observer<InAppBrowserEvent>) => {
this._objectInstance.addEventListener(
event,
observer.next.bind(observer)
);
return () =>
this._objectInstance.removeEventListener(
event,
observer.next.bind(observer)
);
}
);
}
}
@ -202,7 +218,6 @@ export class InAppBrowserObject {
})
@Injectable()
export class InAppBrowser extends IonicNativePlugin {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load.
@ -212,8 +227,11 @@ export class InAppBrowser extends IonicNativePlugin {
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
create(url: string, target?: string, options?: string | InAppBrowserOptions): InAppBrowserObject {
create(
url: string,
target?: string,
options?: string | InAppBrowserOptions
): InAppBrowserObject {
return new InAppBrowserObject(url, target, options);
}
}

View File

@ -4,7 +4,7 @@ import { Injectable } from '@angular/core';
declare const window: any;
export interface IntelSecurityDataOptions {
/** Non-empty string. **/
/* Non-empty string. **/
data: String;
/** Tag text. */
tag?: String;

View File

@ -1,5 +1,10 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import {
Cordova,
CordovaCheck,
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare const cordova: any;
@ -44,9 +49,9 @@ export class JinsMeme extends IonicNativePlugin {
* Must call this method first.
* Sign up for an app ID (and get an app/client secret) at developers.jins.com
*
*@param {string} setAppClientID
*@param {string} clientSecret
*@returns {Promise<any>}
* @param {string} setAppClientID
* @param {string} clientSecret
* @returns {Promise<any>}
*/
@Cordova()
setAppClientID(appClientId: string, clientSecret: string): Promise<any> {
@ -85,15 +90,20 @@ export class JinsMeme extends IonicNativePlugin {
})
connect(target: string): Observable<any> {
return new Observable<any>((observer: any) => {
let data = cordova.plugins.JinsMemePlugin.connect(target, observer.next.bind(observer), observer.complete.bind(observer), observer.error.bind(observer));
const data = cordova.plugins.JinsMemePlugin.connect(
target,
observer.next.bind(observer),
observer.complete.bind(observer),
observer.error.bind(observer)
);
return data;
});
}
/**
* Set auto connection mode.
*@param {Boolean} flag
*@returns {Promise<any>}
* @param {Boolean} flag
* @returns {Promise<any>}
*/
@Cordova()
setAutoConnect(flag: boolean): Promise<any> {
@ -102,7 +112,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns whether a connection to JINS MEME has been established.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
isConnected(): Promise<any> {
@ -111,7 +121,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Disconnects from JINS MEME.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
disconnect(): Promise<any> {
@ -133,7 +143,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Stops receiving data.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
stopDataReport(): Promise<any> {
@ -143,7 +153,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns SDK version.
*
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getSDKVersion(): Promise<any> {
@ -152,7 +162,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns JINS MEME connected with other apps.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getConnectedByOthers(): Promise<any> {
@ -161,7 +171,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns calibration status
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
isCalibrated(): Promise<any> {
@ -170,7 +180,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns device type.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getConnectedDeviceType(): Promise<any> {
@ -179,7 +189,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns hardware version.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getConnectedDeviceSubType(): Promise<any> {
@ -188,7 +198,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns FW Version.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getFWVersion(): Promise<any> {
@ -197,7 +207,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns HW Version.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
getHWVersion(): Promise<any> {
@ -206,7 +216,7 @@ export class JinsMeme extends IonicNativePlugin {
/**
* Returns response about whether data was received or not.
*@returns {Promise<any>}
* @returns {Promise<any>}
*/
@Cordova()
isDataReceiving(): Promise<any> {

View File

@ -17,7 +17,6 @@ export enum ELocalNotificationTriggerUnit {
}
export interface ILocalNotificationTrigger {
/** ***** FIX ***** */
/**
@ -192,7 +191,6 @@ export interface ILocalNotificationProgressBar {
}
export interface ILocalNotification {
/**
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future
* Default: 0
@ -267,7 +265,7 @@ export interface ILocalNotification {
* the value of the key 1 will be used as the 'on' timing, the value of
* the key 2 will be used as the 'off' timing
*/
led?: {color: string, on: number, off: number} | any[] | boolean | string;
led?: { color: string; on: number; off: number } | any[] | boolean | string;
/**
* Notification priority.
@ -396,7 +394,7 @@ export interface ILocalNotification {
* ANDROID ONLY
* Set the token for the media session
*/
mediaSession?: string;
mediaSession?: string;
}
/**
@ -457,7 +455,6 @@ export interface ILocalNotification {
})
@Injectable()
export class LocalNotifications extends IonicNativePlugin {
/**
* Schedules a single or multiple notifications
* @param options {Notification | Array<ILocalNotification>} optional
@ -465,8 +462,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
schedule(options?: ILocalNotification | Array<ILocalNotification>): void {
}
schedule(options?: ILocalNotification | Array<ILocalNotification>): void {}
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
@ -475,8 +471,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
update(options?: ILocalNotification): void {
}
update(options?: ILocalNotification): void {}
/**
* Clears single or multiple notifications
@ -493,7 +488,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} Returns a promise when all notifications have cleared
*/
@Cordova()
clearAll(): Promise<any> { return; }
clearAll(): Promise<any> {
return;
}
/**
* Cancels single or multiple notifications
@ -510,7 +507,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} Returns a promise when all notifications are canceled
*/
@Cordova()
cancelAll(): Promise<any> { return; }
cancelAll(): Promise<any> {
return;
}
/**
* Checks presence of a notification
@ -547,7 +546,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<Array<number>>}
*/
@Cordova()
getIds(): Promise<Array<number>> { return; }
getIds(): Promise<Array<number>> {
return;
}
/**
* Get the ids of triggered notifications
@ -629,7 +630,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>}
*/
@Cordova()
requestPermission(): Promise<boolean> { return; }
requestPermission(): Promise<boolean> {
return;
}
/**
* Informs if the app has the permission to show notifications.
@ -647,7 +650,12 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>}
*/
@Cordova()
addActions(groupId: any, actions: Array<ILocalNotificationAction>): Promise<any> { return; }
addActions(
groupId: any,
actions: Array<ILocalNotificationAction>
): Promise<any> {
return;
}
/**
* Removes a group of actions
@ -655,7 +663,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>}
*/
@Cordova()
removeActions(groupId: any): Promise<any> { return; }
removeActions(groupId: any): Promise<any> {
return;
}
/**
* Checks if a group of actions is defined
@ -663,7 +673,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>} Whether the group is defined
*/
@Cordova()
hasActions(groupId: any): Promise<boolean> { return; }
hasActions(groupId: any): Promise<boolean> {
return;
}
/**
* Gets the (platform specific) default settings.
@ -672,7 +684,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
getDefaults(): Promise<any> { return; }
getDefaults(): Promise<any> {
return;
}
/**
* Overwrites the (platform specific) default settings.
@ -681,7 +695,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
setDefaults(defaults: any): Promise<any> { return; }
setDefaults(defaults: any): Promise<any> {
return;
}
/**
* Sets a callback for a specific event
@ -693,22 +709,26 @@ export class LocalNotifications extends IonicNativePlugin {
clearFunction: 'un',
clearWithArgs: true
})
on(eventName: string): Observable<any> { return; }
on(eventName: string): Observable<any> {
return;
}
/**
* Not an official interface, however its possible to manually fire events.
** @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions
* @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions
* @param args Optional arguments
*/
@Cordova({
sync: true
})
fireEvent(eventName: string, args: any): void { }
fireEvent(eventName: string, args: any): void {}
/**
* Fire queued events once the device is ready and all listeners are registered.
* @returns {Promise<any>}
*/
@Cordova()
fireQueuedEvents(): Promise<any> { return; }
fireQueuedEvents(): Promise<any> {
return;
}
}

View File

@ -1,5 +1,11 @@
import { Injectable } from '@angular/core';
import { checkAvailability, CordovaInstance, InstanceProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
import {
checkAvailability,
CordovaInstance,
InstanceProperty,
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
@ -7,7 +13,6 @@ import { Observer } from 'rxjs/Observer';
* @hidden
*/
export class MediaObject {
/**
* An observable that notifies you on actions success
*/
@ -26,39 +31,37 @@ export class MediaObject {
/**
* @hidden
*/
@InstanceProperty()
successCallback: Function;
@InstanceProperty() successCallback: Function;
/**
* @hidden
*/
@InstanceProperty()
errorCallback: Function;
@InstanceProperty() errorCallback: Function;
/**
* @hidden
*/
@InstanceProperty()
statusCallback: Function;
@InstanceProperty() statusCallback: Function;
constructor(private _objectInstance: any) {
this.onSuccess = new Observable<any>((observer: Observer<any>) => {
this.successCallback = observer.next.bind(observer);
return () => this.successCallback = () => {
};
return () => (this.successCallback = () => {});
});
this.onError = new Observable<MEDIA_ERROR>((observer: Observer<MEDIA_ERROR>) => {
this.errorCallback = observer.next.bind(observer);
return () => this.errorCallback = () => {
};
});
this.onError = new Observable<MEDIA_ERROR>(
(observer: Observer<MEDIA_ERROR>) => {
this.errorCallback = observer.next.bind(observer);
return () => (this.errorCallback = () => {});
}
);
this.onStatusUpdate = new Observable<MEDIA_STATUS>((observer: Observer<MEDIA_STATUS>) => {
this.statusCallback = observer.next.bind(observer);
return () => this.statusCallback = () => {
};
});
this.onStatusUpdate = new Observable<MEDIA_STATUS>(
(observer: Observer<MEDIA_STATUS>) => {
this.statusCallback = observer.next.bind(observer);
return () => (this.statusCallback = () => {});
}
);
}
/**
@ -93,86 +96,73 @@ export class MediaObject {
*/
@CordovaInstance({ sync: true })
play(iosOptions?: {
numberOfLoops?: number,
playAudioWhenScreenIsLocked?: boolean
}): void {
}
numberOfLoops?: number;
playAudioWhenScreenIsLocked?: boolean;
}): void {}
/**
* Pauses playing an audio file.
*/
@CordovaInstance({ sync: true })
pause(): void {
}
pause(): void {}
/**
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
*/
@CordovaInstance({ sync: true })
release(): void {
}
release(): void {}
/**
* Sets the current position within an audio file.
* @param {number} milliseconds The time position you want to set for the current audio file
*/
@CordovaInstance({ sync: true })
seekTo(milliseconds: number): void {
}
seekTo(milliseconds: number): void {}
/**
* Set the volume for an audio file.
* @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0.
*/
@CordovaInstance({ sync: true })
setVolume(volume: number): void {
}
setVolume(volume: number): void {}
@CordovaInstance({ sync: true })
setRate(speedRate: number): void {
}
setRate(speedRate: number): void {}
/**
* Starts recording an audio file.
*/
@CordovaInstance({ sync: true })
startRecord(): void {
}
startRecord(): void {}
/**
* Stops recording
*/
@CordovaInstance({ sync: true })
stopRecord(): void {
}
stopRecord(): void {}
/**
* Pauses recording
*/
@CordovaInstance({ sync: true })
pauseRecord(): void {
}
pauseRecord(): void {}
/**
* Resumes recording
*/
@CordovaInstance({ sync: true })
resumeRecord(): void {
}
resumeRecord(): void {}
/**
* Stops playing an audio file.
*/
@CordovaInstance({ sync: true })
stop(): void {
}
stop(): void {}
}
export type MediaStatusUpdateCallback = (statusCode: number) => void;
export interface MediaError {
/**
* Error message
*/
@ -182,7 +172,6 @@ export interface MediaError {
* Error code
*/
code: number;
}
export enum MEDIA_STATUS {
@ -308,46 +297,45 @@ export type MediaErrorCallback = (error: MediaError) => void;
})
@Injectable()
export class Media extends IonicNativePlugin {
// Constants
/**
* @hidden
*/
MEDIA_NONE: number = 0;
MEDIA_NONE = 0;
/**
* @hidden
*/
MEDIA_STARTING: number = 1;
MEDIA_STARTING = 1;
/**
* @hidden
*/
MEDIA_RUNNING: number = 2;
MEDIA_RUNNING = 2;
/**
* @hidden
*/
MEDIA_PAUSED: number = 3;
MEDIA_PAUSED = 3;
/**
* @hidden
*/
MEDIA_STOPPED: number = 4;
MEDIA_STOPPED = 4;
// error codes
/**
* @hidden
*/
MEDIA_ERR_ABORTED: number = 1;
MEDIA_ERR_ABORTED = 1;
/**
* @hidden
*/
MEDIA_ERR_NETWORK: number = 2;
MEDIA_ERR_NETWORK = 2;
/**
* @hidden
*/
MEDIA_ERR_DECODE: number = 3;
MEDIA_ERR_DECODE = 3;
/**
* @hidden
*/
MEDIA_ERR_NONE_SUPPORTED: number = 4;
MEDIA_ERR_NONE_SUPPORTED = 4;
/**
* Open a media file
@ -357,12 +345,14 @@ export class Media extends IonicNativePlugin {
create(src: string): MediaObject {
let instance: any;
if (checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) === true) {
if (
checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) ===
true
) {
// Creates a new media object
instance = new (Media.getPlugin())(src);
}
return new MediaObject(instance);
}
}

View File

@ -99,7 +99,7 @@ export interface UserInfo {
@Injectable()
export class MSAdal extends IonicNativePlugin {
createAuthenticationContext(authority: string, validateAuthority: boolean = true) {
createAuthenticationContext(authority: string, validateAuthority = true) {
let authContext: any;
if (checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) === true) {
authContext = new (MSAdal.getPlugin()).AuthenticationContext(authority);

View File

@ -71,7 +71,7 @@ export interface MusicControlsOptions {
* // text displayed in the status bar when the notification (and the ticker) are updated, optional
* ticker : 'Now playing "Time is Running Out"',
* // All icons default to their built-in android equivalents
* // The supplied drawable name, e.g. 'media_play', is the name of a drawable found under android/res/drawable* folders
* // The supplied drawable name, e.g. 'media_play', is the name of a drawable found under 'android/res/drawable*' folders
* playIcon: 'media_play',
* pauseIcon: 'media_pause',
* prevIcon: 'media_prev',

View File

@ -32,7 +32,7 @@ declare const navigator: any;
* let connectSubscription = this.network.onConnect().subscribe(() => {
* console.log('network connected!');
* // We just got a connection but we need to wait briefly
* // before we determine the connection type. Might need to wait.
* // before we determine the connection type. Might need to wait.
* // prior to doing any api requests as well.
* setTimeout(() => {
* if (this.network.type === 'wifi') {

View File

@ -1,5 +1,10 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
import {
Cordova,
CordovaProperty,
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare let window: any;
@ -68,7 +73,7 @@ export interface NdefTag {
platforms: ['Android', 'BlackBerry 10', 'Windows', 'Windows Phone 8']
})
/**
*@{ NFC } class methods
* @{ NFC } class methods
*/
@Injectable()
export class NFC extends IonicNativePlugin {
@ -102,7 +107,10 @@ export class NFC extends IonicNativePlugin {
clearFunction: 'removeNdefListener',
clearWithArgs: true
})
addNdefListener(onSuccess?: Function, onFailure?: Function): Observable<NdefEvent> {
addNdefListener(
onSuccess?: Function,
onFailure?: Function
): Observable<NdefEvent> {
return;
}
@ -119,7 +127,10 @@ export class NFC extends IonicNativePlugin {
clearFunction: 'removeTagDiscoveredListener',
clearWithArgs: true
})
addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable<any> {
addTagDiscoveredListener(
onSuccess?: Function,
onFailure?: Function
): Observable<any> {
return;
}
@ -137,7 +148,11 @@ export class NFC extends IonicNativePlugin {
clearFunction: 'removeMimeTypeListener',
clearWithArgs: true
})
addMimeTypeListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable<any> {
addMimeTypeListener(
mimeType: string,
onSuccess?: Function,
onFailure?: Function
): Observable<any> {
return;
}
@ -152,7 +167,10 @@ export class NFC extends IonicNativePlugin {
successIndex: 0,
errorIndex: 3
})
addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {
addNdefFormatableListener(
onSuccess?: Function,
onFailure?: Function
): Observable<any> {
return;
}
@ -273,7 +291,6 @@ export class NFC extends IonicNativePlugin {
bytesToHexString(bytes: number[]): string {
return;
}
}
/**
@ -285,8 +302,8 @@ export class NFC extends IonicNativePlugin {
pluginRef: 'ndef'
})
/**
*@{ Ndef } class methods
*@description
* @{ Ndef } class methods
* @description
* Utility methods for creating ndef records for the ndef tag format.
* Move records into array before usage. Then pass an array to methods as parameters.
* Do not pass bytes as parameters for these methods, conversion is built in.
@ -294,50 +311,41 @@ export class NFC extends IonicNativePlugin {
*/
@Injectable()
export class Ndef extends IonicNativePlugin {
@CordovaProperty() TNF_EMPTY: number;
@CordovaProperty() TNF_WELL_KNOWN: number;
@CordovaProperty() TNF_MIME_MEDIA: number;
@CordovaProperty() TNF_ABSOLUTE_URI: number;
@CordovaProperty() TNF_EXTERNAL_TYPE: number;
@CordovaProperty() TNF_UNKNOWN: number;
@CordovaProperty() TNF_UNCHANGED: number;
@CordovaProperty() TNF_RESERVED: number;
@CordovaProperty()
TNF_EMPTY: number;
@CordovaProperty()
TNF_WELL_KNOWN: number;
@CordovaProperty()
TNF_MIME_MEDIA: number;
@CordovaProperty()
TNF_ABSOLUTE_URI: number;
@CordovaProperty()
TNF_EXTERNAL_TYPE: number;
@CordovaProperty()
TNF_UNKNOWN: number;
@CordovaProperty()
TNF_UNCHANGED: number;
@CordovaProperty()
TNF_RESERVED: number;
@CordovaProperty()
RTD_TEXT: number[];
@CordovaProperty()
RTD_URI: number[];
@CordovaProperty()
RTD_SMART_POSTER: number[];
@CordovaProperty()
RTD_ALTERNATIVE_CARRIER: number[];
@CordovaProperty()
RTD_HANDOVER_CARRIER: number[];
@CordovaProperty()
RTD_HANDOVER_REQUEST: number[];
@CordovaProperty()
RTD_HANDOVER_SELECT: number[];
@CordovaProperty()
textHelper: TextHelper;
@CordovaProperty()
uriHelper: UriHelper;
@CordovaProperty() RTD_TEXT: number[];
@CordovaProperty() RTD_URI: number[];
@CordovaProperty() RTD_SMART_POSTER: number[];
@CordovaProperty() RTD_ALTERNATIVE_CARRIER: number[];
@CordovaProperty() RTD_HANDOVER_CARRIER: number[];
@CordovaProperty() RTD_HANDOVER_REQUEST: number[];
@CordovaProperty() RTD_HANDOVER_SELECT: number[];
@CordovaProperty() textHelper: TextHelper;
@CordovaProperty() uriHelper: UriHelper;
@Cordova({ sync: true })
record(tnf: number, type: number[] | string, id: number[] | string, payload: number[] | string): NdefRecord {
record(
tnf: number,
type: number[] | string,
id: number[] | string,
payload: number[] | string
): NdefRecord {
return;
}
@Cordova({ sync: true })
textRecord(text: string, languageCode: string, id: number[] | string): NdefRecord {
textRecord(
text: string,
languageCode: string,
id: number[] | string
): NdefRecord {
return;
}
@ -347,7 +355,11 @@ export class Ndef extends IonicNativePlugin {
}
@Cordova({ sync: true })
absoluteUriRecord(uri: string, payload: number[] | string, id: number[] | string): NdefRecord {
absoluteUriRecord(
uri: string,
payload: number[] | string,
id: number[] | string
): NdefRecord {
return;
}
@ -407,7 +419,6 @@ export class Ndef extends IonicNativePlugin {
})
@Injectable()
export class NfcUtil extends IonicNativePlugin {
@Cordova({ sync: true })
toHex(i: number): string {
return;

View File

@ -323,10 +323,10 @@ export enum OSActionType {
*
* ```
* #!/usr/bin/env node
*
* var fs = require('fs');
* var path = require('path');
*
* var filestocopy = [{
* "resources/android/icon/drawable-hdpi-icon.png":
* "platforms/android/res/drawable-hdpi/ic_stat_onesignal_default.png"
@ -343,12 +343,12 @@ export enum OSActionType {
* "resources/android/icon/drawable-xxxhdpi-icon.png":
* "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
* } ];
*
* module.exports = function(context) {
*
* // no need to configure below
* var rootdir = context.opts.projectRoot;
*
* filestocopy.forEach(function(obj) {
* Object.keys(obj).forEach(function(key) {
* var val = obj[key];
@ -362,7 +362,7 @@ export enum OSActionType {
* }
* });
* });
*
* };
* ```
*
@ -536,8 +536,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
*/
@Cordova({ sync: true })
sendTag(key: string, value: string): void {
}
sendTag(key: string, value: string): void {}
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
@ -546,8 +545,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
sendTags(json: any): void {
}
sendTags(json: any): void {}
/**
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
@ -555,8 +553,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {string} Key to remove.
*/
@Cordova({ sync: true })
deleteTag(key: string): void {
}
deleteTag(key: string): void {}
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
@ -564,16 +561,14 @@ export class OneSignal extends IonicNativePlugin {
* @param {Array<string>} Keys to remove.
*/
@Cordova({ sync: true })
deleteTags(keys: string[]): void {
}
deleteTags(keys: string[]): void {}
/**
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
* Only works if you set `kOSSettingsAutoPrompt` to `false` in `iOSSettings`
*/
@Cordova({ sync: true })
registerForPushNotifications(): void {
}
registerForPushNotifications(): void {}
/**
* Warning:
@ -585,8 +580,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} false to disable vibrate, true to re-enable it.
*/
@Cordova({ sync: true })
enableVibrate(enable: boolean): void {
}
enableVibrate(enable: boolean): void {}
/**
* Warning:
@ -598,8 +592,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} false to disable sound, true to re-enable it.
*/
@Cordova({ sync: true })
enableSound(enable: boolean): void {
}
enableSound(enable: boolean): void {}
/**
*
@ -620,8 +613,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} enable
*/
@Cordova({ sync: true })
setSubscription(enable: boolean): void {
}
setSubscription(enable: boolean): void {}
/**
* Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below.
@ -648,38 +640,31 @@ export class OneSignal extends IonicNativePlugin {
* @param notificationId {string}
*/
@Cordova({ sync: true })
cancelNotification(notificationId: string): void {
}
cancelNotification(notificationId: string): void {}
/**
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
*/
@Cordova({ sync: true })
promptLocation(): void {
}
promptLocation(): void {}
/**
*
* @param email {string}
*/
@Cordova({ sync: true })
syncHashedEmail(email: string): void {
}
syncHashedEmail(email: string): void {}
/**
* Enable logging to help debug if you run into an issue setting up OneSignal.
* The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
*
* The higher the value the more information is shown.
*
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
*/
@Cordova({ sync: true })
setLogLevel(logLevel: {
logLevel: number,
visualLevel: number
}): void {
}
setLogLevel(logLevel: { logLevel: number; visualLevel: number }): void {}
/**
* The passed in function will be fired when a notification permission setting changes.

View File

@ -9,76 +9,76 @@ import { Injectable } from '@angular/core';
* You can open any of these settings:
* ```
* "about", // ios
"accessibility", // ios, android
"account", // ios, android
"airplane_mode", // ios, android
"apn", // android
"application_details", // ios, android
"application_development", // android
"application", // android
"autolock", // ios
"battery_optimization", // android
"bluetooth", // ios, android
"castle", // ios
"captioning", // android
"cast", // android
"cellular_usage", // ios
"configuration_list", // ios
"data_roaming", // android
"date", // ios, android
"display", // ios, android
"dream", // android
"facetime", // ios
"home", // android
"keyboard", // ios, android
"keyboard_subtype", // android
"locale", // ios, android
"location", // ios, android
"locations", // ios
"manage_all_applications", // android
"manage_applications", // android
"memory_card", // android
"music", // ios
"music_equalizer", // ios
"music_volume", // ios
"network", // ios, android
"nike_ipod", // ios
"nfcsharing", // android
"nfc_payment", // android
"nfc_settings", // android
"notes", // ios
"notification_id", // ios
"passbook", // ios
"phone", // ios
"photos", // ios
"print", // android
"privacy", // android
"quick_launch", // android
"reset", // ios
"ringtone", // ios
"browser", // ios
"search", // ios, android
"security", // android
"settings", // ios, android
"show_regulatory_info",
"sound", // ios, android
"software_update", // ios
"storage", // ios, android
"store", // ios, android
"sync", // android
"tethering", // ios
"twitter", // ios
"touch", // ios
"usage", // ios, android
"user_dictionary", // android
"video", // ios
"voice_input", // android
"vpn", // ios
"wallpaper", // ios
"wifi_ip", // android
"wifi", // ios, android
"wireless" // android
```
* "accessibility", // ios, android
* "account", // ios, android
* "airplane_mode", // ios, android
* "apn", // android
* "application_details", // ios, android
* "application_development", // android
* "application", // android
* "autolock", // ios
* "battery_optimization", // android
* "bluetooth", // ios, android
* "castle", // ios
* "captioning", // android
* "cast", // android
* "cellular_usage", // ios
* "configuration_list", // ios
* "data_roaming", // android
* "date", // ios, android
* "display", // ios, android
* "dream", // android
* "facetime", // ios
* "home", // android
* "keyboard", // ios, android
* "keyboard_subtype", // android
* "locale", // ios, android
* "location", // ios, android
* "locations", // ios
* "manage_all_applications", // android
* "manage_applications", // android
* "memory_card", // android
* "music", // ios
* "music_equalizer", // ios
* "music_volume", // ios
* "network", // ios, android
* "nike_ipod", // ios
* "nfcsharing", // android
* "nfc_payment", // android
* "nfc_settings", // android
* "notes", // ios
* "notification_id", // ios
* "passbook", // ios
* "phone", // ios
* "photos", // ios
* "print", // android
* "privacy", // android
* "quick_launch", // android
* "reset", // ios
* "ringtone", // ios
* "browser", // ios
* "search", // ios, android
* "security", // android
* "settings", // ios, android
* "show_regulatory_info",
* "sound", // ios, android
* "software_update", // ios
* "storage", // ios, android
* "store", // ios, android
* "sync", // android
* "tethering", // ios
* "twitter", // ios
* "touch", // ios
* "usage", // ios, android
* "user_dictionary", // android
* "video", // ios
* "voice_input", // android
* "vpn", // ios
* "wallpaper", // ios
* "wifi_ip", // android
* "wifi", // ios, android
* "wireless" // android
* ```
* ```typescript
* import { OpenNativeSettings } from '@ionic-native/open-native-settings';
*
@ -99,7 +99,6 @@ import { Injectable } from '@angular/core';
})
@Injectable()
export class OpenNativeSettings extends IonicNativePlugin {
/**
* Opens a setting dialog
* @param setting {string} setting name
@ -109,5 +108,4 @@ export class OpenNativeSettings extends IonicNativePlugin {
open(setting: string): Promise<any> {
return;
}
}

View File

@ -189,7 +189,7 @@ export class PayPalPayment {
* Optional Build Notation code ("BN code"), obtained from partnerprogram@paypal.com,
* for your tracking purposes.
*/
bnCode: string = 'PhoneGap_SP';
bnCode = 'PhoneGap_SP';
/**
* Optional invoice number, for your tracking purposes. (up to 256 characters)
*/
@ -417,7 +417,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
*/
constructor(options?: PayPalConfigurationOptions) {
let defaults: PayPalConfigurationOptions = {
const defaults: PayPalConfigurationOptions = {
defaultUserEmail: null,
defaultUserPhoneCountryCode: null,
defaultUserPhoneNumber: null,
@ -436,7 +436,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
};
if (options && typeof options === 'object') {
for (let i in options) {
for (const i in options) {
if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i];
}

View File

@ -60,9 +60,9 @@ export class PhotoLibrary extends IonicNativePlugin {
observable: true
})
getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> {
let wrappedObservable: Observable<any> = wrap(this, 'getLibrary', { callbackOrder: 'reverse' }).apply(this, [options]);
const wrappedObservable: Observable<any> = wrap(this, 'getLibrary', { callbackOrder: 'reverse' }).apply(this, [options]);
return new Observable<any>((observer) => {
let wrappedSubscription = wrappedObservable.subscribe({
const wrappedSubscription = wrappedObservable.subscribe({
next: (x) => {
observer.next((result: { library: LibraryItem[] }) => {
return result.library;

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface TranscodeOptions {
/** The path to the video on the device. */
fileUri: string;
@ -39,7 +38,7 @@ export interface TranscodeOptions {
/** Number of audio channels. iOS only. Defaults to 2. */
audioChannels?: number;
/** Sample rate for the audio. iOS only. Defaults to 44100*/
/** Sample rate for the audio. iOS only. Defaults to 44100 */
audioSampleRate?: number;
/** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */
@ -50,7 +49,6 @@ export interface TranscodeOptions {
}
export interface TrimOptions {
/** Path to input video. */
fileUri: string;
@ -65,11 +63,9 @@ export interface TrimOptions {
/** Progress on transcode. info will be a number from 0 to 100 */
progress?: (info: any) => void;
}
export interface CreateThumbnailOptions {
/** The path to the video on the device */
fileUri: string;
@ -87,18 +83,14 @@ export interface CreateThumbnailOptions {
/** Quality of the thumbnail (between 1 and 100). */
quality?: number;
}
export interface GetVideoInfoOptions {
/** The path to the video on the device. */
fileUri: string;
}
export interface VideoInfo {
/** Width of the video in pixels. */
width: number;
@ -116,7 +108,6 @@ export interface VideoInfo {
/** Bitrate of the video in bits per second. */
bitrate: number;
}
/**
@ -156,7 +147,6 @@ export interface VideoInfo {
})
@Injectable()
export class VideoEditor extends IonicNativePlugin {
OptimizeForNetworkUse = {
NO: 0,
YES: 1
@ -217,5 +207,4 @@ export class VideoEditor extends IonicNativePlugin {
getVideoInfo(options: GetVideoInfoOptions): Promise<VideoInfo> {
return;
}
}

View File

@ -1,6 +1,8 @@
{
"extends": "tslint-ionic-rules",
"rules": {
"ordered-imports": false
"ordered-imports": false,
"no-empty": false,
"no-import-side-effect": false
}
}