Merge remote-tracking branch 'origin/v5'

This commit is contained in:
Daniel
2019-01-23 07:54:31 +01:00
313 changed files with 15065 additions and 8137 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ export function checkReady() {
});
setTimeout(() => {
if (!didFireReady && !!window.cordova) {
if (!didFireReady && window.cordova) {
console.warn(
`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`
);
-251
View File
@@ -1,251 +0,0 @@
import 'core-js';
import { Observable } from 'rxjs/Observable';
import { Cordova, CordovaCheck, CordovaInstance, CordovaProperty, InstanceProperty, Plugin } from './decorators';
import { IonicNativePlugin } from './ionic-native-plugin';
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
declare const window: any;
class TestObject {
constructor(public _objectInstance: any) {}
@InstanceProperty name: string;
@CordovaInstance({ sync: true })
pingSync(): string {
return;
}
@CordovaInstance()
ping(): Promise<any> {
return;
}
}
@Plugin({
pluginName: 'TestPlugin',
pluginRef: 'testPlugin',
repo: '',
plugin: 'cordova-plugin-my-plugin',
platforms: ['Android', 'iOS']
})
class TestPlugin extends IonicNativePlugin {
@CordovaProperty name: string;
@Cordova({ sync: true })
pingSync(): string {
return;
}
@Cordova()
ping(): Promise<string> {
return;
}
@CordovaCheck()
customPing(): Promise<string> {
return Promise.resolve('pong');
}
create(): TestObject {
return new TestObject(TestPlugin.getPlugin().create());
}
@Cordova({
destruct: true
})
destructPromise(): Promise<any> {
return;
}
@Cordova({
destruct: true,
observable: true
})
destructObservable(): Observable<any> {
return;
}
}
function definePlugin() {
(window as any).testPlugin = {
name: 'John Smith',
ping: (success: Function, error: Function) => success('pong'),
pingSync: () => 'pong',
create: function TestObject() {
this.pingSync = () => 'pong';
this.ping = (success: Function, error: Function) => success('pong');
this.name = 'John Smith';
return this;
},
destructPromise: (success: Function) => success('hello', 'world'),
destructObservable: (success: Function) => success('hello', 'world')
};
}
describe('Regular Decorators', () => {
let plugin: TestPlugin;
beforeEach(() => {
plugin = new TestPlugin();
definePlugin();
});
describe('Plugin', () => {
it('should set pluginName', () => {
expect(TestPlugin.getPluginName()).toEqual('TestPlugin');
});
it('should set pluginRef', () => {
expect(TestPlugin.getPluginRef()).toEqual('testPlugin');
});
it('should return original plugin object', () => {
expect(TestPlugin.getPlugin()).toEqual(window.testPlugin);
});
it('should return supported platforms', () => {
expect(TestPlugin.getSupportedPlatforms()).toEqual(['Android', 'iOS']);
});
});
describe('Cordova', () => {
it('should do a sync function', () => {
expect(plugin.pingSync()).toEqual('pong');
});
it('should do an async function', (done: Function) => {
plugin
.ping()
.then(res => {
expect(res).toEqual('pong');
done();
})
.catch(e => {
expect(e).toBeUndefined();
done('Method should have resolved');
});
});
it('should throw plugin_not_installed error', (done: Function) => {
delete window.testPlugin;
window.cordova = true;
expect(plugin.pingSync() as any).toEqual(ERR_PLUGIN_NOT_INSTALLED);
plugin.ping().catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
delete window.cordova;
done();
});
});
xit('should throw cordova_not_available error', (done: Function) => {
delete window.testPlugin;
expect(plugin.pingSync() as any).toEqual(ERR_CORDOVA_NOT_AVAILABLE);
plugin.ping().catch(e => {
expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error);
done();
});
});
});
describe('CordovaProperty', () => {
it('should return property value', () => {
expect(plugin.name).toEqual('John Smith');
});
it('should set property value', () => {
plugin.name = 'value2';
expect(plugin.name).toEqual('value2');
});
});
describe('CordovaCheck', () => {
it('should run the method when plugin exists', done => {
plugin.customPing().then(res => {
expect(res).toEqual('pong');
done();
});
});
it('shouldnt run the method when plugin doesnt exist', done => {
delete window.testPlugin;
window.cordova = true;
plugin.customPing().catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
done();
});
});
});
describe('CordovaOptions', () => {
describe('destruct', () => {
it('should destruct values returned by a Promise', done => {
plugin.destructPromise().then((args: any[]) => {
expect(args).toEqual(['hello', 'world']);
done();
});
});
it('should destruct values returned by an Observable', done => {
plugin.destructObservable().subscribe((args: any[]) => {
expect(args).toEqual(['hello', 'world']);
done();
});
});
});
});
});
describe('Instance Decorators', () => {
let instance: TestObject, plugin: TestPlugin;
beforeEach(() => {
definePlugin();
plugin = new TestPlugin();
instance = plugin.create();
});
describe('Instance plugin', () => {});
describe('CordovaInstance', () => {
it('should call instance async method', done => {
instance.ping().then(r => {
expect(r).toEqual('pong');
done();
});
});
it('should call instance sync method', () => {
expect(instance.pingSync()).toEqual('pong');
});
it('shouldnt call instance method when _objectInstance is undefined', () => {
delete instance._objectInstance;
instance
.ping()
.then(r => {
expect(r).toBeUndefined();
})
.catch(e => {
expect(e).toBeUndefined();
});
});
});
describe('InstanceProperty', () => {
it('should return property value', () => {
expect(instance.name).toEqual('John Smith');
});
it('should set property value', () => {
instance.name = 'John Cena';
expect(instance.name).toEqual('John Cena');
});
});
});
-326
View File
@@ -1,326 +0,0 @@
import { Observable } from 'rxjs/Observable';
import { _throw } from 'rxjs/observable/throw';
import { checkAvailability, instanceAvailability, overrideFunction, wrap, wrapInstance } from './plugin';
import { getPlugin, getPromise } from './util';
export interface PluginConfig {
/**
* Plugin name, this should match the class name
*/
pluginName: string;
/**
* Plugin NPM package name
*/
plugin: string;
/**
* Plugin object reference
*/
pluginRef?: string;
/**
* Github repository URL
*/
repo?: string;
/**
* Custom install command
*/
install?: string;
/**
* Available installation variables
*/
installVariables?: string[];
/**
* Supported platforms
*/
platforms?: string[];
[key: string]: any;
}
export interface CordovaOptions {
destruct?: boolean;
/**
* Set to true if the wrapped method is a sync function
*/
sync?: boolean;
/**
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method takes.
*/
callbackOrder?: 'reverse';
/**
* Callback style
*/
callbackStyle?: 'node' | 'object';
/**
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
successIndex?: number;
/**
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
errorIndex?: number;
/**
* Success function property name. This must be set if callbackStyle is set to object.
*/
successName?: string;
/**
* Error function property name. This must be set if callbackStyle is set to object.
*/
errorName?: string;
/**
* Set to true to return an observable
*/
observable?: boolean;
/**
* If observable is set to true, this can be set to a different function name that will cancel the observable.
*/
clearFunction?: string;
/**
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
*/
clearWithArgs?: boolean;
/**
* Creates an observable that wraps a global event. Replaces document.addEventListener
*/
eventObservable?: boolean;
/**
* Event name, this must be set if eventObservable is set to true
*/
event?: string;
/**
* Element to attach the event listener to, this is optional, defaults to `window`
*/
element?: any;
/**
* Set to true if the wrapped method returns a promise
*/
otherPromise?: boolean;
/**
* Supported platforms
*/
platforms?: string[];
}
export interface CordovaCheckOptions {
sync?: boolean;
observable?: boolean;
}
/**
* @private
*/
export function InstanceCheck(opts: CordovaCheckOptions = {}) {
return (
pluginObj: Object,
methodName: string,
descriptor: TypedPropertyDescriptor<any>
): TypedPropertyDescriptor<any> => {
return {
value(...args: any[]): any {
if (instanceAvailability(this)) {
return descriptor.value.apply(this, args);
} else {
if (opts.sync) {
return;
} else if (opts.observable) {
return new Observable<any>(() => {});
}
return getPromise(() => {});
}
},
enumerable: true
};
};
}
/**
* Executes function only if plugin is available
* @private
*/
export function CordovaCheck(opts: CordovaCheckOptions = {}) {
return (
pluginObj: Object,
methodName: string,
descriptor: TypedPropertyDescriptor<any>
): TypedPropertyDescriptor<any> => {
return {
value(...args: any[]): any {
const check = checkAvailability(pluginObj);
if (check === true) {
return descriptor.value.apply(this, args);
} else {
if (opts.sync) {
return null;
} else if (opts.observable) {
return _throw(new Error(check && check.error));
}
return Promise.reject(check && check.error);
}
},
enumerable: true
};
};
}
/**
* @private
*
* Class decorator specifying Plugin metadata. Required for all plugins.
*
* @usage
* ```typescript
* @Plugin({
* pluginName: 'MyPlugin',
* plugin: 'cordova-plugin-myplugin',
* pluginRef: 'window.myplugin'
* })
* export class MyPlugin {
*
* // Plugin wrappers, properties, and functions go here ...
*
* }
* ```
*/
export function Plugin(config: PluginConfig): ClassDecorator {
return (cls: any) => {
// Add these fields to the class
for (const prop in config) {
cls[prop] = config[prop];
}
cls['installed'] = (printWarning?: boolean) => {
return !!getPlugin(config.pluginRef);
};
cls['getPlugin'] = () => {
return getPlugin(config.pluginRef);
};
cls['checkInstall'] = () => {
return checkAvailability(cls) === true;
};
cls['getPluginName'] = () => {
return config.pluginName;
};
cls['getPluginRef'] = () => {
return config.pluginRef;
};
cls['getPluginInstallName'] = () => {
return config.plugin;
};
cls['getPluginRepo'] = () => {
return config.repo;
};
cls['getSupportedPlatforms'] = () => {
return config.platforms;
};
return cls;
};
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function Cordova(opts: CordovaOptions = {}) {
return (
target: Object,
methodName: string,
descriptor: TypedPropertyDescriptor<any>
) => {
return {
value(...args: any[]) {
return wrap(this, methodName, opts).apply(this, args);
},
enumerable: true
};
};
}
/**
* @private
*
* Wrap an instance method
*/
export function CordovaInstance(opts: CordovaOptions = {}) {
return (target: Object, methodName: string) => {
return {
value(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
},
enumerable: true
};
};
}
/**
* @private
*
*
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
export function CordovaProperty(target: any, key: string) {
Object.defineProperty(target, key, {
enumerable: true,
get: () => {
if (checkAvailability(target, key) === true) {
return getPlugin(target.constructor.getPluginRef())[key];
} else {
return null;
}
},
set: value => {
if (checkAvailability(target, key) === true) {
getPlugin(target.constructor.getPluginRef())[key] = value;
}
}
});
}
/**
* @private
* @param target
* @param key
* @constructor
*/
export function InstanceProperty(target: any, key: string) {
Object.defineProperty(target, key, {
enumerable: true,
get() {
return this._objectInstance[key];
},
set(value) {
this._objectInstance[key] = value;
}
});
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function CordovaFunctionOverride(opts: any = {}) {
return (
target: Object,
methodName: string,
descriptor: TypedPropertyDescriptor<any>
) => {
return {
value(...args: any[]) {
return overrideFunction(this, methodName, opts);
},
enumerable: true
};
};
}
@@ -0,0 +1,108 @@
import { callCordovaPlugin, wrapPromise } from './common';
declare const window: any;
class MockPlugin {
static getPluginRef(): string {
return 'mockPlugin';
}
static getPluginName(): string {
return 'MockPlugin';
}
static getPluginInstallName(): string {
return '';
}
create(): MockInstancePluginObject {
return new MockInstancePluginObject();
}
}
class MockInstancePluginObject {
_pluginInstance: MockCordovaPlugin;
constructor() {
this._pluginInstance = new MockCordovaPlugin();
}
}
class MockCordovaPlugin {
static ping = jest.fn((arg: string) => 'pong');
static pingAsync = jest.fn(
(arg: string, success: Function, error: Function) => success('pong')
);
ping = jest.fn((arg: string) => 'pong');
pingAsync = jest.fn((arg: string, success: Function, error: Function) =>
success('pong')
);
}
describe('Common decorator functions', () => {
let plugin: MockPlugin, instancePluginObject: MockInstancePluginObject;
beforeAll(() => {
window.mockPlugin = MockCordovaPlugin;
plugin = new MockPlugin();
instancePluginObject = plugin.create();
});
describe('callCordovaPlugin', () => {
test('should return value from cordova plugin', () => {
expect(callCordovaPlugin(plugin, 'ping', ['pingpong'])).toBe('pong');
});
test('original method should have been called', () => {
expect(MockCordovaPlugin.ping.mock.calls.length).toBe(1);
});
test('original method should have received args', () => {
expect(MockCordovaPlugin.ping.mock.calls[0][0]).toBe('pingpong');
});
});
describe('wrapPromise', () => {
test('should return a promise that resolves with a value', async () => {
expect(await wrapPromise(plugin, 'pingAsync', ['pingpong'])).toBe('pong');
});
test('original method should have been called', () => {
expect(MockCordovaPlugin.pingAsync.mock.calls.length).toBe(1);
});
test('original method should have received args', () => {
expect(MockCordovaPlugin.pingAsync.mock.calls[0][0]).toBe('pingpong');
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][1]).toBe(
'function'
);
expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][2]).toBe(
'function'
);
});
});
describe('wrapObservable', () => {
test('should return an observable that emits a value', async () => {});
test('original method should have been called', () => {});
test('original method should have received args', () => {});
});
describe('wrapEventObservable', () => {
test('should return an observable that wraps an event listener', async () => {});
});
describe('callInstance', () => {
test('should call an instance method', async () => {});
test('original method should have been called', () => {
// expect(instancePluginObject._pluginInstance.ping.mock.calls.length).toBe(1);
});
test('original method should have received args', () => {
// expect(instancePluginObject._pluginInstance.ping.mock.calls[0][0]).toBe('pingpong');
});
});
});
@@ -1,179 +1,50 @@
import { Observable } from 'rxjs/Observable';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Observable, fromEvent } from 'rxjs';
import { checkReady } from './bootstrap';
import { CordovaOptions } from './decorators';
import { cordovaWarn, getPlugin, getPromise, pluginWarn } from './util';
import { CordovaOptions } from './interfaces';
checkReady();
// declare const window;
// declare var Promise;
declare const window: any;
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
/**
* Checks if plugin/cordova is available
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(
pluginRef: string,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
pluginObj: any,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
plugin: any,
methodName?: string,
pluginName?: string
): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage;
if (typeof plugin === 'string') {
pluginRef = plugin;
} else {
pluginRef = plugin.constructor.getPluginRef();
pluginName = plugin.constructor.getPluginName();
pluginPackage = plugin.constructor.getPluginInstallName();
}
pluginInstance = getPlugin(pluginRef);
if (
!pluginInstance ||
(!!methodName && typeof pluginInstance[methodName] === 'undefined')
) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return ERR_CORDOVA_NOT_AVAILABLE;
}
pluginWarn(pluginName, pluginPackage, methodName);
return ERR_PLUGIN_NOT_INSTALLED;
}
return true;
}
/**
* Checks if _objectInstance exists and has the method/property
* @private
*/
export function instanceAvailability(
pluginObj: any,
methodName?: string
): boolean {
return (
pluginObj._objectInstance &&
(!methodName ||
typeof pluginObj._objectInstance[methodName] !== 'undefined')
);
}
function setIndex(
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
): any {
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
}
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
} else if (opts.callbackStyle === 'node') {
args.push((err: any, result: any) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
} else if (
opts.callbackStyle === 'object' &&
opts.successName &&
opts.errorName
) {
const obj: any = {};
obj[opts.successName] = resolve;
obj[opts.errorName] = reject;
args.push(obj);
} else if (
typeof opts.successIndex !== 'undefined' ||
typeof opts.errorIndex !== 'undefined'
) {
const setSuccessIndex = () => {
// If we've specified a success/error index
if (opts.successIndex > args.length) {
args[opts.successIndex] = resolve;
} else {
args.splice(opts.successIndex, 0, resolve);
}
};
const setErrorIndex = () => {
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
if (opts.errorIndex > args.length) {
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
} else {
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
}
};
if (opts.successIndex > opts.errorIndex) {
setErrorIndex();
setSuccessIndex();
export function getPromise<T>(
callback: (resolve: Function, reject?: Function) => any
): Promise<T> {
const tryNativePromise = () => {
if (Promise) {
return new Promise<T>((resolve, reject) => {
callback(resolve, reject);
});
} else {
setSuccessIndex();
setErrorIndex();
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.'
);
}
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
};
if (window.angular) {
const injector = window.angular
.element(document.querySelector('[ng-app]') || document.body)
.injector();
if (injector) {
const $q = injector.get('$q');
return $q((resolve: Function, reject: Function) => {
callback(resolve, reject);
});
}
console.warn(
`Angular 1 was detected but $q couldn't be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won't trigger an automatic digest when promises resolve.`
);
}
return args;
return tryNativePromise();
}
function callCordovaPlugin(
export function wrapPromise(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
) {
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
args = setIndex(args, opts, resolve, reject);
const availabilityCheck = checkAvailability(pluginObj, methodName);
if (availabilityCheck === true) {
const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
return pluginInstance[methodName].apply(pluginInstance, args);
} else {
return availabilityCheck;
}
}
function wrapPromise(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {}
opts: CordovaOptions = {}
) {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
@@ -288,7 +159,176 @@ function wrapObservable(
});
}
function callInstance(
/**
* Wrap the event with an observable
* @private
* @param event even name
* @param element The element to attach the event listener to
* @returns {Observable}
*/
function wrapEventObservable(event: string, element: any): Observable<any> {
element = element ? get(window, element) : window;
return fromEvent(element, event);
}
/**
* Checks if plugin/cordova is available
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(
pluginRef: string,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
pluginObj: any,
methodName?: string,
pluginName?: string
): boolean | { error: string };
export function checkAvailability(
plugin: any,
methodName?: string,
pluginName?: string
): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage;
if (typeof plugin === 'string') {
pluginRef = plugin;
} else {
pluginRef = plugin.constructor.getPluginRef();
pluginName = plugin.constructor.getPluginName();
pluginPackage = plugin.constructor.getPluginInstallName();
}
pluginInstance = getPlugin(pluginRef);
if (
!pluginInstance ||
(!!methodName && typeof pluginInstance[methodName] === 'undefined')
) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return ERR_CORDOVA_NOT_AVAILABLE;
}
pluginWarn(pluginName, pluginPackage, methodName);
return ERR_PLUGIN_NOT_INSTALLED;
}
return true;
}
/**
* Checks if _objectInstance exists and has the method/property
* @private
*/
export function instanceAvailability(
pluginObj: any,
methodName?: string
): boolean {
return (
pluginObj._objectInstance &&
(!methodName ||
typeof pluginObj._objectInstance[methodName] !== 'undefined')
);
}
export function setIndex(
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
): any {
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
}
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
} else if (opts.callbackStyle === 'node') {
args.push((err: any, result: any) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
} else if (
opts.callbackStyle === 'object' &&
opts.successName &&
opts.errorName
) {
const obj: any = {};
obj[opts.successName] = resolve;
obj[opts.errorName] = reject;
args.push(obj);
} else if (
typeof opts.successIndex !== 'undefined' ||
typeof opts.errorIndex !== 'undefined'
) {
const setSuccessIndex = () => {
// If we've specified a success/error index
if (opts.successIndex > args.length) {
args[opts.successIndex] = resolve;
} else {
args.splice(opts.successIndex, 0, resolve);
}
};
const setErrorIndex = () => {
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been
// defined and thus causing non expected behavior.
if (opts.errorIndex > args.length) {
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
} else {
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
}
};
if (opts.successIndex > opts.errorIndex) {
setErrorIndex();
setSuccessIndex();
} else {
setSuccessIndex();
setErrorIndex();
}
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
}
return args;
}
export function callCordovaPlugin(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {},
resolve?: Function,
reject?: Function
) {
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
args = setIndex(args, opts, resolve, reject);
const availabilityCheck = checkAvailability(pluginObj, methodName);
if (availabilityCheck === true) {
const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
return pluginInstance[methodName].apply(pluginInstance, args);
} else {
return availabilityCheck;
}
}
export function callInstance(
pluginObj: any,
methodName: string,
args: any[],
@@ -306,52 +346,76 @@ function callInstance(
}
}
/**
* Wrap the event with an observable
* @private
* @param event even name
* @param element The element to attach the event listener to
* @returns {Observable}
*/
export function wrapEventObservable(
event: string,
element: any = window
): Observable<any> {
return fromEvent(element, event);
export function getPlugin(pluginRef: string): any {
return get(window, pluginRef);
}
/**
* Certain plugins expect the user to override methods in the plugin. For example,
* window.cordova.plugins.backgroundMode.onactivate = function() { ... }.
*
* Unfortunately, this is brittle and would be better wrapped as an Observable. overrideFunction
* does just this.
* @private
*/
export function overrideFunction(
pluginObj: any,
methodName: string,
args: any[],
opts: any = {}
): Observable<any> {
return new Observable(observer => {
const availabilityCheck = checkAvailability(
pluginObj,
null,
pluginObj.constructor.getPluginName()
);
if (availabilityCheck === true) {
const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
pluginInstance[methodName] = observer.next.bind(observer);
return () => (pluginInstance[methodName] = () => {});
} else {
observer.error(availabilityCheck);
observer.complete();
export function get(element: Element | Window, path: string) {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i = 0; i < paths.length; i++) {
if (!obj) {
return null;
}
});
obj = obj[paths[i]];
}
return obj;
}
export function pluginWarn(
pluginName: string,
plugin?: string,
method?: string
): void {
if (method) {
console.warn(
'Native: tried calling ' +
pluginName +
'.' +
method +
', but the ' +
pluginName +
' plugin is not installed.'
);
} else {
console.warn(
`Native: tried accessing the ${pluginName} plugin but it's not installed.`
);
}
if (plugin) {
console.warn(
`Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`
);
}
}
/**
* @private
* @param pluginName
* @param method
*/
export function cordovaWarn(pluginName: string, method?: string): void {
if (method) {
console.warn(
'Native: tried calling ' +
pluginName +
'.' +
method +
', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
);
} else {
console.warn(
'Native: tried accessing the ' +
pluginName +
' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'
);
}
}
// Fixes a bug in TypeScript 2.9.2 where the ...args is being converted into args: {} and
// causing compilation issues
export type WrapFn = (...args: any[]) => any;
/**
* @private
*/
@@ -359,7 +423,7 @@ export const wrap = (
pluginObj: any,
methodName: string,
opts: CordovaOptions = {}
) => {
): WrapFn => {
return (...args: any[]) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
@@ -383,7 +447,7 @@ export function wrapInstance(
pluginObj: any,
methodName: string,
opts: any = {}
) {
): Function {
return (...args: any[]) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
@@ -413,7 +477,6 @@ export function wrapInstance(
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
}
return () => {
@@ -461,7 +524,7 @@ export function wrapInstance(
reject
);
}
if (result && !!result.then) {
if (result && result.then) {
result.then(resolve, reject);
} else {
reject();
@@ -0,0 +1,25 @@
import { Observable, Observer } from 'rxjs';
import { checkAvailability, getPlugin } from './common';
function overrideFunction(pluginObj: any, methodName: string): Observable<any> {
return new Observable((observer: Observer<any>) => {
const availabilityCheck = checkAvailability(pluginObj, methodName);
if (availabilityCheck === true) {
const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
pluginInstance[methodName] = observer.next.bind(observer);
return () => (pluginInstance[methodName] = () => {});
} else {
observer.error(availabilityCheck);
observer.complete();
}
});
}
export function cordovaFunctionOverride(
pluginObj: any,
methodName: string,
args: IArguments | any[] = []
) {
return overrideFunction(pluginObj, methodName);
}
@@ -0,0 +1,7 @@
import { wrapInstance } from './common';
import { CordovaOptions } from './interfaces';
export function cordovaInstance(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) {
args = Array.from(args);
return wrapInstance(pluginObj, methodName, config).apply(this, args);
}
@@ -0,0 +1,14 @@
import { checkAvailability, getPlugin } from './common';
export function cordovaPropertyGet(pluginObj: any, key: string) {
if (checkAvailability(pluginObj, key) === true) {
return getPlugin(pluginObj.constructor.getPluginRef())[key];
}
return null;
}
export function cordovaPropertySet(pluginObj: any, key: string, value: any) {
if (checkAvailability(pluginObj, key) === true) {
getPlugin(pluginObj.constructor.getPluginRef())[key] = value;
}
}
@@ -0,0 +1,6 @@
import { wrap } from './common';
import { CordovaOptions } from './interfaces';
export function cordova(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) {
return wrap(pluginObj, methodName, config).apply(this, args);
}
@@ -0,0 +1,12 @@
export function instancePropertyGet(pluginObj: any, key: string) {
if (pluginObj._objectInstance && pluginObj._objectInstance[key]) {
return pluginObj._objectInstance[key];
}
return null;
}
export function instancePropertySet(pluginObj: any, key: string, value: any) {
if (pluginObj._objectInstance) {
pluginObj._objectInstance[key] = value;
}
}
@@ -0,0 +1,107 @@
export interface PluginConfig {
/**
* Plugin name, this should match the class name
*/
pluginName: string;
/**
* Plugin NPM package name
*/
plugin: string;
/**
* Plugin object reference
*/
pluginRef?: string;
/**
* Github repository URL
*/
repo?: string;
/**
* Custom install command
*/
install?: string;
/**
* Available installation variables
*/
installVariables?: string[];
/**
* Supported platforms
*/
platforms?: string[];
[key: string]: any;
}
export interface CordovaOptions {
destruct?: boolean;
/**
* Set to true if the wrapped method is a sync function
*/
sync?: boolean;
/**
* Callback order. Set to reverse if the success/error callbacks are the first 2 arguments that the wrapped method
* takes.
*/
callbackOrder?: 'reverse';
/**
* Callback style
*/
callbackStyle?: 'node' | 'object';
/**
* Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
successIndex?: number;
/**
* Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
*/
errorIndex?: number;
/**
* Success function property name. This must be set if callbackStyle is set to object.
*/
successName?: string;
/**
* Error function property name. This must be set if callbackStyle is set to object.
*/
errorName?: string;
/**
* Set to true to return an observable
*/
observable?: boolean;
/**
* If observable is set to true, this can be set to a different function name that will cancel the observable.
*/
clearFunction?: string;
/**
* This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used
* in the initial function.
*/
clearWithArgs?: boolean;
/**
* Creates an observable that wraps a global event. Replaces document.addEventListener
*/
eventObservable?: boolean;
/**
* Event name, this must be set if eventObservable is set to true
*/
event?: string;
/**
* Element to attach the event listener to, this is optional, defaults to `window`
*/
element?: any;
/**
* Set to true if the wrapped method returns a promise
*/
otherPromise?: boolean;
/**
* Supported platforms
*/
platforms?: string[];
}
export declare const Plugin: (config: PluginConfig) => ClassDecorator;
export declare const Cordova: (config?: CordovaOptions) => MethodDecorator;
export declare const CordovaProperty: () => PropertyDecorator;
export declare const CordovaInstance: (config?: CordovaOptions) => MethodDecorator;
export declare const InstanceProperty: () => PropertyDecorator;
export declare const CordovaCheck: (config?: CordovaOptions) => MethodDecorator;
export declare const InstanceCheck: (config?: CordovaOptions) => MethodDecorator;
export declare const CordovaFunctionOverride: () => MethodDecorator;
+14 -4
View File
@@ -1,4 +1,14 @@
export * from './plugin';
export * from './decorators';
export * from './util';
export * from './ionic-native-plugin';
import { checkReady } from './bootstrap';
export { IonicNativePlugin } from './ionic-native-plugin';
// Decorators
export { checkAvailability, instanceAvailability, wrap, getPromise } from './decorators/common';
export * from './decorators/cordova';
export * from './decorators/cordova-function-override';
export * from './decorators/cordova-instance';
export * from './decorators/cordova-property';
export * from './decorators/instance-property';
export * from './decorators/interfaces';
checkReady();
@@ -1,74 +0,0 @@
// This is to verify that new (FileTransfer.getPlugin)() works
import { CordovaInstance, Plugin } from './decorators';
import { IonicNativePlugin } from './ionic-native-plugin';
import { checkAvailability } from './plugin';
class FT {
hello(): string {
return 'world';
}
}
(window as any).FileTransfer = () => new FT();
@Plugin({
plugin: 'cordova-plugin-file-transfer',
pluginRef: 'FileTransfer',
repo: '',
pluginName: 'FileTransfer'
})
export class FileTransfer extends IonicNativePlugin {
create(): FileTransferObject {
let instance: any;
if (
checkAvailability(
FileTransfer.getPluginRef(),
null,
FileTransfer.getPluginName()
) === true
) {
instance = new (FileTransfer.getPlugin())();
}
return new FileTransferObject(instance);
}
}
export class FileTransferObject {
constructor(public _objectInstance: any) {
console.info(
'Creating a new FileTransferObject with instance: ',
_objectInstance
);
}
@CordovaInstance({ sync: true })
hello(): string {
return;
}
}
describe('Mock FileTransfer Plugin', () => {
let plugin: FileTransfer, instance: FileTransferObject;
beforeAll(() => {
plugin = new FileTransfer();
instance = plugin.create();
});
it('should create a new FileTransfer plugin instance', () => {
expect(plugin instanceof FileTransfer).toBeTruthy();
});
it('should create new FileTransferObject instance', () => {
expect(instance instanceof FileTransferObject).toBeTruthy();
});
it('FileTransferObject instance should have _objectInstance property', () => {
expect(instance._objectInstance).toBeDefined();
});
it('FileTransferObject.hello should return world', () => {
console.info('instance hello is', instance.hello());
expect(instance.hello()).toEqual('world');
});
});
+10 -16
View File
@@ -1,3 +1,6 @@
import { checkAvailability } from './decorators/common';
import { get } from './util';
export class IonicNativePlugin {
static pluginName: string;
@@ -15,40 +18,31 @@ export class IonicNativePlugin {
* Returns a boolean that indicates whether the plugin is installed
* @return {boolean}
*/
static installed(): boolean {
return false;
}
static installed(): boolean { return checkAvailability(this.pluginRef) === true; }
/**
* Returns the original plugin object
*/
static getPlugin(): any {}
static getPlugin(): any { return get(window, this.pluginRef); }
/**
* Returns the plugin's name
*/
static getPluginName(): string {
return;
}
static getPluginName(): string { return this.pluginName; }
/**
* Returns the plugin's reference
*/
static getPluginRef(): string {
return;
}
static getPluginRef(): string { return this.pluginRef; }
/**
* Returns the plugin's install name
*/
static getPluginInstallName(): string {
return;
}
static getPluginInstallName(): string { return this.plugin; }
/**
* Returns the plugin's supported platforms
*/
static getSupportedPlatforms(): string[] {
return;
}
static getSupportedPlatforms(): string[] { return this.platforms || []; }
}
+27
View File
@@ -0,0 +1,27 @@
declare const window: any;
/**
* Initialize the ionic.native Angular module if we're running in ng1.
* This iterates through the list of registered plugins and dynamically
* creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
*/
export function initAngular1(plugins: any) {
if (window.angular) {
const ngModule = window.angular.module('ionic.native', []);
for (const name in plugins) {
const serviceName = '$cordova' + name;
const cls = plugins[name];
((serviceName, cls, name) => {
ngModule.service(serviceName, [
() => {
const funcs = window.angular.copy(cls);
funcs.__proto__['name'] = name;
return funcs;
}
]);
})(serviceName, cls, name);
}
}
}
+7 -70
View File
@@ -3,25 +3,24 @@ declare const window: any;
/**
* @private
*/
export const get = (element: Element | Window, path: string): any => {
export function get(element: Element | Window, path: string) {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i = 0; i < paths.length; i++) {
if (!obj) {
return null;
}
if (!obj) { return null; }
obj = obj[paths[i]];
}
return obj;
};
}
/**
* @private
*/
export const getPromise = (callback: Function): Promise<any> => {
export function getPromise(callback: Function = () => {}): Promise<any> {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
return new Promise<any>((resolve, reject) => {
callback(resolve, reject);
});
} else {
@@ -32,66 +31,4 @@ export const getPromise = (callback: Function): Promise<any> => {
};
return tryNativePromise();
};
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
export const getPlugin = (pluginRef: string): any => {
return get(window, pluginRef);
};
/**
* @private
*/
export const pluginWarn = (
pluginName: string,
plugin?: string,
method?: string
): void => {
if (method) {
console.warn(
'Ionic Native: tried calling ' +
pluginName +
'.' +
method +
', but the ' +
pluginName +
' plugin is not installed.'
);
} else {
console.warn(
`'Ionic Native: tried accessing the ${pluginName} plugin but it's not installed.`
);
}
if (plugin) {
console.warn(
`Install the ${pluginName} plugin: 'ionic cordova plugin add ${plugin}'`
);
}
};
/**
* @private
* @param pluginName
* @param method
*/
export const cordovaWarn = (pluginName: string, method?: string): void => {
if (method) {
console.warn(
'Ionic Native: tried calling ' +
pluginName +
'.' +
method +
', but Cordova is not available. Make sure to a) run in a real device or simulator and b) include cordova.js in your index.html'
);
} else {
console.warn(
'Native: tried accessing the ' +
pluginName +
' plugin but Cordova is not available. Make sure to a) run in a real device or simulator and b) include cordova.js in your index.html'
);
}
};
}
+1 -1
View File
@@ -268,7 +268,7 @@ export interface DataCaptureResult {
*
* @usage
* ```typescript
* import { AbbyyRTR } from '@ionic-native/abbyy-rtr';
* import { AbbyyRTR } from '@ionic-native/abbyy-rtr/ngx';
*
*
* constructor(private abbyyRTR: AbbyyRTR) { }
@@ -62,7 +62,7 @@ export interface ActionSheetOptions {
*
* @usage
* ```typescript
* import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet';
* import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet/ngx';
*
* constructor(private actionSheet: ActionSheet) { }
*
@@ -79,7 +79,7 @@ export interface ActionSheetOptions {
* addDestructiveButtonWithLabel: 'Delete',
* androidTheme: this.actionSheet.ANDROID_THEMES.THEME_HOLO_DARK,
* destructiveButtonLast: true
* };
* }
*
* this.actionSheet.show(options).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonIndex);
+1 -1
View File
@@ -263,7 +263,7 @@ export enum AdjustLogLevel {
*
* @usage
* ```typescript
* import { Adjust, AdjustConfig, AdjustEnvironment } from '@ionic-native/adjust';
* import { Adjust, AdjustConfig, AdjustEnvironment } from '@ionic-native/adjust/ngx';
*
* constructor(private adjust: Adjust) { }
*
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Observable, fromEvent } from 'rxjs';
export interface AdMobFreeBannerConfig {
/**
@@ -73,7 +72,7 @@ export interface AdMobFreeRewardVideoConfig {
*
* @usage
* ```typescript
* import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';
* import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free/ngx';
*
*
* constructor(private admobFree: AdMobFree) { }
@@ -179,7 +178,7 @@ export class AdMobFree extends IonicNativePlugin {
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.banner'
})
export class AdMobFreeBanner {
export class AdMobFreeBanner extends IonicNativePlugin {
/**
* Update config
* @param options
@@ -235,7 +234,7 @@ export class AdMobFreeBanner {
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.interstitial'
})
export class AdMobFreeInterstitial {
export class AdMobFreeInterstitial extends IonicNativePlugin {
/**
* Update config
* @param options
@@ -282,7 +281,7 @@ export class AdMobFreeInterstitial {
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.rewardvideo'
})
export class AdMobFreeRewardVideo {
export class AdMobFreeRewardVideo extends IonicNativePlugin {
/**
* Update config
* @param {AdMobFreeRewardVideoConfig} options Admob reward config
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Observable, fromEvent } from 'rxjs';
export type AdUnitIDOption = string | {
android: string;
+8 -8
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export type AdSize =
| 'SMART_BANNER'
@@ -106,8 +106,8 @@ export interface AdExtras {
* IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMobPro Free](../admob-free).
* @usage
* ```typescript
* import { AdMobPro } from '@ionic-native/admob-pro';
* import { Platform } from 'ionic-angular';
* import { AdMobPro } from '@ionic-native/admob-pro/ngx';
* import { Platform } from '@ionic/angular';
*
* constructor(private admob: AdMobPro, private platform: Platform ) { }
*
@@ -275,7 +275,7 @@ export class AdMobPro extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onAdFailLoad',
element: document
element: 'document'
})
onAdFailLoad(): Observable<any> {
return;
@@ -288,7 +288,7 @@ export class AdMobPro extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onAdLoaded',
element: document
element: 'document'
})
onAdLoaded(): Observable<any> {
return;
@@ -301,7 +301,7 @@ export class AdMobPro extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onAdPresent',
element: document
element: 'document'
})
onAdPresent(): Observable<any> {
return;
@@ -314,7 +314,7 @@ export class AdMobPro extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onAdLeaveApp',
element: document
element: 'document'
})
onAdLeaveApp(): Observable<any> {
return;
@@ -327,7 +327,7 @@ export class AdMobPro extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onAdDismiss',
element: document
element: 'document'
})
onAdDismiss(): Observable<any> {
return;
+4 -4
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface AdmobOptions {
/**
@@ -93,7 +93,7 @@ export interface AdmobOptions {
*
* @usage
* ```typescript
* import { Admob, AdmobOptions } from '@ionic-native/admob';
* import { Admob, AdmobOptions } from '@ionic-native/admob/ngx';
*
*
* constructor(private admob: Admob) {
@@ -246,7 +246,7 @@ export class Admob extends IonicNativePlugin {
* Use one of these constants as adSize option when calling createBannerView
* @readonly
*/
@CordovaProperty
@CordovaProperty()
readonly AD_SIZE: {
BANNER: string;
IAB_MRECT: string;
@@ -259,7 +259,7 @@ export class Admob extends IonicNativePlugin {
* This enum represents AdMob's supported ad types
* @readonly
*/
@CordovaProperty
@CordovaProperty()
readonly AD_TYPE: {
BANNER: string;
INTERSTITIAL: string;
+1 -2
View File
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { AES256 } from '@ionic-native/aes-256';
* import { AES256 } from '@ionic-native/aes-256/ngx';
*
* private secureKey: string;
* private secureIV: string;
@@ -56,7 +56,6 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
})
@Injectable()
export class AES256 extends IonicNativePlugin {
/**
* This function used to perform the aes256 encryption
* @param {string} secureKey A 32 bytes string, which will used as input key for AES256 encryption.
+1 -1
View File
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Alipay } from '@ionic-native/alipay';
* import { Alipay } from '@ionic-native/alipay/ngx';
*
* constructor(private alipay: Alipay) {
*
@@ -67,7 +67,7 @@ export class AnalyticsFirebase extends IonicNativePlugin {
* Use one of these default events or a custom event
* @readonly
*/
@CordovaProperty
@CordovaProperty()
readonly DEFAULT_EVENTS: {
ADD_PAYMENT_INFO: string;
ADD_TO_CART: string;
@@ -107,7 +107,7 @@ export class AnalyticsFirebase extends IonicNativePlugin {
* Use one of these default params or a custom param
* @readonly
*/
@CordovaProperty
@CordovaProperty()
readonly DEFAULT_PARAMS: {
ACHIEVEMENT_ID: string;
ACLID: string;
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export type AndroidExoPlayerAspectRatio = 'FILL_SCREEN' | 'FIT_SCREEN';
@@ -158,7 +158,7 @@ export interface AndroidExoPlayerControllerConfig {
*
* @usage
* ```typescript
* import { AndroidExoPlayer } from '@ionic-native/android-exoplayer';
* import { AndroidExoPlayer } from '@ionic-native/android-exoplayer/ngx';
*
* constructor(private androidExoPlayer: AndroidExoPlayer) { }
*
@@ -110,7 +110,7 @@ export interface AFADeleteOptions {
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
* @usage
* ```typescript
* import { AndroidFingerprintAuth } from '@ionic-native/android-fingerprint-auth';
* import { AndroidFingerprintAuth } from '@ionic-native/android-fingerprint-auth/ngx';
*
* constructor(private androidFingerprintAuth: AndroidFingerprintAuth) { }
*
@@ -3,7 +3,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* Bit flag values for setSystemUiVisibility()
* @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
* @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
*/
export enum AndroidSystemUiFlags {
/** View has requested the system UI (status bar) to be visible (the default). SYSTEM_UI_FLAG_VISIBLE */
@@ -36,7 +36,7 @@ export enum AndroidSystemUiFlags {
* In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI.
* @usage
* ```typescript
* import { AndroidFullScreen } from '@ionic-native/android-full-screen';
* import { AndroidFullScreen } from '@ionic-native/android-full-screen/ngx';
*
* constructor(private androidFullScreen: AndroidFullScreen) { }
*
@@ -62,63 +62,81 @@ export class AndroidFullScreen extends IonicNativePlugin {
* @return {Promise<void>}
*/
@Cordova()
isSupported(): Promise<void> { return; }
isSupported(): Promise<void> {
return;
}
/**
* Is immersive mode supported?
* @return {Promise<void>}
*/
@Cordova()
isImmersiveModeSupported(): Promise<void> { return; }
isImmersiveModeSupported(): Promise<void> {
return;
}
/**
* The width of the screen in immersive mode.
* @return {Promise<number>}
*/
@Cordova()
immersiveWidth(): Promise<number> { return; }
immersiveWidth(): Promise<number> {
return;
}
/**
* The height of the screen in immersive mode.
* @return {Promise<number>}
*/
@Cordova()
immersiveHeight(): Promise<number> { return; }
immersiveHeight(): Promise<number> {
return;
}
/**
* Hide system UI until user interacts.
* @return {Promise<void>}
*/
@Cordova()
leanMode(): Promise<void> { return; }
leanMode(): Promise<void> {
return;
}
/**
* Show system UI.
* @return {Promise<void>}
*/
@Cordova()
showSystemUI(): Promise<void> { return; }
showSystemUI(): Promise<void> {
return;
}
/**
* Extend your app underneath the status bar (Android 4.4+ only).
* @return {Promise<void>}
*/
@Cordova()
showUnderStatusBar(): Promise<void> { return; }
showUnderStatusBar(): Promise<void> {
return;
}
/**
* Extend your app underneath the system UI (Android 4.4+ only).
* @return {Promise<void>}
*/
@Cordova()
showUnderSystemUI(): Promise<void> { return; }
showUnderSystemUI(): Promise<void> {
return;
}
/**
* Hide system UI and keep it hidden (Android 4.4+ only).
* @return {Promise<void>}
*/
@Cordova()
immersiveMode(): Promise<void> { return; }
immersiveMode(): Promise<void> {
return;
}
/**
* Manually set the the system UI to a custom mode. This mirrors the Android method of the same name. (Android 4.4+ only).
@@ -127,5 +145,7 @@ export class AndroidFullScreen extends IonicNativePlugin {
* @return {Promise<void>}
*/
@Cordova()
setSystemUiVisibility(visibility: AndroidSystemUiFlags): Promise<void> { return; }
setSystemUiVisibility(visibility: AndroidSystemUiFlags): Promise<void> {
return;
}
}
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```
* import { AndroidPermissions } from '@ionic-native/android-permissions';
* import { AndroidPermissions } from '@ionic-native/android-permissions/ngx';
*
*
* constructor(private androidPermissions: AndroidPermissions) { }
@@ -223,7 +223,7 @@ export class AndroidPermissions extends IonicNativePlugin {
/**
* Request permissions
* @param {Array<string>} permissions An array with permissions
* @param {string[]} permissions An array with permissions
* @return {Promise<any>} Returns a promise
*/
@Cordova()
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { AppAvailability } from '@ionic-native/app-availability';
* import { AppAvailability } from '@ionic-native/app-availability/ngx';
* import { Platform } from 'ionic-angular';
*
* constructor(private appAvailability: AppAvailability, private platform: Platform) { }
@@ -48,6 +48,8 @@ export class AppAvailability extends IonicNativePlugin {
* @returns {Promise<boolean>}
*/
@Cordova()
check(app: string): Promise<boolean> { return; }
check(app: string): Promise<boolean> {
return;
}
}
@@ -17,7 +17,7 @@ export interface StringMap {
*
* @usage
* ```typescript
* import { AppCenterAnalytics } from '@ionic-native/app-center-analytics';
* import { AppCenterAnalytics } from '@ionic-native/app-center-analytics/ngx';
*
*
* constructor(private appCenterAnalytics: AppCenterAnalytics) { }
@@ -40,7 +40,7 @@ export interface AppCenterCrashReportDevice {
*
* @usage
* ```typescript
* import { AppCenterCrashes } from '@ionic-native/app-center-crashes';
* import { AppCenterCrashes } from '@ionic-native/app-center-crashes/ngx';
*
*
* constructor(private AppCenterCrashes: AppCenterCrashes) { }
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name App Center Push
@@ -10,7 +10,7 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```typescript
* import { AppCenterPush } from '@ionic-native/app-center-push';
* import { AppCenterPush } from '@ionic-native/app-center-push/ngx';
*
*
* constructor(private appCenterPush: AppCenterPush) { }
@@ -8,8 +8,8 @@ import { Injectable } from '@angular/core';
*
* @usage
* ```typescript
* import { Platfrom } from 'ionic-angular';
* import { AppMinimize } from '@ionic-native/app-minimize';
* import { Platfrom } from '@ionic/angular';
* import { AppMinimize } from '@ionic-native/app-minimize/ngx';
*
*
* constructor(private platform: Platform, private appMinimize: AppMinimize) { }
@@ -37,6 +37,8 @@ export class AppMinimize extends IonicNativePlugin {
* @return {Promise<any>}
*/
@Cordova()
minimize(): Promise<any> { return; }
minimize(): Promise<any> {
return;
}
}
@@ -1,5 +1,5 @@
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';
/**
@@ -9,7 +9,7 @@ import { Injectable } from '@angular/core';
*
* @usage
* ```typescript
* import { AppPreferences } from '@ionic-native/app-preferences';
* import { AppPreferences } from '@ionic-native/app-preferences/ngx';
*
* constructor(private appPreferences: AppPreferences) { }
*
@@ -25,11 +25,18 @@ import { Injectable } from '@angular/core';
plugin: 'cordova-plugin-app-preferences',
pluginRef: 'plugins.appPreferences',
repo: 'https://github.com/apla/me.apla.cordova.app-preferences',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'macOS', 'Windows 8', 'Windows Phone']
platforms: [
'Android',
'BlackBerry 10',
'Browser',
'iOS',
'macOS',
'Windows 8',
'Windows Phone'
]
})
@Injectable()
export class AppPreferences extends IonicNativePlugin {
/**
* Get a preference value
*
@@ -40,7 +47,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
fetch(dict: string, key?: string): Promise<any> { return; }
fetch(dict: string, key?: string): Promise<any> {
return;
}
/**
* Set a preference value
@@ -67,7 +76,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
remove(dict: string, key?: string): Promise<any> { return; }
remove(dict: string, key?: string): Promise<any> {
return;
}
/**
* Clear preferences
@@ -77,7 +88,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
clearAll(): Promise<any> { return; }
clearAll(): Promise<any> {
return;
}
/**
* Show native preferences interface
@@ -87,7 +100,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
show(): Promise<any> { return; }
show(): Promise<any> {
return;
}
/**
* Show native preferences interface
@@ -98,7 +113,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
observable: true
})
watch(subscribe: boolean): Observable<any> { return; }
watch(subscribe: boolean): Observable<any> {
return;
}
/**
* Return named configuration context
@@ -111,13 +128,17 @@ export class AppPreferences extends IonicNativePlugin {
platforms: ['Android'],
sync: true
})
suite(suiteName: string): any { return; }
suite(suiteName: string): any {
return;
}
@Cordova({
platforms: ['iOS'],
sync: true
})
iosSuite(suiteName: string): any { return; }
iosSuite(suiteName: string): any {
return;
}
/**
* Return cloud synchronized configuration context
@@ -127,7 +148,9 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
cloudSync(): Object { return; }
cloudSync(): Object {
return;
}
/**
* Return default configuration context
@@ -137,6 +160,7 @@ export class AppPreferences extends IonicNativePlugin {
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
defaults(): Object { return; }
defaults(): Object {
return;
}
}
+5 -4
View File
@@ -134,7 +134,7 @@ export interface AppUrls {
*
* @usage
* ```typescript
* import { AppRate } from '@ionic-native/app-rate';
* import { AppRate } from '@ionic-native/app-rate/ngx';
*
* constructor(private appRate: AppRate) { }
*
@@ -144,7 +144,7 @@ export interface AppUrls {
* ios: '<app_id>',
* android: 'market://details?id=<package_name>',
* windows: 'ms-windows-store://review/?ProductId=<store_id>'
* };
* }
*
* this.appRate.promptForRating(true);
*
@@ -156,7 +156,7 @@ export interface AppUrls {
* android: 'market://details?id=<package_name>',
* windows: 'ms-windows-store://review/?ProductId=<store_id>'
* }
* };
* }
*
* this.appRate.promptForRating(false);
* ```
@@ -181,7 +181,8 @@ export class AppRate extends IonicNativePlugin {
* Configure various settings for the Rating View.
* See table below for options
*/
@CordovaProperty preferences: AppRatePreferences;
@CordovaProperty()
preferences: AppRatePreferences;
/**
* Prompts the user for rating
@@ -26,7 +26,7 @@ export interface AppUpdateOptions {
* Then use the following code:
*
* ```typescript
* import { AppUpdate } from '@ionic-native/app-update';
* import { AppUpdate } from '@ionic-native/app-update/ngx';
*
* constructor(private appUpdate: AppUpdate) {
*
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* @name App Version
* @description
@@ -12,7 +11,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { AppVersion } from '@ionic-native/app-version';
* import { AppVersion } from '@ionic-native/app-version/ngx';
*
* constructor(private appVersion: AppVersion) { }
*
+4 -3
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export type IMakePayments =
| 'This device can make payments and has a supported card'
@@ -71,6 +71,7 @@ export interface IShippingMethod {
detail: string;
amount: number;
}
export interface IOrderItemsAndShippingMethods {
items: IOrderItem[];
shippingMethods?: IShippingMethod[];
@@ -99,7 +100,7 @@ export interface ISelectedShippingContact {
*
* @usage
* ```typescript
* import { ApplePay } from '@ionic-native/apple-pay';
* import { ApplePay } from '@ionic-native/apple-pay/ngx';
*
*
* constructor(private applePay: ApplePay) { }
@@ -237,7 +238,7 @@ export class ApplePay extends IonicNativePlugin {
* this.paySheetItems.shippingCost = {
* label: 'Shipping Cost',
* amount: shippingMethod[0].amount
* };
* }
* this.applePay.updateItemsAndShippingMethods(this.paySheetItems, shippingMethods);
* });
*/
@@ -11,7 +11,7 @@ export interface CardData {
cardholderName: string;
primaryAccountNumberSuffix: string;
localizedDescription?: string;
paymentNetwork?: string;
paymentNetwork: string;
}
/**
@@ -21,33 +21,25 @@ export interface CardData {
*
* @usage
* ```typescript
* import { AppleWallet } from '@ionic-native/apple-wallet';
* import { AppleWallet } from '@ionic-native/apple-wallet/ngx';
*
*
* constructor(private appleWallet: AppleWallet) { }
*
*
* ...
*
*
* // Simple call to check whether the app can add cards to Apple Pay.
* this.appleWallet.available()
* .then((res) => {
* // Apple Wallet is enabled and a supported card is setup. Expect:
* // boolean value, true or false
* // res is a boolean value, either true or false
* console.log("Is Apple Wallet available? ", res);
* })
* .catch((message) => {
* // Error message while trying to know if device is able to add to wallet
* console.error("ERROR AVAILBLE>> ", message);
* });
*
*
* ...
*
*
* // Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
* // The encryption scheme, cardholder name, and primary account suffix are required for configuration.
* // The configuration information is used for setup and display only. It should not contain any sensitive information.
*
* let data: cardData = {
* cardholderName: 'Test User',
* primaryAccountNumberSuffix: '1234',
@@ -57,32 +49,14 @@ export interface CardData {
*
* this.appleWallet.startAddPaymentPass(data: cardData)
* .then((res) => {
* // User proceed and successfully asked to add card to his wallet
* // Use the callback response JSON payload to complete addition process
* console.log("startAddPaymentPass success response ", res);
* })
* .catch((err) => {
* // Error or user cancelled.
* console.error("startAddPaymentPass ERROR response", err);
* });
*
* // You should expect the callback success response to be as follow
*
* // {
* // data: {
* // "certificateSubCA": "Base64 string represents certificateSubCA",
* // "certificateLeaf":" Base64 string represents certificateLeaf"
* // "nonce": "Base64 string represents nonce",
* // "nonceSignature": "Base64 string represents nonceSignature",
* // }
* // }
*
* // This method provides the data needed to create an add payment request.
* // Pass the certificate chain to the issuer server. The server returns an encrypted JSON file containing the card data.
* // After you receive the encrypted data, pass it to completeAddPaymentPass method
*
*
* ...
*
*
* let data: encryptedCardData = {
* activationData: 'encoded Base64 activationData from your server',
* encryptedPassData: 'encoded Base64 encryptedPassData from your server',
@@ -91,12 +65,10 @@ export interface CardData {
*
* this.appleWallet.encryptedCardData(data: encryptedCardData)
* .then((res) => {
* // callback success response means card has been added successfully,
* // PKAddPaymentPassViewController will be dismissed
* console.log("completeAddCardToAppleWallet success response ", res);
* })
* .catch((err) => {
* // Error and can not add the card, or something wrong happend
* // PKAddPaymentPassViewController will be dismissed
* console.error("completeAddCardToAppleWallet ERROR response", err);
* });
*
* ```
+26 -26
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name Appodeal
@@ -9,7 +9,7 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```typescript
* import { Appodeal } from '@ionic-native/appodeal';
* import { Appodeal } from '@ionic-native/appodeal/ngx';
*
* constructor(private appodeal: Appodeal) {
*
@@ -361,7 +361,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onInterstitialLoaded',
element: document
element: 'document'
})
onInterstitialLoaded(): Observable<any> {
return;
@@ -370,7 +370,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onInterstitialFailedToLoad',
element: document
element: 'document'
})
onInterstitialFailedToLoad(): Observable<any> {
return;
@@ -379,7 +379,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onInterstitialShown',
element: document
element: 'document'
})
onInterstitialShown(): Observable<any> {
return;
@@ -388,7 +388,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onInterstitialClicked',
element: document
element: 'document'
})
onInterstitialClicked(): Observable<any> {
return;
@@ -397,7 +397,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onInterstitialClosed',
element: document
element: 'document'
})
onInterstitialClosed(): Observable<any> {
return;
@@ -406,7 +406,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onSkippableVideoLoaded',
element: document
element: 'document'
})
onSkippableVideoLoaded(): Observable<any> {
return;
@@ -415,7 +415,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onSkippableVideoFailedToLoad',
element: document
element: 'document'
})
onSkippableVideoFailedToLoad(): Observable<any> {
return;
@@ -424,7 +424,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onSkippableVideoShown',
element: document
element: 'document'
})
onSkippableVideoShown(): Observable<any> {
return;
@@ -433,7 +433,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onSkippableVideoFinished',
element: document
element: 'document'
})
onSkippableVideoFinished(): Observable<any> {
return;
@@ -442,7 +442,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onSkippableVideoClosed',
element: document
element: 'document'
})
onSkippableVideoClosed(): Observable<any> {
return;
@@ -451,7 +451,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onRewardedVideoLoaded',
element: document
element: 'document'
})
onRewardedVideoLoaded(): Observable<any> {
return;
@@ -460,7 +460,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onRewardedVideoFailedToLoad',
element: document
element: 'document'
})
onRewardedVideoFailedToLoad(): Observable<any> {
return;
@@ -469,7 +469,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onRewardedVideoShown',
element: document
element: 'document'
})
onRewardedVideoShown(): Observable<any> {
return;
@@ -478,7 +478,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onRewardedVideoFinished',
element: document
element: 'document'
})
onRewardedVideoFinished(): Observable<any> {
return;
@@ -487,7 +487,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onRewardedVideoClosed',
element: document
element: 'document'
})
onRewardedVideoClosed(): Observable<any> {
return;
@@ -496,7 +496,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoLoaded',
element: document
element: 'document'
})
onNonSkippableVideoLoaded(): Observable<any> {
return;
@@ -505,7 +505,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoFailedToLoad',
element: document
element: 'document'
})
onNonSkippableVideoFailedToLoad(): Observable<any> {
return;
@@ -514,7 +514,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoShown',
element: document
element: 'document'
})
onNonSkippableVideoShown(): Observable<any> {
return;
@@ -523,7 +523,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoFinished',
element: document
element: 'document'
})
onNonSkippableVideoFinished(): Observable<any> {
return;
@@ -532,7 +532,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoClosed',
element: document
element: 'document'
})
onNonSkippableVideoClosed(): Observable<any> {
return;
@@ -541,7 +541,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onBannerClicked',
element: document
element: 'document'
})
onBannerClicked(): Observable<any> {
return;
@@ -550,7 +550,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onBannerFailedToLoad',
element: document
element: 'document'
})
onBannerFailedToLoad(): Observable<any> {
return;
@@ -559,7 +559,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onBannerLoaded',
element: document
element: 'document'
})
onBannerLoaded(): Observable<any> {
return;
@@ -568,7 +568,7 @@ export class Appodeal extends IonicNativePlugin {
@Cordova({
eventObservable: true,
event: 'onBannerShown',
element: document
element: 'document'
})
onBannerShown(): Observable<any> {
return;
+1 -1
View File
@@ -52,7 +52,7 @@ export interface AppsflyerInviteOptions {
*
* @usage
* ```typescript
* import { Appsflyer } from '@ionic-native/appsflyer';
* import { Appsflyer } from '@ionic-native/appsflyer/ngx';
*
*
* constructor(private appsflyer: Appsflyer) { }
@@ -0,0 +1,141 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* @name Audio Management
* @description
* A Cordova plugin to manage volume of audio streams for: ring, music, notification and system. Possible
* ringer values for those streams are: silent, vibrate and normal.
*
* @usage
* ```typescript
* import { AudioManagement } from '@ionic-native/audio-management/ngx';
*
*
* constructor(public audioman: AudioManagement) { }
*
* ...
*
* setAudioMode() {
* this.audioman.setAudioMode(AudioManagement.AudioMode.NORMAL)
* .then(() => {
* console.log('Device audio mode is now NORMAL');
* })
* .catch((reason) => {
* console.log(reason);
* });
* }
*
* getAudioMode() {
* this.audioman.getAudioMode()
* .then((value: AudioManagement.AudioModeReturn) => {
* console.log('Device audio mode is ' + value.label + ' (' + value.audioMode + ')');
* })
* .catch((reason) => {
* console.log(reason);
* });
* }
*
* ```
* @interfaces
* AudioModeReturn
*/
@Plugin({
pluginName: 'AudioManagement',
plugin: 'clovelced-plugin-audiomanagement',
pluginRef: 'AudioManagement',
repo: 'https://github.com/clovelCed/cordova-plugin-audiomanagement',
platforms: ['Android']
})
@Injectable()
export class AudioManagement extends IonicNativePlugin {
/**
* Sets the `AudioManagement.AudioMode` for the device.
*
* @param {AudioManagement.AudioMode} mode the device can be set to: Silent, Normal, Vibrate
* @returns {Promise<void>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
setAudioMode(mode: AudioManagement.AudioMode): Promise<void> {
return;
}
/**
* Gets the current `AudioManagement.AudioMode` of the device. Thenable returns an object with
* `label` and `audioMode` values.
*
* @returns {Promise<AudioManagement.AudioModeReturn>}
*/
@Cordova()
getAudioMode(): Promise<AudioManagement.AudioModeReturn> {
return;
}
/**
* Sets the specified `AudioManagement.VolumeType` for the device with the value from `volume`.
*
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to set
* @param {number} volume the volume value
* @returns {Promise<void>}
*/
@Cordova({
successIndex: 2,
errorIndex: 3
})
setVolume(type: AudioManagement.VolumeType, volume: number): Promise<void> {
return;
}
/**
* Gets the specified `AudioManagement.VolumeType`'s `volume`. Thenable returns an object with
* a numeric property for volume, `volume`.
*
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get
* @returns {Promise<{volume: number}>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
getVolume(type: AudioManagement.VolumeType): Promise<{ volume: number }> {
return;
}
/**
* Gets the specified `AudioManagement.VolumeType`'s maximum `volume`. Thenable returns an
* object with a numeric property, `maxVolume`.
*
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get
* @returns {Promise<{maxVolume: number}>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
getMaxVolume(type: AudioManagement.VolumeType): Promise<{ maxVolume: number }> {
return;
}
}
export namespace AudioManagement {
export enum AudioMode {
SILENT = 0,
VIBRATE,
NORMAL
}
export enum VolumeType {
RING = 0,
MUSIC,
NOTIFICATION,
SYSTEM
}
export interface AudioModeReturn {
audioMode: AudioManagement.AudioMode;
label: string;
}
}
+5 -3
View File
@@ -9,7 +9,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Autostart } from '@ionic-native/autostart';
* import { Autostart } from '@ionic-native/autostart/ngx';
*
*
* constructor(private autostart: Autostart) { }
@@ -36,12 +36,14 @@ export class Autostart extends IonicNativePlugin {
* Enable the automatic startup after the boot
*/
@Cordova({ sync: true })
enable(): void { }
enable(): void {
}
/**
* Disable the automatic startup after the boot
*/
@Cordova({ sync: true })
disable(): void { }
disable(): void {
}
}
@@ -20,14 +20,14 @@ export interface BackgroundFetchConfig {
* @usage
*
* ```typescript
* import { BackgroundFetch, BackgroundFetchConfig } from '@ionic-native/background-fetch';
* import { BackgroundFetch, BackgroundFetchConfig } from '@ionic-native/background-fetch/ngx';
*
*
* constructor(private backgroundFetch: BackgroundFetch) {
*
* const config: BackgroundFetchConfig = {
* stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
* };
* }
*
* backgroundFetch.configure(config)
* .then(() => {
@@ -72,7 +72,9 @@ export class BackgroundFetch extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
configure(config: BackgroundFetchConfig): Promise<any> { return; }
configure(config: BackgroundFetchConfig): Promise<any> {
return;
}
/**
* Start the background-fetch API.
@@ -80,14 +82,18 @@ export class BackgroundFetch extends IonicNativePlugin {
* @returns {Promise<any>}
*/
@Cordova()
start(): Promise<any> { return; }
start(): Promise<any> {
return;
}
/**
* Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
* @returns {Promise<any>}
*/
@Cordova()
stop(): Promise<any> { return; }
stop(): Promise<any> {
return;
}
/**
* You MUST call this method in your fetch callbackFn provided to #configure in order to signal to iOS that your fetch action is complete. iOS provides only 30s of background-time for a fetch-event -- if you exceed this 30s, iOS will kill your app.
@@ -95,13 +101,16 @@ export class BackgroundFetch extends IonicNativePlugin {
@Cordova({
sync: true
})
finish(): void { }
finish(): void {
}
/**
* Return the status of the background-fetch
* @returns {Promise<any>}
*/
@Cordova()
status(): Promise<any> { return; }
status(): Promise<any> {
return;
}
}
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export enum BackgroundGeolocationLocationCode {
PERMISSION_DENIED = 1,
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* Configurations items that can be updated.
@@ -57,7 +57,7 @@ export interface BackgroundModeConfiguration {
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode
* @usage
* ```typescript
* import { BackgroundMode } from '@ionic-native/background-mode';
* import { BackgroundMode } from '@ionic-native/background-mode/ngx';
*
* constructor(private backgroundMode: BackgroundMode) { }
*
+7 -3
View File
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Backlight } from '@ionic-native/backlight';
* import { Backlight } from '@ionic-native/backlight/ngx';
*
* constructor(private backlight: Backlight) { }
*
@@ -39,13 +39,17 @@ export class Backlight extends IonicNativePlugin {
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
*/
@Cordova()
on(): Promise<any> { return; }
on(): Promise<any> {
return;
}
/**
* This function turns backlight off
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
*/
@Cordova()
off(): Promise<any> { return; }
off(): Promise<any> {
return;
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Badge } from '@ionic-native/badge';
* import { Badge } from '@ionic-native/badge/ngx';
*
* constructor(private badge: Badge) { }
*
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
declare const baiduPush: any;
@@ -82,7 +82,7 @@ export interface NotificationData {
*
* @usage
* ```typescript
* import { BaiduPush } from '@ionic-native/baidu-push';
* import { BaiduPush } from '@ionic-native/baidu-push/ngx';
*
*
* constructor(private baiduPush: BaiduPush) { }
@@ -84,7 +84,7 @@ export interface BarcodeScanResult {
*
* @usage
* ```typescript
* import { BarcodeScanner } from '@ionic-native/barcode-scanner';
* import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
*
* constructor(private barcodeScanner: BarcodeScanner) { }
*
@@ -16,7 +16,7 @@ export interface Base64ToGalleryOptions {
* @description This plugin allows you to save base64 data as a png image into the device
* @usage
* ```typescript
* import { Base64ToGallery } from '@ionic-native/base64-to-gallery';
* import { Base64ToGallery } from '@ionic-native/base64-to-gallery/ngx';
*
* constructor(private base64ToGallery: Base64ToGallery) { }
*
+4 -2
View File
@@ -9,7 +9,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Base64 } from '@ionic-native/base64';
* import { Base64 } from '@ionic-native/base64/ngx';
*
* constructor(private base64: Base64) { }
*
@@ -40,6 +40,8 @@ export class Base64 extends IonicNativePlugin {
* @return {Promise<string>} Returns a promise that resolves when the file is successfully encoded
*/
@Cordova()
encodeFile(filePath: string): Promise<string> { return; }
encodeFile(filePath: string): Promise<string> {
return;
}
}
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface BatteryStatusResponse {
/**
@@ -21,7 +21,7 @@ export interface BatteryStatusResponse {
*
* @usage
* ```typescript
* import { BatteryStatus } from '@ionic-native/battery-status';
* import { BatteryStatus } from '@ionic-native/battery-status/ngx';
*
* constructor(private batteryStatus: BatteryStatus) { }
*
+2 -2
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface BLEScanOptions {
/** true if duplicate devices should be reported, false (default) if devices should only be reported once. */
@@ -28,7 +28,7 @@ export interface BLEScanOptions {
*
* ```typescript
*
* import { BLE } from '@ionic-native/ble';
* import { BLE } from '@ionic-native/ble/ngx';
*
* constructor(private ble: BLE) { }
*
File diff suppressed because it is too large Load Diff
+17 -7
View File
@@ -1,5 +1,5 @@
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';
/**
@@ -38,7 +38,7 @@ export interface BlinkUpWPSOptions {
*
* @usage
* ```typescript
* import { BlinkUp } from '@ionic-native/blinkup';
* import { BlinkUp } from '@ionic-native/blinkup/ngx';
*
* const options = <BlinkUpWifiOptions>{
* apiKey: 'API_KEY',
@@ -70,7 +70,9 @@ export class BlinkUp extends IonicNativePlugin {
callbackOrder: 'reverse',
observable: true
})
startBlinkUp(options: BlinkUpOptions): Observable<any> { return; }
startBlinkUp(options: BlinkUpOptions): Observable<any> {
return;
}
/**
* flashWifiBlinkUp - invokes the flash wifi process
@@ -81,7 +83,9 @@ export class BlinkUp extends IonicNativePlugin {
callbackOrder: 'reverse',
observable: true
})
flashWifiBlinkUp(options: BlinkUpWifiOptions): Observable<any> { return; }
flashWifiBlinkUp(options: BlinkUpWifiOptions): Observable<any> {
return;
}
/**
* flashWPSBlinkUp - invokes the flash wps process
@@ -92,7 +96,9 @@ export class BlinkUp extends IonicNativePlugin {
callbackOrder: 'reverse',
observable: true
})
flashWPSBlinkUp(options: BlinkUpWPSOptions): Observable<any> { return; }
flashWPSBlinkUp(options: BlinkUpWPSOptions): Observable<any> {
return;
}
/**
* abortBlinkUp - abort blinkup process
@@ -101,7 +107,9 @@ export class BlinkUp extends IonicNativePlugin {
@Cordova({
observable: true
})
abortBlinkUp(): Observable<any> { return; }
abortBlinkUp(): Observable<any> {
return;
}
/**
* clearBlinkUpData - clear wifi data
@@ -110,5 +118,7 @@ export class BlinkUp extends IonicNativePlugin {
@Cordova({
observable: true
})
clearBlinkUpData(): Observable<any> { return; }
clearBlinkUpData(): Observable<any> {
return;
}
}
+19 -19
View File
@@ -5,7 +5,7 @@ import {
IonicNativePlugin,
Plugin
} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/* Available status of device */
export type Status =
@@ -339,7 +339,7 @@ export interface InitializeResult {
/** Service's UUID */
service: string;
/** Characteristic UUID */
characteristic: string;
characterisitc: string;
/** This integer value will be incremented every read/writeRequested */
requestId: number;
/** Offset value */
@@ -397,7 +397,7 @@ export interface AdapterInfo {
*
* @usage
* ```typescript
* import { BluetoothLE } from '@ionic-native/bluetooth-le';
* import { BluetoothLE } from '@ionic-native/bluetooth-le/ngx';
*
*
* constructor(public bluetoothle: BluetoothLE, public plt: Platform) {
@@ -466,7 +466,7 @@ export class BluetoothLE extends IonicNativePlugin {
* Currently the discoverable state does not have any relevance because there is no "setDiscoverable" functionality in place. That may change in the future.
* @returns {Promise<AdapterInfo>}
*/
@Cordova({ callbackOrder: 'reverse', observable: true })
@Cordova({ callbackOrder: 'reverse' })
getAdapterInfo(): Promise<AdapterInfo> {
return;
}
@@ -668,7 +668,7 @@ export class BluetoothLE extends IonicNativePlugin {
* @returns {Promise<OperationResult>}
*/
@Cordova({ callbackOrder: 'reverse' })
read(params: DescriptorParams): Promise<{ result: OperationResult }> {
read(params: DescriptorParams): Promise<OperationResult> {
return;
}
@@ -678,10 +678,10 @@ export class BluetoothLE extends IonicNativePlugin {
* Once a subscription is no longer needed, execute unsubscribe in a similar fashion.
* The Client Configuration descriptor will automatically be written to enable notification/indication based on the characteristic's properties.
* @param {DescriptorParams} params
* @returns {(Observable<{ result: OperationResult }>)}
* @returns {Observable<OperationResult>}
*/
@Cordova({ callbackOrder: 'reverse', observable: true })
subscribe(params: DescriptorParams): Observable<{ result: OperationResult }> {
subscribe(params: DescriptorParams): Observable<OperationResult> {
return;
}
@@ -1048,28 +1048,28 @@ export class BluetoothLE extends IonicNativePlugin {
return;
}
@CordovaProperty
@CordovaProperty()
SCAN_MODE_OPPORTUNISTIC: number;
@CordovaProperty
@CordovaProperty()
SCAN_MODE_LOW_POWER: number;
@CordovaProperty
@CordovaProperty()
SCAN_MODE_BALANCED: number;
@CordovaProperty
@CordovaProperty()
SCAN_MODE_LOW_LATENCY: number;
@CordovaProperty
@CordovaProperty()
MATCH_MODE_AGRESSIVE: number;
@CordovaProperty
@CordovaProperty()
MATCH_MODE_STICKY: number;
@CordovaProperty
@CordovaProperty()
MATCH_NUM_ONE_ADVERTISEMENT: number;
@CordovaProperty
@CordovaProperty()
MATCH_NUM_FEW_ADVERTISEMENT: number;
@CordovaProperty
@CordovaProperty()
MATCH_NUM_MAX_ADVERTISEMENT: number;
@CordovaProperty
@CordovaProperty()
CALLBACK_TYPE_ALL_MATCHES: number;
@CordovaProperty
@CordovaProperty()
CALLBACK_TYPE_FIRST_MATCH: number;
@CordovaProperty
@CordovaProperty()
CALLBACK_TYPE_MATCH_LOST: number;
}
@@ -1,13 +1,13 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name Bluetooth Serial
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino (not Android to Android or iOS to iOS).
* @usage
* ```typescript
* import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
* import { BluetoothSerial } from '@ionic-native/bluetooth-serial/ngx';
*
* constructor(private bluetoothSerial: BluetoothSerial) { }
*
@@ -39,7 +39,6 @@ import { Observable } from 'rxjs/Observable';
})
@Injectable()
export class BluetoothSerial extends IonicNativePlugin {
/**
* Connect to a Bluetooth device
* @param {string} macAddress_or_uuid Identifier of the remote device
@@ -50,7 +49,9 @@ export class BluetoothSerial extends IonicNativePlugin {
observable: true,
clearFunction: 'disconnect'
})
connect(macAddress_or_uuid: string): Observable<any> { return; }
connect(macAddress_or_uuid: string): Observable<any> {
return;
}
/**
* Connect insecurely to a Bluetooth device
@@ -62,14 +63,18 @@ export class BluetoothSerial extends IonicNativePlugin {
observable: true,
clearFunction: 'disconnect'
})
connectInsecure(macAddress: string): Observable<any> { return; }
connectInsecure(macAddress: string): Observable<any> {
return;
}
/**
* Disconnect from the connected device
* @returns {Promise<any>}
*/
@Cordova()
disconnect(): Promise<any> { return; }
disconnect(): Promise<any> {
return;
}
/**
* Writes data to the serial port
@@ -79,7 +84,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
write(data: any): Promise<any> { return; }
write(data: any): Promise<any> {
return;
}
/**
* Gets the number of bytes of data available
@@ -87,7 +94,10 @@ export class BluetoothSerial extends IonicNativePlugin {
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
}) available(): Promise<any> { return; }
})
available(): Promise<any> {
return;
}
/**
* Reads data from the buffer
@@ -96,7 +106,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
read(): Promise<any> { return; }
read(): Promise<any> {
return;
}
/**
* Reads data from the buffer until it reaches a delimiter
@@ -106,7 +118,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
readUntil(delimiter: string): Promise<any> { return; }
readUntil(delimiter: string): Promise<any> {
return;
}
/**
* Subscribe to be notified when data is received
@@ -118,7 +132,9 @@ export class BluetoothSerial extends IonicNativePlugin {
observable: true,
clearFunction: 'unsubscribe'
})
subscribe(delimiter: string): Observable<any> { return; }
subscribe(delimiter: string): Observable<any> {
return;
}
/**
* Subscribe to be notified when data is received
@@ -129,7 +145,9 @@ export class BluetoothSerial extends IonicNativePlugin {
observable: true,
clearFunction: 'unsubscribeRawData'
})
subscribeRawData(): Observable<any> { return; }
subscribeRawData(): Observable<any> {
return;
}
/**
* Clears data in buffer
@@ -138,7 +156,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
clear(): Promise<any> { return; }
clear(): Promise<any> {
return;
}
/**
* Lists bonded devices
@@ -147,7 +167,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
list(): Promise<any> { return; }
list(): Promise<any> {
return;
}
/**
* Reports if bluetooth is enabled
@@ -156,7 +178,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
isEnabled(): Promise<any> { return; }
isEnabled(): Promise<any> {
return;
}
/**
* Reports the connection status
@@ -165,7 +189,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
isConnected(): Promise<any> { return; }
isConnected(): Promise<any> {
return;
}
/**
* Reads the RSSI from the connected peripheral
@@ -174,7 +200,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
readRSSI(): Promise<any> { return; }
readRSSI(): Promise<any> {
return;
}
/**
* Show the Bluetooth settings on the device
@@ -183,7 +211,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
showBluetoothSettings(): Promise<any> { return; }
showBluetoothSettings(): Promise<any> {
return;
}
/**
* Enable Bluetooth on the device
@@ -192,7 +222,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
enable(): Promise<any> { return; }
enable(): Promise<any> {
return;
}
/**
* Discover unpaired devices
@@ -201,7 +233,9 @@ export class BluetoothSerial extends IonicNativePlugin {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
discoverUnpaired(): Promise<any> { return; }
discoverUnpaired(): Promise<any> {
return;
}
/**
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
@@ -212,7 +246,9 @@ export class BluetoothSerial extends IonicNativePlugin {
observable: true,
clearFunction: 'clearDeviceDiscoveredListener'
})
setDeviceDiscoveredListener(): Observable<any> { return; }
setDeviceDiscoveredListener(): Observable<any> {
return;
}
/**
* Sets the human readable device name that is broadcasted to other devices
@@ -222,7 +258,7 @@ export class BluetoothSerial extends IonicNativePlugin {
platforms: ['Android'],
sync: true
})
setName(newName: string): void { }
setName(newName: string): void {}
/**
* Makes the device discoverable by other devices
@@ -232,6 +268,5 @@ export class BluetoothSerial extends IonicNativePlugin {
platforms: ['Android'],
sync: true
})
setDiscoverable(discoverableDuration: number): void { }
setDiscoverable(discoverableDuration: number): void {}
}
+3 -3
View File
@@ -148,7 +148,7 @@ export interface PaymentUIResult {
*
* @usage
* ```typescript
* import { Braintree, ApplePayOptions, PaymentUIOptions } from '@ionic-native/braintree';
* import { Braintree, ApplePayOptions, PaymentUIOptions } from '@ionic-native/braintree/ngx';
*
* constructor(private braintree: Braintree) { }
*
@@ -166,12 +166,12 @@ export interface PaymentUIResult {
* merchantId: '<YOUR MERCHANT ID>',
* currency: 'USD',
* country: 'US'
* };
* }
*
* const paymentOptions: PaymentUIOptions = {
* amount: '14.99',
* primaryDescription: 'Your product or service (per /item, /month, /week, etc)',
* };
* }
*
* this.braintree.initialize(BRAINTREE_TOKEN)
* .then(() => this.braintree.setupApplePay(appleOptions))
+1 -1
View File
@@ -60,7 +60,7 @@ export interface BranchUniversalObject {
*
* @usage
* ```
* import { BranchIo } from '@ionic-native/branch-io';
* import { BranchIo } from '@ionic-native/branch-io/ngx';
*
*
* constructor(private branch: BranchIo) { }
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Brightness } from '@ionic-native/brightness';
* import { Brightness } from '@ionic-native/brightness/ngx';
*
* constructor(private brightness: Brightness) { }
*
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name Broadcaster
@@ -9,7 +9,7 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```typescript
* import { Broadcaster } from '@ionic-native/broadcaster';
* import { Broadcaster } from '@ionic-native/broadcaster/ngx';
*
* constructor(private broadcaster: Broadcaster) { }
*
@@ -8,7 +8,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { BrowserTab } from '@ionic-native/browser-tab';
* import { BrowserTab } from '@ionic-native/browser-tab/ngx';
*
* constructor(private browserTab: BrowserTab) {
*
+1 -1
View File
@@ -66,7 +66,7 @@ export interface NameOrOptions {
*
* @usage
* ```typescript
* import { Calendar } from '@ionic-native/calendar';
* import { Calendar } from '@ionic-native/calendar/ngx';
*
* constructor(private calendar: Calendar) { }
*
@@ -19,7 +19,7 @@ export interface CallDirectoryLog {
*
* @usage
* ```typescript
* import { CallDirectory } from '@ionic-native/call-directory';
* import { CallDirectory } from '@ionic-native/call-directory/ngx';
*
*
* constructor(private callDirectory: CallDirectory) { }
@@ -62,7 +62,7 @@ export class CallDirectory extends IonicNativePlugin {
/**
* Add identification numbers
* @param {Array<CallDirectoryItem>} items Set of numbers with labels
* @param {CallDirectoryItem[]} items Set of numbers with labels
* @return {Promise<any>} Returns a promise that resolves when numbers are added
*/
@Cordova()
@@ -72,7 +72,7 @@ export class CallDirectory extends IonicNativePlugin {
/**
* Remove identification numbers
* @param {Array<CallDirectoryItem>} items Set of numbers with arbitrary label
* @param {CallDirectoryItem[]} items Set of numbers with arbitrary label
* @return {Promise<any>} Returns a promise that resolves when numbers are removed
*/
@Cordova()
@@ -91,7 +91,7 @@ export class CallDirectory extends IonicNativePlugin {
/**
* Get all numbers and labels in call directory
* @return {Array<CallDirectoryItem>} Returns a promise that resolves with an array of all items
* @return {CallDirectoryItem[]} Returns a promise that resolves with an array of all items
*/
@Cordova()
getAllItems(): Promise<CallDirectoryItem[]> {
+1 -1
View File
@@ -14,7 +14,7 @@ export interface CallLogObject {
*
* @usage
* ```typescript
* import { CallLog } from '@ionic-native/call-log';
* import { CallLog } from '@ionic-native/call-log/ngx';
*
*
* constructor(private callLog: CallLog) { }
@@ -9,7 +9,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { CallNumber } from '@ionic-native/call-number';
* import { CallNumber } from '@ionic-native/call-number/ngx';
*
* constructor(private callNumber: CallNumber) { }
*
@@ -63,7 +63,7 @@ export interface CameraPreviewPictureOptions {
*
* @usage
* ```typescript
* import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
* import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview/ngx';
*
* constructor(private cameraPreview: CameraPreview) { }
*
@@ -80,7 +80,7 @@ export interface CameraPreviewPictureOptions {
* previewDrag: true,
* toBack: true,
* alpha: 1
* };
* }
*
* // start camera
* this.cameraPreview.startCamera(cameraPreviewOpts).then(
+1 -1
View File
@@ -138,7 +138,7 @@ export enum Direction {
*
* @usage
* ```typescript
* import { Camera, CameraOptions } from '@ionic-native/camera';
* import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
*
* constructor(private camera: Camera) { }
*
+4 -4
View File
@@ -8,7 +8,7 @@ export interface CardIOOptions {
requireExpiry?: boolean;
/**
* The user will be prompted for the card CVV
* The user will be prompted for the card CVV
*/
requireCVV?: boolean;
@@ -18,7 +18,7 @@ export interface CardIOOptions {
requirePostalCode?: boolean;
/**
* Removes the keyboard button from the scan screen.
* Removes the keyboard button from the scan screen.
*/
suppressManual?: boolean;
@@ -43,7 +43,7 @@ export interface CardIOOptions {
scanInstructions?: string;
/**
* If set, the card will not be scanned with the camera.
* If set, the card will not be scanned with the camera.
*/
noCamera?: boolean;
@@ -141,7 +141,7 @@ export interface CardIOResponse {
* <string>To scan credit cards.</string>
* ```
* ```typescript
* import { CardIO } from '@ionic-native/card-io';
* import { CardIO } from '@ionic-native/card-io/ngx';
*
* constructor(private cardIO: CardIO) { }
*
+1 -1
View File
@@ -28,7 +28,7 @@ export interface ChooserResult {
*
* @usage
* ```typescript
* import { Chooser } from '@ionic-native/chooser';
* import { Chooser } from '@ionic-native/chooser/ngx';
*
*
* constructor(private chooser: Chooser) { }
+1 -1
View File
@@ -136,7 +136,7 @@ export interface CCKQuantityItem {
*
* @usage
* ```typescript
* import { ClassKit, CCKContext, CCKBinaryItem, CCKQuantityItem, CCKScoreItem, CCKContextTopic, CCKContextType, CCKBinaryType } from '@ionic-native/class-kit';
* import { ClassKit, CCKContext, CCKBinaryItem, CCKQuantityItem, CCKScoreItem, CCKContextTopic, CCKContextType, CCKBinaryType } from '@ionic-native/class-kit/ngx';
*
* // Init contexts defined in XML file 'CCK-contexts.xml'
* constructor( ..., private classKit: ClassKit) {
+1 -1
View File
@@ -10,7 +10,7 @@ declare var clevertap: any;
*
* @usage
* ```typescript
* import { CleverTap } from '@ionic-native/clevertap';
* import { CleverTap } from '@ionic-native/clevertap/ngx';
*
* constructor(private clevertap: CleverTap) { }
*
+1 -1
View File
@@ -8,7 +8,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { Clipboard } from '@ionic-native/clipboard';
* import { Clipboard } from '@ionic-native/clipboard/ngx';
*
* constructor(private clipboard: Clipboard) { }
*
@@ -8,7 +8,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { CloudSettings } from '@ionic-native/cloud-settings';
* import { CloudSettings } from '@ionic-native/cloud-settings/ngx';
*
*
* constructor(private cloudSettings: CloudSettings) { }
+6 -2
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
namespace Http {
export const enum Verb {
@@ -118,20 +118,24 @@ export interface ILocalPackage extends IPackage {
* Decomposed static side of RemotePackage.
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
*/
/* tslint:disable */
interface RemotePackage_Static {
new (): IRemotePackage;
}
/* tslint:enable */
/**
* Decomposed static side of LocalPackage.
* For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics
*/
/* tslint:disable */
interface LocalPackage_Static {
new (): ILocalPackage;
}
/* tslint:enable */
declare const RemotePackage: RemotePackage_Static;
@@ -460,7 +464,7 @@ export interface DownloadProgress {
*
* @usage
* ```typescript
* import { CodePush } from '@ionic-native/code-push';
* import { CodePush } from '@ionic-native/code-push/ngx';
*
* constructor(private codePush: CodePush) { }
*
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name Colored Browser Tabs
@@ -9,7 +9,7 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```typescript
* import { ColoredBrowserTabs } from '@ionic-native/colored-browser-tabs';
* import { ColoredBrowserTabs } from '@ionic-native/colored-browser-tabs/ngx';
*
*
* constructor(private browserTabs: ColoredBrowserTabs) { }
+15 -16
View File
@@ -92,22 +92,21 @@ export interface IContactProperties {
* @hidden
*/
export class Contact implements IContactProperties {
@InstanceProperty() id: string;
@InstanceProperty() displayName: string;
@InstanceProperty() name: IContactName;
@InstanceProperty() nickname: string;
@InstanceProperty() phoneNumbers: IContactField[];
@InstanceProperty() emails: IContactField[];
@InstanceProperty() addresses: IContactAddress[];
@InstanceProperty() ims: IContactField[];
@InstanceProperty() organizations: IContactOrganization[];
@InstanceProperty() birthday: Date;
@InstanceProperty() note: string;
@InstanceProperty() photos: IContactField[];
@InstanceProperty() categories: IContactField[];
@InstanceProperty() urls: IContactField[];
private _objectInstance: any;
@InstanceProperty id: string;
@InstanceProperty rawId: string;
@InstanceProperty displayName: string;
@InstanceProperty name: IContactName;
@InstanceProperty nickname: string;
@InstanceProperty phoneNumbers: IContactField[];
@InstanceProperty emails: IContactField[];
@InstanceProperty addresses: IContactAddress[];
@InstanceProperty ims: IContactField[];
@InstanceProperty organizations: IContactOrganization[];
@InstanceProperty birthday: Date;
@InstanceProperty note: string;
@InstanceProperty photos: IContactField[];
@InstanceProperty categories: IContactField[];
@InstanceProperty urls: IContactField[];
[key: string]: any;
@@ -314,7 +313,7 @@ export class ContactFindOptions implements IContactFindOptions {
* @usage
*
* ```typescript
* import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
* import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts/ngx';
*
* constructor(private contacts: Contacts) { }
*
@@ -1,5 +1,5 @@
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* @name Couchbase Lite
@@ -8,9 +8,9 @@ import { Injectable } from '@angular/core';
*
* @usage
* ```typescript
* import { CouchbaseLite } from '@ionic-native/couchbase-lite';
* import { CouchbaseLite } from '@ionic-native/couchbase-lite/ngx';
* import { Http } from '@angular/http';
* import { Observable } from 'rxjs/Observable'
* import { Observable } from 'rxjs'
* constructor(private couchbase: CouchbaseLite, private platform:Platform,private _http:Http) {
* this.initMethod();
* }
+1 -1
View File
@@ -12,7 +12,7 @@ export interface CropOptions {
* @description Crops images
* @usage
* ```typescript
* import { Crop } from '@ionic-native/crop';
* import { Crop } from '@ionic-native/crop/ngx';
*
* constructor(private crop: Crop) { }
*
@@ -125,7 +125,7 @@ export interface DatePickerOptions {
*
* @usage
* ```typescript
* import { DatePicker } from '@ionic-native/date-picker';
* import { DatePicker } from '@ionic-native/date-picker/ngx';
*
* constructor(private datePicker: DatePicker) { }
*
+2 -2
View File
@@ -1,13 +1,13 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
/**
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @usage
* ```typescript
* import { DBMeter } from '@ionic-native/db-meter';
* import { DBMeter } from '@ionic-native/db-meter/ngx';
*
* constructor(private dbMeter: DBMeter) { }
*
+20 -10
View File
@@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface DeeplinkMatch {
/**
* The route info for the matched route
*/
@@ -20,7 +19,6 @@ export interface DeeplinkMatch {
* the route was matched (for example, Facebook sometimes adds extra data)
*/
$link: any;
}
export interface DeeplinkOptions {
@@ -37,7 +35,7 @@ export interface DeeplinkOptions {
*
* @usage
* ```typescript
* import { Deeplinks } from '@ionic-native/deeplinks';
* import { Deeplinks } from '@ionic-native/deeplinks/ngx';
*
* constructor(private deeplinks: Deeplinks) { }
*
@@ -85,13 +83,18 @@ export interface DeeplinkOptions {
plugin: 'ionic-plugin-deeplinks',
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/ionic-team/ionic-plugin-deeplinks',
install: 'ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX'],
install:
'ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
installVariables: [
'URL_SCHEME',
'DEEPLINK_SCHEME',
'DEEPLINK_HOST',
'ANDROID_PATH_PREFIX'
],
platforms: ['Android', 'Browser', 'iOS']
})
@Injectable()
export class Deeplinks extends IonicNativePlugin {
/**
* Define a set of paths to match against incoming deeplinks.
*
@@ -105,7 +108,9 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
route(paths: any): Observable<DeeplinkMatch> { return; }
route(paths: any): Observable<DeeplinkMatch> {
return;
}
/**
*
@@ -132,6 +137,11 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
routeWithNavController(navController: any, paths: any, options?: DeeplinkOptions): Observable<DeeplinkMatch> { return; }
routeWithNavController(
navController: any,
paths: any,
options?: DeeplinkOptions
): Observable<DeeplinkMatch> {
return;
}
}
@@ -19,7 +19,7 @@ export interface AndroidAccount {
*
* @usage
* ```typescript
* import { DeviceAccounts } from '@ionic-native/device-accounts';
* import { DeviceAccounts } from '@ionic-native/device-accounts/ngx';
*
* constructor(private deviceAccounts: DeviceAccounts) { }
*
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface DeviceFeedbackEnabled {
export interface DeviceFeedbackStatus {
/** Haptic Feedback */
haptic: boolean;
@@ -17,7 +17,7 @@ export interface DeviceFeedbackEnabled {
*
* @usage
* ```typescript
* import { DeviceFeedback } from '@ionic-native/device-feedback';
* import { DeviceFeedback } from '@ionic-native/device-feedback/ngx';
*
* constructor(private deviceFeedback: DeviceFeedback) { }
*
@@ -67,7 +67,7 @@ export class DeviceFeedback extends IonicNativePlugin {
* @returns {Promise<DeviceFeedbackEnabled>}
*/
@Cordova()
isFeedbackEnabled(): Promise<DeviceFeedbackEnabled> {
isFeedbackEnabled(): Promise<DeviceFeedbackStatus> {
return;
}
}
@@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface DeviceMotionAccelerationData {
/**
* Amount of acceleration on the x-axis. (in m/s^2)
*/
@@ -23,16 +22,13 @@ export interface DeviceMotionAccelerationData {
* Creation timestamp in milliseconds.
*/
timestamp: any;
}
export interface DeviceMotionAccelerometerOptions {
/**
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
*/
frequency?: number;
}
/**
@@ -42,7 +38,7 @@ export interface DeviceMotionAccelerometerOptions {
*
* @usage
* ```typescript
* import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion';
* import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion/ngx';
*
* constructor(private deviceMotion: DeviceMotion) { }
*
@@ -72,17 +68,28 @@ export interface DeviceMotionAccelerometerOptions {
plugin: 'cordova-plugin-device-motion',
pluginRef: 'navigator.accelerometer',
repo: 'https://github.com/apache/cordova-plugin-device-motion',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone 8']
platforms: [
'Android',
'BlackBerry 10',
'Browser',
'Firefox OS',
'iOS',
'Tizen',
'Ubuntu',
'Windows',
'Windows Phone 8'
]
})
@Injectable()
export class DeviceMotion extends IonicNativePlugin {
/**
* Get the current acceleration along the x, y, and z axes.
* @returns {Promise<DeviceMotionAccelerationData>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> {
return;
}
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
@@ -94,6 +101,9 @@ export class DeviceMotion extends IonicNativePlugin {
observable: true,
clearFunction: 'clearWatch'
})
watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
watchAcceleration(
options?: DeviceMotionAccelerometerOptions
): Observable<DeviceMotionAccelerationData> {
return;
}
}
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface DeviceOrientationCompassHeading {
/**
@@ -44,7 +44,7 @@ export interface DeviceOrientationCompassOptions {
* @usage
* ```typescript
* // DeviceOrientationCompassHeading is an interface for compass
* import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation';
* import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation/ngx';
*
* constructor(private deviceOrientation: DeviceOrientation) { }
*
+9 -9
View File
@@ -10,7 +10,7 @@ declare const window: any;
*
* @usage
* ```typescript
* import { Device } from '@ionic-native/device';
* import { Device } from '@ionic-native/device/ngx';
*
* constructor(private device: Device) { }
*
@@ -30,38 +30,38 @@ declare const window: any;
export class Device extends IonicNativePlugin {
/** Get the version of Cordova running on the device. */
@CordovaProperty
@CordovaProperty()
cordova: string;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
*/
@CordovaProperty
@CordovaProperty()
model: string;
/** Get the device's operating system name. */
@CordovaProperty
@CordovaProperty()
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
@CordovaProperty
@CordovaProperty()
uuid: string;
/** Get the operating system version. */
@CordovaProperty
@CordovaProperty()
version: string;
/** Get the device's manufacturer. */
@CordovaProperty
@CordovaProperty()
manufacturer: string;
/** Whether the device is running on a simulator. */
@CordovaProperty
@CordovaProperty()
isVirtual: boolean;
/** Get the device hardware serial number. */
@CordovaProperty
@CordovaProperty()
serial: string;
}
@@ -8,13 +8,13 @@ import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-nati
*
* @usage
* ```typescript
* import { Diagnostic } from '@ionic-native/diagnostic';
* import { Diagnostic } from '@ionic-native/diagnostic/ngx';
*
* constructor(private diagnostic: Diagnostic) { }
*
* ...
*
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }
* let errorCallback = (e) => console.error(e);
*
* this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
@@ -70,7 +70,7 @@ export class Diagnostic extends IonicNativePlugin {
BODY_SENSORS: 'BODY_SENSORS'
};
@CordovaProperty
@CordovaProperty()
permissionStatus: {
GRANTED: string;
DENIED: string;
@@ -129,7 +129,7 @@ export class Diagnostic extends IonicNativePlugin {
POWERING_ON: 'powering_on'
};
@CordovaProperty
@CordovaProperty()
NFCState: {
UNKNOWN: string;
POWERED_OFF: string;
@@ -138,7 +138,7 @@ export class Diagnostic extends IonicNativePlugin {
POWERING_OFF: string;
};
@CordovaProperty
@CordovaProperty()
motionStatus: {
NOT_REQUESTED: string;
GRANTED: string;
+3 -3
View File
@@ -22,7 +22,7 @@ export interface DialogsPromptCallback {
*
* @usage
* ```typescript
* import { Dialogs } from '@ionic-native/dialogs';
* import { Dialogs } from '@ionic-native/dialogs/ngx';
*
* constructor(private dialogs: Dialogs) { }
*
@@ -65,7 +65,7 @@ export class Dialogs extends IonicNativePlugin {
* Displays a customizable confirmation dialog box.
* @param {string} message Dialog message.
* @param {string} [title] Dialog title. (Optional, defaults to Confirm)
* @param {Array<string>} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
* @param {string[]} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked, or 0 if the user has dismissed the dialog by clicking outside the dialog box. Note that the index use one-based indexing.
*/
@Cordova({
@@ -84,7 +84,7 @@ export class Dialogs extends IonicNativePlugin {
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param {string} [message] Dialog message.
* @param {string} [title] Dialog title. (Optional, defaults to Prompt)
* @param {Array<string>} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
* @param {string[]} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
* @param {string} [defaultText] Default text box input value. (Optional, Default: empty string)
* @returns {Promise<DialogsPromptCallback>} Returns a promise that resolves an object with the button index clicked and the text entered
*/
+4 -2
View File
@@ -7,7 +7,7 @@ import { Injectable } from '@angular/core';
*
* @usage
* ```typescript
* import { DNS } from '@ionic-native/dns';
* import { DNS } from '@ionic-native/dns/ngx';
*
*
* constructor(private dns: DNS) { }
@@ -36,5 +36,7 @@ export class DNS extends IonicNativePlugin {
* @returns {Promise<string>} Returns a promise that resolves with the resolution.
*/
@Cordova()
resolve(hostname: string): Promise<string> { return; }
resolve(hostname: string): Promise<string> {
return;
}
}
@@ -10,7 +10,7 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { DocumentPicker } from '@ionic-native/document-picker';
* import { DocumentPicker } from '@ionic-native/document-picker/ngx';
*
* constructor(private docPicker: DocumentPicker) { }
*
@@ -36,7 +36,7 @@ export interface DocumentViewerOptions {
*
* @usage
* ```typescript
* import { DocumentViewer } from '@ionic-native/document-viewer';
* import { DocumentViewer } from '@ionic-native/document-viewer/ngx';
*
*
* constructor(private document: DocumentViewer) { }
@@ -69,21 +69,24 @@ export class DocumentViewer extends IonicNativePlugin {
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
*/
@Cordova()
getSupportInfo(): Promise<any> { return; }
getSupportInfo(): Promise<any> {
return;
}
/**
* Check if the document can be shown
*
* @param url {string} Url to the file
* @param contentType {string} Content type of the file
* @param options {Array<DocumentViewerOptions>} options
* @param options {DocumentViewerOptions} options
* @param [onPossible] {Function}
* @param [onMissingApp] {Function}
* @param [onImpossible] {Function}
* @param [onError] {Function}
*/
@Cordova({ sync: true })
canViewDocument(url: string, contentType: string, options: DocumentViewerOptions, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void { }
canViewDocument(url: string, contentType: string, options: DocumentViewerOptions, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void {
}
/**
* Opens the file
@@ -97,6 +100,7 @@ export class DocumentViewer extends IonicNativePlugin {
* @param [onError] {Function}
*/
@Cordova({ sync: true })
viewDocument(url: string, contentType: string, options: DocumentViewerOptions, onShow?: Function, onClose?: Function, onMissingApp?: Function, onError?: Function): void { }
viewDocument(url: string, contentType: string, options: DocumentViewerOptions, onShow?: Function, onClose?: Function, onMissingApp?: Function, onError?: Function): void {
}
}
@@ -3,7 +3,8 @@ import {
Cordova,
CordovaCheck,
IonicNativePlugin,
Plugin
Plugin,
getPromise
} from '@ionic-native/core';
export interface EmailComposerOptions {
@@ -62,7 +63,7 @@ export interface EmailComposerOptions {
*
* @usage
* ```typescript
* import { EmailComposer } from '@ionic-native/email-composer';
* import { EmailComposer } from '@ionic-native/email-composer/ngx';
*
* constructor(private emailComposer: EmailComposer) { }
*
@@ -88,7 +89,7 @@ export interface EmailComposerOptions {
* subject: 'Cordova Icons',
* body: 'How are you? Nice greetings from Leipzig',
* isHtml: true
* };
* }
*
* // Send a text message using default options
* this.emailComposer.open(email);
@@ -149,7 +150,7 @@ export class EmailComposer extends IonicNativePlugin {
*/
@CordovaCheck()
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
return getPromise<boolean>((resolve, reject) => {
if (app) {
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export interface EstimoteBeaconRegion {
state?: string;
@@ -22,7 +22,7 @@ export interface EstimoteBeaconRegion {
*
* @usage
* ```typescript
* import { EstimoteBeacons } from '@ionic-native/estimote-beacons';
* import { EstimoteBeacons } from '@ionic-native/estimote-beacons/ngx';
*
* constructor(private eb: EstimoteBeacons) { }
*
@@ -475,9 +475,9 @@ export class EstimoteBeacons extends IonicNativePlugin {
/**
* Stop monitoring secure beacons. Available on iOS.
* This function has the same parameters/behavior as
* This function has the same parameters/behaviour as
* {@link EstimoteBeacons.stopMonitoringForRegion}.
* @param {EstimoteBeaconRegion} region Region
* @param region {EstimoteBeaconRegion} Region
* @returns {Promise<any>}
*/
@Cordova()
@@ -12,7 +12,7 @@ import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
*
* @usage
* ```typescript
* import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information';
* import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information/ngx';
*
*
* constructor(private extendedDeviceInformation: ExtendedDeviceInformation) { }
@@ -35,24 +35,24 @@ export class ExtendedDeviceInformation extends IonicNativePlugin {
/**
* Get the device's memory size
*/
@CordovaProperty
memory: string;
@CordovaProperty()
memory: number;
/**
* Get the device's CPU mhz
*/
@CordovaProperty
cpumhz: number;
@CordovaProperty()
cpumhz: string;
/**
* Get the total storage
*/
@CordovaProperty
@CordovaProperty()
totalstorage: string;
/**
* Get the total storage
*/
@CordovaProperty
@CordovaProperty()
freestorage: number;
}
+2 -2
View File
@@ -14,7 +14,7 @@ export interface Attributes {
*
* @usage
* ```typescript
* import { Crashlytics } from '@ionic-native/fabric';
* import { Crashlytics } from '@ionic-native/fabric/ngx';
*
*
* constructor(private crashlytics: Crashlytics) { }
@@ -142,7 +142,7 @@ export class Crashlytics extends IonicNativePlugin {
*
* @usage
* ```typescript
* import { Answers } from '@ionic-native/fabric';
* import { Answers } from '@ionic-native/fabric/ngx';
*
*
* constructor(private answers: Answers) { }
+1 -1
View File
@@ -89,7 +89,7 @@ export interface FacebookLoginResponse {
*
* @usage
* ```typescript
* import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
* import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook/ngx';
*
* constructor(private fb: Facebook) { }
*

Some files were not shown because too many files have changed in this diff Show More