Resolve conflicts with master
This commit is contained in:
commit
2e543291ef
26
CHANGELOG.md
26
CHANGELOG.md
@ -1,3 +1,29 @@
|
||||
<a name="3.14.0"></a>
|
||||
# [3.14.0](https://github.com/ionic-team/ionic-native/compare/v3.13.1...v3.14.0) (2017-07-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **in-app-purchase2:** add a second InAppPurchase plugin ([#1775](https://github.com/ionic-team/ionic-native/issues/1775)) ([398d0ee](https://github.com/ionic-team/ionic-native/commit/398d0ee)), closes [#1705](https://github.com/ionic-team/ionic-native/issues/1705)
|
||||
|
||||
|
||||
|
||||
<a name="3.13.1"></a>
|
||||
## [3.13.1](https://github.com/ionic-team/ionic-native/compare/v3.13.0...v3.13.1) (2017-07-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **document-viewer:** make config properties optional ([#1767](https://github.com/ionic-team/ionic-native/issues/1767)) ([5b914d7](https://github.com/ionic-team/ionic-native/commit/5b914d7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **app-rate:** add function handleNegativeFeedback() ([#1748](https://github.com/ionic-team/ionic-native/issues/1748)) ([e64cc0c](https://github.com/ionic-team/ionic-native/commit/e64cc0c))
|
||||
* **app-rate:** add function navigateToAppStore() ([#1719](https://github.com/ionic-team/ionic-native/issues/1719)) ([0c79ac1](https://github.com/ionic-team/ionic-native/commit/0c79ac1))
|
||||
|
||||
|
||||
|
||||
<a name="3.13.0"></a>
|
||||
# [3.13.0](https://github.com/ionic-team/ionic-native/compare/v3.12.2...v3.13.0) (2017-07-03)
|
||||
|
||||
|
@ -171,9 +171,9 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or
|
||||
## Plugin Missing?
|
||||
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart:
|
||||
|
||||
## Ionic V1/Angular 1 support
|
||||
## Ionic v1 (AngularJS, Angular 1.x) support
|
||||
|
||||
For Ionic V1/Angular 1 support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/8cd648db5cddd7bdbe2bd78839b19c620cc8c04c/README.md) for usage information.
|
||||
For Ionic v1 (AngularJS, Angular 1.x) support, please use version 2 of Ionic Native. See the [2.x README](https://github.com/ionic-team/ionic-native/blob/v2.x/README.md) for usage information.
|
||||
|
||||
# Credits
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "3.13.0",
|
||||
"version": "3.14.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)",
|
||||
@ -39,12 +39,12 @@
|
||||
"q": "1.5.0",
|
||||
"queue": "4.2.1",
|
||||
"rimraf": "2.6.1",
|
||||
"rxjs": "5.1.1",
|
||||
"rxjs": "5.4.0",
|
||||
"semver": "5.3.0",
|
||||
"tslint": "3.15.1",
|
||||
"tslint-ionic-rules": "0.0.8",
|
||||
"typescript": "2.3.3",
|
||||
"zone.js": "^0.8.11"
|
||||
"zone.js": "0.8.12"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run test:watch",
|
||||
|
@ -19,7 +19,7 @@ const ROOT = path.resolve(path.join(__dirname, '../../')), // root ionic-native
|
||||
// dependency versions
|
||||
const ANGULAR_VERSION = '*',
|
||||
RXJS_VERSION = '^5.0.1',
|
||||
MIN_CORE_VERSION = '^3.6.0',
|
||||
MIN_CORE_VERSION = '^3.6.0 || >=4.0.0',
|
||||
IONIC_NATIVE_VERSION = require(path.resolve(ROOT, 'package.json')).version;
|
||||
|
||||
// package dependencies
|
||||
|
@ -32,7 +32,7 @@ export interface AdMobOptions {
|
||||
overlap?: boolean;
|
||||
|
||||
/**
|
||||
* Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMob.AD_POSITION` property to select other values.
|
||||
* Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMobPro.AD_POSITION` property to select other values.
|
||||
*/
|
||||
position?: number;
|
||||
|
||||
@ -93,14 +93,15 @@ export interface AdExtras {
|
||||
* @paid
|
||||
* @name AdMob
|
||||
* @description
|
||||
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
* Plugin for Google Ads, including AdMob / DFP (DoubleClick for publisher) and mediations to other Ad networks.
|
||||
*
|
||||
* IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMobPro Free](../admob-free).
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from '@ionic-native/admob';
|
||||
* import { AdMobPro } from '@ionic-native/admob-pro';
|
||||
* import { Platform } from 'ionic-angular';
|
||||
*
|
||||
* constructor(private admob: AdMob, private platform: Platform ) { }
|
||||
* constructor(private admob: AdMobPro, private platform: Platform ) { }
|
||||
*
|
||||
* ionViewDidLoad() {
|
||||
* this.admob.onAdDismiss()
|
||||
@ -125,14 +126,14 @@ export interface AdExtras {
|
||||
* AdExtras
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMob',
|
||||
pluginName: 'AdMob Pro',
|
||||
plugin: 'cordova-plugin-admobpro',
|
||||
pluginRef: 'AdMob',
|
||||
repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
})
|
||||
@Injectable()
|
||||
export class AdMob extends IonicNativePlugin {
|
||||
export class AdMobPro extends IonicNativePlugin {
|
||||
|
||||
AD_POSITION: {
|
||||
NO_CHANGE: number;
|
||||
@ -178,7 +179,7 @@ export class AdMob extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Show banner at position
|
||||
* @param position {number} Position. Use `AdMob.AD_POSITION` to set values.
|
||||
* @param position {number} Position. Use `AdMobPro.AD_POSITION` to set values.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
@ -1,28 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
interface Cordova {
|
||||
plugins: CordovaPlugins & { email: any };
|
||||
}
|
||||
|
||||
declare const cordova: Cordova;
|
||||
|
||||
export interface EmailComposerOptions {
|
||||
|
||||
/**
|
||||
* App to send the email with
|
||||
*/
|
||||
app?: string;
|
||||
|
||||
/**
|
||||
* Email address(es) for To field
|
||||
*/
|
||||
to?: string | Array<string>;
|
||||
|
||||
/**
|
||||
* Email address(es) for CC field
|
||||
*/
|
||||
cc?: string | Array<string>;
|
||||
|
||||
/**
|
||||
* Email address(es) for BCC field
|
||||
*/
|
||||
bcc?: string | Array<string>;
|
||||
|
||||
attachments?: Array<any>;
|
||||
/**
|
||||
* File paths or base64 data streams
|
||||
*/
|
||||
attachments?: string[];
|
||||
|
||||
/**
|
||||
* Subject of the email
|
||||
*/
|
||||
subject?: string;
|
||||
|
||||
/**
|
||||
* Email body (for HTML, set isHtml to true)
|
||||
*/
|
||||
body?: string;
|
||||
|
||||
/**
|
||||
* Indicates if the body is HTML or plain text
|
||||
*/
|
||||
isHtml?: boolean;
|
||||
|
||||
}
|
||||
@ -67,16 +85,27 @@ export interface EmailComposerOptions {
|
||||
*
|
||||
* // Send a text message using default options
|
||||
* this.emailComposer.open(email);
|
||||
* ```
|
||||
*
|
||||
* You can also assign aliases to email apps
|
||||
* ```ts
|
||||
* // add alias
|
||||
* this.email.addAlias('gmail', 'com.google.android.gm');
|
||||
*
|
||||
* // then use alias when sending email
|
||||
* this.email.open({
|
||||
* app: 'gmail',
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
* EmailComposerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'EmailComposer',
|
||||
plugin: 'cordova-plugin-email',
|
||||
plugin: 'cordova-plugin-email-composer',
|
||||
pluginRef: 'cordova.plugins.email',
|
||||
repo: 'https://github.com/hypery2k/cordova-email-plugin',
|
||||
repo: 'https://github.com/katzer/cordova-plugin-email-composer',
|
||||
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
@ -92,7 +121,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
|
||||
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@ -100,7 +129,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
|
||||
EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@ -111,6 +140,26 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permission to access email accounts information
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the permission was granted
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
requestPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Checks if the app has a permission to access email accounts information
|
||||
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the permission was granted
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 0,
|
||||
errorIndex: 2
|
||||
})
|
||||
hasPermission(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Adds a new mail app alias.
|
||||
*
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const FileTransfer: any;
|
||||
|
||||
export interface FileUploadOptions {
|
||||
|
||||
/**
|
||||
@ -109,21 +107,21 @@ export interface FileTransferError {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Transfer
|
||||
* @name File Transfer
|
||||
*
|
||||
* @description
|
||||
* This plugin allows you to upload and download files.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Transfer, FileUploadOptions, TransferObject } from '@ionic-native/transfer';
|
||||
* import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/transfer';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* constructor(private transfer: Transfer, private file: File) { }
|
||||
* constructor(private transfer: FileTransfer, private file: File) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* const fileTransfer: TransferObject = this.transfer.create();
|
||||
* const fileTransfer: FileTransferObject = this.transfer.create();
|
||||
*
|
||||
* // Upload a file:
|
||||
* fileTransfer.upload(..).then(..).catch(..);
|
||||
@ -170,7 +168,7 @@ export interface FileTransferError {
|
||||
* FileUploadResult
|
||||
* FileTransferError
|
||||
* @classes
|
||||
* TransferObject
|
||||
* FileTransferObject
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'FileTransfer',
|
||||
@ -180,7 +178,7 @@ export interface FileTransferError {
|
||||
platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class Transfer extends IonicNativePlugin {
|
||||
export class FileTransfer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Error code rejected from upload with FileTransferError
|
||||
@ -202,10 +200,10 @@ export class Transfer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Creates a new FileTransfer object
|
||||
* @return {TransferObject}
|
||||
* @return {FileTransferObject}
|
||||
*/
|
||||
create(): TransferObject {
|
||||
return new TransferObject();
|
||||
create(): FileTransferObject {
|
||||
return new FileTransferObject();
|
||||
}
|
||||
|
||||
}
|
||||
@ -217,12 +215,12 @@ export class Transfer extends IonicNativePlugin {
|
||||
plugin: 'cordova-plugin-file-transfer',
|
||||
pluginName: 'FileTransfer'
|
||||
})
|
||||
export class TransferObject {
|
||||
export class FileTransferObject {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability('FileTransfer', null, 'FileTransfer') === true) {
|
||||
this._objectInstance = new FileTransfer();
|
||||
if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) {
|
||||
this._objectInstance = new (FileTransfer.getPlugin())();
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,9 +237,7 @@ export class TransferObject {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
|
||||
return;
|
||||
}
|
||||
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> { return; }
|
||||
|
||||
/**
|
||||
* Downloads a file from server.
|
||||
@ -256,9 +252,7 @@ export class TransferObject {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> {
|
||||
return;
|
||||
}
|
||||
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Registers a listener that gets called whenever a new chunk of data is transferred.
|
||||
@ -276,5 +270,5 @@ export class TransferObject {
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
abort(): void { }
|
||||
abort(): void {}
|
||||
}
|
@ -102,7 +102,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Track custom metric
|
||||
* @param key {string}
|
||||
* @param key {number}
|
||||
* @param value {any}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@ -110,7 +110,7 @@ export class GoogleAnalytics extends IonicNativePlugin {
|
||||
successIndex: 2,
|
||||
errorIndex: 3
|
||||
})
|
||||
trackMetric(key: string, value?: any): Promise<any> { return; }
|
||||
trackMetric(key: number, value?: number): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Track a screen
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,11 +42,6 @@ export interface ImageResizerOptions {
|
||||
* @description
|
||||
* Cordova Plugin For Image Resize
|
||||
*
|
||||
* Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command:
|
||||
* `ionic cordova plugin add https://github.com/protonet/cordova-plugin-image-resizer.git`
|
||||
*
|
||||
* For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer';
|
||||
@ -74,9 +69,9 @@ export interface ImageResizerOptions {
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ImageResizer',
|
||||
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
|
||||
plugin: 'info.protonet.imageresizer',
|
||||
pluginRef: 'ImageResizer',
|
||||
repo: 'https://github.com/protonet/cordova-plugin-image-resizer',
|
||||
repo: 'https://github.com/JoschkaSchulz/cordova-plugin-image-resizer',
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
|
425
src/@ionic-native/plugins/in-app-purchase-2/index.ts
Normal file
425
src/@ionic-native/plugins/in-app-purchase-2/index.ts
Normal file
@ -0,0 +1,425 @@
|
||||
import { Plugin, IonicNativePlugin, Cordova, CordovaProperty } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name In App Purchase 2
|
||||
* @description
|
||||
* In-App Purchase for Cordova on iOS, Android and Windows
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2';
|
||||
*
|
||||
* constructor(private store: InAppPurchase2) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* * @advanced
|
||||
*
|
||||
* ```typescript
|
||||
* // After Platform Ready
|
||||
* this.store.verbosity = this.store.DEBUG;
|
||||
* this.store.register({
|
||||
* id: productId,
|
||||
* alias: productId,
|
||||
* type: this.store.NON_RENEWING_SUBSCRIPTION
|
||||
* });
|
||||
*
|
||||
* // Register Event Handlers for the specific product
|
||||
* this.store.when(productId).registered( (product: IAPProduct) => {
|
||||
* console.log('Registered: ' + JSON.stringify(product));
|
||||
* });
|
||||
*
|
||||
* // Updated
|
||||
* 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));
|
||||
* });
|
||||
*
|
||||
* this.store.ready().then((status) => {
|
||||
* console.log(JSON.stringify(this.store.get(productId)));
|
||||
* console.log('Store is Ready: ' + JSON.stringify(status));
|
||||
* console.log('Products: ' + JSON.stringify(this.store.products));
|
||||
* });
|
||||
*
|
||||
*
|
||||
* // Errors
|
||||
* this.store.when(productId).error( (error) => {
|
||||
* this.loader.dismiss();
|
||||
* alert('An Error Occured' + JSON.stringify(error));
|
||||
* });
|
||||
* // Refresh Starts Handlers
|
||||
* console.log('Refresh Store');
|
||||
* this.store.refresh();
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // To Purchase
|
||||
* this.store.order(productId);
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
export interface IAPProductOptions {
|
||||
id: string;
|
||||
alias: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type IAPProducts = Array<IAPProduct> & {
|
||||
/**
|
||||
* Get product by ID
|
||||
*/
|
||||
byId: { [id: string]: IAPProduct; };
|
||||
/**
|
||||
* Get product by alias
|
||||
*/
|
||||
byAlias: { [alias: string]: IAPProduct; };
|
||||
/**
|
||||
* Remove all products (for testing only).
|
||||
*/
|
||||
reset: () => {};
|
||||
};
|
||||
|
||||
export type IAPQueryCallback = ((product: IAPProduct) => void) | ((error: IAPError) => void);
|
||||
|
||||
export interface IAPProduct {
|
||||
|
||||
id: string;
|
||||
|
||||
alias: string;
|
||||
|
||||
type: string;
|
||||
|
||||
state: string;
|
||||
|
||||
title: string;
|
||||
|
||||
description: string;
|
||||
|
||||
priceMicros: string;
|
||||
|
||||
price: string;
|
||||
|
||||
currency: string;
|
||||
|
||||
loaded: boolean;
|
||||
|
||||
valid: boolean;
|
||||
|
||||
canPurchase: boolean;
|
||||
|
||||
owned: boolean;
|
||||
|
||||
downloading: boolean;
|
||||
|
||||
downloaded: boolean;
|
||||
|
||||
additionalData: any;
|
||||
|
||||
transaction: any;
|
||||
|
||||
finish(): void;
|
||||
|
||||
verify(): any;
|
||||
|
||||
set(key: string, value: any): void;
|
||||
|
||||
stateChanged(): void;
|
||||
|
||||
on(event: string, callback: Function): void;
|
||||
|
||||
once(event: string, callback: Function): void;
|
||||
|
||||
off(callback: Function): void;
|
||||
|
||||
trigger(action: string, args: any): void;
|
||||
|
||||
}
|
||||
|
||||
export interface IAPProductEvents {
|
||||
loaded: (callback: IAPQueryCallback) => void;
|
||||
updated: (callback: IAPQueryCallback) => void;
|
||||
error: (callback: IAPQueryCallback) => void;
|
||||
approved: (callback: IAPQueryCallback) => void;
|
||||
owned: (callback: IAPQueryCallback) => void;
|
||||
cancelled: (callback: IAPQueryCallback) => void;
|
||||
refunded: (callback: IAPQueryCallback) => void;
|
||||
registered: (callback: IAPQueryCallback) => void;
|
||||
valid: (callback: IAPQueryCallback) => void;
|
||||
invalid: (callback: IAPQueryCallback) => void;
|
||||
requested: (callback: IAPQueryCallback) => void;
|
||||
initiated: (callback: IAPQueryCallback) => void;
|
||||
finished: (callback: IAPQueryCallback) => void;
|
||||
verified: (callback: IAPQueryCallback) => void;
|
||||
unverified: (callback: IAPQueryCallback) => void;
|
||||
expired: (callback: IAPQueryCallback) => void;
|
||||
downloading: (product: IAPProduct, progress: any, time_remaining: any) => void;
|
||||
downloaded: (callback: IAPQueryCallback) => void;
|
||||
}
|
||||
|
||||
export class IAPError {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name In App Purchase 2
|
||||
* @description
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2';
|
||||
*
|
||||
*
|
||||
* constructor(private inAppPurchase2: InAppPurchase2) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'InAppPurchase2',
|
||||
plugin: 'cc.fovea.cordova.purchase',
|
||||
pluginRef: 'store',
|
||||
repo: 'https://github.com/j3k0/cordova-plugin-purchase',
|
||||
platforms: ['iOS', 'Android', 'Windows'],
|
||||
install: 'ionic cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="<ANDROID_BILLING_KEY>"'
|
||||
})
|
||||
@Injectable()
|
||||
export class InAppPurchase2 extends IonicNativePlugin {
|
||||
|
||||
@CordovaProperty
|
||||
QUIET: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERROR: number;
|
||||
|
||||
@CordovaProperty
|
||||
WARNING: number;
|
||||
|
||||
@CordovaProperty
|
||||
INFO: number;
|
||||
|
||||
@CordovaProperty
|
||||
DEBUG: number;
|
||||
|
||||
/**
|
||||
* Debug level. Use QUIET, ERROR, WARNING, INFO or DEBUG constants
|
||||
*/
|
||||
@CordovaProperty
|
||||
verbosity: number;
|
||||
|
||||
/**
|
||||
* Set to true to invoke the platform purchase sandbox. (Windows only)
|
||||
*/
|
||||
@CordovaProperty
|
||||
sandbox: boolean;
|
||||
|
||||
@CordovaProperty
|
||||
FREE_SUBSCRIPTION: string;
|
||||
|
||||
@CordovaProperty
|
||||
PAID_SUBSCRIPTION: string;
|
||||
|
||||
@CordovaProperty
|
||||
NON_RENEWING_SUBSCRIPTION: string;
|
||||
|
||||
@CordovaProperty
|
||||
CONSUMABLE: string;
|
||||
|
||||
@CordovaProperty
|
||||
NON_CONSUMABLE: string;
|
||||
|
||||
|
||||
@CordovaProperty
|
||||
ERR_SETUP: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_LOAD: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_PURCHASE: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_LOAD_RECEIPTS: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_CLIENT_INVALID: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_PAYMENT_CANCELLED: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_PAYMENT_INVALID: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_PAYMENT_NOT_ALLOWED: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_UNKNOWN: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_REFRESH_RECEIPTS: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_INVALID_PRODUCT_ID: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_FINISH: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_COMMUNICATION: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_SUBSCRIPTIONS_NOT_AVAILABLE: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_MISSING_TOKEN: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_VERIFICATION_FAILED: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_BAD_RESPONSE: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_REFRESH: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_PAYMENT_EXPIRED: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_DOWNLOAD: number;
|
||||
|
||||
@CordovaProperty
|
||||
ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE: number;
|
||||
|
||||
|
||||
@CordovaProperty
|
||||
REGISTERED: string;
|
||||
|
||||
@CordovaProperty
|
||||
INVALID: string;
|
||||
|
||||
@CordovaProperty
|
||||
VALID: string;
|
||||
|
||||
@CordovaProperty
|
||||
REQUESTED: string;
|
||||
|
||||
@CordovaProperty
|
||||
INITIATED: string;
|
||||
|
||||
@CordovaProperty
|
||||
APPROVED: string;
|
||||
|
||||
@CordovaProperty
|
||||
FINISHED: string;
|
||||
|
||||
@CordovaProperty
|
||||
OWNED: string;
|
||||
|
||||
@CordovaProperty
|
||||
DOWNLOADING: string;
|
||||
|
||||
@CordovaProperty
|
||||
DOWNLOADED: string;
|
||||
|
||||
|
||||
@CordovaProperty
|
||||
INVALID_PAYLOAD: number;
|
||||
|
||||
@CordovaProperty
|
||||
CONNECTION_FAILED: number;
|
||||
|
||||
@CordovaProperty
|
||||
PURCHASE_EXPIRED: number;
|
||||
|
||||
@CordovaProperty
|
||||
products: IAPProducts;
|
||||
|
||||
@CordovaProperty
|
||||
validator: string | ((product: string | IAPProduct, callback: Function) => void);
|
||||
|
||||
@CordovaProperty
|
||||
log: {
|
||||
error: (message: string) => void;
|
||||
warn: (message: string) => void;
|
||||
info: (message: string) => void;
|
||||
debug: (message: string) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get product by id or alias
|
||||
* @param idOrAlias
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
get(idOrAlias: string): IAPProduct { return; }
|
||||
|
||||
/**
|
||||
* Register error handler
|
||||
* @param onError {Function} function to call on error
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
error(onError: Function): void {}
|
||||
|
||||
/**
|
||||
* Add or register a product
|
||||
* @param product {IAPProductOptions}
|
||||
*/
|
||||
@Cordova({ sync: true})
|
||||
register(product: IAPProductOptions): void {}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param query
|
||||
* @param event
|
||||
* @param callback
|
||||
* @return {IAPProductEvents}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
when(query: string | IAPProduct, event?: string, callback?: IAPQueryCallback): IAPProductEvents { return; }
|
||||
|
||||
/**
|
||||
* Identical to `when`, but the callback will be called only once. After being called, the callback will be unregistered.
|
||||
* @param query {string | IAPProduct}
|
||||
* @param [event] {event}
|
||||
* @param [callback] {IAPQueryCallback}
|
||||
* @return {IAPProductEvents}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
once(query: string | IAPProduct, event?: string, callback?: IAPQueryCallback): IAPProductEvents { return; }
|
||||
|
||||
/**
|
||||
* Unregister a callback. Works for callbacks registered with ready, when, once and error.
|
||||
* @param callback {Function}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
off(callback: Function): void {}
|
||||
|
||||
@Cordova({ sync: true })
|
||||
order(product: string | IAPProduct, additionalData?: any): { then: Function; error: Function; } { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Promise<any>} returns a promise that resolves when the store is ready
|
||||
*/
|
||||
@Cordova()
|
||||
ready(): Promise<void> { return; }
|
||||
|
||||
@Cordova({ sync: true })
|
||||
refresh(): void {}
|
||||
|
||||
}
|
@ -9,6 +9,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-ios-keychain`. For more info, please see the [Keychain plugin docs](https://github.com/ionic-team/cordova-plugin-ios-keychain).
|
||||
*
|
||||
* See also [Secure Storage](https://ionicframework.com/docs/native/secure-storage/) for more supported platforms.
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { Keychain } from '@ionic-native/keychain';
|
||||
|
@ -1,15 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const Media: any;
|
||||
// TODO for ionic native 4.x ... rename plugin class to Media and use Media.getPlugin() to retrieve the original media object
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class MediaObject {
|
||||
|
||||
constructor(private _objectInstance: any) {}
|
||||
constructor(private _objectInstance: any, public onSuccess: Observable<any>, public onError: Observable<any>, public onStatusUpdate: Observable<any>) {}
|
||||
|
||||
/**
|
||||
* Get the current amplitude of the current recording.
|
||||
@ -122,50 +121,29 @@ export type MediaErrorCallback = (error: MediaError) => void;
|
||||
* @description
|
||||
* This plugin provides the ability to record and play back audio files on a device.
|
||||
*
|
||||
* Some hints if you are using iOS and recording doesn't work:
|
||||
* 1.) Try to use a absolute file path but remove beginning "file://".
|
||||
* Then it looks like: `/var/mobile/Containers/Data/Application/AF438B8B-7724-4FBB-8E69-083463224FC4/tmp/my_file.m4a`
|
||||
* Example: `this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a')`
|
||||
* 2.) If that's not working, too, create the file before using.
|
||||
* Example:
|
||||
* ```typescript
|
||||
* import { MediaPlugin, MediaObject } from '@ionic-native/media';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* constructor(private media: MediaPlugin, private file: File) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.file.createFile(this.file.tempDirectory, 'my_file.m4a', true).then(() => {
|
||||
* let file = this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a');
|
||||
* file.startRecord();
|
||||
* window.setTimeout(() => file.stopRecord(), 10000);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* You can find the reasons here: https://github.com/ionic-team/ionic-native/issues/1452#issuecomment-299605906
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MediaPlugin, MediaObject } from '@ionic-native/media';
|
||||
* import { Media, MediaObject } from '@ionic-native/media';
|
||||
*
|
||||
*
|
||||
* constructor(private media: MediaPlugin) { }
|
||||
* constructor(private media: Media) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Create a MediaPlugin instance. Expects path to file or url as argument
|
||||
* // Create a Media 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 onSuccess = () => console.log('Action is successful.');
|
||||
* const onError = (error) => console.error(error.message);
|
||||
* const file: MediaObject = this.media.create('file.mp3');
|
||||
*
|
||||
* const file: MediaObject = this.media.create('path/to/file.mp3', onStatusUpdate, onSuccess, onError);
|
||||
* // to listen to plugin events:
|
||||
*
|
||||
* file.onStatusUpdate.subscribe(status => console.log(status)); // fires when file status changes
|
||||
*
|
||||
* file.onSuccess.subscribe(() => console.log('Action is successful'));
|
||||
*
|
||||
* file.onError.subscribe(error => console.log('Error!', error));
|
||||
*
|
||||
* // play the file
|
||||
* file.play();
|
||||
@ -205,20 +183,45 @@ export type MediaErrorCallback = (error: MediaError) => void;
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* Some hints if you are using iOS and recording doesn't work:
|
||||
* 1.) Try to use a absolute file path but remove beginning "file://".
|
||||
* Then it looks like: `/var/mobile/Containers/Data/Application/AF438B8B-7724-4FBB-8E69-083463224FC4/tmp/my_file.m4a`
|
||||
* Example: `this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a')`
|
||||
* 2.) If that's not working, too, create the file before using.
|
||||
* Example:
|
||||
* ```typescript
|
||||
* import { Media, MediaObject } from '@ionic-native/media';
|
||||
* import { File } from '@ionic-native/file';
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* constructor(private media: Media, private file: File) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.file.createFile(this.file.tempDirectory, 'my_file.m4a', true).then(() => {
|
||||
* let file = this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a');
|
||||
* file.startRecord();
|
||||
* window.setTimeout(() => file.stopRecord(), 10000);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* You can find the reasons here: https://github.com/ionic-team/ionic-native/issues/1452#issuecomment-299605906
|
||||
* @classes
|
||||
* MediaObject
|
||||
* @interfaces
|
||||
* MediaError
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MediaPlugin',
|
||||
pluginName: 'Media',
|
||||
repo: 'https://github.com/apache/cordova-plugin-media',
|
||||
plugin: 'cordova-plugin-media',
|
||||
pluginRef: 'Media',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class MediaPlugin extends IonicNativePlugin {
|
||||
export class Media extends IonicNativePlugin {
|
||||
|
||||
// Constants
|
||||
/**
|
||||
@ -268,19 +271,33 @@ export class MediaPlugin extends IonicNativePlugin {
|
||||
* @param [onError] {MediaErrorCallback} A callback function is be invoked if an error occurs.
|
||||
* @return {MediaObject}
|
||||
*/
|
||||
create(src: string,
|
||||
onStatusUpdate?: MediaStatusUpdateCallback,
|
||||
onSuccess?: Function,
|
||||
onError?: MediaErrorCallback): MediaObject {
|
||||
create(src: string): MediaObject {
|
||||
|
||||
let instance: any;
|
||||
let instance: any,
|
||||
onSuccess: Function,
|
||||
onError: Function,
|
||||
onStatusUpdate: Function;
|
||||
|
||||
if (checkAvailability(MediaPlugin.getPluginRef(), null, MediaPlugin.getPluginName()) === true) {
|
||||
|
||||
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 () => {};
|
||||
});
|
||||
|
||||
if (checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) === true) {
|
||||
// Creates a new media object
|
||||
instance = new Media(src, onSuccess, onError, onStatusUpdate);
|
||||
instance = new (Media.getPlugin())(src, onSuccess, onError, onStatusUpdate);
|
||||
}
|
||||
|
||||
return new MediaObject(instance);
|
||||
return new MediaObject(instance, onSuccessObservable, onErrorObservable, onStatusUpdateObservable);
|
||||
|
||||
}
|
||||
|
||||
|
154
src/@ionic-native/plugins/ms-adal/index.ts
Normal file
154
src/@ionic-native/plugins/ms-adal/index.ts
Normal file
@ -0,0 +1,154 @@
|
||||
import { Plugin, IonicNativePlugin, checkAvailability, InstanceProperty, CordovaInstance } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export interface AuthenticationResult {
|
||||
|
||||
accessToken: string;
|
||||
accesSTokenType: string;
|
||||
expiresOn: Date;
|
||||
idToken: string;
|
||||
isMultipleResourceRefreshToken: boolean;
|
||||
status: string;
|
||||
statusCode: number;
|
||||
tenantId: string;
|
||||
|
||||
/**
|
||||
* Creates authorization header for web requests.
|
||||
* @returns {String} The authorization header.
|
||||
*/
|
||||
createAuthorizationHeader(): string;
|
||||
|
||||
}
|
||||
|
||||
export interface TokenCache {
|
||||
clear(): void;
|
||||
readItems(): Promise<TokenCacheItem[]>;
|
||||
deleteItem(item: TokenCacheItem): void;
|
||||
}
|
||||
|
||||
export interface TokenCacheItem {
|
||||
accessToken: string;
|
||||
authority: string;
|
||||
clientId: string;
|
||||
displayableId: string;
|
||||
expiresOn: Date;
|
||||
isMultipleResourceRefreshToken: boolean;
|
||||
resource: string;
|
||||
tenantId: string;
|
||||
userInfo: UserInfo;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
displayableId: string;
|
||||
userId: string;
|
||||
familyName: string;
|
||||
givenName: string;
|
||||
identityProvider: string;
|
||||
passwordChangeUrl: string;
|
||||
passwordExpiresOn: Date;
|
||||
uniqueId: string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name MS ADAL
|
||||
* @description
|
||||
* Active Directory Authentication Library (ADAL) plugin.
|
||||
* Active Directory Authentication Library ([ADAL](https://docs.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.clients.activedirectory?view=azure-dotnet))
|
||||
* plugin provides easy to use authentication functionality for your Apache Cordova apps by taking advantage of
|
||||
* Windows Server Active Directory and Windows Azure Active Directory. Here you can find the source code for the library.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { MSAdal, AuthenticationContext, AuthenticationResult } from '@ionic-native/ms-adal';
|
||||
*
|
||||
*
|
||||
* constructor(private msAdal: MSAdal) {}
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');
|
||||
*
|
||||
* authContext.acquireTokenAsync('https://graph.windows.net', 'a5d92493-ae5a-4a9f-bcbf-9f1d354067d3', 'http://MyDirectorySearcherApp')
|
||||
* .then((authResponse: AuthenticationResult) => {
|
||||
* console.log('Token is' , authResponse.accessToken);
|
||||
* console.log('Token will expire on', authResponse.expiresOn);
|
||||
* })
|
||||
* .catch((e: any) => console.log('Authentication failed', e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @classes
|
||||
* AuthenticationContext
|
||||
* @interfaces
|
||||
* AuthenticationResult
|
||||
* TokenCache
|
||||
* TokenCacheItem
|
||||
* UserInfo
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'MSADAL',
|
||||
plugin: 'cordova-plugin-ms-adal',
|
||||
pluginRef: 'Microsoft.ADAL',
|
||||
repo: 'https://github.com/AzureAD/azure-activedirectory-library-for-cordova',
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class MSAdal extends IonicNativePlugin {
|
||||
|
||||
createAuthenticationContext(authority: string, validateAuthority: boolean = true) {
|
||||
let authContext: any;
|
||||
if (checkAvailability(MSAdal.getPluginRef(), null, MSAdal.getPluginName()) === true) {
|
||||
authContext = new (MSAdal.getPlugin()).AuthenticationContext(authority);
|
||||
}
|
||||
return new AuthenticationContext(authContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class AuthenticationContext {
|
||||
|
||||
@InstanceProperty
|
||||
authority: string;
|
||||
|
||||
@InstanceProperty
|
||||
validateAuthority: boolean;
|
||||
|
||||
@InstanceProperty
|
||||
tokenCache: any;
|
||||
|
||||
constructor(private _objectInstance: any) {}
|
||||
|
||||
/**
|
||||
* Acquires token using interactive flow. It always shows UI and skips token from cache.
|
||||
*
|
||||
* @param {String} resourceUrl Resource identifier
|
||||
* @param {String} clientId Client (application) identifier
|
||||
* @param {String} redirectUrl Redirect url for this application
|
||||
* @param {String} userId User identifier (optional)
|
||||
* @param {String} extraQueryParameters
|
||||
* Extra query parameters (optional)
|
||||
* Parameters should be escaped before passing to this method (e.g. using 'encodeURI()')
|
||||
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
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
|
||||
* if not expired. It tries to use refresh token if available. If it fails to get token without
|
||||
* displaying UI it will fail. This method guarantees that no UI will be shown to user.
|
||||
*
|
||||
* @param {String} resourceUrl Resource identifier
|
||||
* @param {String} clientId Client (application) identifier
|
||||
* @param {String} userId User identifier (optional)
|
||||
* @returns {Promise} Promise either fulfilled with AuthenticationResult object or rejected with error
|
||||
*/
|
||||
@CordovaInstance({
|
||||
otherPromise: true
|
||||
})
|
||||
acquireTokenSilentAsync(resourceUrl: string, clientId: string, userId: string): Promise<AuthenticationResult> { return; }
|
||||
|
||||
}
|
@ -449,7 +449,10 @@ export class OneSignal extends IonicNativePlugin {
|
||||
* Launch notifications with a launch URL as an in app webview.
|
||||
* @returns {any}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({
|
||||
sync: true,
|
||||
platforms: ['iOS']
|
||||
})
|
||||
iOSSettings(settings: {
|
||||
kOSSettingsKeyAutoPrompt: boolean;
|
||||
kOSSettingsKeyInAppLaunchURL: boolean;
|
||||
@ -463,6 +466,15 @@ export class OneSignal extends IonicNativePlugin {
|
||||
@Cordova({ sync: true })
|
||||
endInit(): any { return; }
|
||||
|
||||
/**
|
||||
* Prompt the user for notification permissions. Callback fires as soon as the user accepts or declines notifications.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS']
|
||||
})
|
||||
promptForPushNotificationsWithUserResponse(): Promise<boolean> { return; }
|
||||
|
||||
/**
|
||||
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
||||
*
|
||||
@ -588,6 +600,13 @@ export class OneSignal extends IonicNativePlugin {
|
||||
@Cordova()
|
||||
postNotification(notificationObj: OSNotification): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Cancels a single OneSignal notification based on its Android notification integer id. Use instead of NotificationManager.cancel(id); otherwise the notification will be restored when your app is restarted.
|
||||
* @param notificationId {string}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
cancelNotification(notificationId: string): void {}
|
||||
|
||||
/**
|
||||
* Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
|
||||
*/
|
||||
@ -615,4 +634,31 @@ export class OneSignal extends IonicNativePlugin {
|
||||
visualLevel: number
|
||||
}): void { }
|
||||
|
||||
/**
|
||||
* The passed in function will be fired when a notification permission setting changes.
|
||||
* This includes the following events:
|
||||
* - Notification permission prompt shown
|
||||
* - The user accepting or declining the permission prompt
|
||||
* - Enabling/disabling notifications for your app in the device Settings after returning to your app.
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
addPermissionObserver(): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* The passed in function will be fired when a notification subscription property changes.
|
||||
* This includes the following events:
|
||||
* - Getting a push token from Apple / Google.
|
||||
* - Getting a player / user id from OneSignal
|
||||
* - OneSignal.setSubscription is called
|
||||
* - User disables or enables notifications
|
||||
* @return {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
addSubscriptionObserver(): Observable<any> { return; }
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ export interface PrintOptions {
|
||||
export class Printer extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Checks whether to device is capable of printing.
|
||||
* Checks whether the device is capable of printing (uses `check()` internally)
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
isAvailable(): Promise<boolean> {
|
||||
|
228
src/@ionic-native/plugins/qr-scanner/index.ts
Normal file
228
src/@ionic-native/plugins/qr-scanner/index.ts
Normal file
@ -0,0 +1,228 @@
|
||||
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface QRScannerStatus {
|
||||
/**
|
||||
* On iOS and Android 6.0+, camera access is granted at runtime by the user (by clicking "Allow" at the dialog).
|
||||
* The authorized property is a boolean value which is true only when the user has allowed camera access to your app (AVAuthorizationStatus.Authorized).
|
||||
* On platforms with permissions granted at install (Android pre-6.0, Windows Phone) this property is always true.
|
||||
*/
|
||||
authorized: boolean;
|
||||
/**
|
||||
* A boolean value which is true if the user permanently denied camera access to the app (AVAuthorizationStatus.Denied).
|
||||
* Once denied, camera access can only be gained by requesting the user change their decision (consider offering a link to the setting via openSettings()).
|
||||
*/
|
||||
denied: boolean;
|
||||
/**
|
||||
* A boolean value which is true if the user is unable to grant permissions due to parental controls, organization security configuration profiles, or similar reasons.
|
||||
*/
|
||||
restricted: boolean;
|
||||
/**
|
||||
* A boolean value which is true if QRScanner is prepared to capture video and render it to the view.
|
||||
*/
|
||||
prepared: boolean;
|
||||
/**
|
||||
* A boolean value which is true when the preview layer is visible (and on all platforms but browser, the native webview background is transparent).
|
||||
*/
|
||||
showing: boolean;
|
||||
/**
|
||||
* A boolean value which is true if QRScanner is actively scanning for a QR code.
|
||||
*/
|
||||
scanning: boolean;
|
||||
/**
|
||||
* A boolean value which is true if QRScanner is displaying a live preview from the device's camera. Set to false when the preview is paused.
|
||||
*/
|
||||
previewing: boolean;
|
||||
/**
|
||||
* A boolean value which is true if the light is enabled.
|
||||
*/
|
||||
lightEnabled: boolean;
|
||||
/**
|
||||
* A boolean value which is true only if the users' operating system is able to QRScanner.openSettings().
|
||||
*/
|
||||
canOpenSettings: boolean;
|
||||
/**
|
||||
* A boolean value which is true only if the users' device can enable a light in the direction of the currentCamera.
|
||||
*/
|
||||
canEnableLight: boolean;
|
||||
/**
|
||||
* A boolean value which is true only if the current device "should" have a front camera.
|
||||
* The camera may still not be capturable, which would emit error code 3, 4, or 5 when the switch is attempted.
|
||||
* (On the browser platform, this value is false until the prepare method is called.)
|
||||
*/
|
||||
canChangeCamera: boolean;
|
||||
/**
|
||||
* A number representing the index of the currentCamera. 0 is the back camera, 1 is the front.
|
||||
*/
|
||||
currentCamera: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name QR Scanner
|
||||
* @description
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner';
|
||||
*
|
||||
*
|
||||
* constructor(private qrScanner: QRScanner) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* // Optionally request the permission early
|
||||
* this.qrScanner.prepare()
|
||||
* .then((status: QRScannerStatus) => {
|
||||
* if (status.authorized) {
|
||||
* // camera permission was granted
|
||||
*
|
||||
*
|
||||
* // start scanning
|
||||
* let scanSub = this.qrScanner.scan().subscribe((text: string) => {
|
||||
* console.log('Scanned something', text);
|
||||
*
|
||||
* this.qrScanner.hide(); // hide camera preview
|
||||
* scanSub.unsubscribe(); // stop scanning
|
||||
* });
|
||||
*
|
||||
* // show camera preview
|
||||
* this.qrScanner.show();
|
||||
*
|
||||
* // wait for user to scan something, then the observable callback will be called
|
||||
*
|
||||
* } else if (status.denied) {
|
||||
* // camera permission was permanently denied
|
||||
* // you must use QRScanner.openSettings() method to guide the user to the settings page
|
||||
* // then they can grant the permission from there
|
||||
* } else {
|
||||
* // permission was denied, but not permanently. You can ask for permission again at a later time.
|
||||
* }
|
||||
* })
|
||||
* .catch((e: any) => console.log('Error is', e));
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* QRScannerStatus
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'QRScanner',
|
||||
plugin: 'cordova-plugin-qrscanner',
|
||||
pluginRef: 'QRScanner',
|
||||
repo: 'https://github.com/bitpay/cordova-plugin-qrscanner',
|
||||
platforms: ['Android', 'Browser', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class QRScanner extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Request permission to use QR scanner.
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
prepare(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Call this method to enable scanning. You must then call the `show` method to make the camera preview visible.
|
||||
* @return {Observable<string>} returns an Observable that emits the scanned text. Unsubscribe from the observable to stop scanning.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node',
|
||||
observable: true,
|
||||
clearFunction: 'cancelScan'
|
||||
})
|
||||
scan(): Observable<string> { return; }
|
||||
|
||||
/**
|
||||
* Configures the native webview to have a transparent background, then sets the background of the <body> and <html> DOM elements to transparent, allowing the webview to re-render with the transparent background.
|
||||
* @returns {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova()
|
||||
show(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Configures the native webview to be opaque with a white background, covering the video preview.
|
||||
* @returns {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova()
|
||||
hide(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Enable the device's light (for scanning in low-light environments).
|
||||
* @returns {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
enableLight(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Disable the device's light.
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
disableLight(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Use front camera
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
useFrontCamera(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Use back camera
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
useBackCamera(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Set camera to be used.
|
||||
* @param camera {number} Provide `0` for back camera, and `1` for front camera.
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova({
|
||||
callbackStyle: 'node'
|
||||
})
|
||||
useCamera(camera: number): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Pauses the video preview on the current frame and pauses scanning.
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova()
|
||||
pausePreview(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Resumse the video preview and resumes scanning.
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova()
|
||||
resumePreview(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Returns permission status
|
||||
* @return {Promise<QRScannerStatus>}
|
||||
*/
|
||||
@Cordova()
|
||||
getStatus(): Promise<QRScannerStatus> { return; }
|
||||
|
||||
/**
|
||||
* Opens settings to edit app permissions.
|
||||
*/
|
||||
@Cordova({
|
||||
sync: true
|
||||
})
|
||||
openSettings(): void {}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface SafariViewControllerOptions {
|
||||
animated?: boolean;
|
||||
@ -74,13 +75,14 @@ export class SafariViewController extends IonicNativePlugin {
|
||||
/**
|
||||
* Shows Safari View Controller
|
||||
* @param options {SafariViewControllerOptions} optional
|
||||
* @returns {Promise<any>}
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
errorIndex: 2,
|
||||
observable: true
|
||||
})
|
||||
show(options?: SafariViewControllerOptions): Promise<any> { return; }
|
||||
show(options?: SafariViewControllerOptions): Observable<any> { return; }
|
||||
|
||||
/**
|
||||
* Hides Safari View Controller
|
||||
|
@ -95,11 +95,11 @@ export class SQLiteObject {
|
||||
executeSql(statement: string, params: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* @param sqlStatements {Array<string | string[]>}
|
||||
* @param sqlStatements {Array<string | string[] | any>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
sqlBatch(sqlStatements: Array<string | string[]>): Promise<any> { return; }
|
||||
sqlBatch(sqlStatements: Array<string | string[] | any>): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
|
@ -5,6 +5,11 @@ export interface WheelSelectorItem {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface DefaultItem {
|
||||
index: number;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface WheelSelectorOptions {
|
||||
/**
|
||||
* The title of the selector's input box
|
||||
@ -17,9 +22,9 @@ export interface WheelSelectorOptions {
|
||||
items: Array<Array<WheelSelectorItem>>;
|
||||
|
||||
/**
|
||||
* Which items to display by default, example ["2","Apple"] (if items.length is 2 for instance)
|
||||
* Which items to display by default.
|
||||
*/
|
||||
defaultItems?: Array<WheelSelectorItem>;
|
||||
defaultItems?: Array<DefaultItem>;
|
||||
|
||||
/**
|
||||
* The 'ok' button text
|
||||
@ -127,8 +132,8 @@ export interface WheelSelectorData {
|
||||
* positiveButtonText: "Ok",
|
||||
* negativeButtonText: "Nope",
|
||||
* defaultItems: [
|
||||
* this.jsonData.numbers[2], // '3'
|
||||
* this.jsonData.fruits[3] // 'Banana'
|
||||
* {index:0, value: this.jsonData.numbers[2].description},
|
||||
* {index: 1, value: this.jsonData.fruits[3].description}
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
@ -150,8 +155,8 @@ export interface WheelSelectorData {
|
||||
* ],
|
||||
* displayKey: 'name',
|
||||
* defaultItems: [
|
||||
* this.jsonData.firstNames[2],
|
||||
* this.jsonData.lastNames[3]
|
||||
* {index:0, value: this.jsonData.firstNames[2].name},
|
||||
* {index: 0, value: this.jsonData.lastNames[3].name}
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
|
Loading…
Reference in New Issue
Block a user