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() { export function checkReady() {
const DEVICE_READY_TIMEOUT = 5000; const DEVICE_READY_TIMEOUT = 5000;
@ -9,13 +11,17 @@ export function checkReady() {
let didFireReady = false; let didFireReady = false;
document.addEventListener('deviceready', () => { 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; didFireReady = true;
}); });
setTimeout(() => { setTimeout(() => {
if (!didFireReady && !!window.cordova) { 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.`); 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); }, DEVICE_READY_TIMEOUT);
} }

View File

@ -1,44 +1,74 @@
import { CordovaOptions } from './interfaces';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent'; import 'rxjs/add/observable/fromEvent';
import * as _ from 'lodash';
import { Observable } from 'rxjs/Observable';
import { CordovaOptions } from './interfaces';
declare const window: any; declare const window: any;
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' }; export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' }; 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 = () => { const tryNativePromise = () => {
if (Promise) { if (Promise) {
return new Promise<T>((resolve, reject) => { return new Promise<T>((resolve, reject) => {
callback(resolve, reject); callback(resolve, reject);
}); });
} else { } 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) { 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) { if (injector) {
let $q = injector.get('$q'); const $q = injector.get('$q');
return $q((resolve: Function, reject: Function) => { return $q((resolve: Function, reject: Function) => {
callback(resolve, reject); 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(); 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; let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => { const p = getPromise((resolve: Function, reject: Function) => {
if (opts.destruct) { 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 { } else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject); pluginResult = callCordovaPlugin(
pluginObj,
methodName,
args,
opts,
resolve,
reject
);
} }
rej = 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 // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error // to error
if (pluginResult && pluginResult.error) { if (pluginResult && pluginResult.error) {
p.catch(() => { }); p.catch(() => {});
typeof rej === 'function' && rej(pluginResult.error); typeof rej === 'function' && rej(pluginResult.error);
} }
return p; 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) => { return getPromise((resolve: Function, reject: Function) => {
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts); const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) { 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 => { return new Observable(observer => {
let pluginResult; let pluginResult;
if (opts.destruct) { 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 { } 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) { if (pluginResult && pluginResult.error) {
@ -85,12 +139,23 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
try { try {
if (opts.clearFunction) { if (opts.clearFunction) {
if (opts.clearWithArgs) { 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, []); return callCordovaPlugin(pluginObj, opts.clearFunction, []);
} }
} catch (e) { } 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); console.warn(e);
} }
}; };
@ -113,16 +178,26 @@ function wrapEventObservable(event: string, element: any): Observable<any> {
return Observable.fromEvent(element, event); return Observable.fromEvent(element, event);
} }
/** /**
* Checks if plugin/cordova is available * Checks if plugin/cordova is available
* @return {boolean | { error: string } } * @return {boolean | { error: string } }
* @private * @private
*/ */
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string }; export function checkAvailability(
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string }; pluginRef: string,
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: 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; let pluginRef, pluginInstance, pluginPackage;
if (typeof plugin === 'string') { if (typeof plugin === 'string') {
@ -135,7 +210,10 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
pluginInstance = getPlugin(pluginRef); pluginInstance = getPlugin(pluginRef);
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) { if (
!pluginInstance ||
(!!methodName && typeof pluginInstance[methodName] === 'undefined')
) {
if (!window.cordova) { if (!window.cordova) {
cordovaWarn(pluginName, methodName); cordovaWarn(pluginName, methodName);
return ERR_CORDOVA_NOT_AVAILABLE; 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 * Checks if _objectInstance exists and has the method/property
* @private * @private
*/ */
export function instanceAvailability(pluginObj: any, methodName?: string): boolean { export function instanceAvailability(
return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined'); 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 // ignore resolve and reject in case sync
if (opts.sync) { if (opts.sync) {
return args; return args;
@ -175,12 +265,19 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
resolve(result); resolve(result);
} }
}); });
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) { } else if (
let obj: any = {}; opts.callbackStyle === 'object' &&
opts.successName &&
opts.errorName
) {
const obj: any = {};
obj[opts.successName] = resolve; obj[opts.successName] = resolve;
obj[opts.errorName] = reject; obj[opts.errorName] = reject;
args.push(obj); 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 = () => { const setSuccessIndex = () => {
// If we've specified a success/error index // If we've specified a success/error index
if (opts.successIndex > args.length) { if (opts.successIndex > args.length) {
@ -206,8 +303,6 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
setSuccessIndex(); setSuccessIndex();
setErrorIndex(); setErrorIndex();
} }
} else { } else {
// Otherwise, let's tack them on to the end of the argument list // Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases // which is 90% of cases
@ -217,7 +312,14 @@ export function setIndex(args: any[], opts: any = {}, resolve?: Function, reject
return args; 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 // Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers. // to our promise resolve/reject handlers.
args = setIndex(args, opts, resolve, reject); args = setIndex(args, opts, resolve, reject);
@ -230,17 +332,24 @@ export function callCordovaPlugin(pluginObj: any, methodName: string, args: any[
} else { } else {
return availabilityCheck; 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); args = setIndex(args, opts, resolve, reject);
if (instanceAvailability(pluginObj, methodName)) { 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 { export function getPlugin(pluginRef: string): any {
@ -250,21 +359,39 @@ export function getPlugin(pluginRef: string): any {
export function get(element: Element | Window, path: string) { export function get(element: Element | Window, path: string) {
const paths: string[] = path.split('.'); const paths: string[] = path.split('.');
let obj: any = element; 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; } if (!obj) {
return null;
}
obj = obj[paths[i]]; obj = obj[paths[i]];
} }
return obj; return obj;
} }
export function pluginWarn(pluginName: string, plugin?: string, method?: string): void { export function pluginWarn(
pluginName: string,
plugin?: string,
method?: string
): void {
if (method) { 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 { } 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) { 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 { export function cordovaWarn(pluginName: string, method?: string): void {
if (method) { 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 { } 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 * @private
*/ */
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) { export const wrap = function(
pluginObj: any,
methodName: string,
opts: CordovaOptions = {}
) {
return (...args: any[]) => { return (...args: any[]) => {
if (opts.sync) { if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is // 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 * @private
*/ */
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { export function wrapInstance(
pluginObj: any,
methodName: string,
opts: any = {}
) {
return (...args: any[]) => { return (...args: any[]) => {
if (opts.sync) { if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts); return callInstance(pluginObj, methodName, args, opts);
} else if (opts.observable) { } else if (opts.observable) {
return new Observable(observer => { return new Observable(observer => {
let pluginResult; let pluginResult;
if (opts.destruct) { 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 { } 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) { if (pluginResult && pluginResult.error) {
@ -329,38 +484,75 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
return () => { return () => {
try { try {
if (opts.clearWithArgs) { 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, []); return callInstance(pluginObj, opts.clearFunction, []);
} catch (e) { } 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); console.warn(e);
} }
}; };
}); });
} else if (opts.otherPromise) { } else if (opts.otherPromise) {
return getPromise((resolve: Function, reject: Function) => { return getPromise((resolve: Function, reject: Function) => {
let result; let result;
if (opts.destruct) { 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 { } 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); result.then(resolve, reject);
} else { } else {
reject(); reject();
} }
}); });
} else { } else {
let pluginResult: any, rej: Function; let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => { const p = getPromise((resolve: Function, reject: Function) => {
if (opts.destruct) { 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 { } else {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject); pluginResult = callInstance(
pluginObj,
methodName,
args,
opts,
resolve,
reject
);
} }
rej = 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 // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error // to error
if (pluginResult && pluginResult.error) { if (pluginResult && pluginResult.error) {
p.catch(() => { }); p.catch(() => {});
typeof rej === 'function' && rej(pluginResult.error); typeof rej === 'function' && rej(pluginResult.error);
} }
return p; return p;
} }
}; };
} }

View File

@ -1,12 +1,14 @@
import * as _ from 'lodash';
export function instancePropertyGet(pluginObj: any, key: string) { 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 pluginObj._objectInstance[key];
} }
return null; return null;
} }
export function instancePropertySet(pluginObj: any, key: string, value: any) { 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; pluginObj._objectInstance[key] = value;
} }
} }

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@ export interface BackgroundModeConfiguration {
* @description * @description
* Cordova plugin to prevent the app from going to sleep while in background. * 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 * Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode
*@usage * @usage
* ```typescript * ```typescript
* import { BackgroundMode } from '@ionic-native/background-mode'; * 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 * @param {string} deviceId UUID or MAC address of the peripheral
* *
*@returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
readRSSI(deviceId: string): Promise<any> { readRSSI(deviceId: string): Promise<any> {

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface CardIOOptions { export interface CardIOOptions {
/** /**
* Set to true to require expiry date * 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. * 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; supressScan?: boolean;
} }
export interface CardIOResponse { export interface CardIOResponse {
/** /**
* Card type * Card type
*/ */
@ -126,7 +123,6 @@ export interface CardIOResponse {
* Cardholder name * Cardholder name
*/ */
cardholderName: string; cardholderName: string;
} }
/** /**
@ -135,9 +131,9 @@ export interface CardIOResponse {
* @usage * @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. * 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 * ```xml
*<key>NSCameraUsageDescription</key> * <key>NSCameraUsageDescription</key>
*<string>To scan credit cards.</string> * <string>To scan credit cards.</string>
*``` * ```
* ```typescript * ```typescript
* import { CardIO } from '@ionic-native/card-io'; * import { CardIO } from '@ionic-native/card-io';
* *
@ -173,7 +169,6 @@ export interface CardIOResponse {
}) })
@Injectable() @Injectable()
export class CardIO extends IonicNativePlugin { export class CardIO extends IonicNativePlugin {
/** /**
* Check whether card scanning is currently available. (May vary by * Check whether card scanning is currently available. (May vary by
* device, OS version, network connectivity, etc.) * device, OS version, network connectivity, etc.)
@ -203,5 +198,4 @@ export class CardIO extends IonicNativePlugin {
version(): Promise<string> { version(): Promise<string> {
return; return;
} }
} }

View File

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

View File

@ -152,7 +152,7 @@ export interface FileTransferError {
* // error * // error
* }) * })
* } * }
** *
* download() { * download() {
* const url = 'http://www.example.com/file.pdf'; * const url = 'http://www.example.com/file.pdf';
* fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => { * 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. * 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). * 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 * ```xml
* <platform name="android"> * <platform name="android">
* <preference name="GoogleIOSClientId" value="..." /> * <preference name="GoogleIOSClientId" value="..." />

View File

@ -202,7 +202,7 @@ export class Geolocation extends IonicNativePlugin {
watchPosition(options?: GeolocationOptions): Observable<Geoposition> { watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
return new Observable<Geoposition>( return new Observable<Geoposition>(
(observer: any) => { (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); 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') * this.ga.startTrackerWithId('YOUR_TRACKER_ID')
* .then(() => { * .then(() => {
* console.log('Google analytics is ready now'); * console.log('Google analytics is ready now');
this.ga.trackView('test'); * this.ga.trackView('test');
* // Tracker is ready * // Tracker is ready
* // You can now track pages or set additional information such as AppVersion or UserId * // 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> { watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
return new Observable<GyroscopeOrientation>( return new Observable<GyroscopeOrientation>(
(observer: any) => { (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); return () => navigator.gyroscope.clearWatch(watchId);
} }
); );

View File

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

View File

@ -239,7 +239,7 @@ export class Health extends IonicNativePlugin {
* been given at some point in the past. * been given at some point in the past.
* *
* Quirks of requestAuthorization() * Quirks of requestAuthorization()
*
* In Android, it will try to get authorization from the Google Fit APIs. * 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. * 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, * 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?: { details?: {
error?: HotCodePushError; error?: HotCodePushError;
}; };
}; }
/** /**
* @name Hot Code Push * @name Hot Code Push

View File

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

View File

@ -1,14 +1,19 @@
import { Injectable } from '@angular/core'; 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 { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer'; import { Observer } from 'rxjs/Observer';
declare const cordova: Cordova & { InAppBrowser: any; }; declare const cordova: Cordova & { InAppBrowser: any };
export interface InAppBrowserOptions { export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */ /** Set to yes or no to turn the InAppBrowser's location bar on or off. */
location?: 'yes' | 'no'; 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. */ * Omit or set to no (default) to have the browser open and load normally. */
hidden?: 'yes' | 'no'; hidden?: 'yes' | 'no';
/** Set to yes to have the browser's cookie cache cleared before the new window is opened. */ /** 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'; clearsessioncache?: 'yes';
/** (Android Only) set to yes to show Android browser's zoom controls, set to no to hide them. Default value is 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'; 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. */ * 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'; hardwareback?: 'yes' | 'no';
/** Set to yes to prevent HTML5 audio or video from autoplaying (defaults to 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'; toolbar?: 'yes' | 'no';
/** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */ /** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */
enableViewportScale?: 'yes' | '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'; 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). */ /** (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'; keyboardDisplayRequiresUserAction?: 'yes' | 'no';
@ -49,7 +56,7 @@ export interface InAppBrowserOptions {
transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical'; transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical';
/** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */ /** (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'; 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. */ * Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes'; fullscreen?: 'yes';
@ -74,7 +81,6 @@ export interface InAppBrowserEvent extends Event {
* @hidden * @hidden
*/ */
export class InAppBrowserObject { export class InAppBrowserObject {
private _objectInstance: any; private _objectInstance: any;
/** /**
@ -88,20 +94,24 @@ export class InAppBrowserObject {
* The options string must not contain any blank space, and each feature's * 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. * 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 { try {
if (options && typeof options !== 'string') { 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); this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) { } catch (e) {
window.open(url, target); 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. * if the InAppBrowser was already visible.
*/ */
@CordovaInstance({ sync: true }) @CordovaInstance({ sync: true })
show(): void { show(): void {}
}
/** /**
* Closes the InAppBrowser window. * Closes the InAppBrowser window.
*/ */
@CordovaInstance({ sync: true }) @CordovaInstance({ sync: true })
close(): void { close(): void {}
}
/** /**
* Hides an InAppBrowser window that is currently shown. Calling this has no effect * Hides an InAppBrowser window that is currently shown. Calling this has no effect
* if the InAppBrowser was already hidden. * if the InAppBrowser was already hidden.
*/ */
@CordovaInstance({ sync: true }) @CordovaInstance({ sync: true })
hide(): void { hide(): void {}
}
/** /**
* Injects JavaScript code into the InAppBrowser window. * Injects JavaScript code into the InAppBrowser window.
@ -134,7 +141,7 @@ export class InAppBrowserObject {
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@CordovaInstance() @CordovaInstance()
executeScript(script: { file?: string, code?: string }): Promise<any> { executeScript(script: { file?: string; code?: string }): Promise<any> {
return; return;
} }
@ -144,7 +151,7 @@ export class InAppBrowserObject {
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@CordovaInstance() @CordovaInstance()
insertCSS(css: { file?: string, code?: string }): Promise<any> { insertCSS(css: { file?: string; code?: string }): Promise<any> {
return; return;
} }
@ -155,10 +162,19 @@ export class InAppBrowserObject {
*/ */
@InstanceCheck() @InstanceCheck()
on(event: string): Observable<InAppBrowserEvent> { on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>((observer: Observer<InAppBrowserEvent>) => { return new Observable<InAppBrowserEvent>(
this._objectInstance.addEventListener(event, observer.next.bind(observer)); (observer: Observer<InAppBrowserEvent>) => {
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); 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() @Injectable()
export class InAppBrowser extends IonicNativePlugin { export class InAppBrowser extends IonicNativePlugin {
/** /**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load. * @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. * name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject} * @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); return new InAppBrowserObject(url, target, options);
} }
} }

View File

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

View File

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

View File

@ -17,7 +17,6 @@ export enum ELocalNotificationTriggerUnit {
} }
export interface ILocalNotificationTrigger { export interface ILocalNotificationTrigger {
/** ***** FIX ***** */ /** ***** FIX ***** */
/** /**
@ -192,7 +191,6 @@ export interface ILocalNotificationProgressBar {
} }
export interface ILocalNotification { export interface ILocalNotification {
/** /**
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future * A unique identifier required to clear, cancel, update or retrieve the local notification in the future
* Default: 0 * 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 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 * 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. * Notification priority.
@ -396,7 +394,7 @@ export interface ILocalNotification {
* ANDROID ONLY * ANDROID ONLY
* Set the token for the media session * Set the token for the media session
*/ */
mediaSession?: string; mediaSession?: string;
} }
/** /**
@ -457,7 +455,6 @@ export interface ILocalNotification {
}) })
@Injectable() @Injectable()
export class LocalNotifications extends IonicNativePlugin { export class LocalNotifications extends IonicNativePlugin {
/** /**
* Schedules a single or multiple notifications * Schedules a single or multiple notifications
* @param options {Notification | Array<ILocalNotification>} optional * @param options {Notification | Array<ILocalNotification>} optional
@ -465,8 +462,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({ @Cordova({
sync: true 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. * Updates a previously scheduled notification. Must include the id in the options parameter.
@ -475,8 +471,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({ @Cordova({
sync: true sync: true
}) })
update(options?: ILocalNotification): void { update(options?: ILocalNotification): void {}
}
/** /**
* Clears single or multiple notifications * 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 * @returns {Promise<any>} Returns a promise when all notifications have cleared
*/ */
@Cordova() @Cordova()
clearAll(): Promise<any> { return; } clearAll(): Promise<any> {
return;
}
/** /**
* Cancels single or multiple notifications * 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 * @returns {Promise<any>} Returns a promise when all notifications are canceled
*/ */
@Cordova() @Cordova()
cancelAll(): Promise<any> { return; } cancelAll(): Promise<any> {
return;
}
/** /**
* Checks presence of a notification * Checks presence of a notification
@ -547,7 +546,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<Array<number>>} * @returns {Promise<Array<number>>}
*/ */
@Cordova() @Cordova()
getIds(): Promise<Array<number>> { return; } getIds(): Promise<Array<number>> {
return;
}
/** /**
* Get the ids of triggered notifications * Get the ids of triggered notifications
@ -629,7 +630,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
@Cordova() @Cordova()
requestPermission(): Promise<boolean> { return; } requestPermission(): Promise<boolean> {
return;
}
/** /**
* Informs if the app has the permission to show notifications. * Informs if the app has the permission to show notifications.
@ -647,7 +650,12 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
addActions(groupId: any, actions: Array<ILocalNotificationAction>): Promise<any> { return; } addActions(
groupId: any,
actions: Array<ILocalNotificationAction>
): Promise<any> {
return;
}
/** /**
* Removes a group of actions * Removes a group of actions
@ -655,7 +663,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
removeActions(groupId: any): Promise<any> { return; } removeActions(groupId: any): Promise<any> {
return;
}
/** /**
* Checks if a group of actions is defined * 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 * @returns {Promise<boolean>} Whether the group is defined
*/ */
@Cordova() @Cordova()
hasActions(groupId: any): Promise<boolean> { return; } hasActions(groupId: any): Promise<boolean> {
return;
}
/** /**
* Gets the (platform specific) default settings. * Gets the (platform specific) default settings.
@ -672,7 +684,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({ @Cordova({
sync: true sync: true
}) })
getDefaults(): Promise<any> { return; } getDefaults(): Promise<any> {
return;
}
/** /**
* Overwrites the (platform specific) default settings. * Overwrites the (platform specific) default settings.
@ -681,7 +695,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({ @Cordova({
sync: true sync: true
}) })
setDefaults(defaults: any): Promise<any> { return; } setDefaults(defaults: any): Promise<any> {
return;
}
/** /**
* Sets a callback for a specific event * Sets a callback for a specific event
@ -693,22 +709,26 @@ export class LocalNotifications extends IonicNativePlugin {
clearFunction: 'un', clearFunction: 'un',
clearWithArgs: true 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. * 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 * @param args Optional arguments
*/ */
@Cordova({ @Cordova({
sync: true 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. * Fire queued events once the device is ready and all listeners are registered.
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
fireQueuedEvents(): Promise<any> { return; } fireQueuedEvents(): Promise<any> {
return;
}
} }

View File

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

View File

@ -99,7 +99,7 @@ export interface UserInfo {
@Injectable() @Injectable()
export class MSAdal extends IonicNativePlugin { export class MSAdal extends IonicNativePlugin {
createAuthenticationContext(authority: string, validateAuthority: boolean = true) { createAuthenticationContext(authority: string, validateAuthority = true) {
let authContext: any; let authContext: any;
if (checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) === true) { if (checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) === true) {
authContext = new (MSAdal.getPlugin()).AuthenticationContext(authority); 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 * // text displayed in the status bar when the notification (and the ticker) are updated, optional
* ticker : 'Now playing "Time is Running Out"', * ticker : 'Now playing "Time is Running Out"',
* // All icons default to their built-in android equivalents * // 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', * playIcon: 'media_play',
* pauseIcon: 'media_pause', * pauseIcon: 'media_pause',
* prevIcon: 'media_prev', * prevIcon: 'media_prev',

View File

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

View File

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

View File

@ -323,10 +323,10 @@ export enum OSActionType {
* *
* ``` * ```
* #!/usr/bin/env node * #!/usr/bin/env node
*
* var fs = require('fs'); * var fs = require('fs');
* var path = require('path'); * var path = require('path');
*
* var filestocopy = [{ * var filestocopy = [{
* "resources/android/icon/drawable-hdpi-icon.png": * "resources/android/icon/drawable-hdpi-icon.png":
* "platforms/android/res/drawable-hdpi/ic_stat_onesignal_default.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": * "resources/android/icon/drawable-xxxhdpi-icon.png":
* "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png" * "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
* } ]; * } ];
*
* module.exports = function(context) { * module.exports = function(context) {
*
* // no need to configure below * // no need to configure below
* var rootdir = context.opts.projectRoot; * var rootdir = context.opts.projectRoot;
*
* filestocopy.forEach(function(obj) { * filestocopy.forEach(function(obj) {
* Object.keys(obj).forEach(function(key) { * Object.keys(obj).forEach(function(key) {
* var val = obj[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. * @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 }) @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. * 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"} * @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/ */
@Cordova({ sync: true }) @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. * 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. * @param {string} Key to remove.
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
deleteTag(key: string): void { deleteTag(key: string): void {}
}
/** /**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`. * 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. * @param {Array<string>} Keys to remove.
*/ */
@Cordova({ sync: true }) @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. * 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` * Only works if you set `kOSSettingsAutoPrompt` to `false` in `iOSSettings`
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
registerForPushNotifications(): void { registerForPushNotifications(): void {}
}
/** /**
* Warning: * Warning:
@ -585,8 +580,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} false to disable vibrate, true to re-enable it. * @param {boolean} false to disable vibrate, true to re-enable it.
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
enableVibrate(enable: boolean): void { enableVibrate(enable: boolean): void {}
}
/** /**
* Warning: * Warning:
@ -598,8 +592,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} false to disable sound, true to re-enable it. * @param {boolean} false to disable sound, true to re-enable it.
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
enableSound(enable: boolean): void { enableSound(enable: boolean): void {}
}
/** /**
* *
@ -620,8 +613,7 @@ export class OneSignal extends IonicNativePlugin {
* @param {boolean} enable * @param {boolean} enable
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
setSubscription(enable: boolean): void { setSubscription(enable: boolean): void {}
}
/** /**
* Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below. * 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} * @param notificationId {string}
*/ */
@Cordova({ sync: true }) @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. * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
promptLocation(): void { promptLocation(): void {}
}
/** /**
* *
* @param email {string} * @param email {string}
*/ */
@Cordova({ sync: true }) @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. * 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 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. * The higher the value the more information is shown.
* *
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages) * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
setLogLevel(logLevel: { setLogLevel(logLevel: { logLevel: number; visualLevel: number }): void {}
logLevel: number,
visualLevel: number
}): void {
}
/** /**
* The passed in function will be fired when a notification permission setting changes. * 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: * You can open any of these settings:
* ``` * ```
* "about", // ios * "about", // ios
"accessibility", // ios, android * "accessibility", // ios, android
"account", // ios, android * "account", // ios, android
"airplane_mode", // ios, android * "airplane_mode", // ios, android
"apn", // android * "apn", // android
"application_details", // ios, android * "application_details", // ios, android
"application_development", // android * "application_development", // android
"application", // android * "application", // android
"autolock", // ios * "autolock", // ios
"battery_optimization", // android * "battery_optimization", // android
"bluetooth", // ios, android * "bluetooth", // ios, android
"castle", // ios * "castle", // ios
"captioning", // android * "captioning", // android
"cast", // android * "cast", // android
"cellular_usage", // ios * "cellular_usage", // ios
"configuration_list", // ios * "configuration_list", // ios
"data_roaming", // android * "data_roaming", // android
"date", // ios, android * "date", // ios, android
"display", // ios, android * "display", // ios, android
"dream", // android * "dream", // android
"facetime", // ios * "facetime", // ios
"home", // android * "home", // android
"keyboard", // ios, android * "keyboard", // ios, android
"keyboard_subtype", // android * "keyboard_subtype", // android
"locale", // ios, android * "locale", // ios, android
"location", // ios, android * "location", // ios, android
"locations", // ios * "locations", // ios
"manage_all_applications", // android * "manage_all_applications", // android
"manage_applications", // android * "manage_applications", // android
"memory_card", // android * "memory_card", // android
"music", // ios * "music", // ios
"music_equalizer", // ios * "music_equalizer", // ios
"music_volume", // ios * "music_volume", // ios
"network", // ios, android * "network", // ios, android
"nike_ipod", // ios * "nike_ipod", // ios
"nfcsharing", // android * "nfcsharing", // android
"nfc_payment", // android * "nfc_payment", // android
"nfc_settings", // android * "nfc_settings", // android
"notes", // ios * "notes", // ios
"notification_id", // ios * "notification_id", // ios
"passbook", // ios * "passbook", // ios
"phone", // ios * "phone", // ios
"photos", // ios * "photos", // ios
"print", // android * "print", // android
"privacy", // android * "privacy", // android
"quick_launch", // android * "quick_launch", // android
"reset", // ios * "reset", // ios
"ringtone", // ios * "ringtone", // ios
"browser", // ios * "browser", // ios
"search", // ios, android * "search", // ios, android
"security", // android * "security", // android
"settings", // ios, android * "settings", // ios, android
"show_regulatory_info", * "show_regulatory_info",
"sound", // ios, android * "sound", // ios, android
"software_update", // ios * "software_update", // ios
"storage", // ios, android * "storage", // ios, android
"store", // ios, android * "store", // ios, android
"sync", // android * "sync", // android
"tethering", // ios * "tethering", // ios
"twitter", // ios * "twitter", // ios
"touch", // ios * "touch", // ios
"usage", // ios, android * "usage", // ios, android
"user_dictionary", // android * "user_dictionary", // android
"video", // ios * "video", // ios
"voice_input", // android * "voice_input", // android
"vpn", // ios * "vpn", // ios
"wallpaper", // ios * "wallpaper", // ios
"wifi_ip", // android * "wifi_ip", // android
"wifi", // ios, android * "wifi", // ios, android
"wireless" // android * "wireless" // android
``` * ```
* ```typescript * ```typescript
* import { OpenNativeSettings } from '@ionic-native/open-native-settings'; * import { OpenNativeSettings } from '@ionic-native/open-native-settings';
* *
@ -99,7 +99,6 @@ import { Injectable } from '@angular/core';
}) })
@Injectable() @Injectable()
export class OpenNativeSettings extends IonicNativePlugin { export class OpenNativeSettings extends IonicNativePlugin {
/** /**
* Opens a setting dialog * Opens a setting dialog
* @param setting {string} setting name * @param setting {string} setting name
@ -109,5 +108,4 @@ export class OpenNativeSettings extends IonicNativePlugin {
open(setting: string): Promise<any> { open(setting: string): Promise<any> {
return; return;
} }
} }

View File

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

View File

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

View File

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

View File

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