chore(): merge v3-injectable into master (#1203)

* feat(push): plugin is now instance based

no more callbacks

closes #250

* fix(push): fix typo in PushEvents enum

* fix constructor

* feat(push): add subscribe/unsubscribe

fixes #861

* First try

* Moving to modules

* Removed

* Moving things aroudn

* tsconfig for plugins

* Plugin tsconfigs

* Core kind of buidls

* Core

* Plugin tsconfig

* Test

* Remove core

* Build

* Individual packages

* Build and push

* Some stuff

* Bump

* Update core-package.json.template

* Update plugin-package.json.template

* 3.0.0

* Working on injectable

* Updates

* Checkpoint

* More stuff

* Remove duplicate injectables

* Remove lots of static stuff with a fancy regex

* Fix build errors

* chore(): nodejs build script

* chore(): move fs-extra-promise to devDeps

* feat(): make instance based plugins injectable

* Cleanup

* chore(build): convert dependencies to peer dependencies

* chore(build): add auto install scripts (#1059)

* feat(core): auto install scripts

* minor fixes

* minor fixes

* remove prompt message

* fix(plugins): rename packages/classes

* rename google maps

* gulp task to generate readme files

* readme templates

* automating readme file generation and adding it to CI

# Conflicts:
#	src/@ionic-native/plugins/googlemap/index.ts
#	src/@ionic-native/plugins/inappbrowser/index.ts
#	src/@ionic-native/plugins/media/index.ts
#	src/@ionic-native/plugins/sqlite/index.ts

* outputting readmes to dist dir instead of src

* updating package name in usage instructions

* chore(): ngc build

* fix build

* 3.0.1-0

* 3.1.0-alpha.1

* fix AoT support and add publish script

* 3.1.0-alpha.2

* edit publish command

* remove alpha tag

* remove auto-install and cleanup

* 3.1.0-alpha.3

* remove utils from publish command

* refactor(): remove some prefixes

* remove console logs

closes #1145

* chore(): merge master into v3-injectable (#1146)

* 2.5.0

* chore(): update changelog

* fix(pin-dialog): add missing errorIndex

* 2.5.1

* chore(): update changelog

* fix(zip): progress callback is optional (#1049)

* fix(apprate): add missing Windows Store option (#1072)

* Update file-chooser.ts (#1071)

Removed semicolon after .then() in usage instructions

* docs(device-motion): update interface names (#1076)

AccelerationData interface is wrongly named in docs. It should be DeviceMotionAccelerationData. And I added it to import statement.

* feat(inappbrowser): add interface for IAB options (#1065)

* Add InAppBrowserOptions Interface for better tooling.

* feat(inappbrowser): add  interface for IAB options

* Add more constructor tests.

* Add missing iOS options.

* docs(media): update method usage (#1089)

* fix(push): add the missing option clearBadge (#1087)

* docs(badge): fix example (#1096)

Error in code example (supplied parameters do not match call signature)

* fix(imagepicker): add outputType option (#1098)

* fix(facebook): fixes issue when not supplying default params (#1088)

* Fix default facebook logEvent parameters

* Implement correct parameters format in facebook logEvent method

* Update ibeacon.ts (#1099)

Return type of `getAuthorizationStatus()` made more explicit.

* fix(file): add missing exports (#1101)

Any declaration that is not being exported is missing from the resulting d.ts declaration files.

* Add InAppBrowserOptions interface to documentation. (#1103)

* Update sqlite.ts (#1106)

Added a bracket to remove the syntax error

* update device orientation docs to reflect renaming of CompassHeading interface (#1107)

* Move marker code inside MAP_READY (#1108)

The code to set the camera position and marker should be moved inside the function handling MAP_READY.  Otherwise they execute before the event is fired and it doesn't work.

* refactor(file): accept ArrayBuffer for data to write (#1109)

* docs(google-maps): fix param type

closes #1110

* fix(media): add missing pauseRecord and resumeRecord methods (#1122)

* docs(stripe): fix type and naming issues (#1129)

* refactor(paypal): fix type of items (#1125)

Type of items should be Array<PayPalItem> instead of string.

* fix(serial): Serial.requestPermission() options are optional (#1128)

* add success/error indices

* feat(browser-tab): add browser tab plugin (#1126)

* feature: added hasPermission function to Firebase fixes #1115

* feat: Implemented support for BrowserTab #1077

* docs(browser-tab): add proper docs

* fix(background-geolocation): configure returns a promise

closes #1118

* docs(background-geolocation): add return types and platforms

* fix(contacts): allow passing asterisk as contact field type

closes 1093

* fix(contacts): allow passing asterisk as contact field type

closes #1093

* fix(plugin): revert changes to support stable version (#1116)

 fix #1001

* feat(file): add system paths

* feat(app-update): add cordova-plugin-app-update support (#1105)

* add new app-update plugin

* update plugin info

* docs(app-update): add docs

* feat(alipay): add alipay support. (#1097)

* add cordova-alipay-base plugin. to support Alipay payment

* change ALI_PID to APP_ID, make it same with the latest SDK

* rewrite comments

* docs(google-maps): improve docs (#1095)

Move `map.moveCamera(position);` inside the MAP_READY event.
Allow to zoom the map on first launch (both iOS and Android).

* fix(file): remove FileError from return type (#1086)

Promises that reject with a `FileError` are not of the type `Promise<T|FileError>`, but `Promise<T>`.

The previous declarations of `Promise<T|FileError>` would break typing further down the chain where you are trying to use the value that the typing says could be `T|FileError` but in reality could only be `T`.

* feat(google-maps): add constant for map type

* fix(file): platform Browser will raise a an DOMException (#1082)

fix(File): Platform Browser will raise a an DOMException on resoleLocalFilesystemUrl and tries to write on readonly property DOMException err.message in fillErrorMessage

* feat(local-notifications): support for icon background color (#1079)

The Cordova plugin Ionic Natives uses allows specifying the background color of the smallIcon.  By not including it in your interface you force users to use the default color for their version of Android.  While the LocalNotification plugin is not well documented, it does include this feature, see Options.java line 253:

```
/**
     * @return
     *      The notification background color for the small icon
     *      Returns null, if no color is given.
     */
    public int getColor() {
        String hex = options.optString("color", null);

        if (hex == null) {
            return NotificationCompat.COLOR_DEFAULT;
        }

        int aRGB = Integer.parseInt(hex, 16);

        return aRGB + 0xFF000000;
    }
```

I've simply added the option to the interface as well as a short description.

This lets you go from the default color (varies by Android version): https://goo.gl/photos/nERcj4GZgapy8aee9
To any color you'd like: https://goo.gl/photos/t8V9WVba8jDU49aHA
And also works if you also specify a large icon: https://goo.gl/photos/gWQYwa12djmdXfYcA

* feat(unique-device-add): add UniqueDeviceId plugin (#1064)

* fix plugin

* feat(text-to-speech): Add stop method (#1063)

https://github.com/vilic/cordova-plugin-tts/pull/32

* feat(appodeal): adds Appodeal SDK wrappers for iOS and Android (#1031)

* feat(Appodeal) bootrapping

* starting docs

* more docs

* feat(appodeal): add event Observables

* feat(appodeal): replace Cordova Observable events with #.fromEvent()

* feat(appodeal): update decorator metadata

* feat(couchbase-lite): add CouchbaseLite cordova plugin (#1025)

* feat(CouchbaseLite): add CouchbaseLite cordova plugin

* add plugin url

* feat(background-fetch): Adding Background Fetch requested in #990 (#1013)

* Adding Background Fetch (https://github.com/transistorsoft/cordova-plugin-background-fetch) requested in #990

* Adding BackgroundFetch to index

* feat(gyroscope): add Gyroscope plugin (#1004)

* add gyroscope.ts to plugins

* add gyroscope to index

* Update gyroscope.ts

* Update gyroscope.ts

* Revert "fix(File): typing where `FileError` can be thrown" (#1130)

* tslint and fix build issues

* 2.6.0

* chore(): update changelog

* fix(core): dont check if method exists when overriding

fixes #1043

* fix(file): fix writeExistingFile

closes #1044

* feat(diagnostic): add new methods

closes #1045

* feat(background-mode): replace event listeners with on method

The methods onactivate, ondeactive and onfailure no longer exist. You must now use `on` method.

* feat(background-mode): add missing functions

 closes #1078

* tslint

* set GoogleMapsMapTypeId to private

* remove beta from stripe

* 2.7.0

* chore(): update changelog

* feat(app-preferences): added cordova-plugin-app-preferences support (#1084)

* (feat) added cordova-plugin-app-preferences support

* replaced callback functions with promises

* updated example

* (feat) added cordova-plugin-browsertab support

* Revert "(feat) added cordova-plugin-browsertab support"

This reverts commit 00eb5cf5d8.

* (update) synchronize fetch

* feat(photo-library): added cordova-plugin-photo-library (#1102)

* feat(photo-library): added cordova-plugin-photo-library

* CordovaFiniteObservable moved to photo-library.
Overloads are marked as private.

* refactor(photo-library): fixed circleci failing in 2.7.0 (#1132)

* feat(photo-library): added cordova-plugin-photo-library

* CordovaFiniteObservable moved to photo-library.
Overloads are marked as private.

* fixed typescript error in 2.7.0

* feat(health): add wrapper for cordova-plugin-health (#1039)

* feat(health): add wrapper for cordova-plugin-health

* fix(Health): add optional params to QueryOptions for .query()

* docs(health): fix javadoc of interfaces

* fix(health): remove unused Plugin option

* docs(health): add missing documentation

* doc(health): add promise to return

* doc(health): remove empty lines

* doc(health): Add description & reference to repo

* doc(health: add "return {Promise<any>}"

* refactor(safari-view-controller): hide returns promise

* fix typo in ibeacon plugin (#1138)

* fix(file): fix return types

fixes #1139

* docs(background-geolocation): fix param docs

* refactor(health): fix return types and prefix interfaces

* 2.8.0

* chore(): update changelog

* docs(sqlite): syntax error resolved (#1142)

* Syntax error resolved

The `{}` should be `[]`, but since there is no binding we do not get error. In case we add one, then the syntax will be incorrect.

* Fixed a syntax error

* fix(background-geolocation): configure returns an observable

* docs(): update docs

* 3.1.0-rc.1

* refactor(background-geolocation): update imports

* docs(background-fetch): fix return type

* docs(health): fix return type

* chore(CI): fixing npm install instructions in generated readmes

* set concurrency to number of cores

* chore(): update deps

* 3.1.0-rc.2

* chore(): update angular to 2.4.8

* 3.1.0-rc.3

* chore(): update angular to 2.4.8

* chore(): update rxjs to 5.0.1

* chore(): organize and enhance decorators (#1171)

* fix/add decorators

* fix google maps design

* chore(): add root tsconfig to resolve imports in IDE

* updates

* more fixes

* chore(): add options to InstanceCheck

* chore(decorators): promise is default for Cordova/Instance check

* chore(): add check decroators

* docs(): update plugin docs

* chore(decorators): fix cordovaCheck and instanceCheck

* 3.1.0-rc.4

* chore(docs): remove gitPackage from doc generator

* chore(docs): update to latest dgeni version

* fix diagnostic

* feat(media): create method now returns a promise

Breaking change: create no longer returns a MediaObject instance. Make changes to your app accordingly.

* docs update + remove any static methods/properties

* remove duplicate method

* remove extra docs

* remove extra docs

* docs(): rename plugins

* chore(decorators): do not check method name on instancecheck

* chore(decorators): do not check method name on cordovacheck

* chore(plugin): fix pluginWarn

* chore(plugin): fix pluginWarn

* fix(decorators): fix InstanceCheck decorator

* 3.1.0-rc.5

* chore(docs): fix readme generation

* fix(transfer): fix v3 implementation

* refactor(paypal): PayPal is brand name

* chore(docs): replace all spaces with dashes

* chore(): add dashify filter

* chore(build): add aot path to core tsconfig

* feat(action-sheet): add ANDROID_THEMES constant

* refactor(): general cleanup (#1193)

* feat(screen-orientation): update wrapper to match v2 of the plugin

The whole implementation has changed now. You must update your code.

* feat(stripe): add new methods

* feat(linkedin): add LinkedIn plugin

* 3.1.0-rc.6

* style(screen-orientation): double quote to single

* tslint

* refactor(pedometer): rename file to index
This commit is contained in:
Ibby Hadeed
2017-03-20 16:38:14 -04:00
committed by GitHub
parent 8cd648db5c
commit 2f2d55f1d5
222 changed files with 6101 additions and 7958 deletions
+23
View File
@@ -0,0 +1,23 @@
declare var window;
export function checkReady() {
const DEVICE_READY_TIMEOUT = 5000;
// To help developers using cordova, we listen for the device ready event and
// log an error if it didn't fire in a reasonable amount of time. Generally,
// when this happens, developers should remove and reinstall plugins, since
// an inconsistent plugin is often the culprit.
const before = Date.now();
let didFireReady = false;
document.addEventListener('deviceready', () => {
console.log(`Ionic Native: deviceready event fired after ${(Date.now() - before)} ms`);
didFireReady = true;
});
setTimeout(() => {
if (!didFireReady && window.cordova) {
console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
}
}, DEVICE_READY_TIMEOUT);
}
+344
View File
@@ -0,0 +1,344 @@
import { instanceAvailability, checkAvailability, wrap, wrapInstance, overrideFunction } from './plugin';
import { getPlugin, getPromise } from './util';
import { Observable } from 'rxjs/Observable';
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[];
}
export interface CordovaOptions {
/**
* 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;
}
export interface CordovaFiniteObservableOptions extends CordovaOptions {
/**
* Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete.
*/
resultFinalPredicate?: (result: any) => boolean;
/**
* Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result.
*/
resultTransform?: (result: any) => any;
}
/**
* @private
*/
export function InstanceCheck(opts: CordovaCheckOptions = {}) {
return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any> => {
return {
value: function(...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(() => {});
}
}
};
};
}
/**
* 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: function(...args: any[]): any {
if (checkAvailability(pluginObj) === true) {
return descriptor.value.apply(this, args);
} else {
if (opts.sync) {
return;
} else if (opts.observable) {
return new Observable<any>(() => {});
}
return getPromise(() => {});
}
}
};
};
}
/**
* @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) {
return function(cls) {
// Add these fields to the class
for (let k in config) {
cls[k] = config[k];
}
cls['installed'] = function(printWarning?: boolean) {
return !!getPlugin(config.pluginRef);
};
cls['getPlugin'] = function() {
return getPlugin(config.pluginRef);
};
cls['checkInstall'] = function() {
return checkAvailability(cls) === true;
};
cls['getPluginName'] = function() {
return config.pluginName;
};
cls['getPluginRef'] = function() {
return config.pluginRef;
};
cls['getPluginInstallName'] = function() {
return config.plugin;
};
cls['getPluginRepo'] = function() {
return config.repo;
};
cls['getSupportedPlatforms'] = function() {
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: function(...args: any[]) {
return wrap(this, methodName, opts).apply(this, args);
}
};
};
}
/**
* @private
*
* Wrap an instance method
*/
export function CordovaInstance(opts: any = {}) {
return (target: Object, methodName: string) => {
return {
value: function(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
}
};
};
}
/**
* @private
*
*
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
export function CordovaProperty(target: any, key: string) {
Object.defineProperty(target, key, {
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, {
get: function(){
return this._objectInstance[key];
},
set: function(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: function(...args: any[]) {
return overrideFunction(this, methodName, opts);
}
};
};
}
/**
* @private
*
* Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes.
*
*/
export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) {
if (opts.observable === false) {
throw new Error('CordovaFiniteObservable decorator can only be used on methods that returns observable. Please provide correct option.');
}
opts.observable = true;
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
return {
value: function(...args: any[]) {
let wrappedObservable: Observable<any> = wrap(this, methodName, opts).apply(this, args);
return new Observable<any>((observer) => {
let wrappedSubscription = wrappedObservable.subscribe({
next: (x) => {
observer.next(opts.resultTransform ? opts.resultTransform(x) : x);
if (opts.resultFinalPredicate && opts.resultFinalPredicate(x)) {
observer.complete();
}
},
error: (err) => { observer.error(err); },
complete: () => { observer.complete(); }
});
return () => {
wrappedSubscription.unsubscribe();
};
});
}
};
};
}
+3
View File
@@ -0,0 +1,3 @@
export * from './plugin';
export * from './decorators';
export * from './util';
+309
View File
@@ -0,0 +1,309 @@
import { get, getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
import { checkReady } from './bootstrap';
import { CordovaOptions } from './decorators';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
checkReady();
declare var window;
declare var Promise;
/**
* Checks if plugin/cordova is available
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string);
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: 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 && pluginInstance[methodName] === 'undefined')) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return {
error: 'cordova_not_available'
};
}
pluginWarn(pluginName, pluginPackage, methodName);
return {
error: '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 || 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, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
} else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
let 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();
} 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;
}
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;
}
}
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
// Angular throws an error on unhandled rejection, but in this case we have already printed
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
}
return p;
}
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
return getPromise((resolve, reject) => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult && pluginResult.error) {
reject(pluginResult.error);
}
pluginResult.then(resolve).catch(reject);
});
}
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return new Observable(observer => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
}
return () => {
try {
if (opts.clearFunction) {
if (opts.clearWithArgs) {
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
}
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
}
};
});
}
function callInstance(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) {
args = setIndex(args, opts, resolve, reject);
if (instanceAvailability(pluginObj, methodName)) {
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
}
}
/**
* 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 Observable.fromEvent(element, event);
}
/**
* 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, 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();
}
});
}
/**
* @private
*/
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
return (...args) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts);
} else if (opts.observable) {
return wrapObservable(pluginObj, methodName, args, opts);
} else if (opts.eventObservable && opts.event) {
return wrapEventObservable(opts.event, opts.element);
} else if (opts.otherPromise) {
return wrapOtherPromise(pluginObj, methodName, args, opts);
} else {
return wrapPromise(pluginObj, methodName, args, opts);
}
};
};
/**
* @private
*/
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
} else if (opts.observable) {
return new Observable(observer => {
let pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
}
return () => {
try {
if (opts.clearWithArgs) {
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
}
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
}
};
});
} else if (opts.otherPromise) {
return getPromise((resolve, reject) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
if (result && !result.error) {
result.then(resolve, reject);
}
});
} else {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
}
return p;
}
};
}
+68
View File
@@ -0,0 +1,68 @@
declare var window: any;
/**
* @private
*/
export function get(obj, path) {
path = path.split('.');
for (let i = 0; i < path.length; i++) {
if (!obj) { return null; }
obj = obj[path[i]];
}
return obj;
}
/**
* @private
*/
export function getPromise(cb) {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
}
};
return tryNativePromise();
}
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
export function getPlugin(pluginRef: string): any {
return get(window, pluginRef);
};
/**
* @private
*/
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) {
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 plugin add ' + plugin + '\'');
}
};
/**
* @private
* @param pluginName
* @param method
*/
export const cordovaWarn = function(pluginName: string, method?: string) {
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');
}
};
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaProperty } from '@ionic-native/core';
export interface ActionSheetOptions {
@@ -53,15 +54,24 @@ export interface ActionSheetOptions {
*
* @usage
* ```typescript
* import { ActionSheet } from 'ionic-native';
* import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet';
*
* constructor(private actionSheet: ActionSheet) { }
*
* ...
*
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
* 'title': 'What do you want with this image?',
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then((buttonIndex: number) => {
*
* const options: ActionSheetOptions = {
* title: 'What do you want with this image?',
* buttonLabels: buttonLabels,
* addCancelButtonWithLabel: 'Cancel',
* addDestructiveButtonWithLabel: 'Delete',
* androidTheme: this.actionSheet.ANDROID_THEMES.THEME_HOLO_DARK
* };
*
* this.actionSheet.show(options).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonIndex);
* });
* ```
@@ -75,8 +85,18 @@ export interface ActionSheetOptions {
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class ActionSheet {
@CordovaProperty
ANDROID_THEMES: {
THEME_TRADITIONAL: number;
THEME_HOLO_DARK: number;
THEME_HOLO_LIGHT: number;
THEME_DEVICE_DEFAULT_DARK: number;
THEME_DEVICE_DEFAULT_LIGHT: number;
};
/**
* Show a native ActionSheet component. See below for options.
* @param options {ActionSheetOptions} Options See table below
@@ -84,7 +104,7 @@ export class ActionSheet {
* button pressed (1 based, so 1, 2, 3, etc.)
*/
@Cordova()
static show(options?: ActionSheetOptions): Promise<any> { return; }
show(options?: ActionSheetOptions): Promise<any> { return; }
/**
@@ -92,6 +112,5 @@ export class ActionSheet {
* @returns {Promise<any>} Returns a Promise that resolves when the actionsheet is closed
*/
@Cordova()
static hide(options?: any): Promise<any> { return; }
hide(options?: any): Promise<any> { return; }
}
@@ -1,7 +1,8 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export type AdMobAdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
export type AdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
export interface AdMobOptions {
@@ -13,7 +14,7 @@ export interface AdMobOptions {
/**
* Banner Ad Size, defaults to `SMART_BANNER`. IT can be: `SMART_BANNER`, `BANNER`, `MEDIUM_RECTANGLE`, `FULL_BANNER`, `LEADERBOARD`, `SKYSCRAPER`, or `CUSTOM`
*/
adSize?: AdMobAdSize;
adSize?: AdSize;
/**
* Banner width, valid when `adSize` is set to `CUSTOM`
@@ -63,11 +64,11 @@ export interface AdMobOptions {
/**
* Set extra color style for Ad
*/
adExtras?: AdMobAdExtras;
adExtras?: AdExtras;
}
export interface AdMobAdExtras {
export interface AdExtras {
color_bg: string;
@@ -89,23 +90,25 @@ export interface AdMobAdExtras {
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
* @usage
* ```typescript
* import { AdMob } from 'ionic-native';
* import { AdMob, AdMobOptions, AdSize, AdExtras } from '@ionic-native/ad-mob';
*
* constructor(private admob: AdMob){}
*
* ionViewDidLoad() {
* AdMob.onAdDismiss()
* this.admob.onAdDismiss()
* .subscribe(() => { console.log('User dismissed ad'); });
* }
*
* onClick() {
* AdMob.prepareInterstitial('YOUR_ADID')
* .then(() => { AdMob.showInterstitial(); });
* this.admob.prepareInterstitial('YOUR_ADID')
* .then(() => { this.admob.showInterstitial(); });
* }
*
* ```
*
* @interfaces
* AdMobOptions
* AdMobAdExtras
* AdExtras
*/
@Plugin({
pluginName: 'AdMob',
@@ -114,12 +117,22 @@ export interface AdMobAdExtras {
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class AdMob {
/**
* @private
*/
static AD_POSITION = {
AD_POSITION: {
NO_CHANGE: number;
TOP_LEFT: number;
TOP_CENTER: number;
TOP_RIGHT: number;
LEFT: number;
CENTER: number;
RIGHT: number;
BOTTOM_LEFT: number;
BOTTOM_CENTER: number;
BOTTOM_RIGHT: number;
POS_XY: number;
} = {
NO_CHANGE: 0,
TOP_LEFT: 1,
TOP_CENTER: 2,
@@ -139,7 +152,7 @@ export class AdMob {
* @returns {Promise<any>} Returns a Promise that resolves when the banner is created
*/
@Cordova()
static createBanner(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
createBanner(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
/**
* Destroy the banner, remove it from screen.
@@ -147,7 +160,7 @@ export class AdMob {
@Cordova({
sync: true
})
static removeBanner(): void { }
removeBanner(): void { }
/**
* Show banner at position
@@ -156,7 +169,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showBanner(position: number): void { }
showBanner(position: number): void { }
/**
* Show banner at custom position
@@ -166,7 +179,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showBannerAtXY(x: number, y: number): void { }
showBannerAtXY(x: number, y: number): void { }
/**
* Hide the banner, remove it from screen, but can show it later
@@ -174,7 +187,7 @@ export class AdMob {
@Cordova({
sync: true
})
static hideBanner(): void { }
hideBanner(): void { }
/**
* Prepare interstitial banner
@@ -182,7 +195,7 @@ export class AdMob {
* @returns {Promise<any>} Returns a Promise that resolves when interstitial is prepared
*/
@Cordova()
static prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
/**
* Show interstitial ad when it's ready
@@ -190,7 +203,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showInterstitial(): void { }
showInterstitial(): void { }
/**
* Prepare a reward video ad
@@ -198,7 +211,7 @@ export class AdMob {
* @returns {Promise<any>} Returns a Promise that resolves when the ad is prepared
*/
@Cordova()
static prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise<any> { return; }
/**
* Show a reward video ad
@@ -206,7 +219,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showRewardVideoAd(): void { }
showRewardVideoAd(): void { }
/**
* Sets the values for configuration and targeting
@@ -214,14 +227,14 @@ export class AdMob {
* @returns {Promise<any>} Returns a Promise that resolves when the options have been set
*/
@Cordova()
static setOptions(options: AdMobOptions): Promise<any> { return; }
setOptions(options: AdMobOptions): Promise<any> { return; }
/**
* Get user ad settings
* @returns {Promise<any>} Returns a promise that resolves with the ad settings
*/
@Cordova()
static getAdSettings(): Promise<any> { return; }
getAdSettings(): Promise<any> { return; }
/**
* Triggered when failed to receive Ad
@@ -231,7 +244,7 @@ export class AdMob {
eventObservable: true,
event: 'onAdFailLoad'
})
static onAdFailLoad(): Observable<any> { return; }
onAdFailLoad(): Observable<any> { return; }
/**
* Triggered when Ad received
@@ -241,7 +254,7 @@ export class AdMob {
eventObservable: true,
event: 'onAdLoaded'
})
static onAdLoaded(): Observable<any> { return; }
onAdLoaded(): Observable<any> { return; }
/**
* Triggered when Ad will be showed on screen
@@ -251,7 +264,7 @@ export class AdMob {
eventObservable: true,
event: 'onAdPresent'
})
static onAdPresent(): Observable<any> { return; }
onAdPresent(): Observable<any> { return; }
/**
* Triggered when user click the Ad, and will jump out of your App
@@ -261,7 +274,7 @@ export class AdMob {
eventObservable: true,
event: 'onAdLeaveApp'
})
static onAdLeaveApp(): Observable<any> { return; }
onAdLeaveApp(): Observable<any> { return; }
/**
* Triggered when dismiss the Ad and back to your App
@@ -271,6 +284,6 @@ export class AdMob {
eventObservable: true,
event: 'onAdDismiss'
})
static onAdDismiss(): Observable<any> { return; }
onAdDismiss(): Observable<any> { return; }
}
@@ -1,9 +1,6 @@
import { Plugin, Cordova } from './plugin';
/**
* @link https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.wlOhAE&treeId=193&articleId=105465&docType=1
*
* All values need be urlencoded.
*/
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
export interface AlipayOrder {
/**
* appId assigned by Alipay
@@ -42,7 +39,7 @@ export interface AlipayOrder {
sign: string;
/**
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
*/
timestamp: string;
@@ -65,20 +62,23 @@ export interface AlipayOrder {
/**
* @name Alipay
* @description
* This plugin is used for Alipay APP support. Integrated with the latest SDK.
* This plugin is used for Alipay APP support. Integrated with the latest SDK.
*
* Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base).
*
* @usage
* ```
* import { Alipay } from 'ionic-native';
*
* import { Alipay, AlipayOrder } from '@ionic-native/alipay';
*
* constructor(private alipay: Alipay) {
*
* // Should get from server side with sign.
* let alipayOrder = {
...
* const alipayOrder: AlipayOrder = {
* ...
* };
*
* Alipay.pay(alipayOrder)
*
* this.alipay.pay(alipayOrder)
* .then(result => {
* console.log(result); // Success
* })
@@ -86,6 +86,9 @@ export interface AlipayOrder {
* console.log(error); // Failed
* });
*
* }
*
*
* ```
*
* @interfaces
@@ -99,6 +102,7 @@ export interface AlipayOrder {
platforms: ['Android', 'iOS'],
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
})
@Injectable()
export class Alipay {
/**
* Open Alipay to perform App pay
@@ -106,6 +110,6 @@ export class Alipay {
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
*/
@Cordova()
static pay(order: AlipayOrder): Promise<any> { return; }
pay(order: AlipayOrder): Promise<any> { return; }
}
@@ -1,6 +1,8 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface AndroidFingerprintAuthOptions {
export interface AFAAuthOptions {
/**
* Required
@@ -63,20 +65,56 @@ export interface AndroidFingerprintAuthOptions {
}
export interface AFADecryptOptions {
/**
* Biometric authentication
*/
withFingerprint: boolean;
/**
* Authentication using backup credential activity
*/
withBackup: boolean;
/**
* FingerprintAuth.CipherMode.DECRYPT
* Decrypted password
*/
password: string;
}
export interface AFAEncryptResponse {
/**
* Biometric authentication
*/
withFingerprint: boolean;
/**
* Authentication using backup credential activity
*/
withBackup: boolean;
/**
* base64encoded string representation of user credentials
*/
token: string;
}
/**
* @name Android Fingerprint Auth
* @description
* 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';
* import { AndroidFingerprintAuth, AFAAuthOptions } from '@ionic-native/android-fingerprint-auth';
*
* AndroidFingerprintAuth.isAvailable()
* constructor(private androidFingerprintAuth: AndroidFingerprintAuth) { }
*
* ...
*
*
* this.androidFingerprintAuth.isAvailable()
* .then((result)=> {
* if(result.isAvailable){
* // it is available
*
* AndroidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" })
* this.androidFingerprintAuth.encrypt({ clientId: "myAppName", username: "myUsername", password: "myPassword" })
* .then(result => {
* if (result.withFingerprint) {
* console.log("Successfully encrypted credentials.");
@@ -98,7 +136,9 @@ export interface AndroidFingerprintAuthOptions {
* .catch(error => console.error(error));
* ```
* @interfaces
* AndroidFingerprintAuthOptions
* AFAAuthOptions
* AFAEncryptResponse
* AFADecryptOptions
*/
@Plugin({
pluginName: 'AndroidFingerprintAuth',
@@ -106,62 +146,36 @@ export interface AndroidFingerprintAuthOptions {
pluginRef: 'FingerprintAuth',
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
})
@Injectable()
export class AndroidFingerprintAuth {
/**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param options {AndroidFingerprintAuthOptions} Options
* @param options {AFAAuthOptions} Options
* @returns {Promise<any>}
*/
@Cordova()
static encrypt(options: AndroidFingerprintAuthOptions): Promise<{
/**
* Biometric authentication
*/
withFingerprint: boolean;
/**
* Authentication using backup credential activity
*/
withBackup: boolean;
/**
* base64encoded string representation of user credentials
*/
token: string;
}> {return; }
encrypt(options: AFAAuthOptions): Promise<AFAEncryptResponse> {return; }
/**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param options {AndroidFingerprintAuthOptions} Options
* @param options {AFAAuthOptions} Options
* @returns {Promise<any>}
*/
@Cordova()
static decrypt(options: AndroidFingerprintAuthOptions): Promise<{
/**
* Biometric authentication
*/
withFingerprint: boolean;
/**
* Authentication using backup credential activity
*/
withBackup: boolean;
/**
* FingerprintAuth.CipherMode.DECRYPT
* Decrypted password
*/
password: string;
}> {return; }
decrypt(options: AFAAuthOptions): Promise<AFADecryptOptions> {return; }
/**
* Check if service is available
* @returns {Promise<any>} Returns a Promise that resolves if fingerprint auth is available on the device
*/
@Cordova()
static isAvailable(): Promise<{isAvailable: boolean}> { return; }
isAvailable(): Promise<{isAvailable: boolean}> { return; }
/**
* Delete the cipher used for encryption and decryption by username
* @returns {Promise<any>} Returns a Promise that resolves if the cipher was successfully deleted
*/
@Cordova()
static delete(options: {clientId: string; username: string; }): Promise<{deleted: boolean}> { return; }
delete(options: {clientId: string; username: string; }): Promise<{deleted: boolean}> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name App Availability
@@ -9,18 +10,22 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { AppAvailability, Device } from 'ionic-native';
* import { AppAvailability } from '@ionic-native/app-availability';
* import { Platform } from 'ionic-angular';
*
* constructor(private appAvailability: AppAvailability, private platform: Platform) { }
*
* ...
*
* let app;
*
* if (Device.platform === 'iOS') {
* if (this.platform.is('ios')) {
* app = 'twitter://';
* } else if (Device.platform === 'Android') {
* } else if (this.platform.is('android')) {
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* this.appAvailability.check(app)
* .then(
* (yes: string) => console.log(app + ' is available'),
* (no: string) => console.log(app + ' is NOT available')
@@ -34,6 +39,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/ohh2ahh/AppAvailability',
platforms: ['Android', 'iOS']
})
@Injectable()
export class AppAvailability {
/**
@@ -42,6 +48,6 @@ export class AppAvailability {
* @returns {Promise<boolean>}
*/
@Cordova()
static check(app: string): Promise<boolean> { return; }
check(app: string): Promise<boolean> { return; }
}
@@ -1,18 +1,23 @@
import { Cordova, Plugin } from './plugin';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
/**
* @name AppPreferences
* @name App Preferences
* @description
* This plugin allows you to read and write app preferences
*
* @usage
* ```typescript
* import { AppPreferences } from '@ionic-native/app-preferences';
*
* constructor(private appPreferences: AppPreferences) {
*
* this.appPreferences.fetch('key').then((res) => { console.log(res); });
*
* }
* ```
* import { AppPreferences } from 'ionic-native';
*
* AppPreferences.fetch('key').then((res) => { console.log(res); });
*
*```
*/
@Plugin({
pluginName: 'AppPreferences',
@@ -20,6 +25,7 @@ import { Observable } from 'rxjs/Observable';
pluginRef: 'plugins.appPreferences', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/apla/me.apla.cordova.app-preferences', // the github repository URL for the plugin
})
@Injectable()
export class AppPreferences {
/**
@@ -33,7 +39,7 @@ export class AppPreferences {
sync: true,
callbackOrder: 'reverse'
})
static fetch(dict: string, key?: string): Promise<any> { return; }
fetch(dict: string, key?: string): Promise<any> { return; }
/**
* Set a preference value
@@ -46,7 +52,7 @@ export class AppPreferences {
@Cordova({
callbackOrder: 'reverse'
})
static store(dict: string, key: string, value?: string): Promise<any> {
store(dict: string, key: string, value?: string): Promise<any> {
return;
}
@@ -60,7 +66,7 @@ export class AppPreferences {
@Cordova({
callbackOrder: 'reverse'
})
static remove(dict: string, key?: string): Promise<any> { return; }
remove(dict: string, key?: string): Promise<any> { return; }
/**
* Clear preferences
@@ -70,7 +76,7 @@ export class AppPreferences {
@Cordova({
callbackOrder: 'reverse'
})
static clearAll(): Promise<any> { return; }
clearAll(): Promise<any> { return; }
/**
* Show native preferences interface
@@ -80,7 +86,7 @@ export class AppPreferences {
@Cordova({
callbackOrder: 'reverse'
})
static show(): Promise<any> { return; }
show(): Promise<any> { return; }
/**
* Show native preferences interface
@@ -91,7 +97,7 @@ export class AppPreferences {
@Cordova({
observable: true
})
static watch(subscribe: boolean): Observable<any> { return; }
watch(subscribe: boolean): Observable<any> { return; }
/**
* Return named configuration context
@@ -103,12 +109,12 @@ export class AppPreferences {
@Cordova({
platforms: ['Android']
})
static suite(suiteName: string): Object { return; }
suite(suiteName: string): Object { return; }
@Cordova({
platforms: ['iOS']
})
static iosSuite(suiteName: string): Object { return; }
iosSuite(suiteName: string): Object { return; }
/**
* Return cloud synchronized configuration context
@@ -118,7 +124,7 @@ export class AppPreferences {
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
static cloudSync(): Object { return; }
cloudSync(): Object { return; }
/**
* Return default configuration context
@@ -128,6 +134,6 @@ export class AppPreferences {
@Cordova({
platforms: ['iOS', 'Windows', 'Windows Phone 8']
})
static defaults(): Object { return; }
defaults(): Object { return; }
}
@@ -1,4 +1,6 @@
import { Cordova, CordovaProperty, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin } from '@ionic-native/core';
declare var window;
@@ -47,7 +49,7 @@ export interface AppRatePreferences {
/**
* App Store URLS
*/
storeAppURL?: AppRateStoreAppUrls;
storeAppURL?: AppUrls;
}
@@ -65,7 +67,7 @@ export interface AppRateCallbacks {
}
export interface AppRateStoreAppUrls {
export interface AppUrls {
/**
* application id in AppStore
@@ -103,20 +105,24 @@ export interface AppRateStoreAppUrls {
*
* @usage
* ```typescript
* import { AppRate } from 'ionic-native';
* import { AppRate } from '@ionic-native/app-rate';
*
* AppRate.preferences.storeAppURL = {
* constructor(private appRate: AppRate) { }
*
* ...
*
* this.appRate.preferences.storeAppURL = {
* ios: '<my_app_id>',
* android: 'market://details?id=<package_name>',
* windows: 'ms-windows-store://review/?ProductId=<Store_ID>'
* };
*
* AppRate.promptForRating(false);
* this.appRate.promptForRating(false);
* ```
*
* @interfaces
* AppRatePreferences
* AppRateStoreAppUrls
* AppUrls
* AppRateCallbacks
*
*/
@@ -127,6 +133,7 @@ export interface AppRateStoreAppUrls {
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android', 'iOS', 'Windows (experimental)']
})
@Injectable()
export class AppRate {
/**
@@ -134,13 +141,13 @@ export class AppRate {
* See table below for options
*/
@CordovaProperty
static preferences: AppRatePreferences;
preferences: AppRatePreferences;
/**
* Prompts the user for rating
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()
static promptForRating(immediately: boolean): void { };
promptForRating(immediately: boolean): void { };
}
@@ -1,7 +1,8 @@
import { Plugin, Cordova } from './plugin';
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name AppUpdate
* @name App Update
* @description
* This plugin does self-update for android
*
@@ -19,11 +20,16 @@ import { Plugin, Cordova } from './plugin';
* Then use the following code:
*
* ```
* import { AppUpdate } from 'ionic-native';
* import { AppUpdate } from '@ionic-native/app-update';
*
* constructor(private appUpdate: AppUpdate) {
*
* const updateUrl = 'http://your-remote-api.com/update.xml';
* this.appUpdate.checkAppUpdate(updateUrl);
*
* }
*
* let updateUrl = 'http://your-remote-api.com/update.xml';
*
* AppUpdate.checkAppUpdate(updateUrl);
* ```
*
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
@@ -35,6 +41,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/vaenow/cordova-plugin-app-update',
platforms: ['Android']
})
@Injectable()
export class AppUpdate {
/**
* Check and update
@@ -44,6 +51,6 @@ export class AppUpdate {
@Cordova({
callbackOrder: 'reverse'
})
static checkAppUpdate(updateUrl: string): Promise<any> { return; }
checkAppUpdate(updateUrl: string): Promise<any> { return; }
}
@@ -1,4 +1,7 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name App Version
@@ -9,13 +12,18 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { AppVersion } from 'ionic-native';
* import { AppVersion } from '@ionic-native/app-version';
*
* constructor(private appVersion: AppVersion) { }
*
* ...
*
*
* AppVersion.getAppName();
* AppVersion.getPackageName();
* AppVersion.getVersionCode();
* AppVersion.getVersionNumber();
* this.appVersion.getAppName();
* this.appVersion.getPackageName();
* this.appVersion.getVersionCode();
* this.appVersion.getVersionNumber();
*
* ```
*/
@Plugin({
@@ -25,6 +33,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
platforms: ['Android', 'iOS']
})
@Injectable()
export class AppVersion {
/**
@@ -32,27 +41,27 @@ export class AppVersion {
* @returns {Promise<any>}
*/
@Cordova()
static getAppName(): Promise<any> { return; }
getAppName(): Promise<any> { return; }
/**
* Returns the package name of the app
* @returns {Promise<any>}
*/
@Cordova()
static getPackageName(): Promise<any> { return; }
getPackageName(): Promise<any> { return; }
/**
* Returns the build identifier of the app
* @returns {Promise<any>}
*/
@Cordova()
static getVersionCode(): Promise<any> { return; }
getVersionCode(): Promise<any> { return; }
/**
* Returns the version of the app
* @returns {Promise<any>}
*/
@Cordova()
static getVersionNumber(): Promise<any> { return; }
getVersionNumber(): Promise<any> { return; }
}
+519
View File
@@ -0,0 +1,519 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';
/**
* @name Appodeal
* @description
* Plugin to serve ads through native Appodeal SDKs
*
* @usage
* ```
* import { Appodeal } from '@ionic-native/appodeal';
*
* constructor(private appodeal: Appodeal) {
*
* const appKey = '<your app key>';
* appodeal.initialize(appKey, appodeal.AD_TYPES.REWARDED_VIDEO);
* appodeal.show(appodeal.AD_TYPES.REWARDED_VIDEO);
*
* }
*
*
*
* ```
*/
@Plugin({
pluginName: 'Appodeal',
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
pluginRef: 'Appodeal',
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
platforms: [ 'ios', 'android' ]
})
@Injectable()
export class Appodeal {
// available types of advertisements
readonly AD_TYPES = {
INTERSTITIAL: 1,
SKIPPABLE_VIDEO: 2,
BANNER: 4,
BANNER_BOTTOM: 8,
BANNER_TOP: 16,
REWARDED_VIDEO: 128,
NON_SKIPPABLE_VIDEO: 256
};
/**
* initialize Appodeal SDK
* @param {string} appKey
* @param {number} adType
*/
@Cordova()
initialize(appKey: string, adType: number): void {};
/**
* check if SDK has been initialized
* @returns {Promise<boolean>}
*/
@Cordova()
isInitialized(): Promise<any> { return; };
/**
* show ad of specified type
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
show(adType: number): Promise<any> { return; };
/**
* show ad of specified type with placement options
* @param {number} adType
* @param {any} placement
* @returns {Promise<boolean>}
*/
@Cordova()
showWithPlacement(
adType: number,
placement: any
): Promise<any> { return; };
/**
* hide ad of specified type
* @param {number} adType
*/
@Cordova()
hide(adType: number): void {};
/**
* confirm use of ads of specified type
* @param {number} adType
*/
@Cordova()
confirm(adType: number): void {};
/**
* check if ad of specified type has been loaded
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
isLoaded(adType: number): Promise<any> { return; };
/**
* check if ad of specified
* @param {number} adType
* @returns {Promise<boolean>}
*/
@Cordova()
isPrecache(adType: number): Promise<any> { return; };
/**
*
* @param {number} adType
* @param autoCache
*/
@Cordova()
setAutoCache(adType: number, autoCache: any): void {};
/**
* forcefully cache an ad by type
* @param {number} adType
*/
@Cordova()
cache(adType: number): void {};
/**
*
* @param {boolean} set
*/
@Cordova()
setOnLoadedTriggerBoth(set: boolean): void {};
/**
* enable or disable Smart Banners
* @param {boolean} enabled
*/
@Cordova()
setSmartBanners(enabled: boolean): void {};
/**
* enable or disable banner backgrounds
* @param {boolean} enabled
*/
@Cordova()
setBannerBackground(enabled: boolean): void {};
/**
* enable or disable banner animations
* @param {boolean} enabled
*/
@Cordova()
setBannerAnimation(enabled: boolean): void {};
/**
*
* @param value
*/
@Cordova()
set728x90Banners(value: any): void {};
/**
* enable or disable logging
* @param {boolean} logging
*/
@Cordova()
setLogging(logging: boolean): void {};
/**
* enable or disable testing mode
* @param {boolean} testing
*/
@Cordova()
setTesting(testing: boolean): void {};
/**
* reset device ID
*/
@Cordova()
resetUUID(): void {};
/**
* get version of Appdeal SDK
*/
@Cordova()
getVersion(): Promise<any> { return; };
/**
*
* @param {string} network
* @param {number} adType
*/
@Cordova()
disableNetwork(network?: string, adType?: number): void {};
/**
*
* @param {string} network
* @param {number} adType
*/
@Cordova()
disableNetworkType(network?: string, adType?: number): void {};
/**
* disable Location permissions for Appodeal SDK
*/
@Cordova()
disableLocationPermissionCheck(): void {};
/**
* disable Storage permissions for Appodeal SDK
*/
@Cordova()
disableWriteExternalStoragePermissionCheck(): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
enableInterstitialCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
enableSkippableVideoCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
enableNonSkippableVideoCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
enableBannerCallbacks(enabled: boolean): void {};
/**
* enable event listeners
* @param {boolean} enabled
*/
@Cordova()
enableRewardedVideoCallbacks(enabled: boolean): void {};
/**
*
* @param {string} name - name of rule
* @param {boolean} value
*/
@Cordova()
setCustomBooleanRule(name: string, value: boolean): void {};
/**
*
* @param {string} name - name of rule
* @param {number} value
*/
@Cordova()
setCustomIntegerRule(name: string, value: number): void {};
/**
* set rule with float value
* @param {string} name
* @param {number} value
*/
@Cordova()
setCustomDoubleRule(name: string, value: number): void {};
/**
* set rule with string value
* @param {string} name - name of rule
* @param {string} value
*/
@Cordova()
setCustomStringRule(name: string, value: string): void {};
/**
* set ID preference in Appodeal for current user
* @param id
*/
@Cordova()
setUserId(id: any): void {};
/**
* set Email preference in Appodeal for current user
* @param email
*/
@Cordova()
setEmail(email: any): void {};
/**
* set Birthday preference in Appodeal for current user
* @param birthday
*/
@Cordova()
setBirthday(birthday: any): void {};
/**
* et Age preference in Appodeal for current user
* @param age
*/
@Cordova()
setAge(age: any): void {};
/**
* set Gender preference in Appodeal for current user
* @param gender
*/
@Cordova()
setGender(gender: any): void {};
/**
* set Occupation preference in Appodeal for current user
* @param occupation
*/
@Cordova()
setOccupation(occupation: any): void {};
/**
* set Relation preference in Appodeal for current user
* @param relation
*/
@Cordova()
setRelation(relation: any): void {};
/**
* set Smoking preference in Appodeal for current user
* @param smoking
*/
@Cordova()
setSmoking(smoking: any): void {};
/**
* set Alcohol preference in Appodeal for current user
* @param alcohol
*/
@Cordova()
setAlcohol(alcohol: any): void {};
/**
* set Interests preference in Appodeal for current user
* @param interests
*/
@Cordova()
setInterests(interests: any): void {};
@Cordova({
eventObservable: true,
event: 'onInterstitialLoaded',
element: document
})
onInterstitialLoaded(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialFailedToLoad',
element: document
})
onInterstitialFailedToLoad(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialShown',
element: document
})
onInterstitialShown(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialClicked',
element: document
})
onInterstitialClicked(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialClosed',
element: document
})
onInterstitialClosed(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onSkippableVideoLoaded',
element: document
})
onSkippableVideoLoaded(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onSkippableVideoFailedToLoad',
element: document
})
onSkippableVideoFailedToLoad(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onSkippableVideoShown',
element: document
})
onSkippableVideoShown(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onSkippableVideoFinished',
element: document
})
onSkippableVideoFinished(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onSkippableVideoClosed',
element: document
})
onSkippableVideoClosed(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onRewardedVideoLoaded',
element: document
})
onRewardedVideoLoaded(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onRewardedVideoFailedToLoad',
element: document
})
onRewardedVideoFailedToLoad(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onRewardedVideoShown',
element: document
})
onRewardedVideoShown(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onRewardedVideoFinished',
element: document
})
onRewardedVideoFinished(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onRewardedVideoClosed',
element: document
})
onRewardedVideoClosed(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoLoaded',
element: document
})
onNonSkippableVideoLoaded(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoFailedToLoad',
element: document
})
onNonSkippableVideoFailedToLoad(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoShown',
element: document
})
onNonSkippableVideoShown(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoFinished',
element: document
})
onNonSkippableVideoFinished(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onNonSkippableVideoClosed',
element: document
})
onNonSkippableVideoClosed(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onBannerClicked',
element: document
})
onBannerClicked(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onBannerFailedToLoad',
element: document
})
onBannerFailedToLoad(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onBannerLoaded',
element: document
})
onBannerLoaded(): Observable<any> { return; }
@Cordova({
eventObservable: true,
event: 'onBannerShown',
element: document
})
onBannerShown(): Observable<any> { return; }
}
@@ -1,4 +1,5 @@
import {Cordova, Plugin} from './plugin';
import { Cordova, Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window;
@@ -13,7 +14,7 @@ export interface BackgroundFetchConfig {
/**
* @name BackgroundFetch
* @name Background Fetch
* @description
* iOS Background Fetch Implementation. See: https://developer.apple.com/reference/uikit/uiapplication#1657399
* iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example).
@@ -22,35 +23,32 @@ export interface BackgroundFetchConfig {
* @usage
*
* ```typescript
* import { BackgroundFetch } from 'ionic-native';
* import { BackgroundFetch, BackgroundFetchConfig } from '@ionic-native/background-fetch';
*
*
* // When device is ready :
* platform.ready().then(() => {
* constructor(private backgroundFetch: BackgroundFetch) {
*
* let config = {
* const config: BackgroundFetchConfig = {
* stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
* };
*
* BackgroundFetch.configure(() => {
console.log('[js] BackgroundFetch initiated');
// perform some ajax request to server here
You MUST called #finish so that native-side can signal completion of the background-thread to the os.
BackgroundFetch.finish();
* }, (error) => {
* console.log('- BackgroundFetch failed', error);
* }, config);
* backgroundFetch.configure(config)
* .then(() => {
* console.log('Background Fetch initialized');
*
* });
* this.backgroundFetch.finish();
*
* // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
* BackgroundFetch.start();
* })
* .catch(e => console.log('Error initializing background fetch', e));
*
* // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
* BackgroundFetch.stop();
* // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin
* backgroundFetch.start();
*
* // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed.
* backgroundFetch.stop();
*
*
* }
*
* ```
* @interfaces
@@ -64,25 +62,20 @@ export interface BackgroundFetchConfig {
repo: 'https://github.com/transistorsoft/cordova-plugin-background-fetch',
platforms: ['iOS']
})
@Injectable()
export class BackgroundFetch {
/**
* Configures the plugin's fetch callbackFn
*
* @param {Function} callbackFn This callback will fire each time an iOS background-fetch event occurs (typically every 15 min).
* @param {Function} errorCallback The failureFn will be called if the device doesn't support background-fetch.
* @param {BackgroundFetchConfig} config Configuration for plugin
* @return Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
* @return {Promise<any>}
*/
@Cordova({
sync: true
callbackOrder: 'reverse'
})
static configure(callbackFn: Function, errorCallback: Function, config: BackgroundFetchConfig): any { return; }
configure(config: BackgroundFetchConfig): Promise<any> { return; }
/**
* Start the background-fetch API.
@@ -90,18 +83,21 @@ export class BackgroundFetch {
* @returns {Promise<any>}
*/
@Cordova()
static 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()
static 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.
*/
@Cordova()
static finish() { }
@Cordova({
sync: true
})
finish(): void { }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
@@ -255,23 +256,23 @@ export interface BackgroundGeolocationConfig {
}
/**
* @name BackgroundGeolocation
* @name Background Geolocation
* @description
* This plugin provides foreground and background geolocation with battery-saving "circular region monitoring" and "stop detection". For
* more detail, please see https://github.com/mauron85/cordova-plugin-background-geolocation
*
* @usage
*
* BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* ```typescript
* import { BackgroundGeolocation } from 'ionic-native';
* import { BackgroundGeolocation, BackgroundGeolocationConfig } from '@ionic-native/background-geolocation';
*
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
*
* // When device is ready :
* platform.ready().then(() => {
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
* ...
*
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
* let config = {
* const config: BackgroundGeolocationConfig = {
* desiredAccuracy: 10,
* stationaryRadius: 20,
* distanceFilter: 30,
@@ -279,24 +280,23 @@ export interface BackgroundGeolocationConfig {
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
* };
*
* BackgroundGeolocation.configure((location) => {
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
BackgroundGeolocation.finish(); // FOR IOS ONLY
* }, (error) => {
* console.log('BackgroundGeolocation error');
* }, config);
* this.backgroundGeolocation.configure(config)
* .subscribe((location: BackgroundGeolocationResponse) => {
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
* })
* console.log(location);
*
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
* BackgroundGeolocation.finish(); // FOR IOS ONLY
*
* });
*
* // start recording location
* this.backgroundGeolocation.start();
*
* // If you wish to turn OFF background-tracking, call the #stop method.
* BackgroundGeolocation.stop();
* this.backgroundGeolocation.stop();
*
* ```
* @interfaces
@@ -310,6 +310,7 @@ export interface BackgroundGeolocationConfig {
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
platforms: ['iOS', 'Android', 'Windows Phone 8']
})
@Injectable()
export class BackgroundGeolocation {
/**
@@ -321,7 +322,7 @@ export class BackgroundGeolocation {
*
* @enum {number}
*/
static LocationProvider: any = {
LocationProvider: any = {
ANDROID_DISTANCE_FILTER_PROVIDER: 0,
ANDROID_ACTIVITY_PROVIDER: 1
};
@@ -339,7 +340,7 @@ export class BackgroundGeolocation {
*
* enum {number}
*/
static Accuracy: any = {
Accuracy: any = {
HIGH: 0,
MEDIUM: 10,
LOW: 100,
@@ -355,7 +356,7 @@ export class BackgroundGeolocation {
*
* @enum {number}
*/
static Mode: any = {
Mode: any = {
BACKGROUND: 0,
FOREGROUND: 1
};
@@ -364,13 +365,13 @@ export class BackgroundGeolocation {
* Configure the plugin.
*
* @param options {BackgroundGeolocationConfig} options An object of type Config
* @return {Observable<any>}
* @return {Observable<BackgroundGeolocationResponse>}
*/
@Cordova({
callbackOrder: 'reverse',
observable: true
})
static configure(options: BackgroundGeolocationConfig): Observable<any> { return; }
configure(options: BackgroundGeolocationConfig): Observable<BackgroundGeolocationResponse> { return; }
/**
* Turn ON the background-geolocation system.
@@ -378,14 +379,14 @@ export class BackgroundGeolocation {
* @returns {Promise<any>}
*/
@Cordova()
static start(): Promise<any> { return; }
start(): Promise<any> { return; }
/**
* Turn OFF background-tracking
* @returns {Promise<any>}
*/
@Cordova()
static stop(): Promise<any> { return; }
stop(): Promise<any> { return; }
/**
* Inform the native plugin that you're finished, the background-task may be completed
@@ -394,7 +395,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static finish(): Promise<any> { return; }
finish(): Promise<any> { return; }
/**
* Force the plugin to enter "moving" or "stationary" state
@@ -404,7 +405,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static changePace(isMoving: boolean): Promise<any> { return; }
changePace(isMoving: boolean): Promise<any> { return; }
/**
* Setup configuration
@@ -414,7 +415,7 @@ export class BackgroundGeolocation {
@Cordova({
callbackOrder: 'reverse'
})
static setConfig(options: BackgroundGeolocationConfig): Promise<any> { return; }
setConfig(options: BackgroundGeolocationConfig): Promise<any> { return; }
/**
* Returns current stationaryLocation if available. null if not
@@ -423,7 +424,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
getStationaryLocation(): Promise<BackgroundGeolocationResponse> { return; }
/**
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
@@ -433,7 +434,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['iOS', 'Windows Phone']
})
static onStationary(): Promise<any> { return; }
onStationary(): Promise<any> { return; }
/**
* Check if location is enabled on the device
@@ -442,19 +443,19 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static isLocationEnabled(): Promise<number> { return; }
isLocationEnabled(): Promise<number> { return; }
/**
* Display app settings to change permissions
*/
@Cordova({sync: true})
static showAppSettings(): void { }
showAppSettings(): void { }
/**
* Display device location settings
*/
@Cordova({sync: true})
static showLocationSettings(): void { }
showLocationSettings(): void { }
/**
* Method can be used to detect user changes in location services settings.
@@ -465,7 +466,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static watchLocationMode(): Promise<boolean> { return; }
watchLocationMode(): Promise<boolean> { return; }
/**
* Stop watching for location mode changes.
@@ -474,7 +475,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static stopWatchingLocationMode(): Promise<any> { return; }
stopWatchingLocationMode(): Promise<any> { return; }
/**
* Method will return all stored locations.
@@ -488,14 +489,14 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static getLocations(): Promise<any> { return; }
getLocations(): Promise<any> { return; }
/**
* Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId.
* @returns {Promise<any>}
*/
@Cordova()
static getValidLocations(): Promise<any> { return; }
getValidLocations(): Promise<any> { return; }
/**
* Delete stored location by given locationId.
@@ -505,7 +506,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static deleteLocation(locationId: number): Promise<any> { return; }
deleteLocation(locationId: number): Promise<any> { return; }
/**
* Delete all stored locations.
@@ -514,7 +515,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['Android']
})
static deleteAllLocations(): Promise<any> { return; }
deleteAllLocations(): Promise<any> { return; }
/**
* Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself.
@@ -532,7 +533,7 @@ export class BackgroundGeolocation {
@Cordova({
platforms: ['iOS']
})
static switchMode(modeId: number): Promise<any> { return; }
switchMode(modeId: number): Promise<any> { return; }
/**
* Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries.
@@ -542,6 +543,6 @@ export class BackgroundGeolocation {
* @returns {Promise<any>}
*/
@Cordova()
static getLogEntries(limit: number): Promise<any> { return; }
getLogEntries(limit: number): Promise<any> { return; }
}
@@ -1,6 +1,8 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
* Configurations items that can be updated.
*/
@@ -34,20 +36,24 @@ export interface BackgroundModeConfiguration {
}
/**
* @name Background Mode
* @description
* Cordova plugin to prevent the app from going to sleep while in background.
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
*@usage
* ```typescript
* import { BackgroundMode } from 'ionic-native';
*
* BackgroundMode.enable();
* ```
* @name Background Mode
* @description
* Cordova plugin to prevent the app from going to sleep while in background.
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode
*@usage
* ```typescript
* import { BackgroundMode } from '@ionic-native/background-mode';
*
* constructor(private backgroundMode: BackgroundMode) { }
*
* ...
*
* this.backgroundMode.enable();
* ```
*
* @interfaces
* BackgroundModeConfiguration
*/
*/
@Plugin({
pluginName: 'BackgroundMode',
plugin: 'cordova-plugin-background-mode',
@@ -55,61 +61,62 @@ export interface BackgroundModeConfiguration {
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class BackgroundMode {
/**
* Enable the background mode.
* Once called, prevents the app from being paused while in background.
*/
* Enable the background mode.
* Once called, prevents the app from being paused while in background.
*/
@Cordova({
sync: true
})
static enable(): void { }
enable(): void { }
/**
* Disable the background mode.
* Once the background mode has been disabled, the app will be paused when in background.
*/
* Disable the background mode.
* Once the background mode has been disabled, the app will be paused when in background.
*/
@Cordova()
static disable(): Promise<any> { return; }
disable(): Promise<any> { return; }
/**
* Checks if background mode is enabled or not.
* @returns {boolean} returns a boolean that indicates if the background mode is enabled.
*/
* Checks if background mode is enabled or not.
* @returns {boolean} returns a boolean that indicates if the background mode is enabled.
*/
@Cordova({
sync: true
})
static isEnabled(): boolean { return; }
isEnabled(): boolean { return; }
/**
* Can be used to get the information if the background mode is active.
* @returns {boolean} returns a boolean that indicates if the background mode is active.
*/
* Can be used to get the information if the background mode is active.
* @returns {boolean} returns a boolean that indicates if the background mode is active.
*/
@Cordova({
sync: true
})
static isActive(): boolean { return; }
isActive(): boolean { return; }
/**
* Override the default title, ticker and text.
* Available only for Android platform.
* @param {Configure} options List of option to configure. See table below
*/
* Override the default title, ticker and text.
* Available only for Android platform.
* @param {Configure} options List of option to configure. See table below
*/
@Cordova({
platforms: ['Android']
})
static setDefaults(options?: BackgroundModeConfiguration): Promise<any> { return; }
setDefaults(options?: BackgroundModeConfiguration): Promise<any> { return; }
/**
* Modify the displayed information.
* Available only for Android platform.
* @param {Configure} options Any options you want to update. See table below.
*/
* Modify the displayed information.
* Available only for Android platform.
* @param {Configure} options Any options you want to update. See table below.
*/
@Cordova({
platforms: ['Android']
})
static configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
configure(options?: BackgroundModeConfiguration): Promise<any> { return; }
/**
* Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`.
@@ -121,7 +128,7 @@ export class BackgroundMode {
clearFunction: 'un',
clearWithArgs: true
})
static on(event: string): Observable<any> { return; }
on(event: string): Observable<any> { return; }
/**
* Android allows to programmatically move from foreground to background.
@@ -130,7 +137,7 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static moveToBackground(): void {}
moveToBackground(): void {}
/**
* Android allows to programmatically move from background to foreground.
@@ -139,7 +146,7 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static moveToForeground(): void {}
moveToForeground(): void {}
/**
* Override the back button on Android to go to background instead of closing the app.
@@ -148,7 +155,7 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static overrideBackButton(): void {}
overrideBackButton(): void {}
/**
* Exclude the app from the recent task list works on Android 5.0+.
@@ -157,7 +164,7 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static excludeFromTaskList(): void {}
excludeFromTaskList(): void {}
/**
* The method works async instead of isActive() or isEnabled().
@@ -165,7 +172,7 @@ export class BackgroundMode {
@Cordova({
platforms: ['Android']
})
static isScreenOff(): Promise<boolean> { return; }
isScreenOff(): Promise<boolean> { return; }
/**
* Turn screen on
@@ -174,7 +181,7 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static wakeUp(): void {}
wakeUp(): void {}
/**
* Turn screen on and show app even locked
@@ -183,6 +190,6 @@ export class BackgroundMode {
platforms: ['Android'],
sync: true
})
static unlock(): void {}
unlock(): void {}
}
@@ -1,4 +1,6 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @beta
@@ -8,13 +10,17 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import { Backlight } from 'ionic-native';
* import { Backlight } from '@ionic-native/backlight';
*
* constructor(private backlight: Backlight) { }
*
* ...
*
* // Turn backlight on
* Backlight.on().then(() => console.log('backlight on'));
* this.backlight.on().then(() => console.log('backlight on'));
*
* // Turn backlight off
* Backlight.off().then(() => console.log('backlight off'));
* this.backlight.off().then(() => console.log('backlight off'));
*
* ```
*/
@@ -25,6 +31,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
platforms: ['Android']
})
@Injectable()
export class Backlight {
/**
@@ -32,13 +39,13 @@ export class Backlight {
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
*/
@Cordova()
static 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()
static off(): Promise<any> { return; }
off(): Promise<any> { return; }
}
@@ -1,4 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Badge
@@ -9,12 +11,15 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { Badge } from 'ionic-native';
* import { Badge } from '@ionic-native/badge';
*
* constructor(private badge: Badge) { }
*
* Badge.set(10);
* Badge.increase(1);
* Badge.clear();
* ...
*
* this.badge.set(10);
* this.badge.increase(1);
* this.badge.clear();
* ```
*/
@Plugin({
@@ -24,6 +29,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/katzer/cordova-plugin-badge',
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
})
@Injectable()
export class Badge {
/**
@@ -31,7 +37,7 @@ export class Badge {
* @returns {Promise<boolean>}
*/
@Cordova()
static clear(): Promise<boolean> { return; }
clear(): Promise<boolean> { return; }
/**
* Set the badge of the app icon.
@@ -39,14 +45,14 @@ export class Badge {
* @returns {Promise<any>}
*/
@Cordova()
static set(badgeNumber: number): Promise<any> { return; }
set(badgeNumber: number): Promise<any> { return; }
/**
* Get the badge of the app icon.
* @returns {Promise<any>}
*/
@Cordova()
static get(): Promise<any> { return; }
get(): Promise<any> { return; }
/**
* Increase the badge number.
@@ -54,7 +60,7 @@ export class Badge {
* @returns {Promise<any>}
*/
@Cordova()
static increase(increaseBy: number): Promise<any> { return; }
increase(increaseBy: number): Promise<any> { return; }
/**
* Decrease the badge number.
@@ -62,20 +68,20 @@ export class Badge {
* @returns {Promise<any>}
*/
@Cordova()
static decrease(decreaseBy: number): Promise<any> { return; }
decrease(decreaseBy: number): Promise<any> { return; }
/**
* Determine if the app has permission to show badges.
* @returns {Promise<any>}
*/
@Cordova()
static hasPermission(): Promise<any> { return; }
hasPermission(): Promise<any> { return; }
/**
* Register permission to set badge notifications
* @returns {Promise<any>}
*/
@Cordova()
static registerPermission(): Promise<any> { return; }
registerPermission(): Promise<any> { return; }
}
@@ -1,4 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface BarcodeScannerOptions {
@@ -63,10 +65,14 @@ export interface BarcodeScannerOptions {
*
* @usage
* ```typescript
* import { BarcodeScanner } from 'ionic-native';
* import { BarcodeScanner } from '@ionic-native/barcode-scanner';
*
* constructor(private barcodeScanner: BarcodeScanner) { }
*
* ...
*
*
* BarcodeScanner.scan().then((barcodeData) => {
* this.barcodeScanner.scan().then((barcodeData) => {
* // Success! Barcode data is here
* }, (err) => {
* // An error occurred
@@ -82,12 +88,15 @@ export interface BarcodeScannerOptions {
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
})
@Injectable()
export class BarcodeScanner {
/**
* @private
*/
static Encode: any = {
Encode: {
TEXT_TYPE: string;
EMAIL_TYPE: string;
PHONE_TYPE: string;
SMS_TYPE: string;
} = {
TEXT_TYPE: 'TEXT_TYPE',
EMAIL_TYPE: 'EMAIL_TYPE',
PHONE_TYPE: 'PHONE_TYPE',
@@ -102,7 +111,7 @@ export class BarcodeScanner {
@Cordova({
callbackOrder: 'reverse'
})
static scan(options?: BarcodeScannerOptions): Promise<any> { return; }
scan(options?: BarcodeScannerOptions): Promise<any> { return; }
/**
* Encodes data into a barcode.
@@ -112,6 +121,6 @@ export class BarcodeScanner {
* @returns {Promise<any>}
*/
@Cordova()
static encode(type: string, data: any): Promise<any> { return; }
encode(type: string, data: any): Promise<any> { return; }
}
@@ -1,14 +1,20 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @usage
* ```typescript
* import { Base64ToGallery } from 'ionic-native';
* import { Base64ToGallery } from '@ionic-native/base64-to-gallery';
*
* constructor(private base64ToGallery: Base64ToGallery) { }
*
*
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
* ...
*
*
* this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then(
* res => console.log('Saved image to gallery ', res),
* err => console.log('Error saving image to gallery ', err)
* );
@@ -21,6 +27,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Base64ToGallery {
/**
@@ -33,7 +40,7 @@ export class Base64ToGallery {
successIndex: 2,
errorIndex: 3
})
static base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
base64ToGallery(data: string, options?: {prefix?: string; mediaScanner?: boolean}): Promise<any> {
return;
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface BatteryStatusResponse {
@@ -22,11 +23,15 @@ export interface BatteryStatusResponse {
*
* @usage
* ```typescript
* import { BatteryStatus } from 'ionic-native';
* import { BatteryStatus } from '@ionic-native/battery-status';
*
* constructor(private batteryStatus: BatteryStatus) { }
*
* ...
*
*
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
* let subscription = this.batteryStatus.onChange().subscribe(
* (status: StatusObject) => {
* console.log(status.level, status.isPlugged);
* }
@@ -46,6 +51,7 @@ export interface BatteryStatusResponse {
repo: 'https://github.com/apache/cordova-plugin-battery-status',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
@Injectable()
export class BatteryStatus {
/**
@@ -56,7 +62,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterystatus'
})
static onChange(): Observable<BatteryStatusResponse> { return; }
onChange(): Observable<BatteryStatusResponse> { return; }
/**
* Watch when the battery level goes low
@@ -66,7 +72,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterylow'
})
static onLow(): Observable<BatteryStatusResponse> { return; }
onLow(): Observable<BatteryStatusResponse> { return; }
/**
* Watch when the battery level goes to critial
@@ -76,6 +82,6 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterycritical'
})
static onCritical(): Observable<BatteryStatusResponse> { return; }
onCritical(): Observable<BatteryStatusResponse> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
@@ -20,6 +21,14 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
*
* ```typescript
*
* import { BLE } from '@ionic-native/ble';
*
* constructor(private ble: BLE) { }
*
* ```
*
* ## Peripheral Data
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
@@ -166,6 +175,7 @@ import { Observable } from 'rxjs/Observable';
repo: 'https://github.com/don/cordova-plugin-ble-central',
platforms: ['iOS', 'Android']
})
@Injectable()
export class BLE {
/**
@@ -184,7 +194,7 @@ export class BLE {
@Cordova({
observable: true
})
static scan(services: string[], seconds: number): Observable<any> { return; }
scan(services: string[], seconds: number): Observable<any> { return; }
/**
* Scan and discover BLE peripherals until `stopScan` is called.
@@ -207,7 +217,7 @@ export class BLE {
clearFunction: 'stopScan',
clearWithArgs: false
})
static startScan(services: string[]): Observable<any> { return; }
startScan(services: string[]): Observable<any> { return; }
/**
* Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports).
@@ -220,7 +230,7 @@ export class BLE {
clearFunction: 'stopScan',
clearWithArgs: false
})
static startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
startScanWithOptions(services: string[], options: {reportDuplicates?: boolean} | any): Observable<any> { return; }
/**
* Stop a scan started by `startScan`.
@@ -237,7 +247,7 @@ export class BLE {
* @return returns a Promise.
*/
@Cordova()
static stopScan(): Promise<any> { return; }
stopScan(): Promise<any> { return; }
/**
* Connect to a peripheral.
@@ -258,7 +268,7 @@ export class BLE {
clearFunction: 'disconnect',
clearWithArgs: true
})
static connect(deviceId: string): Observable<any> { return; }
connect(deviceId: string): Observable<any> { return; }
/**
* Disconnect from a peripheral.
@@ -272,7 +282,7 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static disconnect(deviceId: string): Promise<any> { return; }
disconnect(deviceId: string): Promise<any> { return; }
/**
* Read the value of a characteristic.
@@ -283,7 +293,7 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static read(
read(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
@@ -318,7 +328,7 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static write(
write(
deviceId: string,
serviceUUID: string,
characteristicUUID: string,
@@ -335,7 +345,7 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static writeWithoutResponse(
writeWithoutResponse(
deviceId: string,
serviceUUID: string,
characteristicUUID: string,
@@ -362,7 +372,7 @@ export class BLE {
clearFunction: 'stopNotification',
clearWithArgs: true
})
static startNotification(
startNotification(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
@@ -377,7 +387,7 @@ export class BLE {
* @returns {Promise<any>}
*/
@Cordova()
static stopNotification(
stopNotification(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
@@ -397,7 +407,7 @@ export class BLE {
* @returns {Promise<any>}
*/
@Cordova()
static isConnected(deviceId: string): Promise<any> { return; }
isConnected(deviceId: string): Promise<any> { return; }
/**
* Report if bluetooth is enabled.
@@ -405,7 +415,7 @@ export class BLE {
* @returns {Promise<void>} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled.
*/
@Cordova()
static isEnabled(): Promise<void> { return; }
isEnabled(): Promise<void> { return; }
/**
* Open System Bluetooth settings (Android only).
@@ -413,7 +423,7 @@ export class BLE {
* @returns {Promise<any>}
*/
@Cordova()
static showBluetoothSettings(): Promise<any> { return; }
showBluetoothSettings(): Promise<any> { return; }
/**
* Enable Bluetooth on the device (Android only).
@@ -421,7 +431,7 @@ export class BLE {
* @returns {Promise<any>}
*/
@Cordova()
static enable(): Promise<any> { return; }
enable(): Promise<any> { return; }
/**
* Read the RSSI value on the device connection.
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
@@ -6,14 +7,16 @@ import { Observable } from 'rxjs/Observable';
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
* @usage
* ```typescript
* import { BluetoothSerial } from 'ionic-native';
* import { BluetoothSerial } from '@ionic-native/bluetooth-serial';
*
* constructor(private bluetoothSerial: BluetoothSerial) { }
*
*
* // Write a string
* BluetoothSerial.write("hello world").then(success, failure);
* this.bluetoothSerial.write("hello world").then(success, failure);
*
* // Array of int or bytes
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
* this.bluetoothSerial.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
@@ -21,10 +24,10 @@ import { Observable } from 'rxjs/Observable';
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
* BluetoothSerial.write(data).then(success, failure);
* this.bluetoothSerial.write(data).then(success, failure);
*
* // Array Buffer
* BluetoothSerial.write(data.buffer).then(success, failure);
* this.bluetoothSerial.write(data.buffer).then(success, failure);
* ```
*/
@Plugin({
@@ -34,6 +37,7 @@ import { Observable } from 'rxjs/Observable';
pluginRef: 'bluetoothSerial',
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
})
@Injectable()
export class BluetoothSerial {
/**
@@ -46,7 +50,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'disconnect'
})
static connect(macAddress_or_uuid: string): Observable<any> { return; }
connect(macAddress_or_uuid: string): Observable<any> { return; }
/**
* Connect insecurely to a Bluetooth device
@@ -58,14 +62,14 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'disconnect'
})
static connectInsecure(macAddress: string): Observable<any> { return; }
connectInsecure(macAddress: string): Observable<any> { return; }
/**
* Disconnect from the connected device
* @returns {Promise<any>}
*/
@Cordova()
static disconnect(): Promise<any> { return; }
disconnect(): Promise<any> { return; }
/**
* Writes data to the serial port
@@ -75,7 +79,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static write(data: any): Promise<any> { return; }
write(data: any): Promise<any> { return; }
/**
* Gets the number of bytes of data available
@@ -83,7 +87,7 @@ export class BluetoothSerial {
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
}) static available(): Promise<any> { return; }
}) available(): Promise<any> { return; }
/**
* Reads data from the buffer
@@ -92,7 +96,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static read(): Promise<any> { return; }
read(): Promise<any> { return; }
/**
* Reads data from the buffer until it reaches a delimiter
@@ -102,7 +106,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static readUntil(delimiter: string): Promise<any> { return; }
readUntil(delimiter: string): Promise<any> { return; }
/**
* Subscribe to be notified when data is received
@@ -114,7 +118,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'unsubscribe'
})
static subscribe(delimiter: string): Observable<any> { return; }
subscribe(delimiter: string): Observable<any> { return; }
/**
* Subscribe to be notified when data is received
@@ -125,7 +129,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'unsubscribeRawData'
})
static subscribeRawData(): Observable<any> { return; }
subscribeRawData(): Observable<any> { return; }
/**
* Clears data in buffer
@@ -134,7 +138,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static clear(): Promise<any> { return; }
clear(): Promise<any> { return; }
/**
* Lists bonded devices
@@ -143,7 +147,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static list(): Promise<any> { return; }
list(): Promise<any> { return; }
/**
* Reports if bluetooth is enabled
@@ -152,7 +156,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static isEnabled(): Promise<any> { return; }
isEnabled(): Promise<any> { return; }
/**
* Reports the connection status
@@ -161,7 +165,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static isConnected(): Promise<any> { return; }
isConnected(): Promise<any> { return; }
/**
* Reads the RSSI from the connected peripheral
@@ -170,7 +174,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static readRSSI(): Promise<any> { return; }
readRSSI(): Promise<any> { return; }
/**
* Show the Bluetooth settings on the device
@@ -179,7 +183,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static showBluetoothSettings(): Promise<any> { return; }
showBluetoothSettings(): Promise<any> { return; }
/**
* Enable Bluetooth on the device
@@ -188,7 +192,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static enable(): Promise<any> { return; }
enable(): Promise<any> { return; }
/**
* Discover unpaired devices
@@ -197,7 +201,7 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static 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.
@@ -208,7 +212,7 @@ export class BluetoothSerial {
observable: true,
clearFunction: 'clearDeviceDiscoveredListener'
})
static setDeviceDiscoveredListener(): Observable<any> { return; }
setDeviceDiscoveredListener(): Observable<any> { return; }
/**
* Sets the human readable device name that is broadcasted to other devices
@@ -218,7 +222,7 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
static setName(newName: string): void { }
setName(newName: string): void { }
/**
* Makes the device discoverable by other devices
@@ -228,6 +232,6 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
static setDiscoverable(discoverableDuration: number): void { }
setDiscoverable(discoverableDuration: number): void { }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Brightness
@@ -9,11 +10,14 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { Brightness } from 'ionic-native';
* import { Brightness } from '@ionic-native/brightness';
*
* constructor(private brightness: Brightness) { }
*
* ...
*
* let brightnessValue: number = 0.8;
* Brightness.setBrightness(brightnessValue);
* this.brightness.setBrightness(brightnessValue);
* ```
*
*/
@@ -24,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Brightness {
/**
@@ -33,7 +38,7 @@ export class Brightness {
* @returns {Promise<any>} Returns a Promise that resolves if setting brightness was successful.
*/
@Cordova()
static setBrightness(value: number): Promise<any> { return; }
setBrightness(value: number): Promise<any> { return; }
/**
* Reads the current brightness of the device display.
@@ -42,12 +47,12 @@ export class Brightness {
* brightness value of the device display (floating number between 0 and 1).
*/
@Cordova()
static getBrightness(): Promise<any> { return; }
getBrightness(): Promise<any> { return; }
/**
* Keeps the screen on. Prevents the device from setting the screen to sleep.
*/
@Cordova()
static setKeepScreenOn(value: boolean): void { }
setKeepScreenOn(value: boolean): void { }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
@@ -8,13 +9,17 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```
* import { Broadcaster } from 'ionic-native';
* import { Broadcaster } from '@ionic-native/broadcaster';
*
* constructor(private broadcaster: Broadcaster) { }
*
* ...
*
* // Listen to events from Native
* Broadcaster.addEventListener('eventName').then((event) => console.log(event));
* this.broadcaster.addEventListener('eventName').then((event) => console.log(event));
*
* // Send event to Native
* Broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
* this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));
*
* ```
*/
@@ -25,6 +30,7 @@ import { Observable } from 'rxjs/Observable';
repo: 'https://github.com/bsorrentino/cordova-broadcaster',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Broadcaster {
/**
@@ -37,7 +43,7 @@ export class Broadcaster {
clearFunction: 'removeEventListener',
clearWithArgs: true
})
static addEventListener(eventName: string): Observable<any> { return; }
addEventListener(eventName: string): Observable<any> { return; }
/**
* This function sends data to the native code
@@ -46,6 +52,6 @@ export class Broadcaster {
* @return {Promise<any>} Returns a promise that resolves when an event is successfully fired
*/
@Cordova()
static fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
fireNativeEvent(eventName: string, eventData: any): Promise<any> { return; }
}
@@ -1,26 +1,34 @@
import { Plugin, Cordova } from './plugin';
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name BrowserTab
* @name Browser Tab
* @description
* This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
*
* @usage
* ```
* import { BrowserTab } from 'ionic-native';
* import { BrowserTab } from '@ionic-native/browser-tab';
*
* BrowserTab.isAvailable()
* .then((isAvailable: boolean) => {
* constructor(private browserTab: BrowserTab) {
*
* if (isAvailable) {
* browserTab.isAvailable()
* .then((isAvailable: boolean) => {
*
* BrowserTab.openUrl('https://ionic.io');
* if (isAvailable) {
*
* } else {
* // open url with InAppBrowser instead
* }
* browserTab.open('https://ionic.io');
*
* });
* } else {
*
* // open URL with InAppBrowser instead or SafariViewController
*
* }
*
* });
*
*
* }
*
* ```
*/
@@ -31,6 +39,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/google/cordova-plugin-browsertab',
platforms: ['Android', 'iOS']
})
@Injectable()
export class BrowserTab {
/**
@@ -38,7 +47,7 @@ export class BrowserTab {
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
*/
@Cordova()
static isAvailable(): Promise<any> { return; }
isAvailable(): Promise<any> { return; }
/**
* Opens the provided URL using a browser tab
@@ -46,12 +55,12 @@ export class BrowserTab {
* @return {Promise<any>} Returns a promise that resolves when check open was successful
*/
@Cordova()
static openUrl(url: string): Promise<any> { return; }
openUrl(url: string): Promise<any> { return; }
/**
* Closes browser tab
* @return {Promise<any>} Returns a promise that resolves when close was finished
*/
@Cordova()
static close(): Promise<any> { return; }
close(): Promise<any> { return; }
}
@@ -1,8 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @private
*/
export interface CalendarOptions {
/**
@@ -62,11 +60,12 @@ export interface CalendarOptions {
*
* @usage
* ```
* import {Calendar} from 'ionic-native';
* import {Calendar} from '@ionic-native/calendar';
*
* constructor(private calendar: Calendar) { }
*
*
*
* Calendar.createCalendar('MyCalendar').then(
* this.calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
@@ -81,6 +80,7 @@ export interface CalendarOptions {
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Calendar {
/**
@@ -95,42 +95,42 @@ export class Calendar {
* @returns {Promise<boolean>}
*/
@Cordova()
static hasReadWritePermission(): Promise<boolean> { return; }
hasReadWritePermission(): Promise<boolean> { return; }
/**
* Check if we have read permission
* @returns {Promise<boolean>}
*/
@Cordova()
static hasReadPermission(): Promise<boolean> { return; }
hasReadPermission(): Promise<boolean> { return; }
/**
* Check if we have write permission
* @returns {Promise<boolean>}
*/
@Cordova()
static hasWritePermission(): Promise<boolean> { return; }
hasWritePermission(): Promise<boolean> { return; }
/**
* Request write permission
* @returns {Promise<any>}
*/
@Cordova()
static requestWritePermission(): Promise<any> { return; }
requestWritePermission(): Promise<any> { return; }
/**
* Request read permission
* @returns {Promise<any>}
*/
@Cordova()
static requestReadPermission(): Promise<any> { return; }
requestReadPermission(): Promise<any> { return; }
/**
* Requests read/write permissions
* @returns {Promise<any>}
*/
@Cordova()
static requestReadWritePermission(): Promise<any> { return; }
requestReadWritePermission(): Promise<any> { return; }
/**
* Create a calendar. (iOS only)
@@ -139,7 +139,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise
*/
@Cordova()
static createCalendar(nameOrOptions: string | any): Promise<any> { return; }
createCalendar(nameOrOptions: string | any): Promise<any> { return; }
/**
* Delete a calendar. (iOS only)
@@ -147,7 +147,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise
*/
@Cordova()
static deleteCalendar(name: string): Promise<any> { return; }
deleteCalendar(name: string): Promise<any> { return; }
/**
* Returns the default calendar options.
@@ -157,7 +157,7 @@ export class Calendar {
@Cordova({
sync: true
})
static getCalendarOptions(): CalendarOptions { return; }
getCalendarOptions(): CalendarOptions { return; }
/**
* Silently create an event.
@@ -169,7 +169,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise
*/
@Cordova()
static createEvent(
createEvent(
title?: string,
location?: string,
notes?: string,
@@ -189,7 +189,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise
*/
@Cordova()
static createEventWithOptions(
createEventWithOptions(
title?: string,
location?: string,
notes?: string,
@@ -209,7 +209,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise
*/
@Cordova()
static createEventInteractively(
createEventInteractively(
title?: string,
location?: string,
notes?: string,
@@ -229,7 +229,7 @@ export class Calendar {
* @returns {Promise<any>}
*/
@Cordova()
static createEventInteractivelyWithOptions(
createEventInteractivelyWithOptions(
title?: string,
location?: string,
notes?: string,
@@ -238,17 +238,6 @@ export class Calendar {
options?: CalendarOptions
): Promise<any> { return; }
// deprecated
// @Cordova()
// static createEventInNamedCalendar(
// title?: string,
// location?: string,
// notes?: string,
// startDate?: Date,
// endDate?: Date,
// calendarName?: string
// ) {}
/**
* Find an event.
*
@@ -260,7 +249,7 @@ export class Calendar {
* @returns {Promise<any>}
*/
@Cordova()
static findEvent(
findEvent(
title?: string,
location?: string,
notes?: string,
@@ -279,7 +268,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise that resolves with the event, or rejects with an error.
*/
@Cordova()
static findEventWithOptions(
findEventWithOptions(
title?: string,
location?: string,
notes?: string,
@@ -298,14 +287,14 @@ export class Calendar {
@Cordova({
platforms: ['Android']
})
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
/**
* Get a list of all calendars.
* @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error.
*/
@Cordova()
static listCalendars(): Promise<any> { return; }
listCalendars(): Promise<any> { return; }
/**
* Get a list of all future events in the specified calendar. (iOS only)
@@ -314,7 +303,7 @@ export class Calendar {
@Cordova({
platforms: ['iOS']
})
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
/**
* Modify an event. (iOS only)
@@ -334,7 +323,7 @@ export class Calendar {
@Cordova({
platforms: ['iOS']
})
static modifyEvent(
modifyEvent(
title?: string,
location?: string,
notes?: string,
@@ -367,7 +356,7 @@ export class Calendar {
@Cordova({
platforms: ['iOS']
})
static modifyEventWithOptions(
modifyEventWithOptions(
title?: string,
location?: string,
notes?: string,
@@ -393,7 +382,7 @@ export class Calendar {
* @return Returns a Promise
*/
@Cordova()
static deleteEvent(
deleteEvent(
title?: string,
location?: string,
notes?: string,
@@ -415,7 +404,7 @@ export class Calendar {
@Cordova({
platforms: ['iOS']
})
static deleteEventFromNamedCalendar(
deleteEventFromNamedCalendar(
title?: string,
location?: string,
notes?: string,
@@ -430,6 +419,6 @@ export class Calendar {
* @return {Promise<any>} Promise returns a promise
*/
@Cordova()
static openCalendar(date: Date): Promise<any> { return; }
openCalendar(date: Date): Promise<any> { return; }
}
@@ -1,15 +1,20 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name CallNumber
* @name Call Number
* @description
* Call a number directly from your Cordova/Ionic application.
*
* @usage
* ```
* import {CallNumber} from 'ionic-native';
* import {CallNumber} from '@ionic-native/call-number';
*
* CallNumber.callNumber(18001010101, true)
* constructor(private callNumber: CallNumber) { }
*
* ...
*
*
* this.callNumber.callNumber(18001010101, true)
* .then(() => console.log('Launched dialer!'))
* .catch(() => console.log('Error launching dialer'));
*
@@ -22,6 +27,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
platforms: ['iOS', 'Android']
})
@Injectable()
export class CallNumber {
/**
@@ -33,7 +39,7 @@ export class CallNumber {
@Cordova({
callbackOrder: 'reverse'
})
static callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
callNumber(numberToCall: string, bypassAppChooser: boolean): Promise<any> {
return;
}
@@ -1,5 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface CameraPreviewDimensions {
/** The width of the camera preview, default to window.screen.width */
@@ -38,7 +38,7 @@ export interface CameraPreviewOptions {
alpha?: number;
}
export interface PictureOptions {
export interface CameraPreviewPictureOptions {
/** The width in pixels, default 0 */
width?: number;
/** The height in pixels, default 0 */
@@ -49,18 +49,22 @@ export interface PictureOptions {
/**
* @beta
* @name CameraPreview
* @name Camera Preview
* @description
* Showing camera preview in HTML
*
*
* Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git`. For more info, please see the [Cordova Camera Preview docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
*
* @usage
* ```typescript
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions, } from 'ionic-native';
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from 'ionic-native';
*
* constructor(private cameraPreview: CameraPreview) { }
*
* ...
*
* // camera options (Size and location). In the following example, the preview uses the rear camera and display the preview in the back of the webview
* public cameraPreviewOpts: CameraPreviewOptions = {
* const cameraPreviewOpts: CameraPreviewOptions = {
* x: 0,
* y: 0,
* width: window.screen.width,
@@ -73,7 +77,7 @@ export interface PictureOptions {
* };
*
* // start camera
* CameraPreview.startCamera(this.cameraPreviewOpts).then(
* this.cameraPreview.startCamera(cameraPreviewOpts).then(
* (res) => {
* console.log(res)
* },
@@ -81,37 +85,43 @@ export interface PictureOptions {
* console.log(err)
* });
*
*
* // Set the handler to run every time we take a picture
* this.cameraPreview.setOnPictureTakenHandler().subscribe((result) => {
* console.log(result);
* // do something with the result
* });
*
*
* // picture options
* public pictureOpts: PictureOptions = {
* const pictureOpts: PictureOptions = {
* width: 1280,
* height: 1280,
* quality: 85
* }
*
* // take a picture
* CameraPreview.takePicture(this.pictureOpts).then((imageData) => {
* this.cameraPreview.takePicture(this.pictureOpts).then((imageData) => {
* this.picture = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* }, (err) => {
* console.log(err);
* this.picture = 'assets/img/test.jpg';
* });
*
*
*
* // Switch camera
* CameraPreview.switchCamera();
* this.cameraPreview.switchCamera();
*
* // set color effect to negative
* CameraPreview.setColorEffect('negative');
* this.cameraPreview.setColorEffect('negative');
*
* // Stop the camera preview
* CameraPreview.stopCamera();
* this.cameraPreview.stopCamera();
*
* ```
*
* @interfaces
* CameraPreviewOptions
* PictureOptions
* CameraPreviewPictureOptions
* CameraPreviewDimensions
*/
@Plugin({
@@ -121,108 +131,117 @@ export interface PictureOptions {
repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
platforms: ['Android', 'iOS']
})
@Injectable()
export class CameraPreview {
/**
* Starts the camera preview instance. (iOS & Android)
* Starts the camera preview instance.
* @param {CameraPreviewOptions} options
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static startCamera(options: CameraPreviewOptions): Promise<any> { return; }
startCamera(options: CameraPreviewOptions): Promise<any> { return; }
/**
* Stops the camera preview instance. (iOS & Android)
* @return {Promise<any>}
*/
@Cordova({
successIndex: 0,
errorIndex: 1
})
static stopCamera(): Promise<any> { return; }
stopCamera(): Promise<any> { return; }
/**
* Switch from the rear camera and front camera, if available. (iOS & Android)
* Switch from the rear camera and front camera, if available.
* @return {Promise<any>}
*/
@Cordova({
successIndex: 0,
errorIndex: 1
})
static switchCamera(): Promise<any> { return; }
switchCamera(): Promise<any> { return; }
/**
* Hide the camera preview box. (iOS & Android)
* Hide the camera preview box.
* @return {Promise<any>}
*/
@Cordova({
successIndex: 0,
errorIndex: 1
})
static hide(): Promise<any> { return; }
hide(): Promise<any> { return; }
/**
* Show the camera preview box. (iOS & Android)
* Show the camera preview box.
* @return {Promise<any>}
*/
@Cordova({
successIndex: 0,
errorIndex: 1
})
static show(): Promise<any> { return; }
show(): Promise<any> { return; }
/**
* Take the picture (base64), the parameter size is optional (iOS & Android)
* @param {PictureOptions} optional - size and quality of the picture to take
* Take the picture (base64)
* @param options {CameraPreviewPictureOptions} optional - size and quality of the picture to take
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static takePicture(opts?: PictureOptions): Promise<any> { return; }
takePicture(options?: CameraPreviewPictureOptions): Promise<any> { return; }
/**
*
* Set camera color effect. (iOS partial & Android)
*
* Set camera color effect.
* @static
* @param {string} effect name : 'none' (iOS & Android), 'aqua' (Android), 'blackboard' (Android), 'mono' (iOS & Android), 'negative' (iOS & Android), 'posterize' (iOS & Android), 'sepia' (iOS & Android), 'solarize' (Android) or 'whiteboard' (Android)
*
* @memberOf CameraPreview
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static setColorEffect(effect: string): Promise<any> { return; }
setColorEffect(effect: string): Promise<any> { return; }
/**
* Set the zoom (Android)
* @param Zoom value (integer)
* @param zoom {number} Zoom value
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static setZoom(zoom?: number): Promise<any> { return; }
setZoom(zoom?: number): Promise<any> { return; }
/**
* Set the preview Size (Android)
* @param dimensions
* Set the preview Size
* @param dimensions {CameraPreviewDimensions}
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
errorIndex: 2,
platforms: ['Android']
})
static setPreviewSize(dimensions?: CameraPreviewDimensions): Promise<any> { return; }
setPreviewSize(dimensions?: CameraPreviewDimensions): Promise<any> { return; }
/**
* Set the flashmode (iOS partial & Android)
* @param flashMode 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
* Set the flashmode
* @param flashMode {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
static setFlashMode(flashMode?: string): Promise<any> { return; }
setFlashMode(flashMode?: string): Promise<any> { return; }
}
@@ -1,5 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface CameraOptions {
/** Picture quality in range 0-100. Default is 50 */
@@ -94,10 +94,21 @@ export interface CameraPopoverOptions {
*
* @usage
* ```typescript
* import { Camera } from 'ionic-native';
* import { Camera, CameraOptions } from '@ionic-native/camera';
*
* constructor(private camera: Camera) { }
*
* ...
*
*
* Camera.getPicture(options).then((imageData) => {
* constant options: CameraOptions = {
* quality: 100,
* destinationType: this.camera.DestinationType.DATA_URL,
* enodingType: this.camera.EncodingType.JPEG,
* mediaType: this.camera.MediaType.PICTURE
* }
*
* this.camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = 'data:image/jpeg;base64,' + imageData;
@@ -109,6 +120,7 @@ export interface CameraPopoverOptions {
* CameraOptions
* CameraPopoverOptions
*/
@Injectable()
@Plugin({
pluginName: 'Camera',
plugin: 'cordova-plugin-camera',
@@ -119,10 +131,9 @@ export interface CameraPopoverOptions {
export class Camera {
/**
* @private
* @enum {number}
* Constant for possible destination types
*/
static DestinationType = {
DestinationType = {
/** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
DATA_URL: 0,
/** Return file uri (content://media/external/images/media/2 for Android) */
@@ -132,20 +143,19 @@ export class Camera {
};
/**
* @private
* @enum {number}
* Convenience constant
*/
static EncodingType = {
EncodingType = {
/** Return JPEG encoded image */
JPEG: 0,
/** Return PNG encoded image */
PNG: 1
};
/**
* @private
* @enum {number}
* Convenience constant
*/
static MediaType = {
MediaType = {
/** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
PICTURE: 0,
/** Allow selection of video only, ONLY RETURNS URL */
@@ -154,11 +164,11 @@ export class Camera {
ALLMEDIA: 2
};
/**
* @private
* @enum {number}
* Convenience constant
*/
static PictureSourceType = {
PictureSourceType = {
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
PHOTOLIBRARY: 0,
/** Take picture from camera */
@@ -167,12 +177,11 @@ export class Camera {
SAVEDPHOTOALBUM: 2
};
/**
* @private
* Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
* @enum {number}
* Convenience constant
*/
static PopoverArrowDirection = {
PopoverArrowDirection = {
ARROW_UP: 1,
ARROW_DOWN: 2,
ARROW_LEFT: 4,
@@ -181,10 +190,9 @@ export class Camera {
};
/**
* @private
* @enum {number}
* Convenience constant
*/
static Direction = {
Direction = {
/** Use the back-facing camera */
BACK: 0,
/** Use the front-facing camera */
@@ -199,7 +207,7 @@ export class Camera {
@Cordova({
callbackOrder: 'reverse'
})
static getPicture(options?: CameraOptions): Promise<any> { return; }
getPicture(options?: CameraOptions): Promise<any> { return; }
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
@@ -209,6 +217,6 @@ export class Camera {
@Cordova({
platforms: ['iOS']
})
static cleanup(): Promise<any> { return; };
cleanup(): Promise<any> { return; };
}
@@ -1,5 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface CardIOOptions {
@@ -130,14 +130,18 @@ export interface CardIOResponse {
}
/**
* @name CardIO
* @name Card IO
* @description
* @usage
* ```
* import { CardIO } from 'ionic-native';
* import { CardIO } from '@ionic-native/card-io';
*
* constructor(private cardIO: CardIO) { }
*
* ...
*
*
* CardIO.canScan()
* this.cardIO.canScan()
* .then(
* (res: boolean) => {
* if(res){
@@ -162,6 +166,7 @@ export interface CardIOResponse {
repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
platforms: ['iOS', 'Android']
})
@Injectable()
export class CardIO {
/**
@@ -171,7 +176,7 @@ export class CardIO {
* @returns {Promise<boolean>}
*/
@Cordova()
static canScan(): Promise<boolean> { return; }
canScan(): Promise<boolean> { return; }
/**
* Scan a credit card with card.io.
@@ -179,13 +184,13 @@ export class CardIO {
* @returns {Promise<any>}
*/
@Cordova()
static scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
scan(options?: CardIOOptions): Promise<CardIOResponse> { return; }
/**
* Retrieve the version of the card.io library. Useful when contacting support.
* @returns {Promise<string>}
*/
@Cordova()
static version(): Promise<string> { return; }
version(): Promise<string> { return; }
}
@@ -1,5 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Clipboard
* @description
@@ -10,20 +10,23 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { Clipboard } from 'ionic-native';
* import { Clipboard } from '@ionic-native/clipboard';
*
* constructor(private clipboard: Clipboard) { }
*
* ...
*
*
* Clipboard.copy('Hello world');
* this.clipboard.copy('Hello world');
*
* Clipboard.paste().then(
* this.clipboard.paste().then(
* (resolve: string) => {
* alert(resolve);
* alert(resolve);
* },
* (reject: string) => {
* alert('Error: ' + reject);
* alert('Error: ' + reject);
* }
* );
* );
* );
* ```
*/
@Plugin({
@@ -33,6 +36,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
@Injectable()
export class Clipboard {
/**
@@ -41,13 +45,13 @@ export class Clipboard {
* @returns {Promise<any>} Returns a promise after the text has been copied
*/
@Cordova()
static copy(text: string): Promise<any> { return; }
copy(text: string): Promise<any> { return; }
/**
* Pastes the text stored in clipboard
* @returns {Promise<any>} Returns a promise after the text has been pasted
*/
@Cordova()
static paste(): Promise<any> { return; }
paste(): Promise<any> { return; }
}
@@ -1,6 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
namespace Http {
export const enum Verb {
GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
@@ -396,7 +396,7 @@ export interface DownloadProgress {
}
/**
* @name CodePush
* @name Code Push
* @description
* CodePush plugin for Cordova by Microsoft that supports iOS and Android.
*
@@ -404,14 +404,18 @@ export interface DownloadProgress {
*
* @usage
* ```typescript
* import { CodePush } from 'ionic-native';
* import { CodePush } from '@ionic-native/code-push';
*
* constructor(private codePush: CodePush) { }
*
* ...
*
* // note - mostly error & completed methods of observable will not fire
* // as syncStatus will contain the current state of the update
* CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
* this.codePush.sync().subscribe((syncStatus) => console.log(syncStatus));
*
* const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
* CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
* this.codePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
*
* ```
*/
@@ -422,6 +426,7 @@ export interface DownloadProgress {
repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
platforms: ['Android', 'iOS']
})
@Injectable()
export class CodePush {
/**
@@ -432,7 +437,7 @@ export class CodePush {
* @returns {Promise<ILocalPackage>}
*/
@Cordova()
static getCurrentPackage(): Promise<ILocalPackage> {
getCurrentPackage(): Promise<ILocalPackage> {
return;
}
@@ -442,7 +447,7 @@ export class CodePush {
* @returns {Promise<ILocalPackage>}
*/
@Cordova()
static getPendingPackage(): Promise<ILocalPackage> {
getPendingPackage(): Promise<ILocalPackage> {
return;
}
@@ -459,7 +464,7 @@ export class CodePush {
@Cordova({
callbackOrder: 'reverse'
})
static checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
checkForUpdate(deploymentKey?: string): Promise<IRemotePackage> {
return;
}
@@ -473,7 +478,7 @@ export class CodePush {
* @returns {Promise<void>}
*/
@Cordova()
static notifyApplicationReady(): Promise<void> {
notifyApplicationReady(): Promise<void> {
return;
}
@@ -483,7 +488,7 @@ export class CodePush {
* @returns {Promise<void>}
*/
@Cordova()
static restartApplication(): Promise<void> {
restartApplication(): Promise<void> {
return;
}
@@ -513,7 +518,7 @@ export class CodePush {
successIndex: 0,
errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
})
static sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback<DownloadProgress>): Observable<SyncStatus> {
return;
}
@@ -1,13 +1,11 @@
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin';
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from '@ionic-native/core';
declare var window: any,
navigator: any;
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
/**
* @private
*/
export interface IContactProperties {
/** A globally unique identifier. */
@@ -54,7 +52,7 @@ export interface IContactProperties {
}
/**
* @private
* @hidden
*/
export class Contact implements IContactProperties {
private _objectInstance: any;
@@ -100,7 +98,7 @@ export class Contact implements IContactProperties {
}
/**
* @private
* @hidden
*/
export interface IContactError {
/** Error code */
@@ -110,7 +108,7 @@ export interface IContactError {
}
/**
* @private
* @hidden
*/
export declare var ContactError: {
new (code: number): IContactError;
@@ -139,7 +137,7 @@ export interface IContactName {
}
/**
* @private
* @hidden
*/
export class ContactName implements IContactName {
constructor(public formatted?: string,
@@ -160,7 +158,7 @@ export interface IContactField {
}
/**
* @private
* @hidden
*/
export class ContactField implements IContactField {
constructor(public type?: string,
@@ -188,7 +186,7 @@ export interface IContactAddress {
}
/**
* @private
* @hidden
*/
export class ContactAddress implements IContactAddress {
constructor(public pref?: boolean,
@@ -215,7 +213,7 @@ export interface IContactOrganization {
}
/**
* @private
* @hidden
*/
export class ContactOrganization implements IContactOrganization {
constructor(
@@ -242,7 +240,7 @@ export interface IContactFindOptions {
}
/**
* @private
* @hidden
*/
export class ContactFindOptions implements IContactFindOptions {
constructor(public filter?: string,
@@ -259,10 +257,11 @@ export class ContactFindOptions implements IContactFindOptions {
* @usage
*
* ```typescript
* import { Contacts, Contact, ContactField, ContactName } from 'ionic-native';
* import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
*
* constructor(private contacts: Contacts) { }
*
* let contact: Contact = Contacts.create();
* let contact: Contact = this.contacts.create();
*
* contact.name = new ContactName(null, 'Smith', 'John');
* contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
@@ -272,6 +271,8 @@ export class ContactFindOptions implements IContactFindOptions {
* );
*
* ```
* @classes
* Contact
* @interfaces
* IContactProperties
* IContactError
@@ -287,13 +288,14 @@ export class ContactFindOptions implements IContactFindOptions {
pluginRef: 'navigator.contacts',
repo: 'https://github.com/apache/cordova-plugin-contacts'
})
@Injectable()
export class Contacts {
/**
* Create a single contact.
* @returns {Contact} Returns a Contact object
*/
static create(): Contact {
create(): Contact {
return new Contact();
}
@@ -303,7 +305,7 @@ export class Contacts {
* @param options {IContactFindOptions} Optional options for the query
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
static find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
resolve(contacts.map(processContact));
@@ -315,7 +317,7 @@ export class Contacts {
* Select a single Contact.
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
*/
static pickContact(): Promise<Contact> {
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
});
@@ -324,7 +326,7 @@ export class Contacts {
}
/**
* @private
* @hidden
*/
function processContact(contact) {
let newContact = new Contact();
@@ -1,4 +1,6 @@
import { Plugin, Cordova } from './plugin';
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name Couchbase Lite
@@ -7,11 +9,15 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import { CouchbaseLite } from 'ionic-native';
* import { CouchbaseLite } from '@ionic-native/couchbase-lite';
*
* CouchbaseLite.getURL()
* .then((url: any) => console.log(url))
* .catch((error: any) => console.log(error));
* constructor(private couchbase: CouchbaseLite) {
*
* couchbase.getURL()
* .then(url => console.log(url))
* .catch(error => console.error(error));
*
* }
*
* ```
*/
@@ -21,6 +27,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'cblite',
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
})
@Injectable()
export class CouchbaseLite {
/**
@@ -30,6 +37,6 @@ export class CouchbaseLite {
@Cordova({
callbackStyle: 'node'
})
static getURL(): Promise<any> { return; }
getURL(): Promise<any> { return; }
}
@@ -1,15 +1,18 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Crop
* @description Crops images
* @usage
* ```
* import {Crop} from 'ionic-native';
* import {Crop} from '@ionic-native/crop';
*
* constructor(private crop: Crop) { }
*
* ...
*
* Crop.crop('path/to/image.jpg', {quality: 75})
* this.crop.crop('path/to/image.jpg', {quality: 75})
* .then(
* newImage => console.log("new image path is: " + newImage),
* error => console.error("Error cropping image", error)
@@ -22,6 +25,7 @@ import { Cordova, Plugin } from './plugin';
pluginRef: 'plugins',
repo: 'https://github.com/jeduan/cordova-plugin-crop'
})
@Injectable()
export class Crop {
/**
@@ -33,6 +37,6 @@ export class Crop {
@Cordova({
callbackOrder: 'reverse'
})
static crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
crop(pathToImage: string, options?: {quality: number}): Promise<string> { return; }
}
@@ -1,4 +1,5 @@
import {Cordova, Plugin} from './plugin';
import { Injectable } from '@angular/core';
import {Cordova, Plugin} from '@ionic-native/core';
export interface DatePickerOptions {
/**
@@ -125,12 +126,18 @@ export interface DatePickerOptions {
*
* @usage
* ```typescript
* import { DatePicker } from 'ionic-native';
* import { DatePicker } from '@ionic-native/date-picker';
*
* constructor(private datePicker: DatePicker) { }
*
*
* DatePicker.show({
* ...
*
*
* this.datePicker.show({
* date: new Date(),
* mode: 'date'
* mode: 'date',
* androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_DARK
* }).then(
* date => console.log('Got date: ', date),
* err => console.log('Error occurred while getting date: ', err)
@@ -146,12 +153,13 @@ export interface DatePickerOptions {
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class DatePicker {
/**
* @private
* @hidden
*/
static ANDROID_THEMES = {
ANDROID_THEMES = {
THEME_TRADITIONAL: 1,
THEME_HOLO_DARK: 2,
THEME_HOLO_LIGHT: 3,
@@ -165,7 +173,7 @@ export class DatePicker {
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: DatePickerOptions): Promise<Date> {
show(options: DatePickerOptions): Promise<Date> {
return;
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
@@ -6,16 +7,20 @@ import { Observable } from 'rxjs/Observable';
* @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';
* import { DBMeter } from '@ionic-native/db-meter';
*
* constructor(private dbMeter: DBMeter) { }
*
* ...
*
*
* // Start listening
* let subscription = DBMeter.start().subscribe(
* let subscription = this.dbMeter.start().subscribe(
* data => console.log(data)
* );
*
* // Check if we are listening
* DBMeter.isListening().then(
* this.dbMeter.isListening().then(
* (isListening: boolean) => console.log(isListening)
* );
*
@@ -23,7 +28,7 @@ import { Observable } from 'rxjs/Observable';
* subscription.unsubscribe();
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
* this.dbMeter.delete().then(
* () => console.log('Deleted DB Meter instance'),
* error => console.log('Error occurred while deleting DB Meter instance')
* );
@@ -36,6 +41,7 @@ import { Observable } from 'rxjs/Observable';
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
platforms: ['iOS', 'Android']
})
@Injectable()
export class DBMeter {
/**
@@ -46,27 +52,27 @@ export class DBMeter {
observable: true,
clearFunction: 'stop'
})
static start(): Observable<any> { return; }
start(): Observable<any> { return; }
/**
* Stops listening
* @private
* @hidden
*/
@Cordova()
static stop(): Promise<any> { return; }
stop(): Promise<any> { return; }
/**
* Check if the DB Meter is listening
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/
@Cordova()
static isListening(): Promise<boolean> { return; }
isListening(): Promise<boolean> { return; }
/**
* Delete the DB Meter instance
* @returns {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
static delete(): Promise<any> { return; }
delete(): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface DeeplinkMatch {
@@ -29,39 +30,41 @@ export interface DeeplinkMatch {
*
* @usage
* ```typescript
* import { Deeplinks } from 'ionic-native';
* import { Deeplinks } from '@ionic-native/deeplinks';
*
* Deeplinks.route({
'/about-us': AboutPage,
'/universal-links-test': AboutPage,
'/products/:productId': ProductPage
}).subscribe((match) => {
// match.$route - the route we matched, which is the matched entry from the arguments to route()
// match.$args - the args passed in the link
// match.$link - the full link data
console.log('Successfully matched route', match);
}, (nomatch) => {
// nomatch.$link - the full link data
console.error('Got a deeplink that didn\'t match', nomatch);
});
* constructor(private deepLinks: DeepLinks) { }
*
* this.deepLinks.route({
* '/about-us': AboutPage,
* '/universal-links-test': AboutPage,
* '/products/:productId': ProductPage
* }).subscribe((match) => {
* // match.$route - the route we matched, which is the matched entry from the arguments to route()
* // match.$args - the args passed in the link
* // match.$link - the full link data
* console.log('Successfully matched route', match);
* }, (nomatch) => {
* // nomatch.$link - the full link data
* console.error('Got a deeplink that didn\'t match', nomatch);
* });
* ```
*
* Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
* the actual navigation for you:
*
* ```typescript
* Deeplinks.routeWithNavController(this.navController, {
'/about-us': AboutPage,
'/products/:productId': ProductPage
}).subscribe((match) => {
// match.$route - the route we matched, which is the matched entry from the arguments to route()
// match.$args - the args passed in the link
// match.$link - the full link data
console.log('Successfully matched route', match);
}, (nomatch) => {
// nomatch.$link - the full link data
console.error('Got a deeplink that didn\'t match', nomatch);
});
* this.deepLinks.routeWithNavController(this.navController, {
* '/about-us': AboutPage,
* '/products/:productId': ProductPage
* }).subscribe((match) => {
* // match.$route - the route we matched, which is the matched entry from the arguments to route()
* // match.$args - the args passed in the link
* // match.$link - the full link data
* console.log('Successfully matched route', match);
* }, (nomatch) => {
* // nomatch.$link - the full link data
* console.error('Got a deeplink that didn\'t match', nomatch);
* });
* ```
*
* See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
@@ -76,8 +79,10 @@ export interface DeeplinkMatch {
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
platforms: ['iOS', 'Android'],
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
install: 'ionic 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']
})
@Injectable()
export class Deeplinks {
/**
@@ -93,7 +98,7 @@ export class Deeplinks {
@Cordova({
observable: true
})
static route(paths): Observable<DeeplinkMatch> { return; }
route(paths): Observable<DeeplinkMatch> { return; }
/**
*
@@ -116,6 +121,6 @@ export class Deeplinks {
@Cordova({
observable: true
})
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
}
@@ -1,5 +1,25 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Device Accounts
* @description
* Gets the Google accounts associated with the Android device
*
* @usage
* ```typescript
* import { DeviceAccounts } from '@ionic-native/device-accounts';
*
* constructor(private deviceAccounts: DeviceAccounts) { }
*
* ...
*
* this.deviceAccounts.get()
* .then(accounts => console.log(accounts))
* .catch(error => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'DeviceAccounts',
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
@@ -7,6 +27,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
platforms: ['Android']
})
@Injectable()
export class DeviceAccounts {
/**
@@ -14,27 +35,27 @@ export class DeviceAccounts {
* @returns {Promise<any>}
*/
@Cordova()
static get(): Promise<any> { return; }
get(): Promise<any> { return; }
/**
* Get all accounts registered on Android device for requested type
* @returns {Promise<any>}
*/
@Cordova()
static getByType(type: string): Promise<any> { return; }
getByType(type: string): Promise<any> { return; }
/**
* Get all emails registered on Android device (accounts with 'com.google' type)
* @returns {Promise<any>}
*/
@Cordova()
static getEmails(): Promise<any> { return; }
getEmails(): Promise<any> { return; }
/**
* Get the first email registered on Android device
* @returns {Promise<any>}
*/
@Cordova()
static getEmail(): Promise<any> { return; }
getEmail(): Promise<any> { return; }
}
@@ -1,19 +1,25 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name DeviceFeedback
* @name Device Feedback
* @description
*
* Plugin that lets you provide haptic or acoustic feedback on Android devices.
*
* @usage
* ```
* import { DeviceFeedback } from 'ionic-native';
* import { DeviceFeedback } from '@ionic-native/device-feedback';
*
* DeviceFeedback.acoustic();
* constructor(private deviceFeedback: DeviceFeedback) { }
*
* DeviceFeedback.haptic(0);
* ...
*
* DeviceFeedback.isFeedbackEnabled()
*
* this.deviceFeedback.acoustic();
*
* this.deviceFeedback.haptic(0);
*
* this.deviceFeedback.isFeedbackEnabled()
* .then((feedback) => {
* console.log(feedback);
* // {
@@ -31,26 +37,27 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/VVelda/device-feedback',
platforms: ['Android']
})
@Injectable()
export class DeviceFeedback {
/**
* Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
*/
@Cordova({ sync: true })
static acoustic(): void { }
acoustic(): void { }
/**
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
* @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
*/
@Cordova({ sync: true })
static haptic(type: number): void { }
haptic(type: number): void { }
/**
* Check if haptic and acoustic feedback is enabled by user settings.
* @returns {Promise<any>}
*/
@Cordova()
static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface DeviceMotionAccelerationData {
@@ -41,17 +42,20 @@ export interface DeviceMotionAccelerometerOptions {
*
* @usage
* ```typescript
* import { DeviceMotion, DeviceMotionAccelerationData } from 'ionic-native';
* import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion';
*
* constructor(private deviceMotion: DeviceMotion) { }
*
* ...
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
* this.deviceMotion.getCurrentAcceleration().then(
* (acceleration: DeviceMotionAccelerationData) => console.log(acceleration),
* (error: any) => console.log(error)
* );
*
* // Watch device acceleration
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
* var subscription = this.deviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => {
* console.log(acceleration);
* });
*
@@ -69,6 +73,7 @@ export interface DeviceMotionAccelerometerOptions {
pluginRef: 'navigator.accelerometer',
repo: 'https://github.com/apache/cordova-plugin-device-motion'
})
@Injectable()
export class DeviceMotion {
/**
@@ -76,7 +81,7 @@ export class DeviceMotion {
* @returns {Promise<DeviceMotionAccelerationData>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
static getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
@@ -88,6 +93,6 @@ export class DeviceMotion {
observable: true,
clearFunction: 'clearWatch'
})
static watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface DeviceOrientationCompassHeading {
@@ -47,17 +48,20 @@ export interface DeviceOrientationCompassOptions {
* @usage
* ```typescript
* // DeviceOrientationCompassHeading is an interface for compass
* import { DeviceOrientation, DeviceOrientationCompassHeading } from 'ionic-native';
* import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation';
*
* constructor(private deviceOrientation: DeviceOrientation) { }
*
* ...
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* this.deviceOrientation.getCurrentHeading().then(
* (data: DeviceOrientationCompassHeading) => console.log(data),
* (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* var subscription = this.deviceOrientation.watchHeading().subscribe(
* (data: DeviceOrientationCompassHeading) => console.log(data)
* );
*
@@ -74,6 +78,7 @@ export interface DeviceOrientationCompassOptions {
pluginRef: 'navigator.compass',
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
})
@Injectable()
export class DeviceOrientation {
/**
@@ -81,7 +86,7 @@ export class DeviceOrientation {
* @returns {Promise<DeviceOrientationCompassHeading>}
*/
@Cordova()
static getCurrentHeading(): Promise<DeviceOrientationCompassHeading> { return; }
getCurrentHeading(): Promise<DeviceOrientationCompassHeading> { return; }
/**
* Get the device current heading at a regular interval
@@ -95,6 +100,6 @@ export class DeviceOrientation {
observable: true,
clearFunction: 'clearWatch'
})
static watchHeading(options?: DeviceOrientationCompassOptions): Observable<DeviceOrientationCompassHeading> { return; }
watchHeading(options?: DeviceOrientationCompassOptions): Observable<DeviceOrientationCompassHeading> { return; }
}
@@ -1,4 +1,5 @@
import { CordovaProperty, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin } from '@ionic-native/core';
declare var window: any;
@@ -9,10 +10,13 @@ declare var window: any;
*
* @usage
* ```typescript
* import { Device } from 'ionic-native';
* import { Device } from '@ionic-native/device';
*
* constructor(private device: Device) { }
*
* console.log('Device UUID is: ' + Device.uuid);
* ...
*
* console.log('Device UUID is: ' + this.device.uuid);
* ```
*/
@Plugin({
@@ -21,41 +25,42 @@ declare var window: any;
pluginRef: 'device',
repo: 'https://github.com/apache/cordova-plugin-device'
})
@Injectable()
export class Device {
/** Get the version of Cordova running on the device. */
@CordovaProperty
static cordova: string;
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
static model: string;
model: string;
/** Get the device's operating system name. */
@CordovaProperty
static platform: string;
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
@CordovaProperty
static uuid: string;
uuid: string;
/** Get the operating system version. */
@CordovaProperty
static version: string;
version: string;
/** Get the device's manufacturer. */
@CordovaProperty
static manufacturer: string;
manufacturer: string;
/** Whether the device is running on a simulator. */
@CordovaProperty
static isVirtual: boolean;
isVirtual: boolean;
/** Get the device hardware serial number. */
@CordovaProperty
static serial: string;
serial: string;
}
@@ -1,4 +1,5 @@
import {Cordova, Plugin, CordovaProperty} from './plugin';
import { Injectable } from '@angular/core';
import {Cordova, Plugin, CordovaProperty} from '@ionic-native/core';
/**
* @name Diagnostic
@@ -7,19 +8,23 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
*
* @usage
* ```typescript
* import { Diagnostic } from 'ionic-native';
* import { Diagnostic } from '@ionic-native/diagnostic';
*
* constructor(private diagnostic: Diagnostic) { }
*
* ...
*
* let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
* let errorCallback = (e) => console.error(e);
*
* Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
* this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
*
* Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
* this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
*
*
* Diagnostic.getBluetoothState()
* this.diagnostic.getBluetoothState()
* .then((state) => {
* if (state == Diagnostic.bluetoothState.POWERED_ON){
* if (state == this.diagnostic.bluetoothState.POWERED_ON){
* // do something
* } else {
* // do something else
@@ -35,9 +40,10 @@ import {Cordova, Plugin, CordovaProperty} from './plugin';
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
})
@Injectable()
export class Diagnostic {
static permission = {
permission = {
READ_CALENDAR: 'READ_CALENDAR',
WRITE_CALENDAR: 'WRITE_CALENDAR',
CAMERA: 'CAMERA',
@@ -65,7 +71,7 @@ export class Diagnostic {
};
@CordovaProperty
static permissionStatus: {
permissionStatus: {
GRANTED: string;
DENIED: string;
NOT_REQUESTED: string;
@@ -74,12 +80,12 @@ export class Diagnostic {
GRANTED_WHEN_IN_USE: string;
};
static locationAuthorizationMode = {
locationAuthorizationMode = {
ALWAYS: 'always',
WHEN_IN_USE: 'when_in_use'
};
static permissionGroups = {
permissionGroups = {
CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
CAMERA: ['CAMERA'],
CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
@@ -91,14 +97,14 @@ export class Diagnostic {
STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
};
static locationMode = {
locationMode = {
HIGH_ACCURACY: 'high_accuracy',
DEVICE_ONLY: 'device_only',
BATTERY_SAVING: 'battery_saving',
LOCATION_OFF: 'location_off'
};
static bluetoothState = {
bluetoothState = {
UNKNOWN: 'unknown',
RESETTING: 'resetting', // iOS
UNSUPPORTED: 'unsupported', // iOS
@@ -110,7 +116,7 @@ export class Diagnostic {
};
@CordovaProperty
static NFCState: {
NFCState: {
UNKNOWN: string;
POWERED_OFF: string;
POWERED_ON: string;
@@ -124,7 +130,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova()
static isLocationAvailable(): Promise<any> { return; }
isLocationAvailable(): Promise<any> { return; }
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
@@ -132,7 +138,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova()
static isWifiAvailable(): Promise<any> { return; }
isWifiAvailable(): Promise<any> { return; }
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
@@ -140,7 +146,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova()
static isCameraAvailable(): Promise<any> { return; }
isCameraAvailable(): Promise<any> { return; }
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
@@ -148,38 +154,38 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova()
static isBluetoothAvailable(): Promise<any> { return; }
isBluetoothAvailable(): Promise<any> { return; }
/**
* Displays the device location settings to allow user to enable location services/change location mode.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToLocationSettings(): void { }
switchToLocationSettings(): void { }
/**
* Displays mobile settings to allow user to enable mobile data.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToMobileDataSettings(): void { }
switchToMobileDataSettings(): void { }
/**
* Displays Bluetooth settings to allow user to enable Bluetooth.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToBluetoothSettings(): void { }
switchToBluetoothSettings(): void { }
/**
* Displays WiFi settings to allow user to enable WiFi.
*/
@Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
static switchToWifiSettings(): void { }
switchToWifiSettings(): void { }
/**
* Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'Windows 10'] })
static isWifiEnabled(): Promise<boolean> { return; }
isWifiEnabled(): Promise<boolean> { return; }
/**
* Enables/disables WiFi on the device.
@@ -188,7 +194,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setWifiState(state: boolean): Promise<any> { return; }
setWifiState(state: boolean): Promise<any> { return; }
/**
* Enables/disables Bluetooth on the device.
@@ -197,7 +203,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
static setBluetoothState(state: boolean): Promise<any> { return; }
setBluetoothState(state: boolean): Promise<any> { return; }
// ANDROID AND IOS ONLY
@@ -207,7 +213,7 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isLocationEnabled(): Promise<boolean> { return; }
isLocationEnabled(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use location.
@@ -215,14 +221,14 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova()
static isLocationAuthorized(): Promise<any> { return; }
isLocationAuthorized(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getLocationAuthorizationStatus(): Promise<any> { return; }
getLocationAuthorizationStatus(): Promise<any> { return; }
/**
* Returns the location authorization status for the application.
@@ -232,14 +238,14 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
static requestLocationAuthorization(mode?: string): Promise<any> { return; }
requestLocationAuthorization(mode?: string): Promise<any> { return; }
/**
* Checks if camera hardware is present on device.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraPresent(): Promise<any> { return; }
isCameraPresent(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the camera.
@@ -247,63 +253,63 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isCameraAuthorized(): Promise<any> { return; }
isCameraAuthorized(): Promise<any> { return; }
/**
* Returns the camera authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getCameraAuthorizationStatus(): Promise<any> { return; }
getCameraAuthorizationStatus(): Promise<any> { return; }
/**
* Requests camera authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCameraAuthorization(): Promise<any> { return; }
requestCameraAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the microphone.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isMicrophoneAuthorized(): Promise<boolean> { return; }
isMicrophoneAuthorized(): Promise<boolean> { return; }
/**
* Returns the microphone authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getMicrophoneAuthorizationStatus(): Promise<any> { return; }
getMicrophoneAuthorizationStatus(): Promise<any> { return; }
/**
* Requests microphone authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestMicrophoneAuthorization(): Promise<any> { return; }
requestMicrophoneAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use contacts (address book).
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isContactsAuthorized(): Promise<boolean> { return; }
isContactsAuthorized(): Promise<boolean> { return; }
/**
* Returns the contacts authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getContactsAuthorizationStatus(): Promise<any> { return; }
getContactsAuthorizationStatus(): Promise<any> { return; }
/**
* Requests contacts authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestContactsAuthorization(): Promise<any> { return; }
requestContactsAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized to use the calendar.
@@ -316,7 +322,7 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static isCalendarAuthorized(): Promise<boolean> { return; }
isCalendarAuthorized(): Promise<boolean> { return; }
/**
* Returns the calendar authorization status for the application.
@@ -330,7 +336,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getCalendarAuthorizationStatus(): Promise<any> { return; }
getCalendarAuthorizationStatus(): Promise<any> { return; }
/**
* Requests calendar authorization for the application.
@@ -347,7 +353,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static requestCalendarAuthorization(): Promise<any> { return; }
requestCalendarAuthorization(): Promise<any> { return; }
/**
* Opens settings page for this app.
@@ -356,28 +362,28 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static switchToSettings(): Promise<any> { return; }
switchToSettings(): Promise<any> { return; }
/**
* Returns the state of Bluetooth on the device.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
static getBluetoothState(): Promise<any> { return; }
getBluetoothState(): Promise<any> { return; }
/**
* Registers a function to be called when a change in Bluetooth state occurs.
* @param handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerBluetoothStateChangeHandler(handler: Function): void { }
registerBluetoothStateChangeHandler(handler: Function): void { }
/**
* Registers a function to be called when a change in Location state occurs.
* @param handler
*/
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
static registerLocationStateChangeHandler(handler: Function): void { }
registerLocationStateChangeHandler(handler: Function): void { }
// ANDROID ONLY
@@ -388,7 +394,7 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isGpsLocationAvailable(): Promise<boolean> { return; }
isGpsLocationAvailable(): Promise<boolean> { return; }
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
@@ -398,7 +404,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isGpsLocationEnabled(): Promise<any> { return; }
isGpsLocationEnabled(): Promise<any> { return; }
/**
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
@@ -406,7 +412,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isNetworkLocationAvailable(): Promise<any> { return; }
isNetworkLocationAvailable(): Promise<any> { return; }
/**
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
@@ -416,14 +422,14 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isNetworkLocationEnabled(): Promise<any> { return; }
isNetworkLocationEnabled(): Promise<any> { return; }
/**
* Returns the current location mode setting for the device.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static getLocationMode(): Promise<any> { return; }
getLocationMode(): Promise<any> { return; }
/**
* Returns the current authorisation status for a given permission.
@@ -432,7 +438,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
getPermissionAuthorizationStatus(permission: any): Promise<any> { return; }
/**
* Returns the current authorisation status for multiple permissions.
@@ -441,7 +447,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
getPermissionsAuthorizationStatus(permissions: any[]): Promise<any> { return; }
/**
* Requests app to be granted authorisation for a runtime permission.
@@ -450,7 +456,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermission(permission: any): Promise<any> { return; }
requestRuntimePermission(permission: any): Promise<any> { return; }
/**
* Requests app to be granted authorisation for multiple runtime permissions.
@@ -459,7 +465,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
static requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
requestRuntimePermissions(permissions: any[]): Promise<any> { return; }
/**
* Indicates if the plugin is currently requesting a runtime permission via the native API.
@@ -469,7 +475,7 @@ export class Diagnostic {
* @returns {boolean}
*/
@Cordova({ sync: true })
static isRequestingPermission(): boolean { return; }
isRequestingPermission(): boolean { return; }
/**
* Registers a function to be called when a runtime permission request has completed.
@@ -477,7 +483,7 @@ export class Diagnostic {
* @param handler {Function}
*/
@Cordova({ sync: true })
static registerPermissionRequestCompleteHandler(handler: Function): void { return; }
registerPermissionRequestCompleteHandler(handler: Function): void { return; }
/**
* Checks if the device setting for Bluetooth is switched on.
@@ -485,49 +491,49 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isBluetoothEnabled(): Promise<boolean> { return; }
isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothSupport(): Promise<boolean> { return; }
hasBluetoothSupport(): Promise<boolean> { return; }
/**
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothLESupport(): Promise<boolean> { return; }
hasBluetoothLESupport(): Promise<boolean> { return; }
/**
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
hasBluetoothLEPeripheralSupport(): Promise<boolean> { return; }
/**
* Checks if the application is authorized to use external storage.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isExternalStorageAuthorized(): Promise<boolean> { return; }
isExternalStorageAuthorized(): Promise<boolean> { return; }
/**
* CReturns the external storage authorization status for the application.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static getExternalStorageAuthorizationStatus(): Promise<any> { return; }
getExternalStorageAuthorizationStatus(): Promise<any> { return; }
/**
* Requests external storage authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static requestExternalStorageAuthorization(): Promise<any> { return; }
requestExternalStorageAuthorization(): Promise<any> { return; }
/**
* Returns details of external SD card(s): absolute path, is writable, free space.
@@ -540,7 +546,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static getExternalSdCardDetails(): Promise<any> { return; }
getExternalSdCardDetails(): Promise<any> { return; }
/**
* Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
@@ -565,7 +571,7 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCPresent(): Promise<boolean> { return; }
isNFCPresent(): Promise<boolean> { return; }
/**
* Checks if the device setting for NFC is switched on.
@@ -573,7 +579,7 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCEnabled(): Promise<boolean> { return; }
isNFCEnabled(): Promise<boolean> { return; }
/**
* Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on.
@@ -581,7 +587,7 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android'] })
static isNFCAvailable(): Promise<boolean> { return; }
isNFCAvailable(): Promise<boolean> { return; }
/**
* Registers a function to be called when a change in NFC state occurs. Pass in a falsey value to de-register the currently registered function.
@@ -603,14 +609,14 @@ export class Diagnostic {
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isCameraRollAuthorized(): Promise<boolean> { return; }
isCameraRollAuthorized(): Promise<boolean> { return; }
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
/**
* Requests camera roll authorization for the application.
@@ -619,21 +625,21 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestCameraRollAuthorization(): Promise<any> { return; }
requestCameraRollAuthorization(): Promise<any> { return; }
/**
* Checks if remote (push) notifications are enabled.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isRemoteNotificationsEnabled(): Promise<boolean> { return; }
isRemoteNotificationsEnabled(): Promise<boolean> { return; }
/**
* Indicates if the app is registered for remote (push) notifications on the device.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
isRegisteredForRemoteNotifications(): Promise<boolean> { return; }
/**
* Indicates the current setting of notification types for the app in the Settings app.
@@ -641,42 +647,42 @@ export class Diagnostic {
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getRemoteNotificationTypes(): Promise<any> { return; }
getRemoteNotificationTypes(): Promise<any> { return; }
/**
* Checks if the application is authorized to use reminders.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isRemindersAuthorized(): Promise<boolean> { return; }
isRemindersAuthorized(): Promise<boolean> { return; }
/**
* Returns the reminders authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getRemindersAuthorizationStatus(): Promise<any> { return; }
getRemindersAuthorizationStatus(): Promise<any> { return; }
/**
* Requests reminders authorization for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestRemindersAuthorization(): Promise<any> { return; }
requestRemindersAuthorization(): Promise<any> { return; }
/**
* Checks if the application is authorized for background refresh.
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
isBackgroundRefreshAuthorized(): Promise<boolean> { return; }
/**
* Returns the background refresh authorization status for the application.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static getBackgroundRefreshStatus(): Promise<any> { return; }
getBackgroundRefreshStatus(): Promise<any> { return; }
/**
* Requests Bluetooth authorization for the application.
@@ -685,14 +691,14 @@ export class Diagnostic {
* @return {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestBluetoothAuthorization(): Promise<any> { return; }
requestBluetoothAuthorization(): Promise<any> { return; }
/**
* Checks if motion tracking is available on the current device.
* @return {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isMotionAvailable(): Promise<boolean> { return; }
isMotionAvailable(): Promise<boolean> { return; }
/**
* Checks if it's possible to determine the outcome of a motion authorization request on the current device.
@@ -702,7 +708,7 @@ export class Diagnostic {
* @return {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
static isMotionRequestOutcomeAvailable(): Promise<boolean> { return; }
isMotionRequestOutcomeAvailable(): Promise<boolean> { return; }
/**
* Requests and checks motion authorization for the application: there is no way to independently request only or check only, so both must be done in one operation.
@@ -712,6 +718,6 @@ export class Diagnostic {
* @return {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
static requestAndCheckMotionAuthorization(): Promise<any> { return; }
requestAndCheckMotionAuthorization(): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface DialogsPromptCallback {
@@ -25,9 +26,15 @@ export interface DialogsPromptCallback {
*
* @usage
* ```typescript
* import { Dialogs } from 'ionic-native';
* import { Dialogs } from '@ionic-native/dialogs';
*
* constructor(private dialogs: Dialogs) { }
*
* ...
*
* this.dialogs.alert('Hello world')
* .then(() => console.log('Dialog dismissed'))
* .catch(e => console.log('Error displaying dialog', e));
*
*
* ```
@@ -40,6 +47,7 @@ export interface DialogsPromptCallback {
pluginRef: 'navigator.notification',
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
})
@Injectable()
export class Dialogs {
/**
@@ -53,11 +61,7 @@ export class Dialogs {
successIndex: 1,
errorIndex: 4
})
static alert(
message,
title: string = 'Alert',
buttonName: string = 'OK'
): Promise<any> { return; }
alert(message: string, title?: string, buttonName?: string): Promise<any> { return; }
/**
* Displays a customizable confirmation dialog box.
@@ -70,11 +74,7 @@ export class Dialogs {
successIndex: 1,
errorIndex: 4
})
static confirm(
message,
title: string = 'Confirm',
buttonLabels: Array<string> = ['OK', 'Cancel']
): Promise<number> { return; }
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
@@ -88,12 +88,7 @@ export class Dialogs {
successIndex: 1,
errorIndex: 5
})
static prompt(
message?: string,
title: string = 'Prompt',
buttonLabels: Array<string> = ['OK', 'Cancel'],
defaultText: string = ''
): Promise<DialogsPromptCallback> { return; }
prompt(message?: string, title?: string, buttonLabels?: string[], defaultText?: string): Promise<DialogsPromptCallback> { return; }
/**
@@ -103,6 +98,6 @@ export class Dialogs {
@Cordova({
sync: true
})
static beep(times: number): void { }
beep(times: number): void { }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core';
declare var cordova: any;
@@ -35,10 +36,14 @@ export interface EmailComposerOptions {
*
* @usage
* ```typescript
* import { EmailComposer } from 'ionic-native';
* import { EmailComposer } from '@ionic-native/email-composer';
*
* constructor(private emailComposer: EmailComposer) { }
*
* ...
*
*
* EmailComposer.isAvailable().then((available: boolean) =>{
* this.emailComposer.isAvailable().then((available: boolean) =>{
* if(available) {
* //Now we know we can send
* }
@@ -60,7 +65,7 @@ export interface EmailComposerOptions {
* };
*
* // Send a text message using default options
* EmailComposer.open(email);
* this.emailComposer.open(email);
*
* ```
* @interfaces
@@ -73,6 +78,7 @@ export interface EmailComposerOptions {
repo: 'https://github.com/hypery2k/cordova-email-plugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class EmailComposer {
/**
@@ -81,7 +87,8 @@ export class EmailComposer {
* @param app {string?} An optional app id or uri scheme.
* @returns {Promise<any>} Resolves if available, rejects if not available
*/
static isAvailable(app?: string): Promise<any> {
@CordovaCheck()
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => {
@@ -110,7 +117,7 @@ export class EmailComposer {
* @param packageName {string} The package name
*/
@Cordova()
static addAlias(alias: string, packageName: string): void { }
addAlias(alias: string, packageName: string): void { }
/**
* Displays the email composer pre-filled with data.
@@ -123,6 +130,6 @@ export class EmailComposer {
successIndex: 1,
errorIndex: 3
})
static open(options: EmailComposerOptions, scope?: any): Promise<any> { return; }
open(options: EmailComposerOptions, scope?: any): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface EstimoteBeaconRegion {
@@ -16,11 +17,25 @@ export interface EstimoteBeaconRegion {
}
/**
* @name EstimoteBeacons
* @name Estimote Beacons
*
* @description
* This plugin enables communication between a phone and Estimote Beacons peripherals.
*
* @usage
* ```typescript
* import { EstimoteBeacons } from '@ionic-native/estimote-beacons';
*
* constructor(private eb: EstimoteBeacons) { }
*
* ...
*
* this.eb.requestAlwaysAuthorization();
*
* this.eb.enableAnalytics(true);
*
* ```
*
* @interfaces
* EstimoteBeaconRegion
*/
@@ -31,63 +46,64 @@ export interface EstimoteBeaconRegion {
repo: 'https://github.com/evothings/phonegap-estimotebeacons',
platforms: ['iOS', 'Android']
})
@Injectable()
export class EstimoteBeacons {
/** Proximity value */
static ProximityUnknown = 0;
ProximityUnknown = 0;
/** Proximity value */
static ProximityImmediate = 1;
ProximityImmediate = 1;
/** Proximity value */
static ProximityNear = 2;
ProximityNear = 2;
/** Proximity value */
static ProximityFar = 3;
ProximityFar = 3;
/** Beacon colour */
static BeaconColorUnknown = 0;
BeaconColorUnknown = 0;
/** Beacon colour */
static BeaconColorMintCocktail = 1;
BeaconColorMintCocktail = 1;
/** Beacon colour */
static BeaconColorIcyMarshmallow = 2;
BeaconColorIcyMarshmallow = 2;
/** Beacon colour */
static BeaconColorBlueberryPie = 3;
BeaconColorBlueberryPie = 3;
/**
* Beacon colour.
*/
static BeaconColorSweetBeetroot = 4;
BeaconColorSweetBeetroot = 4;
/** Beacon colour */
static BeaconColorCandyFloss = 5;
BeaconColorCandyFloss = 5;
/** Beacon colour */
static BeaconColorLemonTart = 6;
BeaconColorLemonTart = 6;
/** Beacon colour */
static BeaconColorVanillaJello = 7;
BeaconColorVanillaJello = 7;
/** Beacon colour */
static BeaconColorLiquoriceSwirl = 8;
BeaconColorLiquoriceSwirl = 8;
/** Beacon colour */
static BeaconColorWhite = 9;
BeaconColorWhite = 9;
/** Beacon colour */
static BeaconColorTransparent = 10;
BeaconColorTransparent = 10;
/** Region state */
static RegionStateUnknown = 'unknown';
RegionStateUnknown = 'unknown';
/** Region state */
static RegionStateOutside = 'outside';
RegionStateOutside = 'outside';
/** Region state */
static RegionStateInside = 'inside';
RegionStateInside = 'inside';
/**
* Ask the user for permission to use location services
@@ -108,7 +124,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static requestWhenInUseAuthorization(): Promise<any> { return; }
requestWhenInUseAuthorization(): Promise<any> { return; }
/**
* Ask the user for permission to use location services
@@ -129,7 +145,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static requestAlwaysAuthorization(): Promise<any> { return; }
requestAlwaysAuthorization(): Promise<any> { return; }
/**
* Get the current location authorization status.
@@ -148,7 +164,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static authorizationStatus(): Promise<any> { return; }
authorizationStatus(): Promise<any> { return; }
/**
* Start advertising as a beacon.
@@ -170,7 +186,7 @@ export class EstimoteBeacons {
@Cordova({
clearFunction: 'stopAdvertisingAsBeacon'
})
static startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
startAdvertisingAsBeacon(uuid: string, major: number, minor: number, regionId: string): Promise<any> { return; }
/**
* Stop advertising as a beacon.
@@ -186,7 +202,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopAdvertisingAsBeacon(): Promise<any> { return; }
stopAdvertisingAsBeacon(): Promise<any> { return; }
/**
* Enable analytics.
@@ -201,7 +217,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static enableAnalytics(enable: boolean): Promise<any> { return; }
enableAnalytics(enable: boolean): Promise<any> { return; }
/**
* Test if analytics is enabled.
@@ -215,7 +231,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static isAnalyticsEnabled(): Promise<any> { return; }
isAnalyticsEnabled(): Promise<any> { return; }
/**
* Test if App ID and App Token is set.
@@ -229,7 +245,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static isAuthorized(): Promise<any> { return; }
isAuthorized(): Promise<any> { return; }
/**
* Set App ID and App Token.
@@ -245,7 +261,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
setupAppIDAndAppToken(appID: string, appToken: string): Promise<any> { return; }
/**
* Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
@@ -266,7 +282,7 @@ export class EstimoteBeacons {
observable: true,
clearFunction: 'stopEstimoteBeaconDiscovery'
})
static startEstimoteBeaconDiscovery(): Observable<any> { return; }
startEstimoteBeaconDiscovery(): Observable<any> { return; }
/**
* Stop CoreBluetooth scan. Available on iOS.
@@ -283,7 +299,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopEstimoteBeaconDiscovery(): Promise<any> { return; }
stopEstimoteBeaconDiscovery(): Promise<any> { return; }
/**
* Start ranging beacons. Available on iOS and Android.
@@ -306,7 +322,7 @@ export class EstimoteBeacons {
clearFunction: 'stopRangingBeaconsInRegion',
clearWithArgs: true
})
static startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
startRangingBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging beacons. Available on iOS and Android.
@@ -325,7 +341,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
stopRangingBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start ranging secure beacons. Available on iOS.
@@ -340,7 +356,7 @@ export class EstimoteBeacons {
clearFunction: 'stopRangingSecureBeaconsInRegion',
clearWithArgs: true
})
static startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
startRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Observable<any> { return; }
/**
* Stop ranging secure beacons. Available on iOS.
@@ -349,7 +365,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
stopRangingSecureBeaconsInRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring beacons. Available on iOS and Android.
@@ -375,7 +391,7 @@ export class EstimoteBeacons {
successIndex: 1,
errorIndex: 2
})
static startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
startMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring beacons. Available on iOS and Android.
@@ -389,7 +405,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
stopMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Start monitoring secure beacons. Available on iOS.
@@ -409,7 +425,7 @@ export class EstimoteBeacons {
successIndex: 1,
errorIndex: 2
})
static startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
startSecureMonitoringForRegion(region: EstimoteBeaconRegion, notifyEntryStateOnDisplay: boolean): Observable<any> { return; }
/**
* Stop monitoring secure beacons. Available on iOS.
@@ -419,7 +435,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
stopSecureMonitoringForRegion(region: EstimoteBeaconRegion): Promise<any> { return; }
/**
* Connect to Estimote Beacon. Available on Android.
@@ -439,7 +455,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static connectToBeacon(beacon: any): Promise<any> { return; }
connectToBeacon(beacon: any): Promise<any> { return; }
/**
* Disconnect from connected Estimote Beacon. Available on Android.
@@ -451,7 +467,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static disconnectConnectedBeacon(): Promise<any> { return; }
disconnectConnectedBeacon(): Promise<any> { return; }
/**
* Write proximity UUID to connected Estimote Beacon. Available on Android.
@@ -465,7 +481,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
writeConnectedProximityUUID(uuid: any): Promise<any> { return; }
/**
* Write major to connected Estimote Beacon. Available on Android.
@@ -479,7 +495,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static writeConnectedMajor(major: number): Promise<any> { return; }
writeConnectedMajor(major: number): Promise<any> { return; }
/**
* Write minor to connected Estimote Beacon. Available on Android.
@@ -493,7 +509,7 @@ export class EstimoteBeacons {
* @returns {Promise<any>}
*/
@Cordova()
static writeConnectedMinor(minor: number): Promise<any> { return; }
writeConnectedMinor(minor: number): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface FacebookLoginResponse {
@@ -92,8 +93,15 @@ export interface FacebookLoginResponse {
*
* @usage
* ```typescript
* import { Facebook } from 'ionic-native';
* import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
*
* constructor(private fb: Facebook) { }
*
* ...
*
* this.fb.login(['public_profile', 'user_friends', 'email'])
* .then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res))
* .catch(e => console.log('Error logging into Facebook', e));
*
*
* ```
@@ -104,8 +112,10 @@ export interface FacebookLoginResponse {
plugin: 'cordova-plugin-facebook4',
pluginRef: 'facebookConnectPlugin',
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"'
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
installVariables: ['APP_ID', 'APP_NAME']
})
@Injectable()
export class Facebook {
/**
@@ -115,7 +125,7 @@ export class Facebook {
* @returns {Promise<any>}
*/
@Cordova()
static browserInit(appId: number, version?: string): Promise<any> {
browserInit(appId: number, version?: string): Promise<any> {
return;
}
@@ -140,7 +150,7 @@ export class Facebook {
* @returns {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/
@Cordova()
static login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
login(permissions: string[]): Promise<FacebookLoginResponse> { return; }
/**
* Logout of Facebook.
@@ -149,7 +159,7 @@ export class Facebook {
* @returns {Promise<any>} Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/
@Cordova()
static logout(): Promise<any> { return; }
logout(): Promise<any> { return; }
/**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
@@ -178,7 +188,7 @@ export class Facebook {
* @returns {Promise<any>} Returns a Promise that resolves with a status, or rejects with an error
*/
@Cordova()
static getLoginStatus(): Promise<any> { return; }
getLoginStatus(): Promise<any> { return; }
/**
* Get a Facebook access token for using Facebook services.
@@ -186,7 +196,7 @@ export class Facebook {
* @returns {Promise<string>} Returns a Promise that resolves with an access token, or rejects with an error
*/
@Cordova()
static getAccessToken(): Promise<string> { return; }
getAccessToken(): Promise<string> { return; }
/**
* Show one of various Facebook dialogs. Example of options for a Share dialog:
@@ -206,7 +216,7 @@ export class Facebook {
* @returns {Promise<any>} Returns a Promise that resolves with success data, or rejects with an error
*/
@Cordova()
static showDialog(options: any): Promise<any> { return; }
showDialog(options: any): Promise<any> { return; }
/**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
@@ -222,7 +232,7 @@ export class Facebook {
* @returns {Promise<any>} Returns a Promise that resolves with the result of the request, or rejects with an error
*/
@Cordova()
static api(requestPath: string, permissions: string[]): Promise<any> { return; }
api(requestPath: string, permissions: string[]): Promise<any> { return; }
/**
* Log an event. For more information see the Events section above.
@@ -236,11 +246,7 @@ export class Facebook {
successIndex: 3,
errorIndex: 4
})
static logEvent(
name: string,
params?: Object,
valueToSum?: number
): Promise<any> { return; }
logEvent(name: string, params?: Object, valueToSum?: number): Promise<any> { return; }
/**
* Log a purchase. For more information see the Events section above.
@@ -250,7 +256,7 @@ export class Facebook {
* @returns {Promise<any>}
*/
@Cordova()
static logPurchase(value: number, currency: string): Promise<any> { return; }
logPurchase(value: number, currency: string): Promise<any> { return; }
/**
* Open App Invite dialog. Does not require login.
@@ -268,7 +274,7 @@ export class Facebook {
* @returns {Promise<any>} Returns a Promise that resolves with the result data, or rejects with an error
*/
@Cordova()
static appInvite(options: {
appInvite(options: {
url: string,
picture: string
}): Promise<any> { return; }
@@ -1,16 +1,21 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name FileChooser
* @name File Chooser
* @description
*
* Opens the file picker on Android for the user to select a file, returns a file URI.
*
* @usage
* ```
* import {FileChooser} from 'ionic-native';
* import { FileChooser } from '@ionic-native/file-chooser';
*
* FileChooser.open()
* constructor(private fileChooser: FileChooser) { }
*
* ...
*
* this.fileChooser.open()
* .then(uri => console.log(uri))
* .catch(e => console.log(e));
*
@@ -23,6 +28,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/don/cordova-filechooser',
platforms: ['Android']
})
@Injectable()
export class FileChooser {
/**
@@ -30,6 +36,6 @@ export class FileChooser {
* @returns {Promise<string>}
*/
@Cordova()
static open(): Promise<string> { return; }
open(): Promise<string> { return; }
}
@@ -1,15 +1,22 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name FileOpener
* @name File Opener
* @description
* This plugin will open a file on your device file system with its default application.
*
* @usage
* ```
* import {FileOpener} from 'ionic-native';
* import { FileOpener } from '@ionic-native/file-opener';
*
* constructor(private fileOpener: FileOpener) { }
*
* ...
*
* this.fileOpener.open('path/to/file.pdf', 'application/pdf')
* .then(() => console.log('File is opened'))
* .catch(e => console.log('Error openening file', e));
*
* ```
*/
@@ -19,6 +26,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'cordova.plugins.fileOpener2',
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
})
@Injectable()
export class FileOpener {
/**
@@ -32,7 +40,7 @@ export class FileOpener {
successName: 'success',
errorName: 'error'
})
static open(filePath: string, fileMIMEType: string): Promise<any> {return; }
open(filePath: string, fileMIMEType: string): Promise<any> {return; }
/**
* Uninstalls a package
@@ -44,7 +52,7 @@ export class FileOpener {
successName: 'success',
errorName: 'error'
})
static uninstall(packageId: string): Promise<any> {return; }
uninstall(packageId: string): Promise<any> {return; }
/**
* Check if an app is already installed
@@ -56,6 +64,6 @@ export class FileOpener {
successName: 'success',
errorName: 'error'
})
static appIsInstalled(packageId: string): Promise<any> {return; }
appIsInstalled(packageId: string): Promise<any> {return; }
}
@@ -1,20 +1,25 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
declare var window: any;
/**
* @name FilePath
* @name File Path
* @description
*
* This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library.
*
* @usage
* ```
* import {FilePath} from 'ionic-native';
* import { FilePath } from '@ionic-native/file-path';
*
* FilePath.resolveNativePath(path)
* .then(filePath => console.log(filePath))
* .catch(err => console.log(err));
* constructor(private filePath: FilePath) { }
*
* ...
*
* this.filePath.resolveNativePath(path)
* .then(filePath => console.log(filePath);
* .catch(err => console.log(err);
*
* ```
*/
@@ -25,6 +30,7 @@ declare var window: any;
repo: 'https://github.com/hiddentao/cordova-plugin-filepath',
platforms: ['Android']
})
@Injectable()
export class FilePath {
/**
@@ -33,6 +39,6 @@ export class FilePath {
* @returns {Promise<string>}
*/
@Cordova()
static resolveNativePath(path: string): Promise<string> {return; }
resolveNativePath(path: string): Promise<string> {return; }
}
@@ -1,4 +1,5 @@
import {CordovaProperty, Plugin, pluginWarn} from './plugin';
import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin, CordovaCheck } from '@ionic-native/core';
declare var window: any;
declare var cordova: any;
@@ -347,11 +348,14 @@ export declare var FileError: {
*
* Example:
* ```
* import { File } from 'ionic-native';
* import { File } from '@ionic-native/file';
*
* const dataDirectory: string = File.dataDirectory;
* constructor(private file: File) { }
*
* ...
*
* this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist'));
*
* File.checkDir(dataDirectory, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
* ```
*
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
@@ -365,82 +369,83 @@ export declare var FileError: {
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
})
@Injectable()
export class File {
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationDirectory: string;
applicationDirectory: string;
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationStorageDirectory: string;
applicationStorageDirectory: string;
/**
* Where to put app-specific data files.
*/
@CordovaProperty
static dataDirectory: string;
dataDirectory: string;
/**
* Cached files that should survive app restarts.
* Apps should not rely on the OS to delete files in here.
*/
@CordovaProperty
static cacheDirectory: string;
cacheDirectory: string;
/**
* Android: the application space on external storage.
*/
@CordovaProperty
static externalApplicationStorageDirectory: string;
externalApplicationStorageDirectory: string;
/**
* Android: Where to put app-specific data files on external storage.
*/
@CordovaProperty
static externalDataDirectory: string;
externalDataDirectory: string;
/**
* Android: the application cache on external storage.
*/
@CordovaProperty
static externalCacheDirectory: string;
externalCacheDirectory: string;
/**
* Android: the external storage (SD card) root.
*/
@CordovaProperty
static externalRootDirectory: string;
externalRootDirectory: string;
/**
* iOS: Temp directory that the OS can clear at will.
*/
@CordovaProperty
static tempDirectory: string;
tempDirectory: string;
/**
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
*/
@CordovaProperty
static syncedDataDirectory: string;
syncedDataDirectory: string;
/**
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
*/
@CordovaProperty
static documentsDirectory: string;
documentsDirectory: string;
/**
* BlackBerry10: Files globally available to all apps
*/
@CordovaProperty
static sharedDirectory: string;
sharedDirectory: string;
static cordovaFileError: {} = {
cordovaFileError: {} = {
1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR',
3: 'ABORT_ERR',
@@ -461,17 +466,10 @@ export class File {
* Get free disk space in Bytes
* @returns {Promise<number>} Returns a promise that resolves with the remaining free disk space in Bytes
*/
static getFreeDiskSpace(): Promise<number> {
@CordovaCheck()
getFreeDiskSpace(): Promise<number> {
return new Promise<any>((resolve, reject) => {
if (!cordova || !cordova.exec) {
pluginWarn({
pluginName: 'File',
plugin: 'cordova-plugin-file'
});
reject({ error: 'plugin_not_installed' });
} else {
cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);
}
cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);
});
}
@@ -482,7 +480,8 @@ export class File {
* @param {string} dir Name of directory to check
* @returns {Promise<boolean>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
*/
static checkDir(path: string, dir: string): Promise<boolean> {
@CordovaCheck()
checkDir(path: string, dir: string): Promise<boolean> {
if ((/^\//.test(dir))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
@@ -490,7 +489,7 @@ export class File {
}
let fullpath = path + dir;
return File.resolveDirectoryUrl(fullpath)
return this.resolveDirectoryUrl(fullpath)
.then(() => {
return true;
});
@@ -506,7 +505,8 @@ export class File {
* @param {boolean} replace If true, replaces file with same name. If false returns error
* @returns {Promise<DirectoryEntry>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
*/
static createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
@CordovaCheck()
createDir(path: string, dirName: string, replace: boolean): Promise<DirectoryEntry> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
@@ -521,9 +521,9 @@ export class File {
options.exclusive = true;
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getDirectory(fse, dirName, options);
return this.getDirectory(fse, dirName, options);
});
}
@@ -534,19 +534,20 @@ export class File {
* @param {string} dirName The directory name
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeDir(path: string, dirName: string): Promise<RemoveResult> {
@CordovaCheck()
removeDir(path: string, dirName: string): Promise<RemoveResult> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getDirectory(fse, dirName, {create: false});
return this.getDirectory(fse, dirName, {create: false});
})
.then((de) => {
return File.remove(de);
return this.remove(de);
});
}
@@ -559,7 +560,8 @@ export class File {
* @param {string} newDirName The destination directory name
* @returns {Promise<DirectoryEntry|Entry>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
*/
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
@CordovaCheck()
moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<DirectoryEntry|Entry> {
newDirName = newDirName || dirName;
if ((/^\//.test(newDirName))) {
@@ -575,7 +577,7 @@ export class File {
.then((srcde) => {
return this.resolveDirectoryUrl(newPath)
.then((deste) => {
return File.move(srcde, deste, newDirName);
return this.move(srcde, deste, newDirName);
});
});
}
@@ -589,7 +591,8 @@ export class File {
* @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
*/
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
@CordovaCheck()
copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<Entry> {
if ((/^\//.test(newDirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
@@ -603,7 +606,7 @@ export class File {
.then((srcde) => {
return this.resolveDirectoryUrl(newPath)
.then((deste) => {
return File.copy(srcde, deste, newDirName);
return this.copy(srcde, deste, newDirName);
});
});
}
@@ -615,20 +618,21 @@ export class File {
* @param {string} dirName Name of directory
* @returns {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
*/
static listDir(path: string, dirName: string): Promise<Entry[]> {
@CordovaCheck()
listDir(path: string, dirName: string): Promise<Entry[]> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<Entry[]>(err);
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getDirectory(fse, dirName, {create: false, exclusive: false});
return this.getDirectory(fse, dirName, {create: false, exclusive: false});
})
.then((de) => {
let reader = de.createReader();
return File.readEntries(reader);
return this.readEntries(reader);
});
}
@@ -639,19 +643,20 @@ export class File {
* @param {string} dirName Name of directory
* @returns {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
*/
static removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
@CordovaCheck()
removeRecursively(path: string, dirName: string): Promise<RemoveResult> {
if ((/^\//.test(dirName))) {
let err = new FileError(5);
err.message = 'directory cannot start with \/';
return Promise.reject<RemoveResult>(err);
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getDirectory(fse, dirName, {create: false});
return this.getDirectory(fse, dirName, {create: false});
})
.then((de) => {
return File.rimraf(de);
return this.rimraf(de);
});
}
@@ -662,14 +667,15 @@ export class File {
* @param {string} file Name of file to check
* @returns {Promise<boolean>} Returns a Promise that resolves with a boolean or rejects with an error.
*/
static checkFile(path: string, file: string): Promise<boolean> {
@CordovaCheck()
checkFile(path: string, file: string): Promise<boolean> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveLocalFilesystemUrl(path + file)
return this.resolveLocalFilesystemUrl(path + file)
.then((fse) => {
if (fse.isFile) {
return true;
@@ -691,7 +697,8 @@ export class File {
* @param {boolean} replace If true, replaces file with same name. If false returns error
* @returns {Promise<FileEntry>} Returns a Promise that resolves to a FileEntry or rejects with an error.
*/
static createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
@CordovaCheck()
createFile(path: string, fileName: string, replace: boolean): Promise<FileEntry> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -706,9 +713,9 @@ export class File {
options.exclusive = true;
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, fileName, options);
return this.getFile(fse, fileName, options);
});
}
@@ -719,19 +726,20 @@ export class File {
* @param {string} fileName Name of file to remove
* @returns {Promise<RemoveResult>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
*/
static removeFile(path: string, fileName: string): Promise<RemoveResult> {
@CordovaCheck()
removeFile(path: string, fileName: string): Promise<RemoveResult> {
if ((/^\//.test(fileName))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
return this.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, fileName, {create: false});
return this.getFile(fse, fileName, {create: false});
})
.then((fe) => {
return File.remove(fe);
return this.remove(fe);
});
}
@@ -743,7 +751,8 @@ export class File {
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
static writeFile(path: string, fileName: string,
@CordovaCheck()
writeFile(path: string, fileName: string,
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
if ((/^\//.test(fileName))) {
const err = new FileError(5);
@@ -756,25 +765,25 @@ export class File {
exclusive: !options.replace
};
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, fileName, getFileOpts);
return this.resolveDirectoryUrl(path)
.then((directoryEntry: DirectoryEntry) => {
return this.getFile(directoryEntry, fileName, getFileOpts);
})
.then((fe) => {
return File.writeFileEntry(fe, text, options);
.then((fileEntry: FileEntry) => {
return this.writeFileEntry(fileEntry, text, options);
});
}
/** Write content to FileEntry.
*
* @private
* @hidden
* @param {FileEntry} fe file entry object
* @param {string | Blob} text content or blob to write
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
private static writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
return File.createWriter(fe)
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
return this.createWriter(fe)
.then((writer) => {
if (options.append) {
writer.seek(writer.length);
@@ -784,7 +793,7 @@ export class File {
writer.truncate(options.truncate);
}
return File.write(writer, text);
return this.write(writer, text);
})
.then(() => fe);
}
@@ -797,8 +806,9 @@ export class File {
* @param {string | Blob} text content or blob to write
* @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
*/
static writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
return File.writeFile(path, fileName, text, { replace: true });
@CordovaCheck()
writeExistingFile(path: string, fileName: string, text: string | Blob): Promise<void> {
return this.writeFile(path, fileName, text, { replace: true });
}
/**
@@ -808,18 +818,19 @@ export class File {
* @param {string} file Name of file, relative to path.
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
*/
static readAsText(path: string, file: string): Promise<string> {
@CordovaCheck()
readAsText(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
return this.resolveDirectoryUrl(path)
.then((directoryEntry: DirectoryEntry) => {
return this.getFile(directoryEntry, file, {create: false});
})
.then((fe) => {
.then((fileEntry: FileEntry) => {
let reader = new FileReader();
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
@@ -831,7 +842,7 @@ export class File {
reject({code: null, message: 'READER_ONLOADEND_ERR'});
}
};
fe.file(file => {
fileEntry.file(file => {
reader.readAsText(file);
}, error => {
reject(error);
@@ -849,18 +860,19 @@ export class File {
* @param {string} file Name of file, relative to path.
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
*/
static readAsDataURL(path: string, file: string): Promise<string> {
@CordovaCheck()
readAsDataURL(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
return this.resolveDirectoryUrl(path)
.then((directoryEntry: DirectoryEntry) => {
return this.getFile(directoryEntry, file, {create: false});
})
.then((fe) => {
.then((fileEntry: FileEntry) => {
let reader = new FileReader();
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
@@ -875,7 +887,7 @@ export class File {
fe.file(file => {
fileEntry.file(file => {
reader.readAsDataURL(file);
}, error => {
reject(error);
@@ -891,18 +903,19 @@ export class File {
* @param {string} file Name of file, relative to path.
* @returns {Promise<string>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
*/
static readAsBinaryString(path: string, file: string): Promise<string> {
@CordovaCheck()
readAsBinaryString(path: string, file: string): Promise<string> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
return this.resolveDirectoryUrl(path)
.then((directoryEntry: DirectoryEntry) => {
return this.getFile(directoryEntry, file, {create: false});
})
.then((fe) => {
.then((fileEntry: FileEntry) => {
let reader = new FileReader();
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
@@ -915,7 +928,7 @@ export class File {
}
};
fe.file(file => {
fileEntry.file(file => {
reader.readAsBinaryString(file);
}, error => {
reject(error);
@@ -927,23 +940,23 @@ export class File {
/**
* Read file and return data as an ArrayBuffer.
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
* @returns {Promise<ArrayBuffer>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
*/
static readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
@CordovaCheck()
readAsArrayBuffer(path: string, file: string): Promise<ArrayBuffer> {
if ((/^\//.test(file))) {
let err = new FileError(5);
err.message = 'file-name cannot start with \/';
return Promise.reject<any>(err);
}
return File.resolveDirectoryUrl(path)
.then((fse) => {
return File.getFile(fse, file, {create: false});
return this.resolveDirectoryUrl(path)
.then((directoryEntry: DirectoryEntry) => {
return this.getFile(directoryEntry, file, {create: false});
})
.then((fe) => {
.then((fileEntry: FileEntry) => {
let reader = new FileReader();
return new Promise<any>((resolve, reject) => {
reader.onloadend = () => {
@@ -956,7 +969,7 @@ export class File {
}
};
fe.file(file => {
fileEntry.file(file => {
reader.readAsArrayBuffer(file);
}, error => {
reject(error);
@@ -975,7 +988,8 @@ export class File {
* @param {string} newFileName New name of file to move to (leave blank to remain the same)
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry or rejects with an error.
*/
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
@CordovaCheck()
moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
@@ -991,7 +1005,7 @@ export class File {
.then((srcfe) => {
return this.resolveDirectoryUrl(newPath)
.then((deste) => {
return File.move(srcfe, deste, newFileName);
return this.move(srcfe, deste, newFileName);
});
});
}
@@ -1005,7 +1019,8 @@ export class File {
* @param {string} newFileName New name of file to copy to (leave blank to remain the same)
* @returns {Promise<Entry>} Returns a Promise that resolves to an Entry or rejects with an error.
*/
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
@CordovaCheck()
copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<Entry> {
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
@@ -1021,17 +1036,17 @@ export class File {
.then((srcfe) => {
return this.resolveDirectoryUrl(newPath)
.then((deste) => {
return File.copy(srcfe, deste, newFileName);
return this.copy(srcfe, deste, newFileName);
});
});
}
/**
* @private
* @hidden
*/
private static fillErrorMessage(err: FileError): void {
private fillErrorMessage(err: FileError): void {
try {
err.message = File.cordovaFileError[err.code];
err.message = this.cordovaFileError[err.code];
} catch (e) {}
}
@@ -1040,17 +1055,18 @@ export class File {
* @param fileUrl {string} file system url
* @returns {Promise<Entry>}
*/
static resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
@CordovaCheck()
resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
return new Promise<Entry>((resolve, reject) => {
try {
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
resolve(entry);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
} catch (xc) {
File.fillErrorMessage(xc);
this.fillErrorMessage(xc);
reject(xc);
}
});
@@ -1061,8 +1077,9 @@ export class File {
* @param directoryUrl {string} directory system url
* @returns {Promise<DirectoryEntry>}
*/
static resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
return File.resolveLocalFilesystemUrl(directoryUrl)
@CordovaCheck()
resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
return this.resolveLocalFilesystemUrl(directoryUrl)
.then((de) => {
if (de.isDirectory) {
return <DirectoryEntry>de;
@@ -1081,17 +1098,18 @@ export class File {
* @param flags {Flags} Options
* @returns {Promise<DirectoryEntry>}
*/
static getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
@CordovaCheck()
getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
return new Promise<DirectoryEntry>((resolve, reject) => {
try {
directoryEntry.getDirectory(directoryName, flags, (de) => {
resolve(de);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
} catch (xc) {
File.fillErrorMessage(xc);
this.fillErrorMessage(xc);
reject(xc);
}
});
@@ -1104,108 +1122,109 @@ export class File {
* @param flags {Flags} Options
* @returns {Promise<FileEntry>}
*/
static getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
@CordovaCheck()
getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
return new Promise<FileEntry>((resolve, reject) => {
try {
directoryEntry.getFile(fileName, flags, resolve, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
} catch (xc) {
File.fillErrorMessage(xc);
this.fillErrorMessage(xc);
reject(xc);
}
});
}
/**
* @private
* @hidden
*/
private static remove(fe: Entry): Promise<RemoveResult> {
private remove(fe: Entry): Promise<RemoveResult> {
return new Promise<RemoveResult>((resolve, reject) => {
fe.remove(() => {
resolve({success: true, fileRemoved: fe});
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
private move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise<Entry>((resolve, reject) => {
srce.moveTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
private copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
return new Promise<Entry>((resolve, reject) => {
srce.copyTo(destdir, newName, (deste) => {
resolve(deste);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static readEntries(dr: DirectoryReader): Promise<Entry[]> {
private readEntries(dr: DirectoryReader): Promise<Entry[]> {
return new Promise<Entry[]>((resolve, reject) => {
dr.readEntries((entries) => {
resolve(entries);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static rimraf(de: DirectoryEntry): Promise<RemoveResult> {
private rimraf(de: DirectoryEntry): Promise<RemoveResult> {
return new Promise<RemoveResult>((resolve, reject) => {
de.removeRecursively(() => {
resolve({success: true, fileRemoved: de});
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static createWriter(fe: FileEntry): Promise<FileWriter> {
private createWriter(fe: FileEntry): Promise<FileWriter> {
return new Promise<FileWriter>((resolve, reject) => {
fe.createWriter((writer) => {
resolve(writer);
}, (err) => {
File.fillErrorMessage(err);
this.fillErrorMessage(err);
reject(err);
});
});
}
/**
* @private
* @hidden
*/
private static write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise<any> {
private write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise<any> {
if (gu instanceof Blob) {
return this.writeFileInChunks(writer, gu);
}
@@ -1223,9 +1242,9 @@ export class File {
}
/**
* @private
* @hidden
*/
private static writeFileInChunks(writer: FileWriter, file: Blob) {
private writeFileInChunks(writer: FileWriter, file: Blob) {
const BLOCK_SIZE = 1024 * 1024;
let writtenSize = 0;
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
export interface FingerprintOptions {
@@ -27,9 +28,13 @@ export interface FingerprintOptions {
*
* @usage
* ```typescript
* import { FingerprintAIO } from 'ionic-native';
* import { FingerprintAIO } from '@ionic-native/fingerprint-aio';
*
* FingerprintAIO.show({
* constructor(private faio: FingerpirntAIO) { }
*
* ...
*
* this.faio.show({
* clientId: "Fingerprint-Demo",
* clientSecret: "password", //Only necessary for Android
* disableBackup:true //Only for Android(optional)
@@ -48,6 +53,7 @@ export interface FingerprintOptions {
repo: 'https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio',
platforms: ['Android', 'iOS']
})
@Injectable()
export class FingerprintAIO {
/**
@@ -55,7 +61,7 @@ export class FingerprintAIO {
* @return {Promise<any>} Returns a promise with result
*/
@Cordova()
static isAvailable(): Promise<any> { return; }
isAvailable(): Promise<any> { return; }
/**
* Show authentication dialogue
@@ -63,6 +69,6 @@ export class FingerprintAIO {
* @return {Promise<any>} Returns a promise that resolves when authentication was successfull
*/
@Cordova()
static show(options: FingerprintOptions): Promise<any> { return; }
show(options: FingerprintOptions): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
@@ -8,13 +9,17 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```
* import { Firebase } from 'ionic-native';
* import { Firebase } from '@ionic-native/firebase';
*
* Firebase.getToken()
* constructor(private firebase: Firebase) { }
*
* ...
*
* this.firebase.getToken()
* .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
* .catch(error => console.error('Error getting token', error));
*
* Firebase.onTokenRefresh()
* this.firebase.onTokenRefresh()
* .subscribe((token: string) => console.log(`Got a new token ${token}`));
*
* ```
@@ -26,6 +31,7 @@ import { Observable } from 'rxjs/Observable';
repo: 'https://github.com/arnesson/cordova-plugin-firebase',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Firebase {
/**
@@ -33,7 +39,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static getToken(): Promise<any> { return; }
getToken(): Promise<any> { return; }
/**
* Get notified when a token is refreshed
@@ -42,7 +48,7 @@ export class Firebase {
@Cordova({
observable: true
})
static onTokenRefresh(): Observable<any> { return; }
onTokenRefresh(): Observable<any> { return; }
/**
* Get notified when the user opens a notification
@@ -51,7 +57,7 @@ export class Firebase {
@Cordova({
observable: true
})
static onNotificationOpen(): Observable<any> { return; }
onNotificationOpen(): Observable<any> { return; }
/**
* Grant permission to recieve push notifications
@@ -60,7 +66,7 @@ export class Firebase {
@Cordova({
platforms: ['iOS']
})
static grantPermission(): Promise<any> { return; }
grantPermission(): Promise<any> { return; }
/**
* Check permission to recieve push notifications
@@ -69,7 +75,7 @@ export class Firebase {
@Cordova({
platforms: ['iOS']
})
static hasPermission(): Promise<any> { return; }
hasPermission(): Promise<any> { return; }
/**
* Set icon badge number. Set to 0 to clear the badge.
@@ -77,14 +83,14 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static setBadgeNumber(badgeNumber: number): Promise<any> { return; }
setBadgeNumber(badgeNumber: number): Promise<any> { return; }
/**
* Get icon badge number
* @return {Promise<any>}
*/
@Cordova()
static getBadgeNumber(): Promise<any> { return; }
getBadgeNumber(): Promise<any> { return; }
/**
* Subscribe to a topic
@@ -92,7 +98,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static subscribe(topic: string): Promise<any> { return; }
subscribe(topic: string): Promise<any> { return; }
/**
* Unsubscribe from a topic
@@ -100,7 +106,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static unsubscribe(topic: string): Promise<any> { return; }
unsubscribe(topic: string): Promise<any> { return; }
/**
* Log an event using Analytics
@@ -109,7 +115,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static logEvent(type: string, data: any): Promise<any> { return; }
logEvent(type: string, data: any): Promise<any> { return; }
/**
* Set the name of the current screen in Analytics
@@ -117,7 +123,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static setScreenName(name: string): Promise<any> { return; }
setScreenName(name: string): Promise<any> { return; }
/**
* Set a user id for use in Analytics
@@ -125,7 +131,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static setUserId(userId: string): Promise<any> { return; }
setUserId(userId: string): Promise<any> { return; }
/**
* Set a user property for use in Analytics
@@ -134,7 +140,7 @@ export class Firebase {
* @return {Promise<any>}
*/
@Cordova()
static setUserProperty(name: string, value: string): Promise<any> { return; }
setUserProperty(name: string, value: string): Promise<any> { return; }
/**
* Fetch Remote Config parameter values for your app
@@ -146,7 +152,7 @@ export class Firebase {
successIndex: 1,
errorIndex: 2
})
static fetch(cacheExpirationSeconds?: number): Promise<any> { return; }
fetch(cacheExpirationSeconds?: number): Promise<any> { return; }
/**
* Activate the Remote Config fetched config
@@ -155,7 +161,7 @@ export class Firebase {
@Cordova({
platforms: ['Android']
})
static activateFetched(): Promise<any> { return; }
activateFetched(): Promise<any> { return; }
/**
* Retrieve a Remote Config value
@@ -168,7 +174,7 @@ export class Firebase {
successIndex: 2,
errorIndex: 3
})
static getValue(key: string, namespace?: string): Promise<any> { return; }
getValue(key: string, namespace?: string): Promise<any> { return; }
/**
* Retrieve a Remote Config byte array
@@ -181,7 +187,7 @@ export class Firebase {
successIndex: 2,
errorIndex: 3
})
static getByteArray(key: string, namespace?: string): Promise<any> { return; }
getByteArray(key: string, namespace?: string): Promise<any> { return; }
/**
* Get the current state of the FirebaseRemoteConfig singleton object
@@ -190,7 +196,7 @@ export class Firebase {
@Cordova({
platforms: ['Android']
})
static getInfo(): Promise<any> { return; }
getInfo(): Promise<any> { return; }
/**
* Change the settings for the FirebaseRemoteConfig object's operations
@@ -200,7 +206,7 @@ export class Firebase {
@Cordova({
platforms: ['Android']
})
static setConfigSettings(settings: any): Promise<any> { return; }
setConfigSettings(settings: any): Promise<any> { return; }
/**
* Set defaults in the Remote Config
@@ -213,6 +219,6 @@ export class Firebase {
successIndex: 2,
errorIndex: 3
})
static setDefaults(defaults: any, namespace: string): Promise<any> { return; }
setDefaults(defaults: any, namespace: string): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Flashlight
@@ -8,8 +9,13 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { Flashlight } from 'ionic-native';
* import { Flashlight } from '@ionic-native/flashlight';
*
* constructor(private flashlight: FlashLight) { }
*
* ...
*
* this.flashlight.switchOn();
*
*
* ```
@@ -20,6 +26,7 @@ import { Cordova, Plugin } from './plugin';
pluginRef: 'window.plugins.flashlight',
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
})
@Injectable()
export class Flashlight {
/**
@@ -27,28 +34,28 @@ export class Flashlight {
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
*/
@Cordova()
static available(): Promise<boolean> { return; }
available(): Promise<boolean> { return; }
/**
* Switches the flashlight on
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOn(): Promise<boolean> { return; }
switchOn(): Promise<boolean> { return; }
/**
* Switches the flashlight off
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOff(): Promise<boolean> { return; }
switchOff(): Promise<boolean> { return; }
/**
* Toggles the flashlight
* @returns {Promise<any>}
*/
@Cordova()
static toggle(): Promise<any> { return; }
toggle(): Promise<any> { return; }
/**
@@ -58,6 +65,6 @@ export class Flashlight {
@Cordova({
sync: true
})
static isSwitchedOn(): boolean { return; }
isSwitchedOn(): boolean { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaFunctionOverride } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window: any;
@@ -9,21 +10,21 @@ declare var window: any;
* Geofences persist after device reboot. Geofences will be monitored even when the app is not running.
* @usage
* ```
* import { Geofence } from 'ionic-native';
* import { Platform } from 'ionic-angular'
* import { Geofence } from '@ionic-native/geofence';
*
* ...
*
* constructor(private platform: Platform) {
* this.platform.ready().then(() => {
// initialize the plugin
* Geofence.initialize().then(
* // resolved promise does not return a value
* () => console.log('Geofence Plugin Ready'),
* (err) => console.log(err)
* )
* })
* constructor(private geofence: Geofence) {
* // initialize the plugin
* geofence.initialize().then(
* // resolved promise does not return a value
* () => console.log('Geofence Plugin Ready'),
* (err) => console.log(err)
* )
* }
*
* ...
*
* private addGeofence() {
* //options describing geofence
* let fence = {
@@ -40,7 +41,7 @@ declare var window: any;
* }
* }
*
* Geofence.addOrUpdate(fence).then(
* this.geofence.addOrUpdate(fence).then(
* () => console.log('Geofence added'),
* (err) => console.log('Geofence failed to add')
* );
@@ -82,15 +83,21 @@ declare var window: any;
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
})
@Injectable()
export class Geofence {
public static TransitionType = {
public TransitionType = {
ENTER: 1,
EXIT: 2,
BOTH: 3
};
public static onTrasitionReceived: Function;
/**
* Subscribe to get notified when a transition is received
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
onTrasitionReceived(): Observable<any> { return; };
/**
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
@@ -98,7 +105,7 @@ export class Geofence {
* @returns {Promise<void>}
*/
@Cordova()
static initialize(): Promise<void> { return; };
initialize(): Promise<void> { return; };
/**
* Adds a new geofence or array of geofences. For geofence object, see above.
@@ -106,7 +113,7 @@ export class Geofence {
* @returns {Promise<void>}
*/
@Cordova()
static addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
addOrUpdate(geofences: Object | Array<Object>): Promise<void> { return; };
/**
* Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
@@ -115,7 +122,7 @@ export class Geofence {
* @returns {Promise<void>}
*/
@Cordova()
static remove(geofenceId: string | Array<string>): Promise<void> { return; };
remove(geofenceId: string | Array<string>): Promise<void> { return; };
/**
* Removes all geofences.
@@ -123,7 +130,7 @@ export class Geofence {
* @returns {Promise<void>}
*/
@Cordova()
static removeAll(): Promise<void> { return; };
removeAll(): Promise<void> { return; };
/**
* Returns an array of geofences currently being monitored.
@@ -131,14 +138,14 @@ export class Geofence {
* @returns {Promise<Array<string>>}
*/
@Cordova()
static getWatched(): Promise<string> { return; };
getWatched(): Promise<string> { return; };
/**
* Called when a geofence is crossed in the direction specified by `TransitType`.
*
* @returns {Observable<any>}
*/
static onTransitionReceived(): Observable<any> {
onTransitionReceived(): Observable<any> {
return new Observable<any>((observer) => {
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
@@ -152,7 +159,7 @@ export class Geofence {
*
* @returns {Observable<any>}
*/
static onNotificationClicked(): Observable<any> {
onNotificationClicked(): Observable<any> {
return new Observable<any>((observer) => {
window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
@@ -119,7 +120,7 @@ export interface GeolocationOptions {
* @usage
*
* ```typescript
* import { Geolocation } from 'ionic-native';
* import { Geolocation } from '@ionic-native/geolocation';
*
*
* Geolocation.getCurrentPosition().then((resp) => {
@@ -148,6 +149,7 @@ export interface GeolocationOptions {
pluginRef: 'navigator.geolocation',
repo: 'https://github.com/apache/cordova-plugin-geolocation'
})
@Injectable()
export class Geolocation {
/**
@@ -159,7 +161,7 @@ export class Geolocation {
@Cordova({
callbackOrder: 'reverse'
})
static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return; }
getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return; }
/**
* Watch the current device's position. Clear the watch by unsubscribing from
@@ -179,7 +181,7 @@ export class Geolocation {
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @returns {Observable<Geoposition>} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
*/
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
watchPosition(options?: GeolocationOptions): Observable<Geoposition> {
return new Observable<Geoposition>(
(observer: any) => {
let watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
@@ -1,11 +1,22 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Globalization
* @description
* @usage
* ```typescript
* import { Globalization } from 'ionic-native';
* import { Globalization } from '@ionic-native/globalization';
*
* constructor(private globalization: Globalization) { }
*
*
* ...
*
*
* this.globalization.getPreferredLanguage()
* .then(res => console.log(res))
* .catch(e => console.log(e));
*
*
* ```
@@ -17,6 +28,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/apache/cordova-plugin-globalization',
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Windows Phone 8', 'Widnows', 'Browser']
})
@Injectable()
export class Globalization {
/**
@@ -24,14 +36,14 @@ export class Globalization {
* @returns {Promise<{value: string}>}
*/
@Cordova()
static getPreferredLanguage(): Promise<{ value: string }> { return; }
getPreferredLanguage(): Promise<{ value: string }> { return; }
/**
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
* @returns {Promise<{value: string}>}
*/
@Cordova()
static getLocaleName(): Promise<{ value: string }> { return; }
getLocaleName(): Promise<{ value: string }> { return; }
/**
* Converts date to string
@@ -43,7 +55,7 @@ export class Globalization {
successIndex: 1,
errorIndex: 2
})
static dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
/**
* Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
@@ -55,7 +67,7 @@ export class Globalization {
successIndex: 1,
errorIndex: 2
})
static stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
/**
* Returns a pattern string to format and parse dates according to the client's user preferences.
@@ -65,7 +77,7 @@ export class Globalization {
@Cordova({
callbackOrder: 'reverse'
})
static getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
/**
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
@@ -75,7 +87,7 @@ export class Globalization {
@Cordova({
callbackOrder: 'reverse'
})
static getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
/**
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
@@ -83,14 +95,14 @@ export class Globalization {
* @returns {Promise<{dst: string}>} reutrns a promise with the value
*/
@Cordova()
static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
/**
* Returns the first day of the week according to the client's user preferences and calendar.
* @returns {Promise<{value: string}>} returns a promise with the value
*/
@Cordova()
static getFirstDayOfWeek(): Promise<{ value: string }> { return; }
getFirstDayOfWeek(): Promise<{ value: string }> { return; }
/**
* Returns a number formatted as a string according to the client's user preferences.
@@ -101,7 +113,7 @@ export class Globalization {
successIndex: 1,
errorIndex: 2
})
static numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; }
numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { return; }
/**
*
@@ -113,7 +125,7 @@ export class Globalization {
successIndex: 1,
errorIndex: 2
})
static stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
/**
* Returns a pattern string to format and parse numbers according to the client's user preferences.
@@ -123,7 +135,7 @@ export class Globalization {
@Cordova({
callbackOrder: 'reverse'
})
static getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
/**
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
@@ -131,6 +143,6 @@ export class Globalization {
* @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>}
*/
@Cordova()
static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
declare var window;
@@ -12,9 +13,13 @@ declare var window;
* - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
* @usage
* ```typescript
* import { GoogleAnalytics } from 'ionic-native';
* import { GoogleAnalytics } from '@ionic-native/google-analytics';
*
* GoogleAnalytics.startTrackerWithId('YOUR_TRACKER_ID')
* constructor(private ga: GoogleAnalytics) { }
*
* ...
*
* this.ga.startTrackerWithId('YOUR_TRACKER_ID')
* .then(() => {
* console.log('Google analytics is ready now');
* // Tracker is ready
@@ -32,6 +37,7 @@ declare var window;
repo: 'https://github.com/danwilson/google-analytics-plugin',
platforms: ['Android', 'iOS', 'Browser']
})
@Injectable()
export class GoogleAnalytics {
/**
@@ -45,7 +51,7 @@ export class GoogleAnalytics {
successIndex: 2,
errorIndex: 3
})
static startTrackerWithId(id: string, interval?: number): Promise<any> { return; }
startTrackerWithId(id: string, interval?: number): Promise<any> { return; }
/**
* Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
@@ -53,7 +59,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static setAllowIDFACollection(allow: boolean): Promise<any> { return; }
setAllowIDFACollection(allow: boolean): Promise<any> { return; }
/**
* Set a UserId
@@ -62,7 +68,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static setUserId(id: string): Promise<any> { return; }
setUserId(id: string): Promise<any> { return; }
/**
* Set a anonymize Ip address
@@ -70,7 +76,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
setAnonymizeIp(anonymize: boolean): Promise<any> { return; }
/**
* Sets the app version
@@ -78,7 +84,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static setAppVersion(appVersion: string): Promise<any> { return; }
setAppVersion(appVersion: string): Promise<any> { return; }
/**
* Set OptOut
@@ -86,14 +92,14 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static setOptOut(optout: boolean): Promise<any> { return; }
setOptOut(optout: boolean): Promise<any> { return; }
/**
* Enable verbose logging
* @returns {Promise<any>}
*/
@Cordova()
static debugMode(): Promise<any> { return; }
debugMode(): Promise<any> { return; }
/**
* Track custom metric
@@ -105,7 +111,7 @@ export class GoogleAnalytics {
successIndex: 2,
errorIndex: 3
})
static trackMetric(key: string, value?: any): Promise<any> { return; }
trackMetric(key: string, value?: any): Promise<any> { return; }
/**
* Track a screen
@@ -120,7 +126,7 @@ export class GoogleAnalytics {
successIndex: 3,
errorIndex: 4
})
static trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise<any> { return; }
/**
* Add a Custom Dimension
@@ -130,7 +136,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static addCustomDimension(key: number, value: string): Promise<any> { return; }
addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Track an event
@@ -146,7 +152,7 @@ export class GoogleAnalytics {
successIndex: 5,
errorIndex: 6
})
static trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise<any> { return; }
/**
* Track an exception
@@ -155,7 +161,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static trackException(description: string, fatal: boolean): Promise<any> { return; }
trackException(description: string, fatal: boolean): Promise<any> { return; }
/**
* Track User Timing (App Speed)
@@ -166,7 +172,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
/**
* Add a Transaction (Ecommerce)
@@ -180,7 +186,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
/**
* Add a Transaction Item (Ecommerce)
@@ -195,7 +201,7 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
/**
* Enable/disable automatic reporting of uncaught exceptions
@@ -203,6 +209,6 @@ export class GoogleAnalytics {
* @returns {Promise<any>}
*/
@Cordova()
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
}
@@ -1,11 +1,12 @@
import { Cordova, CordovaInstance, Plugin, InstanceProperty, getPlugin, pluginWarn } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, InstanceCheck, checkAvailability } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var plugin: any;
/**
* @private
* @hidden
* You can listen to these events where appropriate
*/
export const GoogleMapsEvent = {
@@ -30,7 +31,7 @@ export const GoogleMapsEvent = {
};
/**
* @private
* @hidden
*/
export const GoogleMapsAnimation = {
BOUNCE: 'BOUNCE',
@@ -38,7 +39,7 @@ export const GoogleMapsAnimation = {
};
/**
* @private
* @hidden
*/
export const GoogleMapsMapTypeId = {
HYBRID: 'MAP_TYPE_HYBRID',
@@ -50,100 +51,21 @@ export const GoogleMapsMapTypeId = {
};
/**
* @name Google Maps
* @description This plugin uses the native Google Maps SDK
* @usage
* ```
* import {
* GoogleMap,
* GoogleMapsEvent,
* GoogleMapsLatLng,
* CameraPosition,
* GoogleMapsMarkerOptions,
* GoogleMapsMarker,
* GoogleMapsMapTypeId
* } from 'ionic-native';
*
* export class MapPage {
* constructor() {}
*
* // Load map only after view is initialize
* ngAfterViewInit() {
* this.loadMap();
* }
*
* loadMap() {
* // make sure to create following structure in your view.html file
* // and add a height (for example 100%) to it, else the map won't be visible
* // <ion-content>
* // <div #map id="map" style="height:100%;"></div>
* // </ion-content>
*
* // create a new map by passing HTMLElement
* let element: HTMLElement = document.getElementById('map');
*
* let map = new GoogleMap(element);
*
* // create LatLng object
* let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
*
* // create CameraPosition
* let position: CameraPosition = {
* target: ionic,
* zoom: 18,
* tilt: 30
* };
*
* // listen to MAP_READY event
* map.one(GoogleMapsEvent.MAP_READY).then(() => {
* // move the map's camera to position
* map.moveCamera(position); // works on iOS and Android
* });
*
*
* // create new marker
* let markerOptions: GoogleMapsMarkerOptions = {
* position: ionic,
* title: 'Ionic'
* };
*
* map.addMarker(markerOptions)
* .then((marker: GoogleMapsMarker) => {
* marker.showInfoWindow();
* });
* }
* }
* ```
* @hidden
*/
@Plugin({
pluginName: 'GoogleMap',
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"'
pluginName: 'GoogleMaps',
plugin: 'cordova-plugin-googlemaps'
})
export class GoogleMap {
_objectInstance: any;
/**
* Checks if a map object has been created and is available.
*
* @returns {Promise<boolean>}
*/
@Cordova()
static isAvailable(): Promise<boolean> { return; }
constructor(element: string | HTMLElement, options?: any) {
if (!!getPlugin('plugin.google.maps.Map')) {
if (checkAvailability('plugin.google.maps.Map', null, 'GoogleMaps') === true) {
if (typeof element === 'string') {
element = document.getElementById(<string>element);
}
this._objectInstance = plugin.google.maps.Map.getMap(element, options);
} else {
pluginWarn({
pluginName: 'GoogleMap',
plugin: 'plugin.google.maps.Map'
});
}
}
@@ -152,6 +74,7 @@ export class GoogleMap {
*
* @returns {Observable<any>}
*/
@InstanceCheck()
addEventListener(eventName: string): Observable<any> {
return Observable.fromEvent(this._objectInstance, eventName);
}
@@ -161,13 +84,9 @@ export class GoogleMap {
*
* @returns {Promise<any>}
*/
@InstanceCheck()
addListenerOnce(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
);
return new Promise<any>(resolve => this._objectInstance.addListenerOnce(eventName, resolve));
}
/**
@@ -190,19 +109,9 @@ export class GoogleMap {
*
* @returns {Observable<any>}
*/
@InstanceCheck({ observable: true })
on(eventName: string): Observable<any> {
if (!this._objectInstance) {
return new Observable((observer) => {
observer.error({ error: 'plugin_not_installed' });
});
}
return new Observable(
(observer) => {
this._objectInstance.on(eventName, observer.next.bind(observer));
return () => this._objectInstance.off(event);
}
);
return Observable.fromEvent(this._objectInstance, eventName);
}
/**
@@ -210,13 +119,9 @@ export class GoogleMap {
*
* @returns {Promise<any>}
*/
@InstanceCheck()
one(eventName: string): Promise<any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.one(eventName, resolve)
);
return new Promise<any>(resolve => this._objectInstance.one(eventName, resolve));
}
/**
@@ -265,7 +170,7 @@ export class GoogleMap {
getLicenseInfo(): Promise<string> { return; }
@CordovaInstance({ sync: true })
setCenter(latLng: GoogleMapsLatLng): void { }
setCenter(latLng: LatLng): void { }
@CordovaInstance({ sync: true })
setZoom(zoomLevel: number): void { }
@@ -304,143 +209,115 @@ export class GoogleMap {
setAllGesturesEnabled(enabled: boolean): void { }
/**
* @returns {Promise<GoogleMapsMarker | any>}
* @returns {Promise<Marker | any>}
*/
addMarker(options: GoogleMapsMarkerOptions): Promise<GoogleMapsMarker | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsMarker>(
(resolve, reject) => {
@InstanceCheck()
addMarker(options: MarkerOptions): Promise<Marker | any> {
return new Promise<Marker>((resolve, reject) => {
this._objectInstance.addMarker(options, (marker: any) => {
if (marker) {
resolve(new GoogleMapsMarker(marker));
resolve(new Marker(marker));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsCircle | any>}
* @returns {Promise<Circle | any>}
*/
addCircle(options: GoogleMapsCircleOptions): Promise<GoogleMapsCircle | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsCircle>(
(resolve, reject) => {
@InstanceCheck()
addCircle(options: CircleOptions): Promise<Circle | any> {
return new Promise<Circle>((resolve, reject) => {
this._objectInstance.addCircle(options, (circle: any) => {
if (circle) {
resolve(new GoogleMapsCircle(circle));
resolve(new Circle(circle));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsPolygon | any>}
* @returns {Promise<Polygon | any>}
*/
addPolygon(options: GoogleMapsPolygonOptions): Promise<GoogleMapsPolygon | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsPolygon>(
(resolve, reject) => {
@InstanceCheck()
addPolygon(options: PolygonOptions): Promise<Polygon | any> {
return new Promise<Polygon>((resolve, reject) => {
this._objectInstance.addPolygon(options, (polygon: any) => {
if (polygon) {
resolve(new GoogleMapsPolygon(polygon));
resolve(new Polygon(polygon));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsPolyline | any>}
* @returns {Promise<Polyline | any>}
*/
addPolyline(options: GoogleMapsPolylineOptions): Promise<GoogleMapsPolyline | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsPolyline>(
(resolve, reject) => {
@InstanceCheck()
addPolyline(options: PolylineOptions): Promise<Polyline | any> {
return new Promise<Polyline>((resolve, reject) => {
this._objectInstance.addPolyline(options, (polyline: any) => {
if (polyline) {
resolve(new GoogleMapsPolyline(polyline));
resolve(new Polyline(polyline));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsTileOverlay | any>}
* @returns {Promise<TileOverlay | any>}
*/
addTileOverlay(options: GoogleMapsTileOverlayOptions): Promise<GoogleMapsTileOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsTileOverlay>(
(resolve, reject) => {
@InstanceCheck()
addTileOverlay(options: TileOverlayOptions): Promise<TileOverlay | any> {
return new Promise<TileOverlay>((resolve, reject) => {
this._objectInstance.addTileOverlay(options, (tileOverlay: any) => {
if (tileOverlay) {
resolve(new GoogleMapsTileOverlay(tileOverlay));
resolve(new TileOverlay(tileOverlay));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsGroundOverlay | any>}
* @returns {Promise<GroundOverlay | any>}
*/
addGroundOverlay(options: GoogleMapsGroundOverlayOptions): Promise<GoogleMapsGroundOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsGroundOverlay>(
(resolve, reject) => {
@InstanceCheck()
addGroundOverlay(options: GroundOverlayOptions): Promise<GroundOverlay | any> {
return new Promise<GroundOverlay>((resolve, reject) => {
this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => {
if (groundOverlay) {
resolve(new GoogleMapsGroundOverlay(groundOverlay));
resolve(new GroundOverlay(groundOverlay));
} else {
reject();
}
});
}
);
});
}
/**
* @returns {Promise<GoogleMapsKmlOverlay | any>}
* @returns {Promise<KmlOverlay | any>}
*/
addKmlOverlay(options: GoogleMapsKmlOverlayOptions): Promise<GoogleMapsKmlOverlay | any> {
if (!this._objectInstance) {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<GoogleMapsKmlOverlay>(
(resolve, reject) => {
@InstanceCheck()
addKmlOverlay(options: KmlOverlayOptions): Promise<KmlOverlay | any> {
return new Promise<KmlOverlay>((resolve, reject) => {
this._objectInstance.addKmlOverlay(options, (kmlOverlay: any) => {
if (kmlOverlay) {
resolve(new GoogleMapsKmlOverlay(kmlOverlay));
resolve(new KmlOverlay(kmlOverlay));
} else {
reject();
}
});
}
);
});
}
@CordovaInstance({ sync: true })
@@ -468,13 +345,13 @@ export class GoogleMap {
* @returns {Promise<any>}
*/
@CordovaInstance()
fromLatLngToPoint(latLng: GoogleMapsLatLng, point: any): Promise<any> { return; }
fromLatLngToPoint(latLng: LatLng, point: any): Promise<any> { return; }
/**
* @returns {Promise<GoogleMapsLatLng>}
* @returns {Promise<LatLng>}
*/
@CordovaInstance()
fromPointToLatLng(point: any, latLng: GoogleMapsLatLng): Promise<GoogleMapsLatLng> { return; }
fromPointToLatLng(point: any, latLng: LatLng): Promise<LatLng> { return; }
/**
* @returns {Promise<any>}
@@ -487,14 +364,123 @@ export class GoogleMap {
@CordovaInstance({ sync: true })
panBy(): void { }
}
/**
* @name Google Maps
* @description This plugin uses the native Google Maps SDK
* @usage
* ```
* import {
* GoogleMaps,
* GoogleMap,
* GoogleMapsEvent,
* LatLng,
* CameraPosition,
* MarkerOptions,
* Marker
* } from '@ionic-native/google-maps';
*
* export class MapPage {
* constructor(private googleMaps: GoogleMaps) {}
*
* // Load map only after view is initialize
* ngAfterViewInit() {
* this.loadMap();
* }
*
* loadMap() {
* // make sure to create following structure in your view.html file
* // and add a height (for example 100%) to it, else the map won't be visible
* // <ion-content>
* // <div #map id="map" style="height:100%;"></div>
* // </ion-content>
*
* // create a new map by passing HTMLElement
* let element: HTMLElement = document.getElementById('map');
*
* let map: GoogleMap = GoogleMaps.create(element);
*
* // listen to MAP_READY event
* // You must wait for this event to fire before adding something to the map or modifying it in anyway
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
*
* // create LatLng object
* let ionic: LatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
*
* // create CameraPosition
* let position: CameraPosition = {
* target: ionic,
* zoom: 18,
* tilt: 30
* };
*
* // move the map's camera to position
* map.moveCamera(position);
*
* // create new marker
* let markerOptions: MarkerOptions = {
* position: ionic,
* title: 'Ionic'
* };
*
* const marker: Marker = map.addMarker(markerOptions)
* .then((marker: Marker) => {
* marker.showInfoWindow();
* });
* }
*
* }
* ```
* @classes
* GoogleMap
* Marker
* LatLng
* Geocoder
* @interfaces
* AnimateCameraOptions
* MarkerOptions
* MyLocation
* MyLocationOptions
* VisibleRegion
*
*/
@Plugin({
pluginName: 'GoogleMaps',
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS']
})
@Injectable()
export class GoogleMaps {
/**
* Checks if a map object has been created and is available.
*
* @returns {Promise<boolean>}
*/
@Cordova()
isAvailable(): Promise<boolean> { return; }
/**
* Creates a new GoogleMap instance
* @param element {string | HTMLElement} Element ID or reference to attach the map to
* @param options {any} Options
* @returns {GoogleMap}
*/
create(element: string | HTMLElement, options?: any): GoogleMap {
return new GoogleMap(element, options);
}
}
/**
* @private
* @hidden
*/
export interface AnimateCameraOptions {
target?: GoogleMapsLatLng | Array<GoogleMapsMarker> | GoogleMapsLatLngBounds;
target?: LatLng | Array<Marker> | LatLngBounds;
tilt?: number;
zoom?: number;
bearing?: number;
@@ -502,34 +488,34 @@ export interface AnimateCameraOptions {
}
/**
* @private
* @hidden
*/
export interface CameraPosition {
target?: GoogleMapsLatLng | GoogleMapsLatLngBounds | GoogleMapsLatLng[];
target?: LatLng | LatLngBounds | LatLng[];
zoom?: number;
tilt?: number;
bearing?: number;
}
/**
* @private
* @hidden
*/
export interface MyLocation {
latLng?: GoogleMapsLatLng;
latLng?: LatLng;
speed?: number;
time?: string;
bearing?: number;
}
/**
* @private
* @hidden
*/
export interface MyLocationOptions {
enableHighAccuracy?: boolean;
}
/**
* @private
* @hidden
*/
export interface VisibleRegion {
northeast?: any;
@@ -537,9 +523,9 @@ export interface VisibleRegion {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsMarkerOptions {
export interface MarkerOptions {
/**
* The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64
*/
@@ -558,7 +544,7 @@ export interface GoogleMapsMarkerOptions {
/**
* The position of the marker.
*/
position?: GoogleMapsLatLng;
position?: LatLng;
/**
* Specify the anchor of the InfoWindow
@@ -617,9 +603,9 @@ export interface GoogleMapsMarkerOptions {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsMarkerIcon {
export interface MarkerIcon {
url?: string;
size?: {
width?: number;
@@ -628,9 +614,9 @@ export interface GoogleMapsMarkerIcon {
}
/**
* @private
* @hidden
*/
export class GoogleMapsMarker {
export class Marker {
constructor(private _objectInstance: any) { }
@@ -801,7 +787,7 @@ export class GoogleMapsMarker {
* @param icon
*/
@CordovaInstance({ sync: true })
setIcon(icon: GoogleMapsMarkerIcon): void { return; }
setIcon(icon: MarkerIcon): void { return; }
/**
* Change title of the infoWindow.
@@ -864,14 +850,14 @@ export class GoogleMapsMarker {
* @param latLng {GoogleMapLatLng}
*/
@CordovaInstance({ sync: true })
setPosition(latLng: GoogleMapsLatLng): void { return; }
setPosition(latLng: LatLng): void { return; }
/**
* Return the marker position.
* @return {Promise<GoogleMapLatLng>}
*/
@CordovaInstance()
getPosition(): Promise<GoogleMapsLatLng> { return; }
getPosition(): Promise<LatLng> { return; }
/**
* Return the map instance.
@@ -890,10 +876,10 @@ export class GoogleMapsMarker {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsCircleOptions {
center?: GoogleMapsLatLng;
export interface CircleOptions {
center?: LatLng;
radius?: number;
strokeColor?: string;
strokeWidth?: number;
@@ -903,9 +889,10 @@ export interface GoogleMapsCircleOptions {
}
/**
* @private
* @hidden
*/
export class GoogleMapsCircle {
export class Circle {
constructor(private _objectInstance: any) { }
@@ -988,7 +975,7 @@ export class GoogleMapsCircle {
empty(): void { }
@CordovaInstance({ sync: true })
getCenter(): GoogleMapsLatLng { return; }
getCenter(): LatLng { return; }
@CordovaInstance({ sync: true })
getRadius(): number { return; }
@@ -1006,7 +993,7 @@ export class GoogleMapsCircle {
remove(): void { }
@CordovaInstance({ sync: true })
setCenter(latLng: GoogleMapsLatLng): void { }
setCenter(latLng: LatLng): void { }
@CordovaInstance({ sync: true })
setFillColor(fillColor: string): void { }
@@ -1031,10 +1018,10 @@ export class GoogleMapsCircle {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsPolylineOptions {
points?: Array<GoogleMapsLatLng>;
export interface PolylineOptions {
points?: Array<LatLng>;
visible?: boolean;
geodesic?: boolean;
color?: string;
@@ -1043,9 +1030,10 @@ export interface GoogleMapsPolylineOptions {
}
/**
* @private
* @hidden
*/
export class GoogleMapsPolyline {
export class Polyline {
constructor(private _objectInstance: any) { }
/**
@@ -1127,7 +1115,7 @@ export class GoogleMapsPolyline {
empty(): void { }
@CordovaInstance({ sync: true })
getPoints(): Array<GoogleMapsLatLng> { return; }
getPoints(): Array<LatLng> { return; }
@CordovaInstance({ sync: true })
getCOlor(): string { return; }
@@ -1145,7 +1133,7 @@ export class GoogleMapsPolyline {
remove(): void { }
@CordovaInstance({ sync: true })
setPoints(points: Array<GoogleMapsLatLng>): void { }
setPoints(points: Array<LatLng>): void { }
@CordovaInstance({ sync: true })
setColor(color: string): void { }
@@ -1168,23 +1156,24 @@ export class GoogleMapsPolyline {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsPolygonOptions {
points?: Array<GoogleMapsLatLng>;
export interface PolygonOptions {
points?: Array<LatLng>;
geodesic?: boolean;
strokeColor?: string;
strokeWidth?: number;
fillColor?: string;
visible?: boolean;
zIndex?: number;
addHole?: Array<GoogleMapsLatLng>;
addHole?: Array<LatLng>;
}
/**
* @private
* @hidden
*/
export class GoogleMapsPolygon {
export class Polygon {
constructor(private _objectInstance: any) { }
@@ -1267,7 +1256,7 @@ export class GoogleMapsPolygon {
empty(): void { }
@CordovaInstance({ sync: true })
getPoints(): Array<GoogleMapsLatLng> { return; }
getPoints(): Array<LatLng> { return; }
@CordovaInstance({ sync: true })
getStrokeColor(): string { return; }
@@ -1291,7 +1280,7 @@ export class GoogleMapsPolygon {
remove(): void { }
@CordovaInstance({ sync: true })
setPoints(points: Array<GoogleMapsLatLng>): void { }
setPoints(points: Array<LatLng>): void { }
@CordovaInstance({ sync: true })
setStrokeColor(strokeColor: string): void { }
@@ -1313,9 +1302,9 @@ export class GoogleMapsPolygon {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsTileOverlayOptions {
export interface TileOverlayOptions {
tileUrlFormat?: string;
visible?: boolean;
zIndex?: number;
@@ -1324,9 +1313,9 @@ export interface GoogleMapsTileOverlayOptions {
}
/**
* @private
* @hidden
*/
export class GoogleMapsTileOverlay {
export class TileOverlay {
constructor(private _objectInstance: any) { }
@@ -1441,11 +1430,11 @@ export class GoogleMapsTileOverlay {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsGroundOverlayOptions {
export interface GroundOverlayOptions {
url?: string;
bounds?: Array<GoogleMapsLatLng>;
bounds?: Array<LatLng>;
visible?: boolean;
opacity?: number;
bearing?: number;
@@ -1453,9 +1442,9 @@ export interface GoogleMapsGroundOverlayOptions {
}
/**
* @private
* @hidden
*/
export class GoogleMapsGroundOverlay {
export class GroundOverlay {
constructor(private _objectInstance: any) { }
@@ -1564,18 +1553,18 @@ export class GoogleMapsGroundOverlay {
}
/**
* @private
* @hidden
*/
export interface GoogleMapsKmlOverlayOptions {
export interface KmlOverlayOptions {
url?: string;
preserveViewport?: boolean;
animation?: boolean;
}
/**
* @private
* @hidden
*/
export class GoogleMapsKmlOverlay {
export class KmlOverlay {
constructor(private _objectInstance: any) { }
@@ -1661,20 +1650,20 @@ export class GoogleMapsKmlOverlay {
remove(): void { }
@CordovaInstance({ sync: true })
getOverlays(): Array<GoogleMapsPolyline | GoogleMapsPolygon | GoogleMapsMarker> { return; }
getOverlays(): Array<Polyline | Polygon | Marker> { return; }
}
/**
* @private
* @hidden
*/
export class GoogleMapsLatLngBounds {
export class LatLngBounds {
private _objectInstance: any;
@InstanceProperty northeast: GoogleMapsLatLng;
@InstanceProperty southwest: GoogleMapsLatLng;
@InstanceProperty northeast: LatLng;
@InstanceProperty southwest: LatLng;
@InstanceProperty type: string;
constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) {
constructor(southwestOrArrayOfLatLng: LatLng | LatLng[], northeast?: LatLng) {
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
this._objectInstance = new plugin.google.maps.LatLngBounds(args);
}
@@ -1686,19 +1675,20 @@ export class GoogleMapsLatLngBounds {
toUrlValue(precision?: number): string { return; }
@CordovaInstance({ sync: true })
extend(LatLng: GoogleMapsLatLng): void { }
extend(LatLng: LatLng): void { }
@CordovaInstance({ sync: true })
contains(LatLng: GoogleMapsLatLng): boolean { return; }
contains(LatLng: LatLng): boolean { return; }
@CordovaInstance({ sync: true })
getCenter(): GoogleMapsLatLng { return; }
getCenter(): LatLng { return; }
}
/**
* @private
* @hidden
*/
export class GoogleMapsLatLng {
export class LatLng {
lat: number;
lng: number;
@@ -1708,7 +1698,7 @@ export class GoogleMapsLatLng {
this.lng = lng;
}
equals(other: GoogleMapsLatLng): boolean {
equals(other: LatLng): boolean {
return this.lat === other.lat && this.lng === other.lng;
}
@@ -1723,15 +1713,15 @@ export class GoogleMapsLatLng {
}
}
/**
* @private
* @hidden
*/
export interface GeocoderRequest {
address?: string;
bounds?: GoogleMapsLatLng[];
bounds?: LatLng[];
position?: { lat: number; lng: number };
}
/**
* @private
* @hidden
*/
export interface GeocoderResult {
adminArea?: string;
@@ -1754,25 +1744,24 @@ export interface GeocoderResult {
thoroughfare?: string;
}
/**
* @private
* @hidden
*/
@Plugin({
pluginName: 'Geocoder',
pluginRef: 'plugins.google.maps.Geocoder',
plugin: 'cordova-plugin-googlemaps',
repo: ''
})
export class Geocoder {
/**
* Converts position to address and vice versa
* @param {GeocoderRequest} request Request object with either an address or a position
* @returns {Promise<GeocoderResult[]>}
*/
static geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>((resolve, reject) => {
if (!plugin || !plugin.google || !plugin.google.maps || !plugin.google.maps.Geocoder) {
pluginWarn({
pluginName: 'GoogleMap',
plugin: 'plugin.google.maps.Map'
});
reject({ error: 'plugin_not_installed' });
} else {
plugin.google.maps.Geocoder.geocode(request, resolve);
}
@CordovaCheck()
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>(resolve => {
plugin.google.maps.Geocoder.geocode(request, resolve);
});
}
}
@@ -1,13 +1,18 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name Google Plus
* @description
* @usage
* ```typescript
* import { GooglePlus } from 'ionic-native';
* import { GooglePlus } from '@ionic-native/google-plus';
*
* GooglePlus.login()
* constructor(private googlePlus: GooglePlus) { }
*
* ...
*
* this.googlePlus.login()
* .then(res => console.log(res))
* .catch(err => console.error(err));
*
@@ -19,8 +24,10 @@ import { Cordova, Plugin } from './plugin';
pluginRef: 'window.plugins.googleplus',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
platforms: ['Web', 'Android', 'iOS'],
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid'
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
installVariables: ['REVERSED_CLIENT_ID']
})
@Injectable()
export class GooglePlus {
/**
@@ -32,7 +39,7 @@ export class GooglePlus {
successIndex: 1,
errorIndex: 2
})
static login(options?: any): Promise<any> { return; }
login(options?: any): Promise<any> { return; }
/**
* You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
@@ -40,20 +47,20 @@ export class GooglePlus {
* @returns {Promise<any>}
*/
@Cordova()
static trySilentLogin(options?: any): Promise<any> { return; }
trySilentLogin(options?: any): Promise<any> { return; }
/**
* This will clear the OAuth2 token.
* @returns {Promise<any>}
*/
@Cordova()
static logout(): Promise<any> { return; }
logout(): Promise<any> { return; }
/**
* This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
* @returns {Promise<any>}
*/
@Cordova()
static disconnect(): Promise<any> { return; }
disconnect(): Promise<any> { return; }
}
@@ -0,0 +1,109 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
declare var navigator: any;
/**
* @hidden
*/
export interface GyroscopeOrientation {
/**
* Represent x-axis
*/
x: number;
/**
* Represent y-axis
*/
y: number;
/**
* Represent z-axis
*/
z: number;
/**
* Represent timestamp of sensor read. Default is 10000ms
*/
timestamp: number;
}
/**
* @hidden
*/
export interface GyroscopeOptions {
/**
* Represent how often (in milliseconds) sensor should be read. Default is 10000 ms
*/
frequency: number;
}
/**
* @name Gyroscope
* @description Read Gyroscope sensor data
* @usage
* ```
* import { Gyroscope, GyroscopeOrientation, GyroscopeOptions } from '@ionic-native/gyroscope';
*
*
* constructor(private gyroscope: Gyroscope) { }
*
* ...
*
*
* let options: GyroscopeOptions = {
* frequency: 1000
* };
*
* this.gyroscope.getCurrent(options)
* .then((orientation: GyroscopeOrientation) => {
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
* })
* .catch()
*
*
* this.gyroscope.watch()
* .subscribe((orientation: GyroscopeOrientation) => {
* console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
* });
*
* ```
* @interfaces
* GyroscopeOrientation
* GyroscopeOptions
*/
@Plugin({
pluginName: 'Gyroscope',
plugin: 'cordova-plugin-gyroscope',
pluginRef: 'navigator.gyroscope',
repo: 'https://github.com/NeoLSN/cordova-plugin-gyroscope',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Gyroscope {
/**
* Watching for gyroscope sensor changes
* @param options {GyroscopeOptions} (optional)
* @return {Observable<GyroscopeOrientation>} Returns an Observable that resolves GyroscopeOrientation
*/
watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
return new Observable<GyroscopeOrientation> (
(observer: any) => {
let watchId = navigator.gyroscope.watch(observer.next.bind(observer), observer.next.bind(observer), options);
return () => navigator.gyroscope.clearWatch(watchId);
}
);
}
/**
* Get current data from gyroscope sensor
* @param options {GyroscopeOptions} (optional)
* @return {Promise<GyroscopeOrientation>} Returns a promise that resolves GyroscopeOrientation
*/
@Cordova({
callbackOrder: 'reverse'
})
getCurrent(options?: GyroscopeOptions): Promise<GyroscopeOrientation> { return; }
}
@@ -1,15 +1,20 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name HeaderColor
* @name Header Color
* @description
* Cordova plugin to change color of header in multitask view
*
* @usage
* ```typescript
* import { HeaderColor } from 'ionic-native';
* import { HeaderColor } from '@ionic-native/header-color';
*
* HeaderColor.tint("#becb29");
* constructor(private headerColor: HeaderColor) { }
*
* ...
*
* this.headerColor.tint("#becb29");
* ```
*/
@Plugin({
@@ -19,6 +24,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/tomloprod/cordova-plugin-headercolor',
platforms: ['Android']
})
@Injectable()
export class HeaderColor {
/**
@@ -31,6 +37,6 @@ export class HeaderColor {
successName: 'success',
errorName: 'failure'
})
static tint(color: string): Promise<any> { return; }
tint(color: string): Promise<any> { return; }
}
@@ -1,5 +1,9 @@
import {Plugin, Cordova} from './plugin';
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @hidden
*/
export interface HealthQueryOptions {
/**
* Start date from which to get data
@@ -33,6 +37,9 @@ export interface HealthQueryOptions {
filtered?: boolean;
}
/**
* @hidden
*/
export interface HealthQueryOptionsAggregated {
/**
* Start date from which to get data
@@ -56,6 +63,9 @@ export interface HealthQueryOptionsAggregated {
bucket: string;
}
/**
* @hidden
*/
export interface HealthStoreOptions {
/**
* Start date from which to get data
@@ -77,13 +87,13 @@ export interface HealthStoreOptions {
*/
value: string;
/*
/**
* The source that produced this data. In iOS this is ignored and
* set automatically to the name of your app.
*/
sourceName: string;
/*
/**
* The complete package of the source that produced this data.
* In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and
* set automatically to the bunde id of the app.
@@ -91,6 +101,9 @@ export interface HealthStoreOptions {
sourceBundleId: string;
}
/**
* @hidden
*/
export interface HealthData {
/**
* Start date from which to get data
@@ -133,17 +146,28 @@ export interface HealthData {
*
* @usage
* ```
* import { Health } from 'ionic-native';
* import { Health } from '@ionic-native/health';
*
*
* constructor(private health: Health) { }
*
* ...
*
* this.health.isAvailable()
* .then(res => console.log(res))
* .catch(e => console.log(e));
*
*
* ```
* See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples.
*
* @interfaces
* HealthQueryOptions
* HealthQueryOptionsAggregated
* HealthStoreOptions
* HealthData
*/
@Injectable()
@Plugin({
pluginName: 'Health',
plugin: 'cordova-plugin-health',
@@ -160,9 +184,7 @@ export class Health {
@Cordova({
callbackOrder: 'reverse'
})
static isAvailable(): Promise<boolean> {
return;
};
isAvailable(): Promise<boolean> { return; }
/**
* Checks if recent Google Play Services and Google Fit are installed. If the play services are not installed,
@@ -178,9 +200,7 @@ export class Health {
@Cordova({
callbackOrder: 'reverse'
})
static promptInstallFit(): Promise<any> {
return;
};
promptInstallFit(): Promise<any> { return; }
/**
* Requests read and write access to a set of data types. It is recommendable to always explain why the app
@@ -203,21 +223,17 @@ export class Health {
* @return {Promise<any>}
*/
@Cordova()
static requestAuthorization(datatypes: Array<string>): Promise<any> {
return;
};
requestAuthorization(datatypes: Array<string>): Promise<any> { return; }
/**
* Check if the app has authorization to read/write a set of datatypes.
* This function is similar to requestAuthorization() and has similar quirks.
*
* @param {Array<String>} datatypes a list of data types you want to be granted access to
* @return {Promise<any>}
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that indicates the authorization status
*/
@Cordova()
static isAuthorized(datatypes: Array<string>): Promise<any> {
return;
};
isAuthorized(datatypes: Array<string>): Promise<boolean> { return; }
/**
* Gets all the data points of a certain data type within a certain time window.
@@ -251,9 +267,7 @@ export class Health {
* @return {Promise<HealthData>}
*/
@Cordova()
static query(queryOptions: HealthQueryOptions): Promise<HealthData> {
return;
};
query(queryOptions: HealthQueryOptions): Promise<HealthData> { return; }
/**
* Gets aggregated data in a certain time window. Usually the sum is returned for the given quantity.
@@ -277,9 +291,7 @@ export class Health {
* @return {Promise<HealthData[]>}
*/
@Cordova()
static queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData[]> {
return;
};
queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise<HealthData[]> { return; }
/**
* Stores a data point.
@@ -296,8 +308,6 @@ export class Health {
* @return {Promise<any>}
*/
@Cordova()
static store(storeOptions: HealthStoreOptions): Promise<any> {
return;
};
store(storeOptions: HealthStoreOptions): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface HotspotConnectionInfo {
@@ -89,13 +90,11 @@ export interface HotspotNetworkConfig {
export interface HotspotDevice {
/**
* ip
* Hotspot IP Address
*/
ip: string;
/**
* mac
* Hotspot MAC Address
*/
mac: string;
@@ -108,10 +107,14 @@ export interface HotspotDevice {
* @description
* @usage
* ```typescript
* import { Hotspot, Network } from 'ionic-native';
* import { Hotspot, HotspotNetwork } from '@ionic-native/hotspot';
*
* constructor(private hotspot: Hotspot) { }
*
* ...
*
*
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* this.hotspot.scanWifi().then((networks: Array<HotspotNetwork>) => {
* console.log(networks);
* });
*
@@ -129,19 +132,20 @@ export interface HotspotDevice {
repo: 'https://github.com/hypery2k/cordova-hotspot-plugin',
platforms: ['Android']
})
@Injectable()
export class Hotspot {
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isAvailable(): Promise<boolean> { return; }
isAvailable(): Promise<boolean> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static toggleWifi(): Promise<boolean> { return; }
toggleWifi(): Promise<boolean> { return; }
/**
* Configures and starts hotspot with SSID and Password
@@ -153,7 +157,7 @@ export class Hotspot {
* @returns {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
*/
@Cordova()
static createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
createHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
/**
* Turns on Access Point
@@ -161,7 +165,7 @@ export class Hotspot {
* @returns {Promise<boolean>} - true if AP is started
*/
@Cordova()
static startHotspot(): Promise<boolean> { return; }
startHotspot(): Promise<boolean> { return; }
/**
* Configures hotspot with SSID and Password
@@ -173,7 +177,7 @@ export class Hotspot {
* @returns {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
*/
@Cordova()
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
configureHotspot(ssid: string, mode: string, password: string): Promise<void> { return; }
/**
* Turns off Access Point
@@ -181,7 +185,7 @@ export class Hotspot {
* @returns {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
*/
@Cordova()
static stopHotspot(): Promise<boolean> { return; }
stopHotspot(): Promise<boolean> { return; }
/**
* Checks if hotspot is enabled
@@ -189,13 +193,13 @@ export class Hotspot {
* @returns {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
*/
@Cordova()
static isHotspotEnabled(): Promise<void> { return; }
isHotspotEnabled(): Promise<void> { return; }
/**
* @returns {Promise<Array<HotspotDevice>>}
*/
@Cordova()
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
getAllHotspotDevices(): Promise<Array<HotspotDevice>> { return; }
/**
* Connect to a WiFi network
@@ -209,7 +213,7 @@ export class Hotspot {
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static connectToWifi(ssid: string, password: string): Promise<void> { return; }
connectToWifi(ssid: string, password: string): Promise<void> { return; }
/**
* Connect to a WiFi network
@@ -227,7 +231,7 @@ export class Hotspot {
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> { return; }
connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> { return; }
/**
* Add a WiFi network
@@ -243,7 +247,7 @@ export class Hotspot {
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> { return; }
addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> { return; }
/**
* Remove a WiFi network
@@ -255,79 +259,79 @@ export class Hotspot {
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static removeWifiNetwork(ssid: string): Promise<void> { return; }
removeWifiNetwork(ssid: string): Promise<void> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isConnectedToInternet(): Promise<boolean> { return; }
isConnectedToInternet(): Promise<boolean> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isConnectedToInternetViaWifi(): Promise<boolean> { return; }
isConnectedToInternetViaWifi(): Promise<boolean> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isWifiOn(): Promise<boolean> { return; }
isWifiOn(): Promise<boolean> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isWifiSupported(): Promise<boolean> { return; }
isWifiSupported(): Promise<boolean> { return; }
/**
* @returns {Promise<boolean>}
*/
@Cordova()
static isWifiDirectSupported(): Promise<boolean> { return; }
isWifiDirectSupported(): Promise<boolean> { return; }
/**
* @returns {Promise<Array<HotspotNetwork>>}
*/
@Cordova()
static scanWifi(): Promise<Array<HotspotNetwork>> { return; }
scanWifi(): Promise<Array<HotspotNetwork>> { return; }
/**
* @returns {Promise<Array<HotspotNetwork>>}
*/
@Cordova()
static scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
scanWifiByLevel(): Promise<Array<HotspotNetwork>> { return; }
/**
* @returns {Promise<any>}
*/
@Cordova()
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> { return; }
/**
* @returns {Promise<any>}
*/
@Cordova()
static stopWifiPeriodicallyScan(): Promise<any> { return; }
stopWifiPeriodicallyScan(): Promise<any> { return; }
/**
* @returns {Promise<HotspotNetworkConfig>}
*/
@Cordova()
static getNetConfig(): Promise<HotspotNetworkConfig> { return; }
getNetConfig(): Promise<HotspotNetworkConfig> { return; }
/**
* @returns {Promise<HotspotConnectionInfo>}
*/
@Cordova()
static getConnectionInfo(): Promise<HotspotConnectionInfo> { return; }
getConnectionInfo(): Promise<HotspotConnectionInfo> { return; }
/**
* @returns {Promise<string>}
*/
@Cordova()
static pingHost(ip: string): Promise<string> { return; }
pingHost(ip: string): Promise<string> { return; }
/**
* Gets MAC Address associated with IP Address from ARP File
@@ -337,7 +341,7 @@ export class Hotspot {
* @returns {Promise<string>} - A Promise for the MAC Address
*/
@Cordova()
static getMacAddressOfHost(ip: string): Promise<string> { return; }
getMacAddressOfHost(ip: string): Promise<string> { return; }
/**
* Checks if IP is live using DNS
@@ -347,7 +351,7 @@ export class Hotspot {
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
static isDnsLive(ip: string): Promise<boolean> { return; }
isDnsLive(ip: string): Promise<boolean> { return; }
/**
* Checks if IP is live using socket And PORT
@@ -357,7 +361,7 @@ export class Hotspot {
* @returns {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
static isPortLive(ip: string): Promise<boolean> { return; }
isPortLive(ip: string): Promise<boolean> { return; }
/**
* Checks if device is rooted
@@ -365,6 +369,6 @@ export class Hotspot {
* @returns {Promise<boolean>} - A Promise for whether the device is rooted
*/
@Cordova()
static isRooted(): Promise<boolean> { return; }
isRooted(): Promise<boolean> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
export interface HTTPResponse {
/**
@@ -30,9 +31,13 @@ export interface HTTPResponse {
*
* @usage
* ```
* import { HTTP } from 'ionic-native';
* import { HTTP } from '@ionic-native/http';
*
* HTTP.get('http://ionic.io', {}, {})
* constructor(private http: HTTP) { }
*
* ...
*
* this.http.get('http://ionic.io', {}, {})
* .then(data => {
*
* console.log(data.status);
@@ -59,6 +64,7 @@ export interface HTTPResponse {
repo: 'https://github.com/wymsee/cordova-HTTP',
platforms: ['Android', 'iOS']
})
@Injectable()
export class HTTP {
/**
@@ -68,7 +74,7 @@ export class HTTP {
* @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
*/
@Cordova({ sync: true })
static getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; }
/**
* This sets up all future requests to use Basic HTTP authentication with the given username and password.
@@ -76,7 +82,7 @@ export class HTTP {
* @param password {string} Password
*/
@Cordova({ sync: true })
static useBasicAuth(username: string, password: string): void { }
useBasicAuth(username: string, password: string): void { }
/**
* Set a header for all future requests. Takes a header and a value.
@@ -84,7 +90,7 @@ export class HTTP {
* @param value {string} The value of the header
*/
@Cordova({ sync: true })
static setHeader(header: string, value: string): void { }
setHeader(header: string, value: string): void { }
/**
* Enable or disable SSL Pinning. This defaults to false.
@@ -96,7 +102,7 @@ export class HTTP {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static enableSSLPinning(enable: boolean): Promise<void> { return; }
enableSSLPinning(enable: boolean): Promise<void> { return; }
/**
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
@@ -104,7 +110,7 @@ export class HTTP {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static acceptAllCerts(accept: boolean): Promise<void> { return; }
acceptAllCerts(accept: boolean): Promise<void> { return; }
/**
* Whether or not to validate the domain name in the certificate. This defaults to true.
@@ -112,7 +118,7 @@ export class HTTP {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
static validateDomainName(validate: boolean): Promise<void> { return; }
validateDomainName(validate: boolean): Promise<void> { return; }
/**
* Make a POST request
@@ -122,7 +128,7 @@ export class HTTP {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
@@ -132,7 +138,7 @@ export class HTTP {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
/**
*
@@ -144,7 +150,7 @@ export class HTTP {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; }
uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; }
/**
*
@@ -155,5 +161,5 @@ export class HTTP {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/
@Cordova()
static downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface HttpdOptions {
@@ -25,7 +26,12 @@ export interface HttpdOptions {
* Embedded httpd for Cordova apps. Light weight HTTP server.
* @usage
* ```typescript
* import {Httpd, HttpdOptions} from 'ionic-native';
* import { Httpd, HttpdOptions } from '@ionic-native/httpd';
*
* constructor(private httpd: Httpd) { }
*
* ...
*
*
* let options: HttpdOptions = {
* www_root: 'httpd_root', // relative path to app's www directory
@@ -33,7 +39,7 @@ export interface HttpdOptions {
* localhost_only: false
* };
*
* Httpd.startServer(options).subscribe((data) => {
* this.httpd.startServer(options).subscribe((data) => {
* console.log('Server is live');
* });
*
@@ -48,6 +54,7 @@ export interface HttpdOptions {
repo: 'https://github.com/floatinghotpot/cordova-httpd',
platforms: ['iOS', 'Android']
})
@Injectable()
export class Httpd {
/**
@@ -59,21 +66,20 @@ export class Httpd {
observable: true,
clearFunction: 'stopServer'
})
static startServer(options?: HttpdOptions): Observable<string> { return; }
startServer(options?: HttpdOptions): Observable<string> { return; }
/**
* Gets the URL of the running server
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
*/
@Cordova()
static getUrl(): Promise<string> { return; }
getUrl(): Promise<string> { return; }
/**
* Get the local path of the running webserver
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
*/
@Cordova()
static getLocalPath(): Promise<string> { return; }
getLocalPath(): Promise<string> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
@@ -231,13 +232,17 @@ export interface IBeaconDelegate {
* @usage
*
* ```typescript
* import { IBeacon } from 'ionic-native';
* import { IBeacon } from '@ionic-native/ibeacon';
*
* constructor(private ibeacon: IBeacon) { }
*
* ...
*
*
* // Request permission to use location on iOS
* IBeacon.requestAlwaysAuthorization();
* this.ibeacon.requestAlwaysAuthorization();
* // create a new delegate and register it with the native layer
* let delegate = IBeacon.Delegate();
* let delegate = this.ibeacon.Delegate();
*
* // Subscribe to some of the delegate's event handlers
* delegate.didRangeBeaconsInRegion()
@@ -257,9 +262,9 @@ export interface IBeaconDelegate {
* }
* );
*
* let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
* let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
*
* IBeacon.startMonitoringForRegion(beaconRegion)
* this.ibeacon.startMonitoringForRegion(beaconRegion)
* .then(
* () => console.log('Native layer recieved the request to monitoring'),
* error => console.error('Native layer failed to begin monitoring: ', error)
@@ -280,6 +285,7 @@ export interface IBeaconDelegate {
repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
platforms: ['Android', 'iOS']
})
@Injectable()
export class IBeacon {
/**
@@ -288,7 +294,8 @@ export class IBeacon {
*
* @returns {IBeaconDelegate} An instance of the type {@type Delegate}.
*/
static Delegate(): IBeaconDelegate {
@CordovaCheck({ sync: true })
Delegate(): IBeaconDelegate {
let delegate = new cordova.plugins.locationManager.Delegate();
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
@@ -388,7 +395,8 @@ export class IBeacon {
*
* @returns {BeaconRegion} Returns the BeaconRegion that was created
*/
static BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
@CordovaCheck({ sync: true })
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
}
@@ -396,7 +404,7 @@ export class IBeacon {
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
*/
@Cordova()
static getDelegate(): IBeaconDelegate { return; }
getDelegate(): IBeaconDelegate { return; }
/**
* @param {IBeaconDelegate} delegate An instance of a delegate to register with the native layer.
@@ -404,7 +412,7 @@ export class IBeacon {
* @returns {IBeaconDelegate} Returns the IBeaconDelegate
*/
@Cordova()
static setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { return; }
setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { return; }
/**
* Signals the native layer that the client side is ready to consume messages.
@@ -427,7 +435,7 @@ export class IBeacon {
* native layer acknowledged the request and started to send events.
*/
@Cordova({otherPromise: true})
static onDomDelegateReady(): Promise<void> { return; }
onDomDelegateReady(): Promise<void> { return; }
/**
* Determines if bluetooth is switched on, according to the native layer.
@@ -435,7 +443,7 @@ export class IBeacon {
* indicating whether bluetooth is active.
*/
@Cordova({otherPromise: true})
static isBluetoothEnabled(): Promise<boolean> { return; }
isBluetoothEnabled(): Promise<boolean> { return; }
/**
* Enables Bluetooth using the native Layer. (ANDROID ONLY)
@@ -444,7 +452,7 @@ export class IBeacon {
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({otherPromise: true})
static enableBluetooth(): Promise<void> { return; }
enableBluetooth(): Promise<void> { return; }
/**
* Disables Bluetooth using the native Layer. (ANDROID ONLY)
@@ -453,7 +461,7 @@ export class IBeacon {
* could be enabled. If not, the promise will be rejected with an error.
*/
@Cordova({otherPromise: true})
static disableBluetooth(): Promise<void> { return; }
disableBluetooth(): Promise<void> { return; }
/**
* Start monitoring the specified region.
@@ -473,7 +481,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({otherPromise: true})
static startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
startMonitoringForRegion(region: BeaconRegion): Promise<string> { return; }
/**
* Stop monitoring the specified region. It is valid to call
@@ -490,7 +498,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({otherPromise: true})
static stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
stopMonitoringForRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Request state the for specified region. When result is ready
@@ -506,7 +514,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({otherPromise: true})
static requestStateForRegion(region: Region): Promise<void> { return; }
requestStateForRegion(region: Region): Promise<void> { return; }
/**
@@ -524,7 +532,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the monitoring request.
*/
@Cordova({otherPromise: true})
static startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
startRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Stop ranging the specified region. It is valid to call
@@ -541,7 +549,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the request to stop monitoring.
*/
@Cordova({otherPromise: true})
static stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
stopRangingBeaconsInRegion(region: BeaconRegion): Promise<void> { return; }
/**
* Queries the native layer to determine the current authorization in effect.
@@ -550,7 +558,7 @@ export class IBeacon {
* requested authorization status.
*/
@Cordova({otherPromise: true})
static getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
getAuthorizationStatus(): Promise<IBeaconPluginResult> { return; }
/**
* For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
@@ -562,7 +570,7 @@ export class IBeacon {
* @returns {Promise<void>} Returns a promise that is resolved when the request dialog is shown.
*/
@Cordova({otherPromise: true})
static requestWhenInUseAuthorization(): Promise<void> { return; }
requestWhenInUseAuthorization(): Promise<void> { return; }
/**
@@ -572,7 +580,7 @@ export class IBeacon {
* shows the request dialog.
*/
@Cordova({otherPromise: true})
static requestAlwaysAuthorization(): Promise<void> { return; }
requestAlwaysAuthorization(): Promise<void> { return; }
/**
*
@@ -580,7 +588,7 @@ export class IBeacon {
* of {Region} instances that are being monitored by the native layer.
*/
@Cordova({otherPromise: true})
static getMonitoredRegions(): Promise<Region[]> { return; }
getMonitoredRegions(): Promise<Region[]> { return; }
/**
*
@@ -588,7 +596,7 @@ export class IBeacon {
* of {Region} instances that are being ranged by the native layer.
*/
@Cordova({otherPromise: true})
static getRangedRegions(): Promise<Region[]> { return; }
getRangedRegions(): Promise<Region[]> { return; }
/**
* Determines if ranging is available or not, according to the native layer.
@@ -596,7 +604,7 @@ export class IBeacon {
* indicating whether ranging is available or not.
*/
@Cordova({otherPromise: true})
static isRangingAvailable(): Promise<boolean> { return; }
isRangingAvailable(): Promise<boolean> { return; }
/**
* Determines if region type is supported or not, according to the native layer.
@@ -608,7 +616,7 @@ export class IBeacon {
* indicating whether the region type is supported or not.
*/
@Cordova({otherPromise: true})
static isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
isMonitoringAvailableForClass(region: Region): Promise<boolean> { return; }
/**
* Start advertising the specified region.
@@ -628,7 +636,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the advertising request.
*/
@Cordova({otherPromise: true})
static startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
startAdvertising(region: Region, measuredPower: number): Promise<void> { return; }
/**
* Stop advertising as a beacon.
@@ -639,7 +647,7 @@ export class IBeacon {
* native layer acknowledged the dispatch of the request to stop advertising.
*/
@Cordova({otherPromise: true})
static stopAdvertising(region: Region): Promise<void> { return; }
stopAdvertising(region: Region): Promise<void> { return; }
/**
* Determines if advertising is available or not, according to the native layer.
@@ -647,7 +655,7 @@ export class IBeacon {
* indicating whether advertising is available or not.
*/
@Cordova({otherPromise: true})
static isAdvertisingAvailable(): Promise<boolean> { return; }
isAdvertisingAvailable(): Promise<boolean> { return; }
/**
* Determines if advertising is currently active, according to the native layer.
@@ -655,7 +663,7 @@ export class IBeacon {
* indicating whether advertising is active.
*/
@Cordova({otherPromise: true})
static isAdvertising(): Promise<boolean> { return; }
isAdvertising(): Promise<boolean> { return; }
/**
* Disables debug logging in the native layer. Use this method if you want
@@ -665,7 +673,7 @@ export class IBeacon {
* native layer has set the logging level accordingly.
*/
@Cordova({otherPromise: true})
static disableDebugLogs(): Promise<void> { return; }
disableDebugLogs(): Promise<void> { return; }
/**
* Enables the posting of debug notifications in the native layer. Use this method if you want
@@ -676,7 +684,7 @@ export class IBeacon {
* native layer has set the flag to enabled.
*/
@Cordova({otherPromise: true})
static enableDebugNotifications(): Promise<void> { return; }
enableDebugNotifications(): Promise<void> { return; }
/**
* Disables the posting of debug notifications in the native layer. Use this method if you want
@@ -686,7 +694,7 @@ export class IBeacon {
* native layer has set the flag to disabled.
*/
@Cordova({otherPromise: true})
static disableDebugNotifications(): Promise<void> { return; }
disableDebugNotifications(): Promise<void> { return; }
/**
* Enables debug logging in the native layer. Use this method if you want
@@ -696,7 +704,7 @@ export class IBeacon {
* native layer has set the logging level accordingly.
*/
@Cordova({otherPromise: true})
static enableDebugLogs(): Promise<void> { return; }
enableDebugLogs(): Promise<void> { return; }
/**
* Appends the provided [message] to the device logs.
@@ -709,6 +717,6 @@ export class IBeacon {
* is expected to be equivalent to the one provided in the original call.
*/
@Cordova({otherPromise: true})
static appendToDeviceLog(message: string): Promise<void> { return; }
appendToDeviceLog(message: string): Promise<void> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface ImagePickerOptions {
@@ -37,15 +38,19 @@ export interface ImagePickerOptions {
*
* @usage
* ```typescript
* import { ImagePicker } from 'ionic-native';
* import { ImagePicker } from '@ionic-native/image-picker';
*
*
* constructor(private imagePicker: ImagePicker) { }
*
* ImagePicker.getPictures(options).then((results) => {
* ...
*
* this.imagePicker.getPictures(options).then((results) => {
* for (var i = 0; i < results.length; i++) {
* console.log('Image URI: ' + results[i]);
* }
* }, (err) => { });
*
* ```
* @interfaces
* ImagePickerOptions
@@ -56,6 +61,7 @@ export interface ImagePickerOptions {
pluginRef: 'window.imagePicker',
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker'
})
@Injectable()
export class ImagePicker {
/**
* Pick pictures from the library.
@@ -66,7 +72,7 @@ export class ImagePicker {
@Cordova({
callbackOrder: 'reverse'
})
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
getPictures(options: ImagePickerOptions): Promise<any> { return; }
/**
* Check if we have permission to read images
@@ -75,7 +81,7 @@ export class ImagePicker {
@Cordova({
platforms: ['Android']
})
static hasReadPermission(): Promise<boolean> { return; }
hasReadPermission(): Promise<boolean> { return; }
/**
* Request permission to read images
@@ -84,6 +90,6 @@ export class ImagePicker {
@Cordova({
platforms: ['Android']
})
static requestReadPermission(): Promise<any> { return; }
requestReadPermission(): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface ImageResizerOptions {
/**
@@ -37,7 +38,7 @@ export interface ImageResizerOptions {
}
/**
* @name ImageResizer
* @name Image Resizer
* @description
* Cordova Plugin For Image Resize
*
@@ -48,7 +49,11 @@ export interface ImageResizerOptions {
*
* @usage
* ```typescript
* import { ImageResizer, ImageResizerOptions } from 'ionic-native';
* import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer';
*
* constructor(private imageResizer: ImageResizer) { }
*
* ...
*
* let options = {
* uri: uri,
@@ -58,12 +63,11 @@ export interface ImageResizerOptions {
* height: 1280
* } as ImageResizerOptions;
*
* ImageResizer
* .resize(options)
* .then(
* (filePath: string) => { console.log('FilePath', filePath); },
* () => { console.log('Error occured'); }
* )
* this.imageResizer
* .resize(options)
* .then((filePath: string) => console.log('FilePath', filePath))
* .catch(e => console.log(e));
*
* ```
* @interfaces
* ImageResizerOptions
@@ -74,10 +78,11 @@ export interface ImageResizerOptions {
pluginRef: 'ImageResizer',
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
})
@Injectable()
export class ImageResizer {
/**
* @returns {Promise<any>}
*/
@Cordova()
static resize(options: ImageResizerOptions): Promise<any> { return; }
resize(options: ImageResizerOptions): Promise<any> { return; }
}
@@ -1,5 +1,7 @@
import { Plugin, CordovaInstance } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, CordovaInstance } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var cordova: any;
@@ -57,33 +59,11 @@ export interface InAppBrowserEvent extends Event {
/** the error message, only in the case of loaderror. */
message: string;
}
/**
* @name InAppBrowser
* @description Launches in app Browser
* @usage
* ```typescript
* import {InAppBrowser} from 'ionic-native';
*
*
* ...
*
*
* let browser = new InAppBrowser('https://ionic.io', '_system');
* browser.executeScript(...);
* browser.insertCSS(...);
* browser.close();
* ```
* @interfaces
* InAppBrowserEvent
* InAppBrowserOptions
* @hidden
*/
@Plugin({
pluginName: 'InAppBrowser',
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
})
export class InAppBrowser {
export class InAppBrowserObject {
private _objectInstance: any;
@@ -95,8 +75,6 @@ export class InAppBrowser {
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
constructor(url: string, target?: string, options?: InAppBrowserOptions);
constructor(url: string, target?: string, options?: string);
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try {
if (options && typeof options !== 'string')
@@ -104,7 +82,7 @@ export class InAppBrowser {
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
}
}
@@ -146,14 +124,60 @@ export class InAppBrowser {
/**
* A method that allows you to listen to events happening in the browser.
* @param {string} name of the event
* @param event {string} Name of the event
* @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
on(event: string): Observable<InAppBrowserEvent> {
return new Observable<InAppBrowserEvent>((observer) => {
this._objectInstance.addEventListener(event, observer.next.bind(observer));
return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer));
});
return Observable.fromEvent(this._objectInstance, event);
}
}
/**
* @name In App Browser
* @description Launches in app Browser
* @usage
* ```typescript
* import { InAppBrowser } from '@ionic-native/in-app-browser';
*
* constructor(private iab: InAppBrowser) { }
*
*
* ...
*
*
* const browser = this.iab.create('https://ionic.io');
*
* browser.executeScript(...);
* browser.insertCSS(...);
* browser.close();
*
* ```
* @classes
* InAppBrowserObject
* @interfaces
* InAppBrowserEvent
* InAppBrowserOptions
*/
@Plugin({
pluginName: 'InAppBrowser',
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
})
@Injectable()
export class InAppBrowser {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url {string} The URL to load.
* @param target {string} The target in which to load the URL, an optional parameter that defaults to _self.
* @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
* @returns {InAppBrowserObject}
*/
create(url: string, target?: string, options?: string | InAppBrowserOptions): InAppBrowserObject {
return new InAppBrowserObject(url, target, options);
}
}
@@ -1,16 +1,21 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name InAppPurchase
* @name In App Purchase
* @description
* A lightweight Cordova plugin for in app purchases on iOS/Android.
*
* @usage
* ```ts
* import {InAppPurchase} from 'ionic-native';
* import { InAppPurchase } from '@ionic-native/in-app-purchase';
*
* InAppPurchase
* constructor(private iap: InAppPurchase) { }
*
* ...
*
* this.iap
* .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
* .then((products) => {
* console.log(products);
@@ -21,7 +26,7 @@ import { Plugin, Cordova } from './plugin';
* });
*
*
* InAppPurchase
* this.iap
* .buy('com.yourapp.prod1')
* .then((data)=> {
* console.log(data);
@@ -41,14 +46,12 @@ import { Plugin, Cordova } from './plugin';
*
* ```ts
* // fist buy the product...
* InAppPurchase
* this.iap
* .buy('com.yourapp.consumable_prod1')
* .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature))
* .then(data => this.iap.consume(data.productType, data.receipt, data.signature))
* .then(() => console.log('product was successfully consumed!'))
* .catch( err=> console.log(err))
* ```
*
*
*/
@Plugin({
pluginName: 'InAppPurchase',
@@ -57,6 +60,7 @@ import { Plugin, Cordova } from './plugin';
platforms: ['Android', 'iOS'],
repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase'
})
@Injectable()
export class InAppPurchase {
/**
@@ -67,7 +71,7 @@ export class InAppPurchase {
@Cordova({
otherPromise: true
})
static getProducts(productId: string[]): Promise<any> { return; }
getProducts(productId: string[]): Promise<any> { return; }
/**
* Buy a product that matches the productId.
@@ -77,7 +81,7 @@ export class InAppPurchase {
@Cordova({
otherPromise: true
})
static buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
buy(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
/**
* Same as buy, but for subscription based products.
@@ -87,7 +91,7 @@ export class InAppPurchase {
@Cordova({
otherPromise: true
})
static subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
subscribe(productId: string): Promise<{transactionId: string, receipt: string, signature: string, productType: string}> { return; }
/**
* Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message:
@@ -99,7 +103,7 @@ export class InAppPurchase {
@Cordova({
otherPromise: true
})
static consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
consume(productType: string, receipt: string, signature: string): Promise<any> { return; }
/**
* Restore all purchases from the store
@@ -108,7 +112,7 @@ export class InAppPurchase {
@Cordova({
otherPromise: true
})
static restorePurchases(): Promise<any> { return; }
restorePurchases(): Promise<any> { return; }
/**
* Get the receipt.
@@ -118,6 +122,6 @@ export class InAppPurchase {
otherPromise: true,
platforms: ['iOS']
})
static getReceipt(): Promise<string> { return; }
getReceipt(): Promise<string> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
@@ -8,16 +9,19 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import { Insomnia } from 'ionic-native';
* import { Insomnia } from '@ionic-native/insomnia';
*
* constructor(private insomnia: Insomnia) { }
*
* Insomnia.keepAwake()
* ...
*
* this.insomnia.keepAwake()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
*
* Insomnia.allowSleepAgain()
* this.insomnia.allowSleepAgain()
* .then(
* () => console.log('success'),
* () => console.log('error')
@@ -32,6 +36,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Insomnia {
/**
@@ -39,13 +44,13 @@ export class Insomnia {
* @returns {Promise<any>}
*/
@Cordova()
static keepAwake(): Promise<any> { return; }
keepAwake(): Promise<any> { return; }
/**
* Allows the application to sleep again
* @returns {Promise<any>}
*/
@Cordova()
static allowSleepAgain(): Promise<any> { return; }
allowSleepAgain(): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name Instagram
@@ -6,9 +7,13 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import {Instagram} from 'ionic-native';
* import { Instagram } from '@ionic-native/instagram';
*
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
* constructor(private instagram: Instagram) { }
*
* ...
*
* this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
* .then(() => console.log('Shared!'))
* .catch((error: any) => console.error(error));
*
@@ -20,6 +25,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'Instagram',
repo: 'https://github.com/vstirbu/InstagramPlugin'
})
@Injectable()
export class Instagram {
/**
@@ -30,7 +36,7 @@ export class Instagram {
@Cordova({
callbackStyle: 'node'
})
static isInstalled(): Promise<boolean|string> { return; }
isInstalled(): Promise<boolean|string> { return; }
/**
* Share an image on Instagram
@@ -43,7 +49,7 @@ export class Instagram {
@Cordova({
callbackStyle: 'node'
})
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
share(canvasIdOrDataUrl: string, caption?: string): Promise<any> { return; }
/**
* Share a library asset or video
@@ -53,6 +59,6 @@ export class Instagram {
@Cordova({
callbackOrder: 'reverse'
})
static shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
shareAsset(assetLocalIdentifier: string): Promise<any> { return; }
}
@@ -1,16 +1,21 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name IsDebug
* @name Is Debug
* @description
* Detect if the app is running in debug mode or not.
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
*
* @usage
* ```
* import {IsDebug} from 'ionic-native';
* import { IsDebug } from '@ionic-native/is-debug';
*
* IsDebug.getIsDebug()
* constructor(private isDebug: IsDebug) { }
*
* ...
*
* this.isDebug.getIsDebug()
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
* .catch((error: any) => console.error(error));
*
@@ -22,6 +27,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'cordova.plugins.IsDebug',
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
})
@Injectable()
export class IsDebug {
/**
@@ -29,7 +35,7 @@ export class IsDebug {
* @returns {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
*/
@Cordova()
static getIsDebug(): Promise<boolean> {
getIsDebug(): Promise<boolean> {
return;
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
@@ -7,9 +8,15 @@ import { Observable } from 'rxjs/Observable';
* @description
* @usage
* ```typescript
* import { Keyboard } from 'ionic-native';
* import { Keyboard } from '@ionic-native/keyboard';
*
* constructor(private keyboard: Keyboard) { }
*
* ...
*
* this.keyboard.show();
*
* this.keyboard.close();
*
* ```
*/
@@ -19,6 +26,7 @@ import { Observable } from 'rxjs/Observable';
pluginRef: 'cordova.plugins.Keyboard',
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
})
@Injectable()
export class Keyboard {
/**
@@ -26,7 +34,7 @@ export class Keyboard {
* @param hide {boolean}
*/
@Cordova({sync: true})
static hideKeyboardAccessoryBar(hide: boolean): void { }
hideKeyboardAccessoryBar(hide: boolean): void { }
/**
* Force keyboard to be shown.
@@ -35,7 +43,7 @@ export class Keyboard {
sync: true,
platforms: ['Android', 'BlackBerry 10', 'Windows']
})
static show(): void { }
show(): void { }
/**
* Close the keyboard if open.
@@ -44,7 +52,7 @@ export class Keyboard {
sync: true,
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static close(): void { }
close(): void { }
/**
* Prevents the native UIScrollView from moving when an input is focused.
@@ -54,7 +62,7 @@ export class Keyboard {
sync: true,
platforms: ['iOS', 'Windows']
})
static disableScroll(disable: boolean): void { }
disableScroll(disable: boolean): void { }
/**
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
@@ -65,7 +73,7 @@ export class Keyboard {
event: 'native.keyboardshow',
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static onKeyboardShow(): Observable<any> { return; }
onKeyboardShow(): Observable<any> { return; }
/**
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
@@ -76,6 +84,6 @@ export class Keyboard {
event: 'native.keyboardhide',
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static onKeyboardHide(): Observable<any> { return; }
onKeyboardHide(): Observable<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface LaunchNavigatorOptions {
@@ -66,14 +67,18 @@ export interface LaunchNavigatorOptions {
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
*
* ```typescript
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
* import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator';
*
* constructor(private launchNavigator: LaunchNavigator) { }
*
* ...
*
* let options: LaunchNavigatorOptions = {
* start: 'London, ON',
* app: LaunchNavigator.APPS.UBER
* };
*
* LaunchNavigator.navigate('Toronto, ON', options)
* this.launchNavigator.navigate('Toronto, ON', options)
* .then(
* success => console.log('Launched navigator'),
* error => console.log('Error launching navigator', error)
@@ -88,6 +93,7 @@ export interface LaunchNavigatorOptions {
pluginRef: 'launchnavigator',
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
})
@Injectable()
export class LaunchNavigator {
/**
@@ -100,7 +106,7 @@ export class LaunchNavigator {
successIndex: 1,
errorIndex: 2
})
static navigate(
navigate(
destination: string | number[],
options?: LaunchNavigatorOptions
): Promise<any> { return; }
@@ -111,14 +117,14 @@ export class LaunchNavigator {
* @returns {Promise<any>}
*/
@Cordova()
static isAppAvailable(app: string): Promise<any> { return; }
isAppAvailable(app: string): Promise<any> { return; }
/**
* Returns a list indicating which apps are installed and available on the current device.
* @returns {Promise<string[]>}
*/
@Cordova()
static availableApps(): Promise<string[]> { return; }
availableApps(): Promise<string[]> { return; }
/**
* Returns the display name of the specified app.
@@ -126,7 +132,7 @@ export class LaunchNavigator {
* @returns {string}
*/
@Cordova({ sync: true })
static getAppDisplayName(app: string): string { return; }
getAppDisplayName(app: string): string { return; }
/**
* Returns list of supported apps on a given platform.
@@ -134,7 +140,7 @@ export class LaunchNavigator {
* @returns {string[]}
*/
@Cordova({ sync: true })
static getAppsForPlatform(platform: string): string[] { return; }
getAppsForPlatform(platform: string): string[] { return; }
/**
* Indicates if an app on a given platform supports specification of transport mode.
@@ -143,7 +149,7 @@ export class LaunchNavigator {
* @returns {boolean}
*/
@Cordova({ sync: true })
static supportsTransportMode(app: string, platform: string): boolean { return; }
supportsTransportMode(app: string, platform: string): boolean { return; }
/**
* Returns the list of transport modes supported by an app on a given platform.
@@ -152,7 +158,7 @@ export class LaunchNavigator {
* @returns {string[]}
*/
@Cordova({ sync: true })
static getTransportModes(app: string, platform: string): string[] { return; }
getTransportModes(app: string, platform: string): string[] { return; }
/**
* Indicates if an app on a given platform supports specification of launch mode.
@@ -162,7 +168,7 @@ export class LaunchNavigator {
* @returns {boolean}
*/
@Cordova({ sync: true })
static supportsLaunchMode(app: string, platform: string): boolean { return; }
supportsLaunchMode(app: string, platform: string): boolean { return; }
/**
* Indicates if an app on a given platform supports specification of start location.
@@ -171,7 +177,7 @@ export class LaunchNavigator {
* @returns {boolean}
*/
@Cordova({ sync: true })
static supportsStart(app: string, platform: string): boolean { return; }
supportsStart(app: string, platform: string): boolean { return; }
/**
* @param app {string}
@@ -179,7 +185,7 @@ export class LaunchNavigator {
* @returns {boolean}
*/
@Cordova({ sync: true })
static supportsStartName(app: string, platform: string): boolean { return; }
supportsStartName(app: string, platform: string): boolean { return; }
/**
* @param app {string}
@@ -187,16 +193,16 @@ export class LaunchNavigator {
* @returns {boolean}
*/
@Cordova({ sync: true })
static supportsDestName(app: string, platform: string): boolean { return; }
supportsDestName(app: string, platform: string): boolean { return; }
/**
* @param destination {string | number[]}
* @param options {LaunchNavigatorOptions}
*/
@Cordova({ sync: true })
static userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
static APP: any = {
APP: any = {
USER_SELECT: 'user_select',
APPLE_MAPS: 'apple_maps',
GOOGLE_MAPS: 'google_maps',
@@ -213,7 +219,7 @@ export class LaunchNavigator {
MOOVIT: 'moovit'
};
static TRANSPORT_MODE: any = {
TRANSPORT_MODE: any = {
DRIVING: 'driving',
WALKING: 'walking',
BICYCLING: 'bicycling',
@@ -1,7 +1,8 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name LaunchReview
* @name Launch Review
* @description
*
* This launches the native store app in order for the user to leave a review.
@@ -10,10 +11,14 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import { LaunchReview } from 'ionic-native';
* import { LaunchReview } from '@ionic-native/launch-review';
*
* constructor(private launchReview: LaunchReview) { }
*
* ...
*
* const appId: string = 'yourAppId';
* LaunchReview.launch(appId)
* this.launchReview.launch(appId)
* .then(() => console.log('Successfully launched store app');
* ```
*/
@@ -24,6 +29,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/dpa99c/cordova-launch-review',
platforms: ['Android', 'iOS']
})
@Injectable()
export class LaunchReview {
/**
@@ -31,6 +37,6 @@ export class LaunchReview {
* @returns {Promise<void>}
*/
@Cordova()
static launch(appId: string): Promise<void> { return; }
launch(appId: string): Promise<void> { return; }
}
+108
View File
@@ -0,0 +1,108 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_company_admin' | 'w_share';
/**
* @name LinkedIn
* @description
* A Cordova plugin that lets you use LinkedIn Native SDKs for Android and iOS.
*
* Please see the [plugin's repo](https://github.com/zyramedia/cordova-plugin-linkedin#installation) for detailed installation steps.
*
* @usage
* ```
* import { LinkedIn } from 'ionic-native';
*
* constructor(private linkedin: LinkedIn) { }
*
* ...
*
* // check if there is an active session
* this.linkedin.hasActiveSession().then((active) => console.log('has active session?', active));
*
* // login
* const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
* this.linkedin.login(scopes, true)
* .then(() => console.log('Logged in!')
* .catch(e => console.log('Error logging in', e));
*
*
* // get connections
* this.linkedin.getRequest('people/~')
* .then(res => console.log(res))
* .catch(e => console.log(e));
*
* // share something on profile
* const body = {
* comment: 'Hello world!',
* visibility: {
* code: 'anyone'
* }
* };
*
* this.linkedin.postRequest('~/shares', body)
* .then(res => console.log(res))
* .catch(e => console.log(e));
*
*
* ```
*/
@Plugin({
pluginName: 'LinkedIn',
plugin: 'cordova-plugin-linkedin',
pluginRef: 'cordova.plugins.LinkedIn',
repo: 'https://github.com/zyramedia/cordova-plugin-linkedin',
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID'
})
@Injectable()
export class LinkedIn {
/**
* Login with the LinkedIn App
* @param scopes {string[]} Scopes to authorize
* @param promptToInstall {boolean} set to true to prompt the user to download the LinkedIn app if it's not installed
* @return {Promise<any>}
*/
@Cordova()
login(scopes: LinkedInLoginScopes[], promptToInstall: boolean): Promise<any> { return; }
/**
* Clears the current session
*/
@Cordova({ sync: true })
logout(): void { }
/**
* Make a get request
* @param path {string} request path
* @return {Promise<any>}
*/
@Cordova()
getRequest(path: string): Promise<any> { return; }
/**
* Make a post request
* @param path {string} request path
* @param body {Object} request body
* @return {Promise<any>}
*/
@Cordova()
postRequest(path: string, body: any): Promise<any> { return; }
/**
* Opens a member's profile
* @param memberId {string} Member id
* @return {Promise<any>}
*/
@Cordova()
openProfile(memberId: string): Promise<any> { return; }
/**
* Checks if there is already an existing active session. This should be used to avoid unecessary login.
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether there is an active session
*/
@Cordova()
hasActiveSession(): Promise<boolean> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
export interface ILocalNotification {
@@ -97,11 +98,16 @@ export interface ILocalNotification {
*
* @usage
* ```typescript
* import { LocalNotifications } from 'ionic-native';
* import { LocalNotifications } from '@ionic-native/local-notifications';
*
*
* constructor(private localNotifications: LocalNotifications) { }
*
* ...
*
*
* // Schedule a single notification
* LocalNotifications.schedule({
* this.localNotifications.schedule({
* id: 1,
* text: 'Single ILocalNotification',
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
@@ -110,7 +116,7 @@ export interface ILocalNotification {
*
*
* // Schedule multiple notifications
* LocalNotifications.schedule([{
* this.localNotifications.schedule([{
* id: 1,
* text: 'Multi ILocalNotification 1',
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
@@ -124,7 +130,7 @@ export interface ILocalNotification {
*
*
* // Schedule delayed notification
* LocalNotifications.schedule({
* this.localNotifications.schedule({
* text: 'Delayed ILocalNotification',
* at: new Date(new Date().getTime() + 3600),
* led: 'FF0000',
@@ -140,6 +146,7 @@ export interface ILocalNotification {
pluginRef: 'cordova.plugins.notification.local',
repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
})
@Injectable()
export class LocalNotifications {
/**
@@ -149,7 +156,7 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static schedule(options?: ILocalNotification | Array<ILocalNotification>): void { }
schedule(options?: ILocalNotification | Array<ILocalNotification>): void { }
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
@@ -158,7 +165,7 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static update(options?: ILocalNotification): void { }
update(options?: ILocalNotification): void { }
/**
* Clears single or multiple notifications
@@ -166,7 +173,7 @@ export class LocalNotifications {
* @returns {Promise<any>} Returns a promise when the notification had been cleared
*/
@Cordova()
static clear(notificationId: any): Promise<any> { return; }
clear(notificationId: any): Promise<any> { return; }
/**
* Clears all notifications
@@ -176,7 +183,7 @@ export class LocalNotifications {
successIndex: 0,
errorIndex: 2
})
static clearAll(): Promise<any> { return; }
clearAll(): Promise<any> { return; }
/**
* Cancels single or multiple notifications
@@ -184,7 +191,7 @@ export class LocalNotifications {
* @returns {Promise<any>} Returns a promise when the notification is canceled
*/
@Cordova()
static cancel(notificationId: any): Promise<any> { return; }
cancel(notificationId: any): Promise<any> { return; }
/**
* Cancels all notifications
@@ -194,7 +201,7 @@ export class LocalNotifications {
successIndex: 0,
errorIndex: 2
})
static cancelAll(): Promise<any> { return; }
cancelAll(): Promise<any> { return; }
/**
* Checks presence of a notification
@@ -202,7 +209,7 @@ export class LocalNotifications {
* @returns {Promise<boolean>}
*/
@Cordova()
static isPresent(notificationId: number): Promise<boolean> { return; }
isPresent(notificationId: number): Promise<boolean> { return; }
/**
* Checks is a notification is scheduled
@@ -210,7 +217,7 @@ export class LocalNotifications {
* @returns {Promise<boolean>}
*/
@Cordova()
static isScheduled(notificationId: number): Promise<boolean> { return; }
isScheduled(notificationId: number): Promise<boolean> { return; }
/**
* Checks if a notification is triggered
@@ -218,28 +225,28 @@ export class LocalNotifications {
* @returns {Promise<boolean>}
*/
@Cordova()
static isTriggered(notificationId: number): Promise<boolean> { return; }
isTriggered(notificationId: number): Promise<boolean> { return; }
/**
* Get all the notification ids
* @returns {Promise<Array<number>>}
*/
@Cordova()
static getAllIds(): Promise<Array<number>> { return; }
getAllIds(): Promise<Array<number>> { return; }
/**
* Get the ids of triggered notifications
* @returns {Promise<Array<number>>}
*/
@Cordova()
static getTriggeredIds(): Promise<Array<number>> { return; }
getTriggeredIds(): Promise<Array<number>> { return; }
/**
* Get the ids of scheduled notifications
* @returns {Promise<Array<number>>} Returns a promise
*/
@Cordova()
static getScheduledIds(): Promise<Array<number>> { return; }
getScheduledIds(): Promise<Array<number>> { return; }
/**
* Get a notification object
@@ -247,7 +254,7 @@ export class LocalNotifications {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
static get(notificationId: any): Promise<ILocalNotification> { return; }
get(notificationId: any): Promise<ILocalNotification> { return; }
/**
* Get a scheduled notification object
@@ -255,7 +262,7 @@ export class LocalNotifications {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
static getScheduled(notificationId: any): Promise<ILocalNotification> { return; }
getScheduled(notificationId: any): Promise<ILocalNotification> { return; }
/**
* Get a triggered notification object
@@ -263,42 +270,42 @@ export class LocalNotifications {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
static getTriggered(notificationId: any): Promise<ILocalNotification> { return; }
getTriggered(notificationId: any): Promise<ILocalNotification> { return; }
/**
* Get all notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
static getAll(): Promise<Array<ILocalNotification>> { return; }
getAll(): Promise<Array<ILocalNotification>> { return; }
/**
* Get all scheduled notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
static getAllScheduled(): Promise<Array<ILocalNotification>> { return; }
getAllScheduled(): Promise<Array<ILocalNotification>> { return; }
/**
* Get all triggered notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
static getAllTriggered(): Promise<Array<ILocalNotification>> { return; }
getAllTriggered(): Promise<Array<ILocalNotification>> { return; }
/**
* Register permission to show notifications if not already granted.
* @returns {Promise<boolean>}
*/
@Cordova()
static registerPermission(): Promise<boolean> { return; }
registerPermission(): Promise<boolean> { return; }
/**
* Informs if the app has the permission to show notifications.
* @returns {Promise<boolean>}
*/
@Cordova()
static hasPermission(): Promise<boolean> { return; }
hasPermission(): Promise<boolean> { return; }
/**
@@ -309,7 +316,7 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static on(eventName: string, callback: any): void { }
on(eventName: string, callback: any): void { }
}
@@ -0,0 +1,139 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name LocationAccuracy
* @description
* This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
*
* @usage
* ```
* import { LocationAccuracy } from '@ionic-native/location-accuracy';
*
* constructor(private locationAccuracy: LocationAccuracy) { }
*
* ...
*
* this.locationAccuracy.canRequest().then((canRequest: boolean) => {
*
* if(canRequest) {
* // the accuracy option will be ignored by iOS
* this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
* () => console.log('Request successful'),
* error => console.log('Error requesting location permissions', error)
* );
* }
*
* });
*
* ```
*/
@Plugin({
pluginName: 'LocationAccuracy',
plugin: 'cordova-plugin-request-location-accuracy',
pluginRef: 'cordova.plugins.locationAccuracy',
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
})
@Injectable()
export class LocationAccuracy {
/**
* Indicates if you can request accurate location
* @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
*/
@Cordova()
canRequest(): Promise<boolean> { return; }
/**
* Indicates if a request is currently in progress
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
*/
@Cordova()
isRequesting(): Promise<boolean> { return; }
/**
* Requests accurate location
* @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_
* @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
*/
@Cordova({ callbackOrder: 'reverse' })
request(accuracy: number): Promise<any> { return; }
/**
* Convenience constant
* @type {number}
*/
REQUEST_PRIORITY_NO_POWER = 0;
/**
* Convenience constant
* @type {number}
*/
REQUEST_PRIORITY_LOW_POWER = 1;
/**
* Convenience constant
* @type {number}
*/
REQUEST_PRIORITY_BALANCED_POWER_ACCURACY = 2;
/**
* Convenience constant
* @type {number}
*/
REQUEST_PRIORITY_HIGH_ACCURACY = 3;
/**
* Convenience constant
* @type {number}
*/
SUCCESS_SETTINGS_SATISFIED = 0;
/**
* Convenience constant
* @type {number}
*/
SUCCESS_USER_AGREED = 1;
/**
* Convenience constant
* @type {number}
*/
ERROR_ALREADY_REQUESTING = -1;
/**
* Convenience constant
* @type {number}
*/
ERROR_INVALID_ACTION = 0;
/**
* Convenience constant
* @type {number}
*/
ERROR_INVALID_ACCURACY = 1;
/**
* Convenience constant
* @type {number}
*/
ERROR_EXCEPTION = 1;
/**
* Convenience constant
* @type {number}
*/
ERROR_CANNOT_CHANGE_ACCURACY = 3;
/**
* Convenience constant
* @type {number}
*/
ERROR_USER_DISAGREED = 4;
/**
* Convenience constant
* @type {number}
*/
ERROR_GOOGLE_API_CONNECTION_FAILED = 4;
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name Market
* @description
@@ -6,9 +7,13 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import {Market} from 'ionic-native';
* import { Market } from '@ionic-native/market';
*
* Market.open('your.package.name');
* constructor(private market: Market) { }
*
* ...
*
* this.market.open('your.package.name');
*
* ```
*/
@@ -18,6 +23,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'cordova.plugins.market',
repo: 'https://github.com/xmartlabs/cordova-plugin-market'
})
@Injectable()
export class Market {
/**
@@ -30,7 +36,7 @@ export class Market {
successName: 'success',
errorName: 'failure'
})
static open(appId: string): Promise<any> { return; }
open(appId: string): Promise<any> { return; }
/**
* Search apps by keyword
@@ -43,6 +49,6 @@ export class Market {
errorName: 'failure',
platforms: ['Android']
})
static search(keyword: string): Promise<any> { return; }
search(keyword: string): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, CordovaProperty, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
@@ -15,15 +16,18 @@ export interface MediaFile {
/**
* The file's mime type
*/
type: string;
type: string;
/**
* The date and time when the file was last modified.
*/
lastModifiedDate: Date;
/**
* The size of the file, in bytes.
*/
size: number;
/**
* Retrieves the format information of the media file.
* @param {Function} successCallback
@@ -113,11 +117,16 @@ export interface ConfigurationData {
* @description
* @usage
* ```typescript
* import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from 'ionic-native';
* import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/media-capture';
*
*
* constructor(private mediaCapture: MediaCapture) { }
*
* ...
*
*
* let options: CaptureImageOptions = { limit: 3 };
* MediaCapture.captureImage(options)
* this.mediaCapture.captureImage(options)
* .then(
* (data: MediaFile[]) => console.log(data),
* (err: CaptureError) => console.error(err)
@@ -139,27 +148,28 @@ export interface ConfigurationData {
pluginRef: 'navigator.device.capture',
repo: 'https://github.com/apache/cordova-plugin-media-capture'
})
@Injectable()
export class MediaCapture {
/**
* The recording image sizes and formats supported by the device.
* @returns {ConfigurationData[]}
*/
@CordovaProperty
static supportedImageModes: ConfigurationData[];
supportedImageModes: ConfigurationData[];
/**
* The audio recording formats supported by the device.
* @returns {ConfigurationData[]}
*/
@CordovaProperty
static supportedAudioModes: ConfigurationData[];
supportedAudioModes: ConfigurationData[];
/**
* The recording video resolutions and formats supported by the device.
* @returns {ConfigurationData[]}
*/
@CordovaProperty
static supportedVideoModes: ConfigurationData[];
supportedVideoModes: ConfigurationData[];
/**
* Start the audio recorder application and return information about captured audio clip files.
@@ -169,7 +179,9 @@ export class MediaCapture {
@Cordova({
callbackOrder: 'reverse'
})
static captureAudio(options?: CaptureAudioOptions): Promise<MediaFile[] | CaptureError> { return; }
captureAudio(options?: CaptureAudioOptions): Promise<MediaFile[] | CaptureError> {
return;
}
/**
* Start the camera application and return information about captured image files.
@@ -179,7 +191,9 @@ export class MediaCapture {
@Cordova({
callbackOrder: 'reverse'
})
static captureImage(options?: CaptureImageOptions): Promise<MediaFile[] | CaptureError> { return; }
captureImage(options?: CaptureImageOptions): Promise<MediaFile[] | CaptureError> {
return;
}
/**
* Start the video recorder application and return information about captured video clip files.
@@ -189,7 +203,9 @@ export class MediaCapture {
@Cordova({
callbackOrder: 'reverse'
})
static captureVideo(options?: CaptureVideoOptions): Promise<MediaFile[] | CaptureError> { return; }
captureVideo(options?: CaptureVideoOptions): Promise<MediaFile[] | CaptureError> {
return;
}
/**
* is fired if the capture call is successful
@@ -199,7 +215,9 @@ export class MediaCapture {
eventObservable: true,
event: 'pendingcaptureresult'
})
static onPendingCaptureResult(): Observable<MediaFile[]> { return; }
onPendingCaptureResult(): Observable<MediaFile[]> {
return;
}
/**
* is fired if the capture call is unsuccessful
@@ -209,6 +227,8 @@ export class MediaCapture {
eventObservable: true,
event: 'pendingcaptureerror'
})
static onPendingCaptureError(): Observable<CaptureError> { return; }
onPendingCaptureError(): Observable<CaptureError> {
return;
}
}
@@ -1,144 +1,20 @@
import { CordovaInstance, Plugin, getPlugin, pluginWarn } from './plugin';
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck } from '@ionic-native/core';
declare var Media: any;
export interface MediaError {
code: number;
message: string;
}
/**
* @name MediaPlugin
* @description
* @usage
* ```typescript
* import { MediaPlugin } from 'ionic-native';
*
*
*
* // Create a MediaPlugin instance. Expects path to file or url as argument
* // We can optionally pass a second argument to track the status of the media
*
* const onStatusUpdate = (status) => console.log(status);
*
* const file = new MediaPlugin('path/to/file.mp3', onStatusUpdate);
*
* // Catch the Success & Error Output
* // Platform Quirks
* // iOS calls success on completion of playback only
* // Android calls success on completion of playback AND on release()
* file.init.then(() => {
* console.log('Playback Finished');
* }, (err) => {
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
* });
*
* // play the file
* file.play();
*
* // pause the file
* file.pause();
*
* // get current playback position
* file.getCurrentPosition().then((position) => {
* console.log(position);
* });
*
* // get file duration
* file.getDuration();
*
* // skip to 10 seconds (expects int value in ms)
* file.seekTo(10000);
*
* // stop playing the file
* file.stop();
*
* // release the native audio resource
* // Platform Quirks:
* // iOS simply create a new instance and the old one will be overwritten
* // Android you must call release() to destroy instances of media when you are done
* file.release();
*
* // Recording to a file
* var newFile = new MediaPlugin('path/to/file.mp3');
* newFile.startRecord();
*
* newFile.stopRecord();
*
*
*
* ```
* @hidden
*/
@Plugin({
pluginName: 'MediaPlugin',
repo: 'https://github.com/apache/cordova-plugin-media',
plugin: 'cordova-plugin-media',
pluginRef: 'Media'
})
export class MediaPlugin {
export class MediaObject {
// Constants
/**
* @private
*/
static MEDIA_NONE: number = 0;
/**
* @private
*/
static MEDIA_STARTING: number = 1;
/**
* @private
*/
static MEDIA_RUNNING: number = 2;
/**
* @private
*/
static MEDIA_PAUSED: number = 3;
/**
* @private
*/
static MEDIA_STOPPED: number = 4;
// error codes
/**
* @private
*/
static MEDIA_ERR_ABORTED: number = 1;
/**
* @private
*/
static MEDIA_ERR_NETWORK: number = 2;
/**
* @private
*/
static MEDIA_ERR_DECODE: number = 3;
/**
* @private
*/
static MEDIA_ERR_NONE_SUPPORTED: number = 4;
// Properties
private _objectInstance: any;
init: Promise<any>;
// Methods
/**
* Open a media file
* @param src {string} A URI containing the audio content.
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
*/
constructor(src: string, onStatusUpdate?: Function) {
if (!!getPlugin('Media')) {
this.init = new Promise<any>((resolve, reject) => {
this._objectInstance = new Media(src, resolve, reject, onStatusUpdate);
});
} else {
pluginWarn({
pluginName: 'MediaPlugin',
plugin: 'cordova-plugin-media'
});
}
}
constructor(private _objectInstnace: any) {}
/**
* Get the current amplitude of the current recording.
@@ -248,5 +124,141 @@ export class MediaPlugin {
sync: true
})
stop(): void { }
}
/**
* @name MediaPlugin
* @description
* @usage
* ```typescript
* import { MediaPlugin, MediaObject } from '@ionic-native/media';
*
*
* constructor(private media: MediaPlugin) { }
*
*
* ...
*
*
* // Create a MediaPlugin instance. Expects path to file or url as argument
* // We can optionally pass a second argument to track the status of the media
*
* const onStatusUpdate = (status) => console.log(status);
*
* this.media.create('path/to/file.mp3', onStatusUpdate)
* .then((file: MediaObject) => {
*
* // play the file
* file.play();
*
* // pause the file
* file.pause();
*
* // get current playback position
* file.getCurrentPosition().then((position) => {
* console.log(position);
* });
*
* // get file duration
* file.getDuration().then((duration) => {
* console.log(position);
* });
*
* // skip to 10 seconds (expects int value in ms)
* file.seekTo(10000);
*
* // stop playing the file
* file.stop();
*
* // release the native audio resource
* // Platform Quirks:
* // iOS simply create a new instance and the old one will be overwritten
* // Android you must call release() to destroy instances of media when you are done
* file.release();
*
* })
* .catch(e => console.log('Error opening media file', e));
*
*
* // Recording to a file
* this.media.create('path/to/file.mp3')
* .then((file: MedieObject) => {
*
* file.startRecord();
*
* file.stopRecord();
*
* });
*
* ```
* @classes
* MediaObject
*/
@Plugin({
pluginName: 'MediaPlugin',
repo: 'https://github.com/apache/cordova-plugin-media',
plugin: 'cordova-plugin-media',
pluginRef: 'Media'
})
@Injectable()
class MediaPlugin {
// Constants
/**
* @hidden
*/
MEDIA_NONE: number = 0;
/**
* @hidden
*/
MEDIA_STARTING: number = 1;
/**
* @hidden
*/
MEDIA_RUNNING: number = 2;
/**
* @hidden
*/
MEDIA_PAUSED: number = 3;
/**
* @hidden
*/
MEDIA_STOPPED: number = 4;
// error codes
/**
* @hidden
*/
MEDIA_ERR_ABORTED: number = 1;
/**
* @hidden
*/
MEDIA_ERR_NETWORK: number = 2;
/**
* @hidden
*/
MEDIA_ERR_DECODE: number = 3;
/**
* @hidden
*/
MEDIA_ERR_NONE_SUPPORTED: number = 4;
/**
* Open a media file
* @param src {string} A URI containing the audio content.
* @param onStatusUpdate {Function} A callback function to be invoked when the status of the file changes
* @return {Promise<MediaObject>}
*/
@CordovaCheck()
create(src: string, onStatusUpdate?: Function): Promise<MediaObject> {
return new Promise<MediaObject>((resolve, reject) => {
// Creates a new media object
// Resolves with the media object
// or rejects with the error
const instance = new Media(src, () => resolve(new Media(instance)), reject, onStatusUpdate);
});
}
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
declare var mixpanel: any;
@@ -9,9 +10,13 @@ declare var mixpanel: any;
*
* @usage
* ```
* import {Mixpanel} from 'ionic-native';
* import { Mixpanel, MixpanelPeople } from '@ionic-native/mixpanel';
*
* Mixpanel.init(token)
* constructor(private mixpanel: Mixpanel, private mixpanelPeople: MixpanelPeople) { }
*
* ...
*
* this.mixpanel.init(token)
* .then(onSuccess)
* .catch(onError);
*
@@ -25,7 +30,9 @@ declare var mixpanel: any;
pluginRef: 'mixpanel',
repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
})
@Injectable()
export class Mixpanel {
/**
*
* @param aliasId {string}
@@ -33,20 +40,20 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static alias(aliasId: string, originalId: string): Promise<any> { return; }
alias(aliasId: string, originalId: string): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static distinctId(): Promise<any> { return; }
distinctId(): Promise<any> { return; }
/**
* @returns {Promise<any>}
*/
@Cordova()
static flush(): Promise<any> { return; }
flush(): Promise<any> { return; }
/**
*
@@ -54,7 +61,7 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static identify(distinctId: string): Promise<any> { return; }
identify(distinctId: string): Promise<any> { return; }
/**
*
@@ -62,7 +69,7 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static init(token: string): Promise<any> { return; }
init(token: string): Promise<any> { return; }
/**
*
@@ -70,14 +77,14 @@ export class Mixpanel {
* @returns {Promise<any>}
*/
@Cordova()
static registerSuperProperties(superProperties: any): Promise<any> { return; }
registerSuperProperties(superProperties: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static reset(): Promise<any> { return; }
reset(): Promise<any> { return; }
/**
*
@@ -89,36 +96,26 @@ export class Mixpanel {
successIndex: 2,
errorIndex: 3
})
static track(eventName: string, eventProperties?: any): Promise<any> { return; }
track(eventName: string, eventProperties?: any): Promise<any> { return; }
/**
*
* @returns {Promise<any>}
*/
@Cordova()
static showSurvey(): Promise<any> { return; }
/**
*
* @returns {MixpanelPeople}
*/
static get people(): typeof MixpanelPeople {
return MixpanelPeople;
};
showSurvey(): Promise<any> { return; }
}
/**
* @private
* @hidden
*/
@Injectable()
@Plugin({
plugin: 'cordova-plugin-mixpanel',
pluginRef: 'mixpanel.people',
pluginName: 'Mixpanel'
})
export class MixpanelPeople {
/**
* @private
*/
static plugin: string = 'cordova-plugin-mixpanel';
/**
* @private
*/
static pluginRef: string = 'mixpanel.people';
/**
*
@@ -126,7 +123,7 @@ export class MixpanelPeople {
* @return {Promise<any>}
*/
@Cordova()
static identify(distinctId: string): Promise<any> { return; }
identify(distinctId: string): Promise<any> { return; }
/**
*
@@ -134,7 +131,7 @@ export class MixpanelPeople {
* @return {Promise<any>}
*/
@Cordova()
static increment(peopleProperties: any): Promise<any> { return; }
increment(peopleProperties: any): Promise<any> { return; }
/**
*
@@ -142,7 +139,7 @@ export class MixpanelPeople {
* @return {Promise<any>}
*/
@Cordova()
static setPushId(pushId: string): Promise<any> { return; }
setPushId(pushId: string): Promise<any> { return; }
/**
*
@@ -150,7 +147,7 @@ export class MixpanelPeople {
* @return {Promise<any>}
*/
@Cordova()
static set(peopleProperties: any): Promise<any> { return; }
set(peopleProperties: any): Promise<any> { return; }
/**
*
@@ -158,5 +155,6 @@ export class MixpanelPeople {
* @return {Promise<any>}
*/
@Cordova()
static setOnce(peopleProperties: any): Promise<any> { return; }
setOnce(peopleProperties: any): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface MusicControlsOptions {
@@ -10,14 +11,14 @@ export interface MusicControlsOptions {
hasPrev: boolean;
hasNext: boolean;
hasClose: boolean;
album:string;
album: string;
duration: number;
elapsed:number;
elapsed: number;
ticker: string;
}
/**
* @name MusicControls
* @name Music Controls
* @description
* Music controls for Cordova applications.
* Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play.
@@ -25,9 +26,13 @@ export interface MusicControlsOptions {
*
* @usage
* ```
* import {MusicControls} from 'ionic-native';
* import { MusicControls } from '@ionic-native/music-controls';
*
* MusicControls.create({
* constructor(private musicControls: MusicControls) { }
*
* ...
*
* this.musicControls.create({
* track : 'Time is Running Out', // optional, default : ''
* artist : 'Muse', // optional, default : ''
* cover : 'albums/absolution.jpg', // optional, default : nothing
@@ -51,7 +56,7 @@ export interface MusicControlsOptions {
* ticker : 'Now playing "Time is Running Out"'
* });
*
* MusicControls.subscribe().subscribe(action => {
* this.musicControls.subscribe().subscribe(action => {
*
* switch(action) {
* case 'music-controls-next':
@@ -86,9 +91,9 @@ export interface MusicControlsOptions {
*
* });
*
* MusicControls.listen(); // activates the observable above
* this.musicControls.listen(); // activates the observable above
*
* MusicControls.updateIsPlaying(true);
* this.musicControls.updateIsPlaying(true);
*
*
* ```
@@ -101,6 +106,7 @@ export interface MusicControlsOptions {
pluginRef: 'MusicControls',
repo: 'https://github.com/homerours/cordova-music-controls-plugin'
})
@Injectable()
export class MusicControls {
/**
@@ -109,14 +115,14 @@ export class MusicControls {
* @returns {Promise<any>}
*/
@Cordova()
static create(options: MusicControlsOptions): Promise<any> {return; }
create(options: MusicControlsOptions): Promise<any> {return; }
/**
* Destroy the media controller
* @returns {Promise<any>}
*/
@Cordova()
static destroy(): Promise<any> {return; }
destroy(): Promise<any> {return; }
/**
* Subscribe to the events of the media controller
@@ -125,25 +131,25 @@ export class MusicControls {
@Cordova({
observable: true
})
static subscribe(): Observable<any> {return; }
subscribe(): Observable<any> {return; }
/**
* Start listening for events, this enables the Observable from the subscribe method
*/
@Cordova({sync: true})
static listen(): void {}
listen(): void {}
/**
* Toggle play/pause:
* @param isPlaying {boolean}
*/
@Cordova()
static updateIsPlaying(isPlaying: boolean): void {}
updateIsPlaying(isPlaying: boolean): void {}
/**
* Toggle dismissable:
* @param dismissable {boolean}
*/
@Cordova()
static updateDismissable(dismissable: boolean): void {}
updateDismissable(dismissable: boolean): void {}
}
@@ -1,26 +1,31 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name NativeAudio
* @name Native Audio
* @description Native Audio Playback
* @usage
* ```typescript
* import {NativeAudio} from 'ionic-native';
* import { NativeAudio } from '@ionic-native/native-audio';
*
* NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
* NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
* constructor(private nativeAudio: NativeAudio) { }
*
* NativeAudio.play('uniqueId1').then(onSuccess, onError);
* ...
*
* this.nativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
* this.nativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
*
* this.nativeAudio.play('uniqueId1').then(onSuccess, onError);
*
* // can optionally pass a callback to be called when the file is done playing
* NativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
* this.nativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing'));
*
* NativeAudio.loop('uniqueId2').then(onSuccess, onError);
* this.nativeAudio.loop('uniqueId2').then(onSuccess, onError);
*
* NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
* this.nativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
*
* NativeAudio.stop('uniqueId1').then(onSuccess,onError);
* this.nativeAudio.stop('uniqueId1').then(onSuccess,onError);
*
* NativeAudio.unload('uniqueId1').then(onSuccess,onError);
* this.nativeAudio.unload('uniqueId1').then(onSuccess,onError);
*
* ```
*/
@@ -30,6 +35,7 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'plugins.NativeAudio',
repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
})
@Injectable()
export class NativeAudio {
/**
* Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
@@ -38,7 +44,7 @@ export class NativeAudio {
* @returns {Promise<any>}
*/
@Cordova()
static preloadSimple(id: string, assetPath: string): Promise<any> {return; }
preloadSimple(id: string, assetPath: string): Promise<any> {return; }
/**
* Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
@@ -50,7 +56,7 @@ export class NativeAudio {
* @returns {Promise<any>}
*/
@Cordova()
static preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise<any> {return; }
/**
* Plays an audio asset
@@ -62,7 +68,7 @@ export class NativeAudio {
successIndex: 1,
errorIndex: 2
})
static play(id: string, completeCallback?: Function): Promise<any> {return; }
play(id: string, completeCallback?: Function): Promise<any> {return; }
/**
* Stops playing an audio
@@ -70,7 +76,7 @@ export class NativeAudio {
* @returns {Promise<any>}
*/
@Cordova()
static stop(id: string): Promise<any> {return; }
stop(id: string): Promise<any> {return; }
/**
* Loops an audio asset infinitely, this only works for complex assets
@@ -78,7 +84,7 @@ export class NativeAudio {
* @return {Promise<any>}
*/
@Cordova()
static loop(id: string): Promise<any> {return; }
loop(id: string): Promise<any> {return; }
/**
* Unloads an audio file from memory
@@ -86,7 +92,7 @@ export class NativeAudio {
* @returns {Promise<any>}
*/
@Cordova()
static unload(id: string): Promise<any> {return; }
unload(id: string): Promise<any> {return; }
/**
* Changes the volume for preloaded complex assets.
@@ -95,6 +101,6 @@ export class NativeAudio {
* @returns {Promise<any>}
*/
@Cordova()
static setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
setVolumeForComplexAsset(id: string, volume: number): Promise<any> {return; }
}
@@ -1,20 +1,25 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @beta
* @name NativeGeocoder
* @name Native Geocoder
* @description
* Cordova plugin for native forward and reverse geocoding
*
* @usage
* ```typescript
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from 'ionic-native';
* import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';
*
* NativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
* constructor(private nativeGeocoder: NativeGeocoder) { }
*
* ...
*
* this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
* .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.street + " in " + result.countryCode))
* .catch((error: any) => console.log(error));
*
* NativeGeocoder.forwardGeocode("Berlin")
* this.nativeGeocoder.forwardGeocode("Berlin")
* .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude))
* .catch((error: any) => console.log(error));
* ```
@@ -29,6 +34,7 @@ import { Plugin, Cordova } from './plugin';
repo: 'https://github.com/sebastianbaar/cordova-plugin-nativegeocoder',
platforms: ['iOS', 'Android']
})
@Injectable()
export class NativeGeocoder {
/**
@@ -40,7 +46,7 @@ export class NativeGeocoder {
@Cordova({
callbackOrder: 'reverse'
})
static reverseGeocode(latitude: number, longitude: number): Promise<NativeGeocoderReverseResult> { return; }
reverseGeocode(latitude: number, longitude: number): Promise<NativeGeocoderReverseResult> { return; }
/**
* Forward geocode a given address to find coordinates
@@ -50,7 +56,7 @@ export class NativeGeocoder {
@Cordova({
callbackOrder: 'reverse'
})
static forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }
forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
export interface NativeTransitionOptions {
direction?: string;
@@ -16,13 +17,17 @@ export interface NativeTransitionOptions {
}
/**
* @name NativePageTransitions
* @name Native Page Transitions
* @description
* The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction.
*
* @usage
* ```
* import {NativePageTransitions, NativeTransitionOptions} from 'ionic-native';
* import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
*
* constructor(private nativePageTransitions: NativePageTransitions) { }
*
* ...
*
* let options: NativeTransitionOptions = {
* direction: 'up',
@@ -36,7 +41,7 @@ export interface NativeTransitionOptions {
* fixedPixelsBottom: 60
* };
*
* NativePageTransitions.slide(options)
* this.nativePageTransitions.slide(options)
* .then(onSuccess)
* .catch(onError);
*
@@ -49,6 +54,7 @@ export interface NativeTransitionOptions {
repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions',
platforms: ['iOS', 'Android', 'Windows Phone']
})
@Injectable()
export class NativePageTransitions {
/**
* Perform a slide animation
@@ -56,7 +62,7 @@ export class NativePageTransitions {
* @returns {Promise<any>}
*/
@Cordova()
static slide(options: NativeTransitionOptions): Promise<any> { return; }
slide(options: NativeTransitionOptions): Promise<any> { return; }
/**
* Perform a flip animation
@@ -64,7 +70,7 @@ export class NativePageTransitions {
* @returns {Promise<any>}
*/
@Cordova()
static flip(options: NativeTransitionOptions): Promise<any> { return; }
flip(options: NativeTransitionOptions): Promise<any> { return; }
/**
* Perform a fade animation
@@ -72,7 +78,7 @@ export class NativePageTransitions {
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS', 'Android']})
static fade(options: NativeTransitionOptions): Promise<any> { return; }
fade(options: NativeTransitionOptions): Promise<any> { return; }
/**
@@ -81,7 +87,7 @@ export class NativePageTransitions {
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS', 'Android']})
static drawer(options: NativeTransitionOptions): Promise<any> { return; }
drawer(options: NativeTransitionOptions): Promise<any> { return; }
@@ -91,7 +97,6 @@ export class NativePageTransitions {
* @returns {Promise<any>}
*/
@Cordova({platforms: ['iOS']})
static curl(options: NativeTransitionOptions): Promise<any> { return; }
curl(options: NativeTransitionOptions): Promise<any> { return; }
}
@@ -1,21 +1,26 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @name NativeStorage
* @name Native Storage
* @description Native storage of variables in Android and iOS
*
* @usage
* ```typescript
* import { NativeStorage } from 'ionic-native';
* import { NativeStorage } from '@ionic-native/native-storage';
*
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
* constructor(private nativeStorage: NativeStorage) { }
*
* ...
*
* this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
* .then(
* () => console.log('Stored item!'),
* error => console.error('Error storing item', error)
* );
*
* NativeStorage.getItem('myitem')
* this.nativeStorage.getItem('myitem')
* .then(
* data => console.log(data),
* error => console.error(error)
@@ -28,6 +33,7 @@ import { Cordova, Plugin } from './plugin';
pluginRef: 'NativeStorage',
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
})
@Injectable()
export class NativeStorage {
/**
* Stores a value
@@ -36,7 +42,7 @@ export class NativeStorage {
* @returns {Promise<any>}
*/
@Cordova()
static setItem(reference: string, value: any): Promise<any> {return; }
setItem(reference: string, value: any): Promise<any> {return; }
/**
* Gets a stored item
@@ -44,7 +50,7 @@ export class NativeStorage {
* @returns {Promise<any>}
*/
@Cordova()
static getItem(reference: string): Promise<any> {return; }
getItem(reference: string): Promise<any> {return; }
/**
* Removes a single stored item
@@ -52,13 +58,13 @@ export class NativeStorage {
* @returns {Promise<any>}
*/
@Cordova()
static remove(reference: string): Promise<any> {return; }
remove(reference: string): Promise<any> {return; }
/**
* Removes all stored values.
* @returns {Promise<any>}
*/
@Cordova()
static clear(): Promise<any> {return; }
clear(): Promise<any> {return; }
}
@@ -1,18 +1,23 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
/**
* @beta
* @name NavigationBar
* @name Navigation Bar
* @description
* The NavigationBar plugin can you to hide and auto hide the android navigation bar.
*
* @usage
* ```typescript
* import { NavigationBar } from 'ionic-native';
* import { NavigationBar } from '@ionic-native/navigation-bar';
*
* constructor(private navigationBar: NavigationBar) { }
*
* ...
*
* let autoHide: boolean = true;
* NavigationBar.hide(autoHide);
* this.navigationBar.hide(autoHide);
* ```
*/
@Plugin({
@@ -22,6 +27,7 @@ import { Cordova, Plugin } from './plugin';
repo: 'https://github.com/cranberrygame/cordova-plugin-navigationbar',
platforms: ['Android']
})
@Injectable()
export class NavigationBar {
/**
@@ -34,7 +40,7 @@ export class NavigationBar {
successName: 'success',
errorName: 'failure'
})
static setUp(autohide?: boolean): Promise<any> { return; }
setUp(autohide?: boolean): Promise<any> { return; }
/**
* Hide the navigation bar. 
@@ -45,6 +51,6 @@ export class NavigationBar {
successName: 'success',
errorName: 'failure'
})
static hideNavigationBar(): Promise<any> { return; }
hideNavigationBar(): Promise<any> { return; }
}
@@ -1,4 +1,5 @@
import {Cordova, CordovaProperty, Plugin, CordovaFunctionOverride} from './plugin';
import { Injectable } from '@angular/core';
import {Cordova, CordovaProperty, Plugin, CordovaFunctionOverride} from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
@@ -11,10 +12,14 @@ declare var navigator: any;
*
* @usage
* ```typescript
* import { Network } from 'ionic-native';
* import { Network } from '@ionic-native/network';
*
* constructor(private network: Network) { }
*
* ...
*
* // watch network for a disconnect
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
* let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
* console.log('network was disconnected :-(');
* });
*
@@ -23,7 +28,7 @@ declare var navigator: any;
*
*
* // watch network for a connection
* let connectSubscription = Network.onConnect().subscribe(() => {
* let connectSubscription = this.network.onConnect().subscribe(() => {
* console.log('network connected!');
* // We just got a connection but we need to wait briefly
* // before we determine the connection type. Might need to wait
@@ -49,6 +54,7 @@ declare var navigator: any;
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'],
pluginRef: 'navigator.connection'
})
@Injectable()
export class Network {
/**
@@ -56,28 +62,28 @@ export class Network {
* @return {string}
*/
@CordovaProperty
static type: string;
type: string;
/**
* Downlink Max Speed
* @return {string}
*/
@CordovaProperty
static downlinkMax: string;
downlinkMax: string;
/**
* Returns an observable to watch connection changes
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
static onchange(): Observable<any> { return; }
onchange(): Observable<any> { return; }
/**
* Returns an observable to watch connection type changes
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
static ontypechange(): Observable<any> { return; }
ontypechange(): Observable<any> { return; }
/**
* Get notified when the device goes offline
@@ -87,7 +93,7 @@ export class Network {
eventObservable: true,
event: 'offline'
})
static onDisconnect(): Observable<any> { return; }
onDisconnect(): Observable<any> { return; }
/**
* Get notified when the device goes online
@@ -97,6 +103,6 @@ export class Network {
eventObservable: true,
event: 'online'
})
static onConnect(): Observable<any> { return; }
onConnect(): Observable<any> { return; }
}
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare let window: any;
/**
@@ -16,10 +17,14 @@ declare let window: any;
*
* @usage
* ```
* import {NFC, Ndef} from 'ionic-native';
* import { NFC, Ndef } from '@ionic-native/nfc';
*
* let message = Ndef.textRecord('Hello world');
* NFC.share([message]).then(onSuccess).catch(onError);
* constructor(private nfc: NFC, private ndef: Ndef) { }
*
* ...
*
* let message = this.ndef.textRecord('Hello world');
* this.nfc.share([message]).then(onSuccess).catch(onError);
*
* ```
*/
@@ -29,6 +34,7 @@ declare let window: any;
pluginRef: 'nfc',
repo: 'https://github.com/chariotsolutions/phonegap-nfc'
})
@Injectable()
export class NFC {
/**
* Registers an event listener for any NDEF tag.
@@ -43,7 +49,7 @@ export class NFC {
clearFunction: 'removeNdefListener',
clearWithArgs: true
})
static addNdefListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
addNdefListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
/**
* Registers an event listener for tags matching any tag type.
@@ -58,7 +64,7 @@ export class NFC {
clearFunction: 'removeTagDiscoveredListener',
clearWithArgs: true
})
static addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
/**
* Registers an event listener for NDEF tags matching a specified MIME type.
@@ -74,7 +80,7 @@ export class NFC {
clearFunction: 'removeMimeTypeListener',
clearWithArgs: true
})
static addMimeTypeListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
addMimeTypeListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
/**
* Registers an event listener for formatable NDEF tags.
@@ -87,7 +93,7 @@ export class NFC {
successIndex: 0,
errorIndex: 3
})
static addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable<any> {return; }
/**
* Qrites an NdefMessage to a NFC tag.
@@ -95,13 +101,13 @@ export class NFC {
* @returns {Promise<any>}
*/
@Cordova()
static write(message: any[]): Promise<any> {return; }
write(message: any[]): Promise<any> {return; }
/**
* Makes a NFC tag read only. **Warning** this is permanent.
* @returns {Promise<any>}
*/
@Cordova()
static makeReadyOnly(): Promise<any> {return; }
makeReadyOnly(): Promise<any> {return; }
/**
* Shares an NDEF Message via peer-to-peer.
@@ -109,20 +115,20 @@ export class NFC {
* @returns {Promise<any>}
*/
@Cordova()
static share(message: any[]): Promise<any> {return; }
share(message: any[]): Promise<any> {return; }
/**
* Stop sharing NDEF data via peer-to-peer.
* @returns {Promise<any>}
*/
@Cordova()
static unshare(): Promise<any> {return; }
unshare(): Promise<any> {return; }
/**
* Erase a NDEF tag
*/
@Cordova()
static erase(): Promise<any> {return; }
erase(): Promise<any> {return; }
/**
* Send a file to another device via NFC handover.
@@ -130,77 +136,71 @@ export class NFC {
* @returns {Promise<any>}
*/
@Cordova()
static handover(uris: string[]): Promise<any> {return; }
handover(uris: string[]): Promise<any> {return; }
/**
* Stop sharing NDEF data via NFC handover.
* @returns {Promise<any>}
*/
@Cordova()
static stopHandover(): Promise<any> {return; }
stopHandover(): Promise<any> {return; }
/**
* Show the NFC settings on the device.
* @returns {Promise<any>}
*/
@Cordova()
static showSettings(): Promise<any> {return; }
showSettings(): Promise<any> {return; }
/**
* Check if NFC is available and enabled on this device.
* @returns {Promise<any>}
*/
@Cordova()
static enabled(): Promise<any> {return; }
enabled(): Promise<any> {return; }
/**
* Convert bytes to string
* @param bytes {number[]}
* @returns {string}
*/
@Cordova({ sync: true })
static bytesToString(bytes: number[]): string {return; }
bytesToString(bytes: number[]): string {return; }
/**
* Convert string to bytes
* @param str {string}
* @returns {number[]}
*/
@Cordova({ sync: true })
static stringToBytes(str: string): number[] {return; };
stringToBytes(str: string): number[] {return; };
/**
* Convert bytes to hex string
* @param bytes {number[]}
* @returns {string}
*/
@Cordova({ sync: true })
static bytesToHexString(bytes: number[]): string {return; };
bytesToHexString(bytes: number[]): string {return; };
}
/**
* @private
* @hidden
*/
@Injectable()
@Plugin({
pluginName: 'NFC',
plugin: 'phonegap-nfc',
pluginRef: 'ndef'
})
export class Ndef {
/**
* @private
*/
static pluginName = 'NFC';
/**
* @private
*/
static plugin = 'phonegap-nfc';
/**
* @private
*/
static pluginRef = 'ndef';
@Cordova({ sync: true })
static uriRecord(uri: string): any { return; }
uriRecord(uri: string): any { return; }
@Cordova({ sync: true })
static textRecord(text: string): any { return; }
textRecord(text: string): any { return; }
@Cordova({ sync: true })
static mimeMediaRecord(mimeType: string, payload: string): any { return; }
mimeMediaRecord(mimeType: string, payload: string): any { return; }
@Cordova({ sync: true })
static androidApplicationRecord(packageName: string): any { return; }
androidApplicationRecord(packageName: string): any { return; }
}
@@ -1,4 +1,5 @@
import { Cordova, Plugin } from './plugin';
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface OSNotification {
@@ -269,21 +270,25 @@ export enum OSActionType {
*
* @usage
* ```typescript
* import { OneSignal } from 'ionic-native';
* import { OneSignal } from '@ionic-native/onesignal';
*
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
* constructor(private oneSignal: OneSignal) { }
*
* OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
* ...
*
* OneSignal.handleNotificationReceived().subscribe(() => {
* this.oneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
*
* this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);
*
* this.oneSignal.handleNotificationReceived().subscribe(() => {
* // do something when notification is received
* });
*
* OneSignal.handleNotificationOpened().subscribe(() => {
* this.oneSignal.handleNotificationOpened().subscribe(() => {
* // do something when a notification is opened
* });
*
* OneSignal.endInit();
* this.oneSignal.endInit();
* ```
* @interfaces
* OSNotification
@@ -302,12 +307,13 @@ export enum OSActionType {
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
platforms: ['Android', 'iOS', 'Windows', 'FireOS']
})
@Injectable()
export class OneSignal {
/**
* constants to use in inFocusDisplaying()
*/
static OSInFocusDisplayOption = {
OSInFocusDisplayOption = {
None: 0,
InAppAlert : 1,
Notification : 2
@@ -321,7 +327,7 @@ export class OneSignal {
* @returns {any}
*/
@Cordova({ sync: true })
static startInit(appId: string, googleProjectNumber?: string): any { return; }
startInit(appId: string, googleProjectNumber?: string): any { return; }
/**
* Callback to run when a notification is received, whether it was displayed or not.
@@ -331,7 +337,7 @@ export class OneSignal {
@Cordova({
observable: true
})
static handleNotificationReceived(): Observable<OSNotification> { return; }
handleNotificationReceived(): Observable<OSNotification> { return; }
/**
* Callback to run when a notification is tapped on from the notification shade (**ANDROID**) or notification
@@ -343,7 +349,7 @@ export class OneSignal {
@Cordova({
observable: true
})
static handleNotificationOpened(): Observable<OSNotificationOpenedResult> { return; }
handleNotificationOpened(): Observable<OSNotificationOpenedResult> { return; }
/**
* **iOS** - Settings for iOS apps
@@ -357,7 +363,7 @@ export class OneSignal {
* @returns {any}
*/
@Cordova({ sync: true })
static iOSSettings(settings: {
iOSSettings(settings: {
kOSSettingsKeyAutoPrompt: boolean;
kOSSettingsKeyInAppLaunchURL: boolean;
}): any { return; }
@@ -368,7 +374,7 @@ export class OneSignal {
* @returns {any}
*/
@Cordova({ sync: true })
static endInit(): any { return; }
endInit(): any { return; }
/**
* Retrieve a list of tags that have been set on the user from the OneSignal server.
@@ -376,7 +382,7 @@ export class OneSignal {
* @returns {Promise<any>} Returns a Promise that resolves when tags are recieved.
*/
@Cordova()
static getTags(): Promise<any> { return; }
getTags(): Promise<any> { return; }
/**
* Lets you retrieve the OneSignal user id and device token.
@@ -389,7 +395,7 @@ export class OneSignal {
* pushToken {string} A push token is a Google/Apple assigned identifier(unique per device per app).
*/
@Cordova()
static getIds(): Promise<{userId: string; pushToken: string}> { return; }
getIds(): Promise<{userId: string; pushToken: string}> { return; }
/**
@@ -400,7 +406,7 @@ export class OneSignal {
* @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
*/
@Cordova({ sync: true })
static sendTag(key: string, value: string): void { }
sendTag(key: string, value: string): void { }
/**
* Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
@@ -409,7 +415,7 @@ export class OneSignal {
* @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
*/
@Cordova({ sync: true })
static sendTags(json: any): void { }
sendTags(json: any): void { }
/**
* Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
@@ -417,7 +423,7 @@ export class OneSignal {
* @param {string} Key to remove.
*/
@Cordova({ sync: true })
static deleteTag(key: string): void { }
deleteTag(key: string): void { }
/**
* Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
@@ -425,14 +431,14 @@ export class OneSignal {
* @param {Array<string>} Keys to remove.
*/
@Cordova({ sync: true })
static deleteTags(keys: string[]): void { }
deleteTags(keys: string[]): void { }
/**
* Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
* Only works if you set `kOSSettingsAutoPrompt` to `false` in `iOSSettings`
*/
@Cordova({ sync: true })
static registerForPushNotifications(): void { }
registerForPushNotifications(): void { }
/**
* Warning:
@@ -444,7 +450,7 @@ export class OneSignal {
* @param {boolean} false to disable vibrate, true to re-enable it.
*/
@Cordova({ sync: true })
static enableVibrate(enable: boolean): void { }
enableVibrate(enable: boolean): void { }
/**
* Warning:
@@ -456,7 +462,7 @@ export class OneSignal {
* @param {boolean} false to disable sound, true to re-enable it.
*/
@Cordova({ sync: true })
static enableSound(enable: boolean): void { }
enableSound(enable: boolean): void { }
/**
*
@@ -466,7 +472,7 @@ export class OneSignal {
* @returns {any}
*/
@Cordova({ sync: true })
static inFocusDisplaying(displayOption: OSDisplayType): any { return; }
inFocusDisplaying(displayOption: OSDisplayType): any { return; }
/**
* You can call this method with false to opt users out of receiving all notifications through OneSignal.
@@ -475,7 +481,7 @@ export class OneSignal {
* @param {boolean} enable
*/
@Cordova({ sync: true })
static setSubscription(enable: boolean): void { }
setSubscription(enable: boolean): void { }
/**
*
@@ -483,20 +489,20 @@ export class OneSignal {
* @returns {Promise<any>} Returns a Promise that resolves if the notification was send successfully.
*/
@Cordova()
static postNotification(notificationObj: OSNotification): Promise<any> { return; }
postNotification(notificationObj: OSNotification): Promise<any> { return; }
/**
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
*/
@Cordova({ sync: true })
static promptLocation(): void { }
promptLocation(): void { }
/**
*
* @param email {string}
*/
@Cordova({ sync: true })
static syncHashedEmail(email: string): void { }
syncHashedEmail(email: string): void { }
/**
* Enable logging to help debug if you run into an issue setting up OneSignal.
@@ -507,7 +513,7 @@ export class OneSignal {
* @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
*/
@Cordova({ sync: true })
static setLogLevel(logLevel: {
setLogLevel(logLevel: {
logLevel: number,
visualLevel: number
}): void { }
@@ -1,4 +1,5 @@
import { Plugin, Cordova } from './plugin';
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
/**
* @name PayPal
* @description
@@ -6,19 +7,24 @@ import { Plugin, Cordova } from './plugin';
*
* @usage
* ```
* import {PayPal, PayPalPayment, PayPalConfiguration} from "ionic-native";
* import { PayPal, PayPalPayment, PayPalConfiguration } from '@ionic-native/pay-pal';
*
* PayPal.init({
* "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
* "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
* constructor(private payPal: PayPal) { }
*
* ...
*
*
* this.payPal.init({
* PayPalEnvironmentProduction: "YOUR_PRODUCTION_CLIENT_ID",
* PayPalEnvironmentSandbox: "YOUR_SANDBOX_CLIENT_ID"
* }).then(() => {
* // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
* PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
* this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
* // Only needed if you get an "Internal Service Error" after PayPal login!
* //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
* })).then(() => {
* let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
* PayPal.renderSinglePaymentUI(payment).then(() => {
* this.payPal.renderSinglePaymentUI(payment).then(() => {
* // Successfully paid
*
* // Example sandbox response
@@ -63,13 +69,14 @@ import { Plugin, Cordova } from './plugin';
pluginRef: 'PayPalMobile',
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
})
@Injectable()
export class PayPal {
/**
* Retrieve the version of the PayPal iOS SDK library. Useful when contacting support.
* @returns {Promise<string>}
*/
@Cordova()
static version(): Promise<string> {return; }
version(): Promise<string> {return; }
/**
* You must preconnect to PayPal to prepare the device for processing payments.
@@ -81,7 +88,7 @@ export class PayPal {
* @returns {Promise<any>}
*/
@Cordova()
static init(clientIdsForEnvironments: PayPalEnvironment): Promise<any> {return; }
init(clientIdsForEnvironments: PayPalEnvironment): Promise<any> {return; }
/**
* You must preconnect to PayPal to prepare the device for processing payments.
@@ -93,7 +100,7 @@ export class PayPal {
* @returns {Promise<any>}
*/
@Cordova()
static prepareToRender(environment: string, configuration: PayPalConfiguration): Promise<any> {return; }
prepareToRender(environment: string, configuration: PayPalConfiguration): Promise<any> {return; }
/**
* Start PayPal UI to collect payment from the user.
@@ -104,7 +111,7 @@ export class PayPal {
* @returns {Promise<any>}
*/
@Cordova()
static renderSinglePaymentUI(payment: PayPalPayment): Promise<any> {return; }
renderSinglePaymentUI(payment: PayPalPayment): Promise<any> {return; }
/**
* Once a user has consented to future payments, when the user subsequently initiates a PayPal payment
@@ -117,14 +124,14 @@ export class PayPal {
* @returns {Promise<any>}
*/
@Cordova()
static clientMetadataID(): Promise<any> {return; }
clientMetadataID(): Promise<any> {return; }
/**
* Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments
* @returns {Promise<any>}
*/
@Cordova()
static renderFuturePaymentUI(): Promise<any> {return; }
renderFuturePaymentUI(): Promise<any> {return; }
/**
* Please Read Docs on Profile Sharing at https://github.com/paypal/PayPal-iOS-SDK#profile-sharing
@@ -134,7 +141,7 @@ export class PayPal {
* @returns {Promise<any>}
*/
@Cordova()
static renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
renderProfileSharingUI(scopes: string[]): Promise<any> {return; }
}
export interface PayPalEnvironment {
@@ -143,7 +150,7 @@ export interface PayPalEnvironment {
}
/**
* @private
* @hidden
*/
export class PayPalPayment {
constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) {
@@ -207,7 +214,7 @@ export class PayPalPayment {
}
/**
* @private
* @hidden
*/
export class PayPalItem {
/**
@@ -250,7 +257,7 @@ export class PayPalItem {
}
/**
* @private
* @hidden
*/
export class PayPalPaymentDetails {
/**
@@ -279,7 +286,7 @@ export class PayPalPaymentDetails {
}
/**
* @private
* @hidden
*/
export interface PayPalConfigurationOptions {
/**
@@ -377,7 +384,7 @@ export interface PayPalConfigurationOptions {
sandboxUserPin?: string;
}
/**
* @private
* @hidden
*/
export class PayPalConfiguration implements PayPalConfigurationOptions {
/**
@@ -417,7 +424,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
}
/**
* @private
* @hidden
*/
export class PayPalShippingAddress {
/**
@@ -1,10 +1,10 @@
import { Plugin, Cordova } from './plugin';
import { Plugin, Cordova } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
/**
* Interface of a pedometer data object which is returned by watching for new data or by recieving historical data
*/
export interface IPedometerData {
startDate?: number;
endDate?: number;
@@ -17,7 +17,7 @@ export interface IPedometerData {
/**
* @name Pedometer
* @description
* Fetch pedestrian-related pedometer data,
* Fetch pedestrian-related pedometer data,
* such as step counts and other information about the distance travelled.
*
* @usage
@@ -41,6 +41,7 @@ export interface IPedometerData {
repo: 'https://github.com/leecrossley/cordova-plugin-pedometer',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Pedometer {
/**
@@ -48,7 +49,7 @@ export class Pedometer {
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isStepCountingAvailable(): Promise<boolean> { return; }
isStepCountingAvailable(): Promise<boolean> { return; }
/**
* Distance estimation indicates the ability to use step information to supply the approximate distance travelled by the user.
@@ -57,7 +58,7 @@ export class Pedometer {
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isDistanceAvailable(): Promise<boolean> { return; }
isDistanceAvailable(): Promise<boolean> { return; }
/**
* Floor counting indicates the ability to count the number of floors the user walks up or down using stairs.
@@ -66,12 +67,12 @@ export class Pedometer {
* @return {Promise<boolean>} Returns a promise that resolves when feature is supported (true) or not supported (false)
*/
@Cordova()
static isFloorCountingAvailable(): Promise<boolean> { return; }
isFloorCountingAvailable(): Promise<boolean> { return; }
/**
* Starts the delivery of recent pedestrian-related data to your Cordova app.
*
* When the app is suspended, the delivery of updates stops temporarily.
*
* When the app is suspended, the delivery of updates stops temporarily.
* Upon returning to foreground or background execution, the pedometer object begins updates again.
* @return {Observable<IPedometerData>} Returns a Observable that recieves repeatly data from pedometer in background.
*/
@@ -79,18 +80,18 @@ export class Pedometer {
observable: true,
clearFunction: 'stopPedometerUpdates'
})
static startPedometerUpdates(): Observable<IPedometerData> { return; }
startPedometerUpdates(): Observable<IPedometerData> { return; }
/**
* Stops the delivery of recent pedestrian data updates to your Cordova app.
* @return {Promise<boolean>} Returns a promise that resolves when pedometer watching was stopped
*/
@Cordova()
static stopPedometerUpdates(): Promise<any> { return; }
stopPedometerUpdates(): Promise<any> { return; }
/**
* Retrieves the data between the specified start and end dates.
* The startDate and endDate options are required and can be constructed in any valid JavaScript way
* The startDate and endDate options are required and can be constructed in any valid JavaScript way
* (e.g. new Date(2015, 4, 1, 15, 20, 00) is also valid, as is milliseconds).
* Only works on iOS.
* @param {any} options start date and en date where you want to get pedometer data
@@ -99,5 +100,6 @@ export class Pedometer {
@Cordova({
callbackOrder: 'reverse'
})
static queryData(options: { startDate: Date, endDate: Date }): Promise<IPedometerData> { return; }
queryData(options: { startDate: Date, endDate: Date }): Promise<IPedometerData> { return; }
}
@@ -1,8 +1,9 @@
import { Plugin, Cordova, CordovaFiniteObservable } from './plugin';
import { Plugin, Cordova, CordovaFiniteObservable } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
/**
* @name PhotoLibrary
* @name Photo Library
* @description
* The PhotoLibrary plugin allows access to photos from device by url. So you can use plain img tag to display photos and their thumbnails, and different 3rd party libraries as well.
* Saving photos and videos to the library is also supported.
@@ -10,10 +11,12 @@ import { Observable } from 'rxjs/Observable';
*
* @usage
* ```
* import { PhotoLibrary } from 'ionic-native';
* import { PhotoLibrary } from '@ionic-native/photo-library';
*
* PhotoLibrary.requestAuthorization().then(() => {
* PhotoLibrary.getLibrary().subscribe({
* constructor(private photoLibrary: PhotoLibrary) { }
*
* this.photoLibrary.requestAuthorization().then(() => {
* this.photoLibrary.getLibrary().subscribe({
* next: library => {
* library.forEach(function(libraryItem) {
* console.log(libraryItem.id); // ID of the photo
@@ -43,6 +46,7 @@ import { Observable } from 'rxjs/Observable';
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"'
})
@Injectable()
export class PhotoLibrary {
/**
@@ -55,7 +59,7 @@ export class PhotoLibrary {
resultFinalPredicate: (result: {isLastChunk: boolean}) => { return result.isLastChunk; },
resultTransform: (result: {library: LibraryItem[]}) => { return result.library; },
})
static getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> { return; }
getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> { return; }
/**
* Asks user permission to access photo library.
@@ -65,7 +69,7 @@ export class PhotoLibrary {
@Cordova({
callbackOrder: 'reverse',
})
static requestAuthorization(options?: RequestAuthorizationOptions): Promise<void> { return; }
requestAuthorization(options?: RequestAuthorizationOptions): Promise<void> { return; }
/**
* Returns list of photo albums on device.
@@ -74,7 +78,7 @@ export class PhotoLibrary {
@Cordova({
callbackOrder: 'reverse',
})
static getAlbums(): Promise<AlbumItem[]> { return; }
getAlbums(): Promise<AlbumItem[]> { return; }
/**
* Provides means to request URL of thumbnail, with specified size or quality.
@@ -86,7 +90,7 @@ export class PhotoLibrary {
successIndex: 1,
errorIndex: 2
})
static getThumbnailURL(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<string> { return; }
getThumbnailURL(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<string> { return; }
/**
* Provides means to request photo URL by id.
@@ -98,7 +102,7 @@ export class PhotoLibrary {
successIndex: 1,
errorIndex: 2
})
static getPhotoURL(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<string> { return; }
getPhotoURL(photo: string | LibraryItem, options?: any): Promise<string> { return; }
/**
* Returns thumbnail as Blob.
@@ -110,7 +114,7 @@ export class PhotoLibrary {
successIndex: 1,
errorIndex: 2
})
static getThumbnail(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<Blob> { return; }
getThumbnail(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise<Blob> { return; }
/**
* Returns photo as Blob.
@@ -122,7 +126,7 @@ export class PhotoLibrary {
successIndex: 1,
errorIndex: 2
})
static getPhoto(photo: string | LibraryItem, options?: GetPhotoOptions): Promise<Blob> { return; }
getPhoto(photo: string | LibraryItem, options?: any): Promise<Blob> { return; }
/**
* Saves image to specified album. Album will be created if not exists.
@@ -136,7 +140,7 @@ export class PhotoLibrary {
successIndex: 2,
errorIndex: 3
})
static saveImage(url: string, album: AlbumItem | string, options?: GetThumbnailOptions): Promise<LibraryItem> { return; }
saveImage(url: string, album: AlbumItem | string, options?: GetThumbnailOptions): Promise<LibraryItem> { return; }
/**
* Saves video to specified album. Album will be created if not exists.
@@ -148,10 +152,13 @@ export class PhotoLibrary {
successIndex: 2,
errorIndex: 3
})
static saveVideo(url: string, album: AlbumItem | string): Promise<void> { return; }
saveVideo(url: string, album: AlbumItem | string): Promise<void> { return; }
}
/**
* @hidden
*/
export interface LibraryItem {
/**
* Local id of the photo
@@ -174,6 +181,9 @@ export interface LibraryItem {
albumIds?: string[];
}
/**
* @hidden
*/
export interface AlbumItem {
/**
* Local id of the album
@@ -182,6 +192,9 @@ export interface AlbumItem {
title: string;
}
/**
* @hidden
*/
export interface GetLibraryOptions {
thumbnailWidth?: number;
thumbnailHeight?: number;
@@ -192,16 +205,19 @@ export interface GetLibraryOptions {
includeAlbumData?: boolean;
}
/**
* @hidden
*/
export interface RequestAuthorizationOptions {
read?: boolean;
write?: boolean;
}
/**
* @hidden
*/
export interface GetThumbnailOptions {
thumbnailWidth?: number;
thumbnailHeight?: number;
quality?: number;
}
export interface GetPhotoOptions {
}

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