mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2d33963b1 | ||
|
|
332f9aefe5 | ||
|
|
4942b88873 | ||
|
|
39ec5158a0 | ||
|
|
c11aec33a7 | ||
|
|
21045ea535 | ||
|
|
955c450483 | ||
|
|
00c0707dad | ||
|
|
79f88d6a02 | ||
|
|
ce5966bf10 | ||
|
|
fb8dbe5fc0 | ||
|
|
cde87e2113 | ||
|
|
262e18f409 | ||
|
|
39ef066875 | ||
|
|
35d317f7f3 | ||
|
|
5505e5f064 | ||
|
|
e6b0250d97 | ||
|
|
aa4c3b3787 | ||
|
|
57bbcdebfb | ||
|
|
85825c7b91 | ||
|
|
1acade4883 | ||
|
|
7c1b409542 | ||
|
|
fe02c84fd9 | ||
|
|
a2cc1870b4 | ||
|
|
1c6a3a3bc5 | ||
|
|
0c097ba2be | ||
|
|
0dd507ff03 | ||
|
|
9ab458bba2 | ||
|
|
7e900dae22 | ||
|
|
0fa82e5c56 | ||
|
|
4af3d5bcc1 | ||
|
|
976401a4e9 | ||
|
|
6230958585 | ||
|
|
47fa44c932 | ||
|
|
f1dd8d61f5 | ||
|
|
3d387798b6 | ||
|
|
380eb88a39 | ||
|
|
6e2c998dad | ||
|
|
7105048b89 | ||
|
|
6061af6238 | ||
|
|
1decedd899 | ||
|
|
b5fe6631fe | ||
|
|
25c1cf4058 | ||
|
|
b265b5bd0c | ||
|
|
238e2ab26c | ||
|
|
146c823f2a | ||
|
|
1b55513bc4 | ||
|
|
953841681c | ||
|
|
76a45a3834 | ||
|
|
eff9bc376c | ||
|
|
b9993c24f0 | ||
|
|
9752c865fc | ||
|
|
4c4cf76f7a | ||
|
|
70cbcbf1e9 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,5 @@ node_modules/
|
||||
.idea
|
||||
.tmp
|
||||
aot/
|
||||
dist/
|
||||
scripts/ionic-native-bower
|
||||
dist/
|
||||
|
||||
36
CHANGELOG.md
36
CHANGELOG.md
@@ -1,3 +1,39 @@
|
||||
<a name="4.1.0"></a>
|
||||
# [4.1.0](https://github.com/ionic-team/ionic-native/compare/v4.0.1...v4.1.0) (2017-07-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **media:** add setRate method ([4af3d5b](https://github.com/ionic-team/ionic-native/commit/4af3d5b)), closes [#1825](https://github.com/ionic-team/ionic-native/issues/1825)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **firebase:** add unregister method ([#1823](https://github.com/ionic-team/ionic-native/issues/1823)) ([6230958](https://github.com/ionic-team/ionic-native/commit/6230958))
|
||||
* **google-maps:** add missing features and fix wrong definitions ([#1815](https://github.com/ionic-team/ionic-native/issues/1815)) ([976401a](https://github.com/ionic-team/ionic-native/commit/976401a))
|
||||
* **hyper-track:** add HyperTrack plugin ([#1816](https://github.com/ionic-team/ionic-native/issues/1816)) ([47fa44c](https://github.com/ionic-team/ionic-native/commit/47fa44c))
|
||||
* **open-native-settings:** add Open Native Settings plugin ([0fa82e5](https://github.com/ionic-team/ionic-native/commit/0fa82e5)), closes [#1821](https://github.com/ionic-team/ionic-native/issues/1821)
|
||||
|
||||
|
||||
|
||||
<a name="4.0.1"></a>
|
||||
## [4.0.1](https://github.com/ionic-team/ionic-native/compare/v4.0.0...v4.0.1) (2017-07-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **media:** fix success/error/statusUpdate observables ([7105048](https://github.com/ionic-team/ionic-native/commit/7105048)), closes [#1806](https://github.com/ionic-team/ionic-native/issues/1806)
|
||||
* **social-sharing:** fix issues caused by omitting optional params ([25c1cf4](https://github.com/ionic-team/ionic-native/commit/25c1cf4)), closes [#1805](https://github.com/ionic-team/ionic-native/issues/1805)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **camera:** add enums for camera options ([6061af6](https://github.com/ionic-team/ionic-native/commit/6061af6))
|
||||
* **launch-navigator:** update plugin wrapper to support v4 ([9538416](https://github.com/ionic-team/ionic-native/commit/9538416)), closes [#1738](https://github.com/ionic-team/ionic-native/issues/1738)
|
||||
* **media:** add MEDIA_STATUS and MEDIA_ERROR enums ([1decedd](https://github.com/ionic-team/ionic-native/commit/1decedd))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
# [4.0.0](https://github.com/ionic-team/ionic-native/compare/v3.14.0...v4.0.0) (2017-07-11)
|
||||
|
||||
|
||||
3572
package-lock.json
generated
3572
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.0",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
|
||||
2
scripts/docs/templates/common.template.html
vendored
2
scripts/docs/templates/common.template.html
vendored
@@ -186,7 +186,7 @@ docType: "<$ doc.docType $>"
|
||||
<h2><a class="anchor" name="installation" href="#installation"></a>Installation</h2>
|
||||
<ol class="installation">
|
||||
<li>Install the Cordova and Ionic Native plugins:<br>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install | replace('<', '<').replace('>', '>') $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
</li>
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'core-js';
|
||||
import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators';
|
||||
import { IonicNativePlugin } from './ionic-native-plugin';
|
||||
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare const window: any;
|
||||
|
||||
@@ -47,6 +48,17 @@ class TestPlugin extends IonicNativePlugin {
|
||||
return new TestObject(TestPlugin.getPlugin().create());
|
||||
}
|
||||
|
||||
@Cordova({
|
||||
destruct: true
|
||||
})
|
||||
destructPromise(): Promise<any> { return; }
|
||||
|
||||
@Cordova({
|
||||
destruct: true,
|
||||
observable: true
|
||||
})
|
||||
destructObservable(): Observable<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
function definePlugin() {
|
||||
@@ -59,7 +71,9 @@ function definePlugin() {
|
||||
this.ping = (success: Function, error: Function) => success('pong');
|
||||
this.name = 'John Smith';
|
||||
return this;
|
||||
}
|
||||
},
|
||||
destructPromise: (success: Function) => success('hello', 'world'),
|
||||
destructObservable: (success: Function) => success('hello', 'world')
|
||||
};
|
||||
}
|
||||
|
||||
@@ -177,6 +191,30 @@ describe('Regular Decorators', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('CordovaOptions', () => {
|
||||
|
||||
describe('destruct', () => {
|
||||
|
||||
it('should destruct values returned by a Promise', (done) => {
|
||||
plugin.destructPromise()
|
||||
.then((args: any[]) => {
|
||||
expect(args).toEqual(['hello', 'world']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should destruct values returned by an Observable', (done) => {
|
||||
plugin.destructObservable()
|
||||
.subscribe((args: any[]) => {
|
||||
expect(args).toEqual(['hello', 'world']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Instance Decorators', () => {
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface PluginConfig {
|
||||
}
|
||||
|
||||
export interface CordovaOptions {
|
||||
destruct?: boolean;
|
||||
/**
|
||||
* Set to true if the wrapped method is a sync function
|
||||
*/
|
||||
@@ -252,7 +253,7 @@ export function Cordova(opts: CordovaOptions = {}) {
|
||||
*
|
||||
* Wrap an instance method
|
||||
*/
|
||||
export function CordovaInstance(opts: any = {}) {
|
||||
export function CordovaInstance(opts: CordovaOptions = {}) {
|
||||
return (target: Object, methodName: string) => {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
|
||||
69
src/@ionic-native/core/ionic-native-plugin.spec.ts
Normal file
69
src/@ionic-native/core/ionic-native-plugin.spec.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
// This is to verify that new (FileTransfer.getPlugin)() works
|
||||
|
||||
import { Plugin, CordovaInstance } from './decorators';
|
||||
import { checkAvailability } from './plugin';
|
||||
import { IonicNativePlugin } from './ionic-native-plugin';
|
||||
|
||||
class FT {
|
||||
hello(): string {
|
||||
return 'world';
|
||||
}
|
||||
}
|
||||
|
||||
(window as any).FileTransfer = () => new FT();
|
||||
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginRef: 'FileTransfer',
|
||||
repo: '',
|
||||
pluginName: 'FileTransfer'
|
||||
})
|
||||
export class FileTransfer extends IonicNativePlugin {
|
||||
create(): FileTransferObject {
|
||||
let instance: any;
|
||||
if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
|
||||
instance = new (FileTransfer.getPlugin())();
|
||||
}
|
||||
return new FileTransferObject(instance);
|
||||
}
|
||||
}
|
||||
|
||||
export class FileTransferObject {
|
||||
|
||||
constructor(public _objectInstance: any) {
|
||||
console.info('Creating a new FileTransferObject with instance: ', _objectInstance);
|
||||
}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
hello(): string { return; }
|
||||
|
||||
}
|
||||
|
||||
describe('Mock FileTransfer Plugin', () => {
|
||||
|
||||
let plugin: FileTransfer,
|
||||
instance: FileTransferObject;
|
||||
|
||||
beforeAll(() => {
|
||||
plugin = new FileTransfer();
|
||||
instance = plugin.create();
|
||||
});
|
||||
|
||||
it('should create a new FileTransfer plugin instance', () => {
|
||||
expect(plugin instanceof FileTransfer).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should create new FileTransferObject instance', () => {
|
||||
expect(instance instanceof FileTransferObject).toBeTruthy();
|
||||
});
|
||||
|
||||
it('FileTransferObject instance should have _objectInstance property', () => {
|
||||
expect(instance._objectInstance).toBeDefined();
|
||||
});
|
||||
|
||||
it('FileTransferObject.hello should return world', () => {
|
||||
console.info('instance hello is', instance.hello());
|
||||
expect(instance.hello()).toEqual('world');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -136,7 +136,11 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
if (opts.destruct) {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
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
|
||||
@@ -166,7 +170,14 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts:
|
||||
|
||||
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));
|
||||
let pluginResult;
|
||||
|
||||
if (opts.destruct) {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
|
||||
} else {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
|
||||
if (pluginResult && pluginResult.error) {
|
||||
observer.error(pluginResult.error);
|
||||
observer.complete();
|
||||
@@ -266,7 +277,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
} else if (opts.observable) {
|
||||
|
||||
return new Observable(observer => {
|
||||
let pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
|
||||
let pluginResult;
|
||||
|
||||
if (opts.destruct) {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => observer.next(args), (...args: any[]) => observer.error(args));
|
||||
} else {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
|
||||
if (pluginResult && pluginResult.error) {
|
||||
observer.error(pluginResult.error);
|
||||
@@ -287,9 +305,13 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
});
|
||||
|
||||
} else if (opts.otherPromise) {
|
||||
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
let result;
|
||||
if (opts.destruct) {
|
||||
result = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
}
|
||||
if (result && !!result.then) {
|
||||
result.then(resolve, reject);
|
||||
} else {
|
||||
@@ -298,8 +320,24 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
});
|
||||
|
||||
} else {
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
if (opts.destruct) {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, (...args: any[]) => resolve(args), (...args: any[]) => reject(args));
|
||||
} else {
|
||||
pluginResult = callInstance(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(() => { });
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
|
||||
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaProperty, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface ActionSheetOptions {
|
||||
|
||||
@@ -99,13 +99,21 @@ export interface ActionSheetOptions {
|
||||
@Injectable()
|
||||
export class ActionSheet extends IonicNativePlugin {
|
||||
|
||||
@CordovaProperty
|
||||
/**
|
||||
* Convenience property to select an Android theme value
|
||||
*/
|
||||
ANDROID_THEMES: {
|
||||
THEME_TRADITIONAL: number;
|
||||
THEME_HOLO_DARK: number;
|
||||
THEME_HOLO_LIGHT: number;
|
||||
THEME_DEVICE_DEFAULT_DARK: number;
|
||||
THEME_DEVICE_DEFAULT_LIGHT: number;
|
||||
} = {
|
||||
THEME_TRADITIONAL: 1,
|
||||
THEME_HOLO_DARK: 2,
|
||||
THEME_HOLO_LIGHT: 3,
|
||||
THEME_DEVICE_DEFAULT_DARK: 4,
|
||||
THEME_DEVICE_DEFAULT_LIGHT: 5
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
|
||||
* success => console.log('Permission granted'),
|
||||
* err => this.androidPermissions.requestPermissions(this.androidPermissions.PERMISSION.CAMERA)
|
||||
* err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
|
||||
* );
|
||||
*
|
||||
* this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
|
||||
|
||||
@@ -264,7 +264,7 @@ export interface BackgroundGeolocationConfig {
|
||||
* 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, BackgroundGeolocationConfig } from '@ionic-native/background-geolocation';
|
||||
* import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation';
|
||||
*
|
||||
* constructor(private backgroundGeolocation: BackgroundGeolocation) { }
|
||||
*
|
||||
|
||||
@@ -19,14 +19,14 @@ export interface BackgroundModeConfiguration {
|
||||
text?: String;
|
||||
|
||||
/**
|
||||
* This will look for <icon name>.png in platforms/android/res/drawable|mipmap
|
||||
* This will look for `<icon name>.png` in platforms/android/res/drawable|mipmap
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
color?: string;
|
||||
|
||||
/**
|
||||
* By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
|
||||
* By default the app will come to foreground when taping on the notification. If false, plugin won't come to foreground when tapped.
|
||||
*/
|
||||
resume?: boolean;
|
||||
|
||||
@@ -50,7 +50,7 @@ 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
|
||||
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode
|
||||
*@usage
|
||||
* ```typescript
|
||||
* import { BackgroundMode } from '@ionic-native/background-mode';
|
||||
@@ -179,7 +179,7 @@ export class BackgroundMode extends IonicNativePlugin {
|
||||
overrideBackButton(): void { }
|
||||
|
||||
/**
|
||||
* Exclude the app from the recent task list works on Android 5.0+.
|
||||
* Exclude the app from the recent task list. Works on Android 5.0+.
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['Android'],
|
||||
|
||||
@@ -85,6 +85,42 @@ export interface CameraPopoverOptions {
|
||||
arrowDir: number;
|
||||
}
|
||||
|
||||
export enum DestinationType {
|
||||
DATA_URL = 0,
|
||||
FILE_URL,
|
||||
NATIVE_URI
|
||||
}
|
||||
|
||||
export enum EncodingType {
|
||||
JPEG = 0,
|
||||
PNG
|
||||
}
|
||||
|
||||
export enum MediaType {
|
||||
PICTURE = 0,
|
||||
VIDEO,
|
||||
ALLMEDIA
|
||||
}
|
||||
|
||||
export enum PictureSourceType {
|
||||
PHOTOLIBRARY = 0,
|
||||
CAMERA,
|
||||
SAVEDPHOTOALBUM
|
||||
}
|
||||
|
||||
export enum PopoverArrowDirection {
|
||||
ARROW_UP = 1,
|
||||
ARROW_DOWN,
|
||||
ARROW_LEFT,
|
||||
ARROW_RIGHT,
|
||||
ARROW_ANY
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
BACK = 0,
|
||||
FRONT
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Camera
|
||||
* @description
|
||||
|
||||
@@ -133,6 +133,11 @@ export interface CardIOResponse {
|
||||
* @name Card IO
|
||||
* @description
|
||||
* @usage
|
||||
* Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the <your app name>Info.plist file. Add the following lines in the main <dict> element.
|
||||
* ```xml
|
||||
*<key>NSCameraUsageDescription</key>
|
||||
*<string>To scan credit cards.</string>
|
||||
*```
|
||||
* ```typescript
|
||||
* import { CardIO } from '@ionic-native/card-io';
|
||||
*
|
||||
@@ -147,7 +152,7 @@ export interface CardIOResponse {
|
||||
* if(res){
|
||||
* let options = {
|
||||
* requireExpiry: true,
|
||||
* requireCCV: false,
|
||||
* requireCVV: false,
|
||||
* requirePostalCode: false
|
||||
* };
|
||||
* CardIO.scan(options);
|
||||
|
||||
@@ -29,10 +29,10 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Clipboard',
|
||||
plugin: 'danielsogl-cordova-plugin-clipboard',
|
||||
plugin: 'cordova-clipboard',
|
||||
pluginRef: 'cordova.plugins.clipboard',
|
||||
repo: 'https://github.com/danielsogl/cordova-plugin-clipboard',
|
||||
platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8']
|
||||
repo: 'https://github.com/ihadeed/cordova-clipboard',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class Clipboard extends IonicNativePlugin {
|
||||
|
||||
@@ -17,6 +17,16 @@ export interface FingerprintOptions {
|
||||
* Disable 'use backup' option. Only for android (optional)
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
|
||||
/**
|
||||
* Title of fallback button. Only for iOS
|
||||
*/
|
||||
localizedFallbackTitle?: string;
|
||||
|
||||
/**
|
||||
* Description in authentication dialogue. Only for iOS
|
||||
*/
|
||||
localizedReason?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +46,9 @@ export interface FingerprintOptions {
|
||||
* this.faio.show({
|
||||
* clientId: 'Fingerprint-Demo',
|
||||
* clientSecret: 'password', //Only necessary for Android
|
||||
* disableBackup:true //Only for Android(optional)
|
||||
* disableBackup:true, //Only for Android(optional)
|
||||
* localizedFallbackTitle: 'Use Pin', //Only for iOS
|
||||
* localizedReason: 'Please authenticate' //Only for iOS
|
||||
* })
|
||||
* .then((result: any) => console.log(result))
|
||||
* .catch((error: any) => console.log(error));
|
||||
|
||||
@@ -107,6 +107,13 @@ export class Firebase extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
unsubscribe(topic: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Unregister from firebase, used to stop receiving push notifications.
|
||||
* Call this when you logout user from your app.
|
||||
*/
|
||||
@Cordova()
|
||||
unregister(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Log an event using Analytics
|
||||
* @param type {string}
|
||||
|
||||
@@ -85,7 +85,7 @@ declare const window: any;
|
||||
@Injectable()
|
||||
export class Geofence extends IonicNativePlugin {
|
||||
|
||||
public TransitionType = {
|
||||
TransitionType = {
|
||||
ENTER: 1,
|
||||
EXIT: 2,
|
||||
BOTH: 3
|
||||
@@ -96,7 +96,7 @@ export class Geofence extends IonicNativePlugin {
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@CordovaFunctionOverride()
|
||||
onTrasitionReceived(): Observable<any> { return; };
|
||||
onTransitionReceived(): Observable<any> { return; };
|
||||
|
||||
/**
|
||||
* Initializes the plugin. User will be prompted to allow the app to use location and notifications.
|
||||
@@ -139,20 +139,6 @@ export class Geofence extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
getWatched(): Promise<string> { return; };
|
||||
|
||||
/**
|
||||
* Called when a geofence is crossed in the direction specified by `TransitType`.
|
||||
*
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
onTransitionReceived(): Observable<any> {
|
||||
|
||||
return new Observable<any>((observer) => {
|
||||
window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
|
||||
return () => window.geofence.onTransitionReceived = () => { };
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user clicks a geofence notification. iOS and Android only.
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,9 +59,9 @@ export interface HTTPResponse {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'HTTP',
|
||||
plugin: 'cordova-plugin-http',
|
||||
plugin: 'cordova-plugin-advanced-http',
|
||||
pluginRef: 'cordovaHTTP',
|
||||
repo: 'https://github.com/wymsee/cordova-HTTP',
|
||||
repo: 'https://github.com/silkimen/cordova-plugin-advanced-http',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
@@ -92,6 +92,34 @@ export class HTTP extends IonicNativePlugin {
|
||||
@Cordova({ sync: true })
|
||||
setHeader(header: string, value: string): void { }
|
||||
|
||||
/**
|
||||
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
|
||||
* @param serializer {string} The name of the serializer. Can be urlencoded or json
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setDataSerializer(serializer: string): void { }
|
||||
|
||||
/**
|
||||
* Clear all cookies
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
clearCookies(): void { }
|
||||
|
||||
/**
|
||||
* Remove cookies
|
||||
* @param url {string}
|
||||
* @param cb
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
removeCookies(url: string, cb: () => void): void { }
|
||||
|
||||
/**
|
||||
* Set request timeout
|
||||
* @param timeout {number} The timeout in seconds. Default 60
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
setRequestTimeout(timeout: number): void { }
|
||||
|
||||
/**
|
||||
* Enable or disable SSL Pinning. This defaults to false.
|
||||
*
|
||||
@@ -131,7 +159,7 @@ export class HTTP extends IonicNativePlugin {
|
||||
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* Make a GET request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
@@ -140,6 +168,36 @@ export class HTTP extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a PUT request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param body {Object} The body of the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
put(url: string, body: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a DELETE request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
* Make a HEAD request
|
||||
* @param url {string} The url to send the request to
|
||||
* @param parameters {Object} Parameters to send with the request
|
||||
* @param headers {Object} The headers to set for this request
|
||||
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
|
||||
*/
|
||||
@Cordova()
|
||||
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} The url to send the request to
|
||||
|
||||
180
src/@ionic-native/plugins/hyper-track/index.ts
Normal file
180
src/@ionic-native/plugins/hyper-track/index.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name HyperTrack
|
||||
* @description
|
||||
* HyperTrack cordova plugin wrapper for Ionic Native. Location-based services provider.
|
||||
* Make sure to include your publishable key at config.xml (see [HyperTrack Cordova Setup](https://docs.hypertrack.com/sdks/cordova/setup.html#step-2-configure-the-sdk)).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { HyperTrack } from '@ionic-native/hyper-track';
|
||||
*
|
||||
* constructor(private hyperTrack: HyperTrack) { }
|
||||
*
|
||||
* // Check if app has location permissions enabled
|
||||
* this.hyperTrack.checkLocationPermission().then(response => {
|
||||
* // response (String) can be "true" or "false"
|
||||
* if (response != "true") {
|
||||
* // Ask for permissions
|
||||
* this.hyperTrack.requestPermissions().then(response => {}, error => {});
|
||||
* }
|
||||
* }, error => {});
|
||||
*
|
||||
* // Check if app has location services enabled
|
||||
* this.hyperTrack.checkLocationServices().then(response => {
|
||||
* // response (String) can be "true" or "false"
|
||||
* if (response != "true") {
|
||||
* // Request services to be enabled
|
||||
* this.hyperTrack.requestLocationServices().then(response => {}, error => {});
|
||||
* }
|
||||
* }, error => {});
|
||||
*
|
||||
* // First set the current user. This can be done via getOrCreateUser() or setUserId()
|
||||
* this.hyperTrack.setUserId("xxx").then(user => {
|
||||
* // user (String) is a String representation of a User's JSON
|
||||
*
|
||||
* this.hyperTrack.startTracking().then(userId => {}, trackingError => {});
|
||||
*
|
||||
* this.hyperTrack.createAndAssignAction('visit', 'lookupId','address', 20.12, -100.3).then(action => {
|
||||
* // Handle action. It's a String representation of the Action's JSON. For example:
|
||||
* // '{"eta":"Jul 17, 2017 12:50:03 PM","assigned_at":"Jul 17, 2017 12:34:38 PM",,"distance":"0.0",...}'
|
||||
* }, error => {});
|
||||
*
|
||||
* // You can complete an action with completeAction() or completeActionWithLookupId()
|
||||
* this.hyperTrack.completeAction('action-id').then(response => {
|
||||
* // Handle response (String). Should be "OK".
|
||||
* }, error => {});
|
||||
*
|
||||
* this.hyperTrack.getCurrentLocation().then(location => {
|
||||
* // Handle location. It's a String representation of a Location's JSON.For example:
|
||||
* // '{"mAccuracy":22.601,,"mLatitude":23.123456, "mLongitude":-100.1234567, ...}'
|
||||
* }, error => {});
|
||||
*
|
||||
* this.hyperTrack.stopTracking().then(success => {
|
||||
* // Handle success (String). Should be "OK".
|
||||
* }, error => {});
|
||||
*
|
||||
* }, error => {});*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'HyperTrack',
|
||||
plugin: 'cordova-plugin-hypertrack',
|
||||
pluginRef: 'cordova.plugins.HyperTrack',
|
||||
repo: 'https://github.com/hypertrack/hypertrack-cordova',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class HyperTrack extends IonicNativePlugin {
|
||||
/**
|
||||
* Returns given text. For testing purposes.
|
||||
* @param {String} text Given text to print
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result text (which is the same as the given text) if successful, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
helloWorld(text: String): Promise<String> { return; }
|
||||
|
||||
/**
|
||||
* Create a new user to identify the current device or get a user from a lookup id.
|
||||
* @param {String} name User's name
|
||||
* @param {String} phone User's phone
|
||||
* @param {String} photo User's photo as URL or a Base64 converted string
|
||||
* @param {String} lookupId User's lookupId, which is used to check if a new user is to be created (in this case you could set it to an internal reference for the user that you can use later to identify it), or if one with an existing lookupId is to be used.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with a string representation of the User's JSON, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
getOrCreateUser(name: String, phone: String, photo: String, lookupId: String): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Set UserId for the SDK created using HyperTrack APIs. This is useful if you already have a user previously created.
|
||||
* @param {String} userId User's ID
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with an "OK" string if successful, or it gets rejected if an error ocurred. An "OK" response doesn't necessarily mean that the userId was found. It just means that it was set correctly.
|
||||
*/
|
||||
@Cordova()
|
||||
setUserId(userId: String): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Enable the SDK and start tracking. This will fail if there is no user set.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the userId (String) of the User being tracked if successful, or it gets rejected if an error ocurred. One example of an error is not setting a User with getOrCreateUser() or setUserId() before calling this function.
|
||||
*/
|
||||
@Cordova()
|
||||
startTracking(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create and assign an action to the current user using specified parameters
|
||||
* @param {String} type The action type. Can be one from "pickup", "delivery", "dropoff", "visit", "stopover" or "task"
|
||||
* @param {String} lookupId The Action's desired lookupId
|
||||
* @param {String} expectedPlaceAddress The address of the Action
|
||||
* @param {Number} expectedPlaceLatitude The latitude of the Action
|
||||
* @param {Number} expectedPlaceLongitude The longitude of the Action
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with a string representation of the Action's JSON, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
createAndAssignAction(type: String, lookupId: String, expectedPlaceAddress: String, expectedPlaceLatitude: Number, expectedPlaceLongitude: Number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Complete an action from the SDK by its ID
|
||||
* @param {String} actionId ID of the Action that will be marked as completed
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with an "OK" string if successful, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
completeAction(actionId: String): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Complete an action from the SDK using Action's lookupId as parameter
|
||||
* @param {String} lookupId Lookup ID of the Action that will be marked as completed
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with an "OK" string if successful, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
completeActionWithLookupId(lookupId: String): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Disable the SDK and stop tracking.
|
||||
* Needs user setting (via getOrCreateUser() or setUserId()) first.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the an "OK" string if successful, or it gets rejected if an error ocurred. One example of an error is not setting a User with getOrCreateUser() or setUserId() before calling this function.
|
||||
*/
|
||||
@Cordova()
|
||||
stopTracking(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Get user's current location from the SDK
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with a string representation of the Location's JSON, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
getCurrentLocation(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if Location permission has been granted to the app (for Android).
|
||||
* Returns "true" or "false" in success method accordingly.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the a string that can be "true" or "false", depending if location permission was granted, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
checkLocationPermission(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Request user to grant Location access to the app (for Anrdoid).
|
||||
* For Android Marshmallow and above. In other platforms, the Promise is never resolved.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the a string that can be "true" or "false", depending if Location access was given to the app, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
requestPermissions(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Check if Location services are enabled on the device (for Android).
|
||||
* Returns "true" or "false" in success method accordingly.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the a string that can be "true" or "false", depending if location services are enabled, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
checkLocationServices(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Request user to enable Location services on the device.
|
||||
* For Android Marshmallow and above. In other platforms, the Promise is never resolved.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the a string that can be "true" or "false", depending if Location services were enabled, or it gets rejected if an error ocurred.
|
||||
*/
|
||||
@Cordova()
|
||||
requestLocationServices(): Promise<any> { return; }
|
||||
}
|
||||
@@ -57,10 +57,10 @@ export interface ImagePickerOptions {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ImagePicker',
|
||||
plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker.git',
|
||||
plugin: 'cordova-plugin-telerik-imagepicker',
|
||||
pluginRef: 'window.imagePicker',
|
||||
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
|
||||
install: 'ionic cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"',
|
||||
install: 'ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"',
|
||||
installVariables: ['PHOTO_LIBRARY_USAGE_DESCRIPTION'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
@@ -13,9 +13,10 @@ import { Injectable } from '@angular/core';
|
||||
* constructor(private store: InAppPurchase2) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* * @advanced
|
||||
*
|
||||
*
|
||||
* ```typescript
|
||||
* // After Platform Ready
|
||||
* this.store.verbosity = this.store.DEBUG;
|
||||
@@ -34,12 +35,12 @@ import { Injectable } from '@angular/core';
|
||||
* this.store.when(productId).updated( (product: IAPProduct) => {
|
||||
* console.log('Loaded' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Issue with buying
|
||||
* this.store.when(productId).cancelled( (product) => {
|
||||
* alert('Purchase was Cancelled');
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Track All Store Errors
|
||||
* this.store.error( (err) => {
|
||||
* alert('Store Error ' + JSON.stringify(err));
|
||||
@@ -54,15 +55,15 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* // Errors
|
||||
* this.store.when(productId).error( (error) => {
|
||||
* this.loader.dismiss();
|
||||
* this.loader.dismiss();
|
||||
* alert('An Error Occured' + JSON.stringify(error));
|
||||
* });
|
||||
* // Refresh Starts Handlers
|
||||
* // Refresh Starts Handlers
|
||||
* console.log('Refresh Store');
|
||||
* this.store.refresh();
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // To Purchase
|
||||
* this.store.order(productId);
|
||||
*
|
||||
@@ -168,6 +169,9 @@ export interface IAPProductEvents {
|
||||
downloaded: (callback: IAPQueryCallback) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class IAPError {
|
||||
code: number;
|
||||
message: string;
|
||||
|
||||
88
src/@ionic-native/plugins/keychain-touch-id/index.ts
Normal file
88
src/@ionic-native/plugins/keychain-touch-id/index.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Keychain Touch Id
|
||||
* @description
|
||||
* A cordova plugin adding the iOS TouchID / Android fingerprint to your
|
||||
* app and allowing you to store a password securely in the device keychain.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { KeychainTouchId } from '@ionic-native/keychain-touch-id';
|
||||
*
|
||||
*
|
||||
* constructor(private keychainTouchId: KeychainTouchId) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.keychainTouchId.isAvailable()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'KeychainTouchId',
|
||||
plugin: 'cordova-plugin-keychain-touch-id',
|
||||
pluginRef: 'plugins.touchid',
|
||||
repo: 'https://github.com/sjhoeksma/cordova-plugin-keychain-touch-id',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class KeychainTouchId extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check if Touch ID / Fingerprint is supported by the device
|
||||
* @return {Promise<any>} Returns a promise that resolves when there is hardware support
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypts and Saves a password under the key in the device keychain, which can be retrieved after
|
||||
* successful authentication using fingerprint
|
||||
* @param key {string} the key you want to store
|
||||
* @param password {string} the password you want to encrypt and store
|
||||
* @return {Promise<any>} Returns a promise that resolves when there is a result
|
||||
*/
|
||||
@Cordova()
|
||||
save(key: string, password: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Opens the fingerprint dialog, for the given key, showing an additional message. Promise will resolve
|
||||
* with the password stored in keychain or will resolve an error code, where -1 indicated not available.
|
||||
* @param key {string} the key you want to retrieve from keychain
|
||||
* @param message {string} a message to the user
|
||||
* @return {Promise<any>} Returns a promise that resolves when the key value is successfully retrieved or an error
|
||||
*/
|
||||
@Cordova()
|
||||
verify(key: string, message: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if there is a password stored within the keychain for the given key.
|
||||
* @param key {string} the key you want to check from keychain
|
||||
* @return {Promise<any>} Returns a promise that resolves with success if the key is available or failure if key is not.
|
||||
*/
|
||||
@Cordova()
|
||||
has(key: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Deletes the password stored under given key from the keychain.
|
||||
* @param key {string} the key you want to delete from keychain
|
||||
* @return {Promise<any>} Returns a promise that resolves with success if the key is deleted or failure if key is not
|
||||
*/
|
||||
@Cordova()
|
||||
delete(key: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Sets the language of the fingerprint dialog
|
||||
* @param locale {string} locale subtag from [this list](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
|
||||
*/
|
||||
@Cordova()
|
||||
setLocale(locale: string): void {}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,125 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface PromptsOptions {
|
||||
|
||||
/**
|
||||
* a function to pass the user's decision whether to remember their choice of app.
|
||||
* This will be passed a single boolean value indicating the user's decision.
|
||||
* @param rememberChoice
|
||||
*/
|
||||
callback?: (rememberChoice: boolean) => void;
|
||||
|
||||
/**
|
||||
* text to display in the native prompt header asking user whether to remember their choice.
|
||||
* Defaults to "Remember your choice?" if not specified.
|
||||
*/
|
||||
headerText?: string;
|
||||
|
||||
/**
|
||||
* text to display in the native prompt body asking user whether to remember their choice.
|
||||
* Defaults to "Use the same app for navigating next time?" if not specified.
|
||||
*/
|
||||
bodyText?: string;
|
||||
|
||||
|
||||
/**
|
||||
* text to display for the Yes button.
|
||||
* Defaults to "Yes" if not specified.
|
||||
*/
|
||||
yesButtonText?: string;
|
||||
|
||||
/**
|
||||
* text to display for the No button.
|
||||
* Defaults to "No" if not specified.
|
||||
*/
|
||||
noButtonText?: string;
|
||||
}
|
||||
|
||||
export interface RememberChoiceOptions {
|
||||
|
||||
/**
|
||||
* whether to remember user choice of app for next time, instead of asking again for user choice.
|
||||
* `"prompt"` - Prompt user to decide whether to remember choice.
|
||||
* - Default value if unspecified.
|
||||
* - If `promptFn` is defined, this will be used for user confirmation.
|
||||
* - Otherwise (by default), a native dialog will be displayed to ask user.
|
||||
* `false` - Do not remember user choice.
|
||||
* `true` - Remember user choice.
|
||||
*/
|
||||
enabled?: boolean | string;
|
||||
|
||||
|
||||
/**
|
||||
* a function which asks the user whether to remember their choice of app.
|
||||
* If this is defined, then the default dialog prompt will not be shown, allowing for a custom UI for asking the user.
|
||||
* This will be passed a callback function which should be invoked with a single boolean argument which indicates the user's decision to remember their choice.
|
||||
* @param callback
|
||||
*/
|
||||
promptFn?: (callback: (rememberChoice: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* options related to the default dialog prompt used to ask the user whether to remember their choice of app.
|
||||
*/
|
||||
prompt?: PromptsOptions;
|
||||
}
|
||||
|
||||
export interface AppSelectionOptions {
|
||||
/**
|
||||
* text to display in the native picker which enables user to select which navigation app to launch.
|
||||
* Defaults to "Select app for navigation" if not specified.
|
||||
*/
|
||||
dialogHeaderText?: string;
|
||||
|
||||
/**
|
||||
* text to display for the cancel button in the native picker which enables user to select which navigation app to launch.
|
||||
* Defaults to "Cancel" if not specified.
|
||||
*/
|
||||
cancelButtonText?: string;
|
||||
|
||||
/**
|
||||
* List of apps, defined as `launchnavigator.APP` constants, which should be displayed in the picker if the app is available.
|
||||
* This can be used to restrict which apps are displayed, even if they are installed.
|
||||
* By default, all available apps will be displayed.
|
||||
*/
|
||||
list?: string[];
|
||||
|
||||
/**
|
||||
* Callback to invoke when the user selects an app in the native picker.
|
||||
* A single string argument is passed which is the app what was selected defined as a `launchnavigator.APP` constant.
|
||||
*/
|
||||
callback?: (app: string) => void;
|
||||
|
||||
/**
|
||||
* (Android only) native picker theme. Specify using `actionsheet.ANDROID_THEMES` constants.
|
||||
* Default `actionsheet.ANDROID_THEMES.THEME_HOLO_LIGHT`
|
||||
*/
|
||||
androidTheme?: number;
|
||||
|
||||
/**
|
||||
* options related to whether to remember user choice of app for next time, instead of asking again for user choice.
|
||||
*/
|
||||
rememberChoice?: RememberChoiceOptions;
|
||||
}
|
||||
|
||||
export interface LaunchNavigatorOptions {
|
||||
|
||||
/**
|
||||
* name of the navigation app to use for directions. Specify using launchnavigator.APP constants. If not specified, defaults to User Selection.
|
||||
* A callback to invoke when the navigation app is successfully launched.
|
||||
*/
|
||||
successCallback?: Function;
|
||||
|
||||
/**
|
||||
* A callback to invoke if an error is encountered while launching the app.
|
||||
* A single string argument containing the error message will be passed in.
|
||||
*/
|
||||
errorCallback?: (error: string) => void;
|
||||
|
||||
/**
|
||||
* name of the navigation app to use for directions.
|
||||
* Specify using launchnavigator.APP constants.
|
||||
* e.g. `launchnavigator.APP.GOOGLE_MAPS`.
|
||||
* If not specified, defaults to User Selection.
|
||||
*/
|
||||
app?: string;
|
||||
|
||||
@@ -14,7 +129,12 @@ export interface LaunchNavigatorOptions {
|
||||
destinationName?: string;
|
||||
|
||||
/**
|
||||
* Start point of the navigation
|
||||
* Start point of the navigation.
|
||||
* If not specified, the current device location will be used.
|
||||
* Either:
|
||||
* - a {string} containing the address. e.g. "Buckingham Palace, London"
|
||||
* - a {string} containing a latitude/longitude coordinate. e.g. "50.1. -4.0"
|
||||
* - an {array}, where the first element is the latitude and the second element is a longitude, as decimal numbers. e.g. [50.1, -4.0]
|
||||
*/
|
||||
start?: string | number[];
|
||||
|
||||
@@ -39,23 +159,82 @@ export interface LaunchNavigatorOptions {
|
||||
extras?: any;
|
||||
|
||||
/**
|
||||
* (Android only) mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified. Specify using launchnavigator.LAUNCH_MODE constants.
|
||||
* (Android only) mode in which to open Google Maps app.
|
||||
* `launchnavigator.LAUNCH_MODE.MAPS` or `launchnavigator.LAUNCH_MODE.TURN_BY_TURN`
|
||||
* Defaults to `launchnavigator.LAUNCH_MODE.MAPS` if not specified.
|
||||
*/
|
||||
launchMode?: string;
|
||||
launchModeGoogleMaps?: string;
|
||||
|
||||
/**
|
||||
* text to display in the native picker which enables user to select which navigation app to launch. Defaults to "Select app for navigation" if not specified.
|
||||
* (iOS only) method to use to open Apple Maps app.
|
||||
* `launchnavigator.LAUNCH_MODE.URI_SCHEME` or `launchnavigator.LAUNCH_MODE.MAPKIT`
|
||||
* Defaults to `launchnavigator.LAUNCH_MODE.URI_SCHEME` if not specified.
|
||||
*/
|
||||
appSelectionDialogHeader?: string;
|
||||
launchModeAppleMaps?: string;
|
||||
|
||||
|
||||
/**
|
||||
* text to display for the cancel button in the native picker which enables user to select which navigation app to launch. Defaults to "Cancel" if not specified.
|
||||
* If true, and input location type(s) doesn't match those required by the app, use geocoding to obtain the address/coords as required. Defaults to true.
|
||||
*/
|
||||
appSelectionCancelButton?: string;
|
||||
enableGeolocation?: boolean;
|
||||
|
||||
successCallback?: Function;
|
||||
/**
|
||||
* options related to the default native actionsheet picker which enables user to select which navigation app to launch if `app` is not specified.
|
||||
*/
|
||||
appSelection?: AppSelectionOptions;
|
||||
}
|
||||
|
||||
errorCallback?: Function;
|
||||
export interface UserChoice {
|
||||
|
||||
/**
|
||||
* Indicates whether a user choice exists for a preferred navigator app.
|
||||
* @param callback - function to pass result to: will receive a boolean argument.
|
||||
*/
|
||||
exists: (callback: (exists: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* Returns current user choice of preferred navigator app.
|
||||
* @param callback - function to pass result to: will receive a string argument indicating the app, which is a constant in `launchnavigator.APP`.
|
||||
*/
|
||||
get: (callback: (app: string) => void) => void;
|
||||
|
||||
/**
|
||||
* Sets the current user choice of preferred navigator app.
|
||||
* @param app - app to set as preferred choice as a constant in `launchnavigator.APP`.
|
||||
* @param callback - function to call once operation is complete.
|
||||
*/
|
||||
set: (app: string, callback: () => void) => void;
|
||||
|
||||
/**
|
||||
* Clears the current user choice of preferred navigator app.
|
||||
* @param callback - function to call once operation is complete.
|
||||
*/
|
||||
clear: (callback: () => void) => void;
|
||||
}
|
||||
|
||||
export interface UserPrompted {
|
||||
/**
|
||||
* Indicates whether user has already been prompted whether to remember their choice a preferred navigator app.
|
||||
* @param callback - function to pass result to: will receive a boolean argument.
|
||||
*/
|
||||
get: (callback: (exists: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* Sets flag indicating user has already been prompted whether to remember their choice a preferred navigator app.
|
||||
* @param callback - function to call once operation is complete.
|
||||
*/
|
||||
set: ( callback: () => void) => void;
|
||||
|
||||
/**
|
||||
* Clears flag which indicates if user has already been prompted whether to remember their choice a preferred navigator app.
|
||||
* @param callback - function to call once operation is complete.
|
||||
*/
|
||||
clear: ( callback: () => void) => void;
|
||||
}
|
||||
|
||||
export interface AppSelection {
|
||||
userChoice: UserChoice;
|
||||
userPrompted: UserPrompted;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +265,12 @@ export interface LaunchNavigatorOptions {
|
||||
* ```
|
||||
* @interfaces
|
||||
* LaunchNavigatorOptions
|
||||
* PromptsOptions
|
||||
* RememberChoiceOptions
|
||||
* AppSelectionOptions
|
||||
* UserChoice
|
||||
* UserPrompted
|
||||
* AppSelection
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'LaunchNavigator',
|
||||
@@ -97,6 +282,30 @@ export interface LaunchNavigatorOptions {
|
||||
@Injectable()
|
||||
export class LaunchNavigator extends IonicNativePlugin {
|
||||
|
||||
APP: any = {
|
||||
USER_SELECT: 'user_select',
|
||||
APPLE_MAPS: 'apple_maps',
|
||||
GOOGLE_MAPS: 'google_maps',
|
||||
WAZE: 'waze',
|
||||
CITYMAPPER: 'citymapper',
|
||||
NAVIGON: 'navigon',
|
||||
TRANSIT_APP: 'transit_app',
|
||||
YANDEX: 'yandex',
|
||||
UBER: 'uber',
|
||||
TOMTOM: 'tomtom',
|
||||
BING_MAPS: 'bing_maps',
|
||||
SYGIC: 'sygic',
|
||||
HERE_MAPS: 'here_maps',
|
||||
MOOVIT: 'moovit'
|
||||
};
|
||||
|
||||
TRANSPORT_MODE: any = {
|
||||
DRIVING: 'driving',
|
||||
WALKING: 'walking',
|
||||
BICYCLING: 'bicycling',
|
||||
TRANSIT: 'transit'
|
||||
};
|
||||
|
||||
/**
|
||||
* Launches navigator app
|
||||
* @param destination {string|number[]} Location name or coordinates (as string or array)
|
||||
@@ -107,10 +316,7 @@ export class LaunchNavigator extends IonicNativePlugin {
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
navigate(
|
||||
destination: string | number[],
|
||||
options?: LaunchNavigatorOptions
|
||||
): Promise<any> { return; }
|
||||
navigate(destination: string | number[], options?: LaunchNavigatorOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Determines if the given app is installed and available on the current device.
|
||||
@@ -162,14 +368,12 @@ export class LaunchNavigator extends IonicNativePlugin {
|
||||
getTransportModes(app: string, platform: string): string[] { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of launch mode.
|
||||
* Note that currently only Google Maps on Android does.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
supportsDestName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of start location.
|
||||
@@ -189,41 +393,21 @@ export class LaunchNavigator extends IonicNativePlugin {
|
||||
supportsStartName(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* Indicates if an app on a given platform supports specification of launch mode.
|
||||
* Note that currently only Google Maps on Android does.
|
||||
* @param app {string}
|
||||
* @param platform {string}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
supportsDestName(app: string, platform: string): boolean { return; }
|
||||
supportsLaunchMode(app: string, platform: string): boolean { return; }
|
||||
|
||||
/**
|
||||
* @param destination {string | number[]}
|
||||
* @param options {LaunchNavigatorOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
userSelect(destination: string | number[], options: LaunchNavigatorOptions): void { }
|
||||
userSelect(destination: string | number[], options: LaunchNavigatorOptions): void {}
|
||||
|
||||
APP: any = {
|
||||
USER_SELECT: 'user_select',
|
||||
APPLE_MAPS: 'apple_maps',
|
||||
GOOGLE_MAPS: 'google_maps',
|
||||
WAZE: 'waze',
|
||||
CITYMAPPER: 'citymapper',
|
||||
NAVIGON: 'navigon',
|
||||
TRANSIT_APP: 'transit_app',
|
||||
YANDEX: 'yandex',
|
||||
UBER: 'uber',
|
||||
TOMTOM: 'tomtom',
|
||||
BING_MAPS: 'bing_maps',
|
||||
SYGIC: 'sygic',
|
||||
HERE_MAPS: 'here_maps',
|
||||
MOOVIT: 'moovit'
|
||||
};
|
||||
|
||||
TRANSPORT_MODE: any = {
|
||||
DRIVING: 'driving',
|
||||
WALKING: 'walking',
|
||||
BICYCLING: 'bicycling',
|
||||
TRANSIT: 'transit'
|
||||
};
|
||||
appSelection: AppSelection;
|
||||
}
|
||||
|
||||
@@ -324,5 +324,15 @@ export class LocalNotifications extends IonicNativePlugin {
|
||||
})
|
||||
on(eventName: string, callback: any): void { }
|
||||
|
||||
/**
|
||||
* Removes a callback of a specific event
|
||||
* @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall
|
||||
* @param callback Call back function. All events return notification and state parameter. clear and clearall return state parameter only.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
un(eventName: string, callback: any): void { }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin, InstanceProperty } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
@@ -8,7 +8,55 @@ import { Observer } from 'rxjs/Observer';
|
||||
*/
|
||||
export class MediaObject {
|
||||
|
||||
constructor(private _objectInstance: any, public onSuccess: Observable<any>, public onError: Observable<any>, public onStatusUpdate: Observable<any>) {}
|
||||
/**
|
||||
* An observable that notifies you on actions success
|
||||
*/
|
||||
onSuccess: Observable<any>;
|
||||
|
||||
/**
|
||||
* An observable that notifies you when an error occurs
|
||||
*/
|
||||
onError: Observable<MEDIA_ERROR>;
|
||||
|
||||
/**
|
||||
* An observable that notifies you when the file status changes
|
||||
*/
|
||||
onStatusUpdate: Observable<MEDIA_STATUS>;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
successCallback: Function;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
errorCallback: Function;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
statusCallback: Function;
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
this.onSuccess = new Observable<any>((observer: Observer<any>) => {
|
||||
this.successCallback = observer.next.bind(observer);
|
||||
return () => this.successCallback = () => {};
|
||||
});
|
||||
|
||||
this.onError = new Observable<MEDIA_ERROR>((observer: Observer<MEDIA_ERROR>) => {
|
||||
this.errorCallback = observer.next.bind(observer);
|
||||
return () => this.errorCallback = () => {};
|
||||
});
|
||||
|
||||
this.onStatusUpdate = new Observable<MEDIA_STATUS>((observer: Observer<MEDIA_STATUS>) => {
|
||||
this.statusCallback = observer.next.bind(observer);
|
||||
return () => this.statusCallback = () => {};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current amplitude of the current recording.
|
||||
@@ -66,6 +114,9 @@ export class MediaObject {
|
||||
@CordovaInstance({ sync: true })
|
||||
setVolume(volume: number): void { }
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setRate(speedRate: number): void {}
|
||||
|
||||
/**
|
||||
* Starts recording an audio file.
|
||||
*/
|
||||
@@ -114,6 +165,21 @@ export interface MediaError {
|
||||
|
||||
}
|
||||
|
||||
export enum MEDIA_STATUS {
|
||||
NONE = 0,
|
||||
STARTING,
|
||||
RUNNING,
|
||||
PAUSED,
|
||||
STOPPED
|
||||
}
|
||||
|
||||
export enum MEDIA_ERROR {
|
||||
ABORTED = 1,
|
||||
NETWORK,
|
||||
DECODE,
|
||||
SUPPORTED
|
||||
}
|
||||
|
||||
export type MediaErrorCallback = (error: MediaError) => void;
|
||||
|
||||
/**
|
||||
@@ -266,39 +332,17 @@ export class Media extends IonicNativePlugin {
|
||||
/**
|
||||
* Open a media file
|
||||
* @param src {string} A URI containing the audio content.
|
||||
* @param [onStatusUpdate] {MediaStatusUpdateCallback} A callback function to be invoked when the status of the file changes
|
||||
* @param [onSuccess] {Function} A callback function to be invoked after the current play, record, or stop action is completed
|
||||
* @param [onError] {MediaErrorCallback} A callback function is be invoked if an error occurs.
|
||||
* @return {MediaObject}
|
||||
*/
|
||||
create(src: string): MediaObject {
|
||||
|
||||
let instance: any,
|
||||
onSuccess: Function,
|
||||
onError: Function,
|
||||
onStatusUpdate: Function;
|
||||
|
||||
|
||||
const onSuccessObservable: Observable<any> = new Observable<any>((observer: Observer<any>) => {
|
||||
onSuccess = observer.next.bind(observer);
|
||||
return () => {};
|
||||
}),
|
||||
onErrorObservable: Observable<any> = new Observable<any>((observer: Observer<any>) => {
|
||||
onError = observer.next.bind(observer);
|
||||
return () => {};
|
||||
}),
|
||||
onStatusUpdateObservable: Observable<any> = new Observable<any>((observer: Observer<any>) => {
|
||||
onStatusUpdate = observer.next.bind(observer);
|
||||
return () => {};
|
||||
});
|
||||
let instance: any;
|
||||
|
||||
if (checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) === true) {
|
||||
// Creates a new media object
|
||||
instance = new (Media.getPlugin())(src, onSuccess, onError, onStatusUpdate);
|
||||
instance = new (Media.getPlugin())(src);
|
||||
}
|
||||
|
||||
return new MediaObject(instance, onSuccessObservable, onErrorObservable, onStatusUpdateObservable);
|
||||
|
||||
return new MediaObject(instance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ export class MSAdal extends IonicNativePlugin {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class AuthenticationContext {
|
||||
|
||||
@InstanceProperty
|
||||
@@ -134,7 +137,7 @@ export class AuthenticationContext {
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId: string, extraQueryParameters?: any): Promise<AuthenticationResult> { return; }
|
||||
acquireTokenAsync(resourceUrl: string, clientId: string, redirectUrl: string, userId?: string, extraQueryParameters?: any): Promise<AuthenticationResult> { return; }
|
||||
|
||||
/**
|
||||
* Acquires token WITHOUT using interactive flow. It checks the cache to return existing result
|
||||
@@ -149,6 +152,6 @@ export class AuthenticationContext {
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): Promise<AuthenticationResult> { return; }
|
||||
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId?: string): Promise<AuthenticationResult> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
* ...
|
||||
*
|
||||
* this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818)
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log('The address is ' + result.street + ' in ' + result.countryCode))
|
||||
* .then((result: NativeGeocoderReverseResult) => console.log(JSON.stringify(result)))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* this.nativeGeocoder.forwardGeocode('Berlin')
|
||||
@@ -40,7 +40,7 @@ export class NativeGeocoder extends IonicNativePlugin {
|
||||
* Reverse geocode a given latitude and longitude to find location address
|
||||
* @param latitude {number} The latitude
|
||||
* @param longitude {number} The longitude
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<NativeGeocoderReverseResult>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
@@ -50,48 +50,59 @@ export class NativeGeocoder extends IonicNativePlugin {
|
||||
/**
|
||||
* Forward geocode a given address to find coordinates
|
||||
* @param addressString {string} The address to be geocoded
|
||||
* @return {Promise<any>}
|
||||
* @return {Promise<NativeGeocoderForwardResult>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
forwardGeocode(addressString: string): Promise<NativeGeocoderForwardResult> { return; }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates format information about a reverse geocoding result.
|
||||
* more Info:
|
||||
* - https://developer.apple.com/documentation/corelocation/clplacemark
|
||||
* - https://developer.android.com/reference/android/location/Address.html
|
||||
*/
|
||||
export interface NativeGeocoderReverseResult {
|
||||
/**
|
||||
* The street.
|
||||
* The country code.
|
||||
*/
|
||||
street: string;
|
||||
/**
|
||||
* The house number.
|
||||
*/
|
||||
houseNumber: string;
|
||||
/**
|
||||
* The postal code.
|
||||
*/
|
||||
postalCode: string;
|
||||
/**
|
||||
* The city.
|
||||
*/
|
||||
city: string;
|
||||
/**
|
||||
* The district.
|
||||
*/
|
||||
district: string;
|
||||
countryCode: string;
|
||||
/**
|
||||
* The country name.
|
||||
*/
|
||||
countryName: string;
|
||||
/**
|
||||
* The country code.
|
||||
* The postal code.
|
||||
*/
|
||||
countryCode: string;
|
||||
postalCode: string;
|
||||
/**
|
||||
* The administrativeArea.
|
||||
*/
|
||||
administrativeArea: string;
|
||||
/**
|
||||
* The subAdministrativeArea.
|
||||
*/
|
||||
subAdministrativeArea: string;
|
||||
/**
|
||||
* The locality.
|
||||
*/
|
||||
locality: string;
|
||||
/**
|
||||
* The subLocality.
|
||||
*/
|
||||
subLocality: string;
|
||||
/**
|
||||
* The thoroughfare.
|
||||
*/
|
||||
thoroughfare: string;
|
||||
/**
|
||||
* The subThoroughfare.
|
||||
*/
|
||||
subThoroughfare: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates format information about a forward geocoding result.
|
||||
*/
|
||||
|
||||
@@ -23,8 +23,17 @@ declare let window: any;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let message = this.ndef.textRecord('Hello world');
|
||||
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
||||
* this.nfc.addNdefListener(() => {
|
||||
* console.log('successfully attached ndef listener');
|
||||
* }, (err) => {
|
||||
* console.log('error attaching ndef listener', err);
|
||||
* }).subscribe((event) => {
|
||||
* console.log('received ndef message. the tag contains: ', event.tag);
|
||||
* console.log('decoded tag id', this.nfc.bytesToHexString(event.tag.id));
|
||||
*
|
||||
* let message = this.ndef.textRecord('Hello world');
|
||||
* this.nfc.share([message]).then(onSuccess).catch(onError);
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
|
||||
111
src/@ionic-native/plugins/open-native-settings/index.ts
Normal file
111
src/@ionic-native/plugins/open-native-settings/index.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name Open Native Settings
|
||||
* @description
|
||||
* Plugin to open native screens of iOS/android settings
|
||||
* @usage
|
||||
* You can open any of these settings:
|
||||
* ```
|
||||
* "about", // ios
|
||||
"accessibility", // ios, android
|
||||
"account", // ios, android
|
||||
"airplane_mode", // ios, android
|
||||
"apn", // android
|
||||
"application_details", // ios, android
|
||||
"application_development", // android
|
||||
"application", // android
|
||||
"autolock", // ios
|
||||
"battery_optimization", // android
|
||||
"bluetooth", // ios, android
|
||||
"castle", // ios
|
||||
"captioning", // android
|
||||
"cast", // android
|
||||
"cellular_usage", // ios
|
||||
"configuration_list", // ios
|
||||
"data_roaming", // android
|
||||
"date", // ios, android
|
||||
"display", // ios, android
|
||||
"dream", // android
|
||||
"facetime", // ios
|
||||
"home", // android
|
||||
"keyboard", // ios, android
|
||||
"keyboard_subtype", // android
|
||||
"locale", // ios, android
|
||||
"location", // ios, android
|
||||
"locations", // ios
|
||||
"manage_all_applications", // android
|
||||
"manage_applications", // android
|
||||
"memory_card", // android
|
||||
"music", // ios
|
||||
"music_equalizer", // ios
|
||||
"music_volume", // ios
|
||||
"network", // ios, android
|
||||
"nike_ipod", // ios
|
||||
"nfcsharing", // android
|
||||
"nfc_payment", // android
|
||||
"nfc_settings", // android
|
||||
"notes", // ios
|
||||
"notification_id", // ios
|
||||
"passbook", // ios
|
||||
"phone", // ios
|
||||
"photos", // ios
|
||||
"print", // android
|
||||
"privacy", // android
|
||||
"quick_launch", // android
|
||||
"reset", // ios
|
||||
"ringtone", // ios
|
||||
"browser", // ios
|
||||
"search", // ios, android
|
||||
"security", // android
|
||||
"settings", // ios, android
|
||||
"show_regulatory_info",
|
||||
"sound", // ios, android
|
||||
"software_update", // ios
|
||||
"storage", // ios, android
|
||||
"store", // ios, android
|
||||
"sync", // android
|
||||
"tethering", // ios
|
||||
"twitter", // ios
|
||||
"touch", // ios
|
||||
"usage", // ios, android
|
||||
"user_dictionary", // android
|
||||
"video", // ios
|
||||
"voice_input", // android
|
||||
"vpn", // ios
|
||||
"wallpaper", // ios
|
||||
"wifi_ip", // android
|
||||
"wifi", // ios, android
|
||||
"wireless" // android
|
||||
```
|
||||
* ```typescript
|
||||
* import { OpenNativeSettings } from '@ionic-native/open-native-settings';
|
||||
*
|
||||
*
|
||||
* constructor(private openNativeSettings: OpenNativeSettings) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'OpenNativeSettings',
|
||||
plugin: 'cordova-open-native-settings',
|
||||
pluginRef: 'cordova.plugins.settings',
|
||||
repo: 'https://github.com/guyromb/Cordova-open-native-settings',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class OpenNativeSettings extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Opens a setting dialog
|
||||
* @param setting {string} setting name
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
open(setting: string): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -204,6 +204,12 @@ export class PayPalPayment {
|
||||
*/
|
||||
items: Array<PayPalItem>;
|
||||
|
||||
/**
|
||||
* Optional payee email, if your app is paying a third-party merchant.
|
||||
* The payee's email. It must be a valid PayPal email address.
|
||||
*/
|
||||
payeeEmail: string;
|
||||
|
||||
/**
|
||||
* Optional customer shipping address, if your app wishes to provide this to the SDK.
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,7 @@ export interface LocalNotificationOptions {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Phonegap Local Notifications',
|
||||
plugin: 'phonegap-local-notifications',
|
||||
plugin: 'phonegap-plugin-local-notification',
|
||||
pluginRef: 'Notification',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-local-notification',
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows']
|
||||
|
||||
@@ -31,8 +31,8 @@ import { Injectable } from '@angular/core';
|
||||
* console.log(libraryItem.albumIds); // array of ids of appropriate AlbumItem, only of includeAlbumsData was used
|
||||
* });
|
||||
* },
|
||||
* error: err => {},
|
||||
* complete: () => { console.log('could not get photos'); }
|
||||
* error: err => { console.log('could not get photos'); },
|
||||
* complete: () => { console.log('done getting photos'); }
|
||||
* });
|
||||
* })
|
||||
* .catch(err => console.log('permissions weren\'t granted'));
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaInstance, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error;
|
||||
|
||||
@@ -188,10 +188,25 @@ export interface AndroidPushOptions {
|
||||
topics?: string[];
|
||||
}
|
||||
|
||||
export interface BrowserPushOptions {
|
||||
/**
|
||||
* Optional. Your GCM API key if you are using VAPID keys.
|
||||
*/
|
||||
applicationServerKey?: string;
|
||||
|
||||
/**
|
||||
* URL for the push server you want to use.
|
||||
* Default: http://push.api.phonegap.com/v1/push Optional.
|
||||
*/
|
||||
pushServiceURL?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PushOptions {
|
||||
ios?: IOSPushOptions;
|
||||
android?: AndroidPushOptions;
|
||||
windows?: any;
|
||||
browser?: BrowserPushOptions;
|
||||
}
|
||||
|
||||
export type PushEvent = 'registration' | 'error' | 'notification';
|
||||
@@ -237,7 +252,10 @@ export type PushEvent = 'registration' | 'error' | 'notification';
|
||||
* badge: true,
|
||||
* sound: 'false'
|
||||
* },
|
||||
* windows: {}
|
||||
* windows: {},
|
||||
* browser: {
|
||||
* pushServiceURL: 'http://push.api.phonegap.com/v1/push'
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* const pushObject: PushObject = this.push.init(options);
|
||||
@@ -257,6 +275,7 @@ export type PushEvent = 'registration' | 'error' | 'notification';
|
||||
* NotificationEventAdditionalData
|
||||
* IOSPushOptions
|
||||
* AndroidPushOptions
|
||||
* BrowserPushOptions
|
||||
* PushOptions
|
||||
*/
|
||||
@Plugin({
|
||||
|
||||
@@ -38,7 +38,7 @@ export interface SafariViewControllerOptions {
|
||||
* enterReaderModeIfAvailable: true,
|
||||
* tintColor: '#ff0000'
|
||||
* })
|
||||
* .then((result: any) => {
|
||||
* .subscribe((result: any) => {
|
||||
* if(result.event === 'opened') console.log('Opened');
|
||||
* else if(result.event === 'loaded') console.log('Loaded');
|
||||
* else if(result.event === 'closed') console.log('Closed');
|
||||
|
||||
@@ -12,6 +12,12 @@ export interface SerialPermissionOptions {
|
||||
|
||||
export interface SerialOpenOptions {
|
||||
baudRate: number;
|
||||
dataBits: number;
|
||||
stopBits: number;
|
||||
parity: number;
|
||||
dtr: boolean;
|
||||
rts: boolean;
|
||||
sleepOnPause: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +35,13 @@ export interface SerialOpenOptions {
|
||||
*
|
||||
* this.serial.requestPermission().then(() => {
|
||||
* this.serial.open({
|
||||
* baudRate: 9800
|
||||
* baudRate: 9800,
|
||||
* dataBits: 4,
|
||||
* stopBits: 1,
|
||||
* parity: 0,
|
||||
* dtr: true,
|
||||
* rts: true,
|
||||
* sleepOnPause: false
|
||||
* }).then(() => {
|
||||
* console.log('Serial connection opened');
|
||||
* });
|
||||
|
||||
@@ -49,7 +49,10 @@ export class SocialSharing extends IonicNativePlugin {
|
||||
* @param url {string} A URL to share
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({
|
||||
successIndex: 4,
|
||||
errorIndex: 5
|
||||
})
|
||||
share(message?: string, subject?: string, file?: string | string[], url?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface SpinnerDialogIOSOptions {
|
||||
@Plugin({
|
||||
pluginName: 'SpinnerDialog',
|
||||
plugin: 'cordova-plugin-native-spinner',
|
||||
pluginRef: 'window.plugins.spinnerDialog',
|
||||
pluginRef: 'SpinnerDialog',
|
||||
repo: 'https://github.com/greybax/cordova-plugin-native-spinner',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows']
|
||||
})
|
||||
|
||||
@@ -20,6 +20,10 @@ export interface SQLiteDatabaseConfig {
|
||||
* support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext
|
||||
*/
|
||||
createFromLocation?: number;
|
||||
/**
|
||||
* support encrypted databases with https://github.com/litehelpers/Cordova-sqlcipher-adapter
|
||||
*/
|
||||
key?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface VideoOptions {
|
||||
*/
|
||||
volume?: number;
|
||||
/**
|
||||
* There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
|
||||
* There are two options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
|
||||
* These strings are the only ones which can be passed as option.
|
||||
*/
|
||||
scalingMode?: number;
|
||||
|
||||
Reference in New Issue
Block a user