Merge branch 'master' into v5

This commit is contained in:
Daniel 2018-07-18 22:12:44 +02:00
commit bea5eaea1a
18 changed files with 890 additions and 202 deletions

View File

@ -56,10 +56,10 @@ export class MyComponent {
constructor(private geolocation: Geolocation, private platform: Platform) { constructor(private geolocation: Geolocation, private platform: Platform) {
platform.ready().then(() => { this.platform.ready().then(() => {
// get position // get position
geolocation.getCurrentPosition().then(pos => { this.geolocation.getCurrentPosition().then(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
}); });
@ -67,7 +67,6 @@ export class MyComponent {
// watch position // watch position
const watch = geolocation.watchPosition().subscribe(pos => { const watch = geolocation.watchPosition().subscribe(pos => {
console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`)
this.position = pos;
}); });
// to stop watching // to stop watching
@ -169,7 +168,7 @@ providers: [
Here's the full example: Here's the full example:
```typescript ```typescript
import { NgModule, ErrorHandler } from '@angular/core'; import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component'; import { MyApp } from './app.component';
@ -177,26 +176,29 @@ import { HomePage } from '../pages/home/home';
import { Camera } from '@ionic-native/camera/ngx'; import { Camera } from '@ionic-native/camera/ngx';
import { HomePage } from '../pages/home/home';
import { MyApp } from './app.component';
class CameraMock extends Camera { class CameraMock extends Camera {
getPicture(options) { getPicture(options) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve("BASE_64_ENCODED_DATA_GOES_HERE"); resolve('BASE_64_ENCODED_DATA_GOES_HERE');
}) });
} }
} }
@NgModule({ @NgModule({
declarations: [ declarations: [
MyApp, MyApp,
HomePage HomePage
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
IonicModule.forRoot(MyApp) IonicModule.forRoot(MyApp)
], ],
bootstrap: [IonicApp], bootstrap: [IonicApp],
entryComponents: [ entryComponents: [
MyApp, MyApp,
HomePage HomePage
], ],
providers: [ providers: [
@ -205,6 +207,7 @@ class CameraMock extends Camera {
] ]
}) })
export class AppModule {} export class AppModule {}
``` ```
@ -223,6 +226,8 @@ Let us know or submit a PR! Take a look at [the Developer Guide](https://github.
Ibby Hadeed - [@ihadeed](https://github.com/ihadeed) Ibby Hadeed - [@ihadeed](https://github.com/ihadeed)
Daniel Sogl - [@sogldaniel](https://twitter.com/sogldaniel)
Tim Lancina - [@timlancina](https://twitter.com/timlancina) Tim Lancina - [@timlancina](https://twitter.com/timlancina)
Mike Hartington - [@mhartington](https://twitter.com/mhartington) Mike Hartington - [@mhartington](https://twitter.com/mhartington)

View File

@ -4,7 +4,6 @@ const gulp = require('gulp'),
minimist = require('minimist'), minimist = require('minimist'),
rename = require("gulp-rename"), rename = require("gulp-rename"),
tslint = require('gulp-tslint'), tslint = require('gulp-tslint'),
decamelize = require('decamelize'),
replace = require('gulp-replace'), replace = require('gulp-replace'),
_ = require('lodash'); _ = require('lodash');

6
package-lock.json generated
View File

@ -16310,6 +16310,12 @@
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
"dev": true "dev": true
},
"zone.js": {
"version": "0.8.26",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.26.tgz",
"integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA==",
"dev": true
} }
} }
} }

View File

@ -42,7 +42,6 @@
"conventional-changelog-cli": "^2.0.1", "conventional-changelog-cli": "^2.0.1",
"cpr": "^3.0.1", "cpr": "^3.0.1",
"cz-conventional-changelog": "^2.1.0", "cz-conventional-changelog": "^2.1.0",
"decamelize": "^2.0.0",
"dgeni": "^0.4.9", "dgeni": "^0.4.9",
"dgeni-packages": "0.16.10", "dgeni-packages": "0.16.10",
"fs-extra": "^6.0.1", "fs-extra": "^6.0.1",

View File

@ -0,0 +1,336 @@
import { Injectable } from '@angular/core';
import { CordovaCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
declare const AbbyyRtrSdk: any;
/**
* JSON object that you can pass as the options argument to change text
* capture settings. All keys are optional. Omitting a key means that a
* default setting will be used.
*/
export interface TextCaptureOptions {
/**
* The name of the license file. This file must be located in the
* www/rtr_assets/ directory in your project.
*/
licenseFileName?: string;
/**
* Recognition languages which can be selected by the user,
* for example: ["English", "French", "German"]. Empty array
* disables language selection.
*/
selectableRecognitionLanguages?: Array<string>;
/**
* Recognition language selected by default.
*/
recognitionLanguages?: Array<string>;
/**
* Width and height of the recognition area, separated by a
* whitespace for example: "0.8 0.3". The area of interest is
* centered in the preview frame, its width and height are
* relative to the preview frame size and should be in the [0.0, 1.0] range.
*/
areaOfInterest?: string;
/**
* Whether to stop the plugin as soon as the result status is
* "Stable" (see Result status). When enabled (true), the
* recognition process can be stopped automatically. When
* disabled (false), recognition can be stopped only manually
* by user.
*/
stopWhenStable?: boolean;
/**
* Show (true) or hide (false) the flashlight button in the text
* capture dialog.
*/
isFlashlightVisible?: boolean;
/**
* Show (true) or hide (false) the stop button in the text
* capture dialog. When the user taps stop, RTR SDK returns
* the latest recognition result.
*/
isStopButtonVisible?: boolean;
}
/**
* JSON object that represents text recognition results.
* The callback you implement should parse this object and show results to user.
*/
export interface TextCaptureResult {
/**
* An array of objects representing recognized lines of text.
* These objects have the following keys:
* · text (string): the recognized text.
* · quadrangle (string): vertex coordinates of the bounding quadrangle,
* a string of 8 integers separated with whitespaces ("x1 y1 ... x4 y4"),
* goes clockwise starting from the bottom left.
* · rect (string): position and size of the bounding rectangle,
* a string of 4 integers separated with whitespaces ("x y width height").
*/
textLines: Array<{ text: string, quadrangle: string, rect?: string }>;
/**
* Additional information. This object has the following keys:
* · stabilityStatus (string): result stability status.
* See Result status for details.
* · userAction (string): the user's action which stopped the plugin,
* if any. Can be "Manually Stopped" if the stop button has been used,
* and "Canceled" if the user canceled processing. If the plugin has
* stopped automatically, the userAction key is not present in resultInfo.
* · frameSize (string): full size of the preview frame, a string
* with 2 integers separated with a whitespace ("720 1280").
* · recognitionLanguages (string array): languages used for recognition,
* the array contains language identifiers (["English", "French", "German"]).
*/
resultInfo: {
stabilityStatus: string,
userAction: string,
frameSize: string,
recognitionLanguages: Array<string>
};
/**
* Error details. This key is present only if an error occurs.
* The value is an object which has a single key:
* · description (string): human-readable error description.
*/
error?: {
description: string;
};
}
/**
* JSON object that you can pass as the options argument to change data
* capture settings. All keys are optional. Omitting a key means that a default
* setting will be used, except the profile and customDataCaptureScenario
* keys: you must specify either one of them, but not both at the same time.
*/
export interface DataCaptureOptions {
/**
* The predefined data capture profile to use, for example: "MRZ".
* Note: For the list of supported documents, see Specifications Data
* Capture Profiles in the ABBYY Real-Time Recognition SDK 1 Developer's Guide.
*/
profile?: string;
/**
* Custom data capture settings. This object has the following keys:
* · name (string): the name of your custom data capture scenario, required.
* · description (string): a more detailed description. This key is optional;
* if not given, it will be assigned the same value as name.
* · recognitionLanguages (string array): recognition languages to use.
* Default is ["English"].
* · fields (object array): describes data fields to capture. Each object
* in this array has a single regEx key; its value is a string containing
* the regular expression that should be matched when capturing a field.
*/
customDataCaptureScenario?: {
name: string,
description: string,
recognitionLanguages: Array<string>,
fields: Array<{ regEx: string }>
};
/**
* The name of the license file. This file must be located in the
* www/rtr_assets/ directory in your project.
*/
licenseFileName?: string;
/**
* Width and height of the recognition area, separated by a
* whitespace for example: "0.8 0.3". The area of interest is
* centered in the preview frame, its width and height are
* relative to the preview frame size and should be in the [0.0, 1.0] range.
*/
areaOfInterest?: string;
/**
* Whether to stop the plugin as soon as the result status is
* "Stable" (see Result status). When enabled (true), the
* recognition process can be stopped automatically. When
* disabled (false), recognition can be stopped only manually
* by user.
*/
stopWhenStable?: boolean;
/**
* Show (true) or hide (false) the flashlight button in the text
* capture dialog.
*/
isFlashlightVisible?: boolean;
/**
* Show (true) or hide (false) the stop button in the text
* capture dialog. When the user taps stop, RTR SDK returns
* the latest recognition result.
*/
isStopButtonVisible?: boolean;
}
/**
* JSON object that represents data recognition results. The callback you
* implement should parse this object and show results to user.
*/
export interface DataCaptureResult {
/**
* The data scheme which was applied during data capture.
* The value is an object which has two keys:
* · id (string): the internal scheme identifier.
* · name (string): the scheme name.
* If you had defined a custom data capture scenario in options, both the
* id and name will be the same as the scenario name you specified. If
* you selected a predefined profile, the id and name are specified by the
* profile. If an error occurs during processing, the dataScheme key is not
* present in the result.
*/
dataScheme?: {
id: string,
name: string
};
/**
* Recognized data fields. Each object in the array represents a separate
* data field. The data field objects have the following keys:
* · id (string): the internal identifier of the field.
* · name (string): the field name.
* Similarly to dataScheme, in custom scenarios both id and name are the same
* as the scenario name you specified (currently custom scenarios allow
* only 1 recognized field).
* · text (string): full text of the field.
* · quadrangle (string): vertex coordinates of the bounding quadrangle, a
* string of 8 integers separated with whitespaces ("x1 y1 ... x4 y4"),
* goes clockwise starting from the bottom left.
* · components (object array): an array of objects representing field
* components, that is, the text fragments found on the image, which
* constitute the field.
* In the components array each element is an object with the following keys:
* · text (string): text of this fragment.
* · quadrangle (string): vertex coordinates of the bounding quadrangle of
* this fragment, similar to the field's quadrangle.
* · rect (string): position and size of the bounding rectangle, a string
* of 4 integers separated with whitespaces ("x y width height").
*/
dataFields: {
id: string,
name: string,
text: string,
quadrangle: string,
components: {
text: string,
quadrangle: string,
rect: string
}
};
/**
* Additional information. This object has the following keys:
* · stabilityStatus (string): result stability status.
* See Result status for details.
* · userAction (string): the user's action which stopped the plugin,
* if any. Can be "Manually Stopped" if the stop button has been used,
* and "Canceled" if the user canceled processing. If the plugin has
* stopped automatically, the userAction key is not present in resultInfo.
* · frameSize (string): full size of the preview frame, a string
* with 2 integers separated with a whitespace ("720 1280").
*/
resultInfo: {
stabilityStatus: string,
userAction: string,
frameSize: string
};
/**
* Error details. This key is present only if an error occurs.
* The value is an object which has a single key:
* · description (string): human-readable error description.
*/
error?: {
description: string;
};
}
/**
* @name ABBYY Real-Time Recognition
* @description
* This plugin allows to use the Text Capture and Data Capture features of
* ABBYY Real-Time Recognition SDK (RTR SDK) in apps.
*
* @usage
* ```typescript
* import { AbbyyRTR } from '@ionic-native/abbyy-rtr';
*
*
* constructor(private abbyyRTR: AbbyyRTR) { }
*
* ...
*
*
* this.abbyyRTR.startTextCapture(options)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
*
* this.abbyyRTR.startDataCapture(options)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'AbbyyRTR',
plugin: 'cordova-plugin-abbyy-rtr-sdk',
pluginRef: 'AbbyyRtrSdk',
repo: 'https://github.com/abbyysdk/RTR-SDK.Cordova',
install: 'ionic cordova plugin add cordova-plugin-abbyy-rtr-sdk',
platforms: ['Android', 'iOS']
})
@Injectable()
export class AbbyyRTR extends IonicNativePlugin {
/**
* Opens a modal dialog with controls for the Text Capture scenario.
* @param {TextCaptureOptions} options
* @return {Promise<TextCaptureResult>}
*/
@CordovaCheck()
startTextCapture(options: TextCaptureOptions): Promise<TextCaptureResult> {
return new Promise<any>((resolve, reject) => {
AbbyyRtrSdk.startTextCapture((result: DataCaptureResult) => {
if (result.error) {
reject(result);
} else {
resolve(result);
}
}, options);
});
}
/**
* Opens a modal dialog with controls for the Data Capture scenario.
* @param {DataCaptureOptions} options
* @return {Promise<DataCaptureResult>}
*/
@CordovaCheck()
startDataCapture(options: DataCaptureOptions): Promise<DataCaptureResult> {
return new Promise<any>((resolve, reject) => {
AbbyyRtrSdk.startDataCapture((result: DataCaptureResult) => {
if (result.error) {
reject(result);
} else {
resolve(result);
}
}, options);
});
}
}

View File

@ -1,83 +1,20 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface AlipayOrder {
/**
* appId assigned by Alipay
*/
app_id: string;
/**
* Api name.
* Should be: alipay.trade.app.pay
*/
method: string;
/**
* Data format
* Default: "JSON"
*/
format?: string;
/**
* Charset
* Possible values: "UTF-8", "GBK"
* Default: "UTF-8"
*/
charset: string;
/**
* Sign method
* Default: 'RSA'
*/
sign_type: string;
/**
* Sign value. Should be got from server side.
* Default: 'RSA'
*/
sign: string;
/**
* Timestamp, formated like "yyyy-MM-dd HH:mm:ss", e.g. 2014-07-24 03:07:50
*/
timestamp: string;
/**
* Api version. Fixed value '1.0'
*/
version: string;
/**
* Notify url.
*/
notify_url: string;
/**
* biz content. formated in json. see alipay doc for detail.
*/
biz_content: string;
}
/** /**
* @name Alipay * @name Alipay
* @description * @description
* This plugin is used for Alipay APP support. Integrated with the latest SDK. * This plugin facilitates the usage of Alipay in an Ionic apps with the integrated AlipaySDK dated on 20180601.
* *
* Requires Cordova plugin: `cordova-alipay-base`. For more info, please see the [Alipay plugin docs](https://github.com/xueron/cordova-alipay-base). * Requires Cordova plugin: `cordova-plugin-gubnoi-alipay`. For more info, please see https://github.com/jing-zhou/cordova-plugin-alipay .
* *
* @usage * @usage
* ```typescript * ```typescript
* import { Alipay, AlipayOrder } from '@ionic-native/alipay'; * import { Alipay } from '@ionic-native/alipay';
* *
* constructor(private alipay: Alipay) { * constructor(private alipay: Alipay) {
* *
* // Should get from server side with sign. * //alipayOrder is a string that has been generated and signed by the server side.
* const alipayOrder: AlipayOrder = {
* ...
* }
*
*
* this.alipay.pay(alipayOrder) * this.alipay.pay(alipayOrder)
* .then(result => { * .then(result => {
* console.log(result); // Success * console.log(result); // Success
@ -88,31 +25,26 @@ export interface AlipayOrder {
* *
* } * }
* *
*
* ``` * ```
*
* @interfaces
* AlipayOrder
*/ */
@Plugin({ @Plugin({
pluginName: 'Alipay', pluginName: 'Alipay',
plugin: 'cordova-alipay-base', plugin: 'cordova-plugin-gubnoi-alipay',
pluginRef: 'Alipay.Base', pluginRef: 'Alipay',
repo: 'https://github.com/xueron/cordova-alipay-base', repo: 'https://github.com/jing-zhou/cordova-plugin-alipay',
install: install: 'ionic cordova plugin add cordova-plugin-gubnoi-alipay --variable APP_ID=your_app_id',
'ionic cordova plugin add cordova-alipay-base --variable ALI_PID=your_app_id', installVariables: ['APP_ID'],
installVariables: ['ALI_PID'],
platforms: ['Android', 'iOS'] platforms: ['Android', 'iOS']
}) })
@Injectable() @Injectable()
export class Alipay extends IonicNativePlugin { export class Alipay extends IonicNativePlugin {
/** /**
* Open Alipay to perform App pay * Open Alipay to perform App pay
* @param { AlipayOrder | string } order alipay options * @param {string} order alipay order string
* @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error. * @returns {Promise<any>} Returns a Promise that resolves with the success return, or rejects with an error.
*/ */
@Cordova() @Cordova()
pay(order: AlipayOrder | string): Promise<any> { pay(order: string): Promise<any> {
return; return;
} }
} }

View File

@ -36,28 +36,30 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export class AppVersion extends IonicNativePlugin { export class AppVersion extends IonicNativePlugin {
/** /**
* Returns the name of the app * Returns the name of the app, e.g.: "My Awesome App"
* @returns {Promise<string>} * @returns {Promise<string>}
*/ */
@Cordova() @Cordova()
getAppName(): Promise<string> { return; } getAppName(): Promise<string> { return; }
/** /**
* Returns the package name of the app * Returns the package name of the app, e.g.: "com.example.myawesomeapp"
* @returns {Promise<string>} * @returns {Promise<string>}
*/ */
@Cordova() @Cordova()
getPackageName(): Promise<string> { return; } getPackageName(): Promise<string> { return; }
/** /**
* Returns the build identifier of the app * Returns the build identifier of the app.
* @returns {Promise<string>} * In iOS a string with the build version like "1.6095"
* In Android a number generated from the version string, like 10203 for version "1.2.3"
* @returns {Promise<string | number>}
*/ */
@Cordova() @Cordova()
getVersionCode(): Promise<string> { return; } getVersionCode(): Promise<string | number> { return; }
/** /**
* Returns the version of the app * Returns the version of the app, e.g.: "1.2.3"
* @returns {Promise<string>} * @returns {Promise<string>}
*/ */
@Cordova() @Cordova()

View File

@ -68,7 +68,7 @@ export interface BarcodeScanResult {
| 'ITF' | 'ITF'
| 'RSS14' | 'RSS14'
| 'RSS_EXPANDED' | 'RSS_EXPANDED'
| 'PDF417' | 'PDF_417'
| 'AZTEC' | 'AZTEC'
| 'MSI'; | 'MSI';
cancelled: boolean; cancelled: boolean;

View File

@ -290,25 +290,34 @@ export class BLE extends IonicNativePlugin {
} }
/** /**
* Establish an automatic connection to a peripheral. * Establish an automatic connection to a peripheral. The phone will automatically connect to the Bluetooth peripheral
* whenever it is in range. The autoConnect function uses callbacks instead of observables because connect and
* disconnect can each be called many times as a devices connects and disconnects.
*
* On Android you can pass a MAC address directly to autoConnect. With iOS, you need to get a device id by scanning,
* calling ble.peripheralsWithIdentifiers, or calling ble.connectedPeripheralsWithServices.
*
* @usage * @usage
* ``` * ```
* BLE.autoConnect('12:34:56:78:9A:BC').subscribe(peripheralData => { * someFunction() {
* console.log(peripheralData); * this.ble.autoConnect(deviceId, onConnected.bind(this), onDisconnected.bind(this));
* }, * }
* peripheralData => { *
* console.log('disconnected'); * onConnected(peripheral) {
* }); * console.log(`Connected to ${peripheral.id}`)l
* }
*
* onDisconnected(peripheral) {
* console.log(`Disconnected from ${peripheral.id}`)l
* }
*
* ``` * ```
* @param {string} deviceId UUID or MAC address of the peripheral * @param {string} deviceId UUID or MAC address of the peripheral
* @return {Observable<any>} Returns an Observable that notifies of connect/disconnect. * @param {function} connectCallback function that is called with peripheral data when the devices connects
* @param {function} disconnectCallback function that is called with peripheral data when the devices disconnects
*/ */
@Cordova({ @Cordova({ sync: true })
observable: true, autoConnect(deviceId: string, connectCallback: any, disconnectCallback: any) {
clearFunction: 'disconnect',
clearWithArgs: true
})
autoConnect(deviceId: string): Observable<any> {
return; return;
} }
@ -579,4 +588,41 @@ export class BLE extends IonicNativePlugin {
readRSSI(deviceId: string): Promise<any> { readRSSI(deviceId: string): Promise<any> {
return; return;
} }
/**
* Retrieves a list of the peripherals (containing any of the specified services)
* currently connected to the system. The peripheral list is sent to the success callback.
* iOS only
*
* @param {string[]} services List of services to discover
* @returns {Promise<any>} Returns a promise with a list of peripheral objects
*/
@Cordova()
connectedPeripheralsWithServices (services: string[]): Promise<any[]> {
return;
}
/**
* Find the connected peripherals offering the listed service UUIDs.
* iOS only
*
* @param {string[]} uuids List of peripheral UUIDs
* @returns {Promise<any>} Returns a promise with a list of peripheral objects
*/
@Cordova()
peripheralsWithIdentifiers (uuids: string[]): Promise<any[]> {
return;
}
/**
* Find the bonded devices
* Android only
*
* @returns {Promise<any>} Returns a promise with a list of peripheral objects
*/
@Cordova()
bondedDevices (): Promise<any[]> {
return;
}
} }

View File

@ -0,0 +1,366 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface CCKContext {
/**
* Full identifier path from root, including the context identifier itself..
*/
identifierPath: string[];
/**
* Title of the context.
*/
title: string;
/**
* Optional. Type value for the context.
*/
type?: CCKContextType;
/**
* Optional. Topic value of the context.
*/
topic?: string;
/**
* Optional. Display order of the context.
*/
displayOrder?: number;
}
export enum CCKContextType {
none = 0,
app,
chapter,
section,
level,
page,
task,
challenge,
quiz,
exercise,
lesson,
book,
game,
document,
audio,
video
}
export enum CCKContextTopic {
math = 'math',
science = 'science',
literacyAndWriting = 'literacyAndWriting',
worldLanguage = 'worldLanguage',
socialScience = 'socialScience',
computerScienceAndEngineering = 'computerScienceAndEngineering',
artsAndMusic = 'artsAndMusic',
healthAndFitness = 'healthAndFitness'
}
export interface CCKBinaryItem {
/**
* A unique string identifier for the activity item.
*/
identifier: string;
/**
* A human readable name for the activity item.
*/
title: string;
/**
* A type value for the activity item.
*/
type: CCKBinaryType;
/**
* The value that the binary activity item takes.
*/
isCorrect: boolean;
/**
* Optional. Should the activity item be added as the primary activity item.
*/
isPrimaryActivityItem?: boolean;
}
export enum CCKBinaryType {
trueFalse = 0,
passFail,
yesNo
}
export interface CCKScoreItem {
/**
* A unique string identifier for the activity item.
*/
identifier: string;
/**
* A human readable name for the activity item.
*/
title: string;
/**
* The score earned during completion of a task.
*/
score: number;
/**
* The maximum possible score, against which the reported score should be judged.
*/
maxScore: number;
/**
* Optional. Should the activity item be added as the primary activity item.
*/
isPrimaryActivityItem?: boolean;
}
export interface CCKQuantityItem {
/**
* A unique string identifier for the activity item.
*/
identifier: string;
/**
* A human readable name for the activity item.
*/
title: string;
/**
* A quantity associated with the task.
*/
quantity: number;
/**
* Optional. Should the activity item be added as the primary activity item.
*/
isPrimaryActivityItem?: boolean;
}
/**
* @name Class Kit
* @description Plugin for using Apple's ClassKit framework.
*
*
* Prerequisites:
* Only works with Xcode 9.4 and iOS 11.4. Your Provisioning Profile must include the ClassKit capability. Read more about how to Request ClassKit Resources (https://developer.apple.com/contact/classkit/) in here: https://developer.apple.com/documentation/classkit/enabling_classkit_in_your_app.
* Also note that you cant test ClassKit behavior in Simulator because Schoolwork isnt available in that environment.
*
* @usage
* ```typescript
* import { ClassKit, CCKContext, CCKBinaryItem, CCKQuantityItem, CCKScoreItem, CCKContextTopic, CCKContextType, CCKBinaryType } from '@ionic-native/class-kit';
*
* // Init contexts defined in XML file 'CCK-contexts.xml'
* constructor( ..., private classKit: ClassKit) {
* platform.ready().then(() => {
* classKit.initContextsFromXml("classkitplugin://")
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
* });
* }
*
* ...
*
* // Init context with identifier path
* const context: CCKContext = {
* identifierPath: ["parent_title_one", "child_one", "child_one_correct_quiz"],
* title: "child one correct quiz",
* type: CCKContextType.exercise,
* topic: CCKContextTopic.science,
* displayOrder: 0
* };
*
* this.classKit.addContext("classkitplugin://", context)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Remove all contexts
* this.classKit.removeContexts()
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Remove context with identifier path
* this.classKit.removeContext(["parent_title_one", "child_one", "child_one_correct_quiz"])
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Begin a new activity or restart an activity for a given context
* this.classKit.beginActivity(["parent_title_one", "child_two", "child_two_quiz"], false)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Adds a progress range to the active given activity
* this.classKit.setProgressRange(0, 0.66)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Adds a progress to the active given activity
* this.classKit.setProgress(0.66)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Adds activity information that is true or false, pass or fail, yes or no
* const binaryItem: CCKBinaryItem = {
* identifier: "child_two_quiz_IDENTIFIER_1",
* title: "CHILD TWO QUIZ 1",
* type: CCKBinaryType.trueFalse,
* isCorrect: isCorrect,
* isPrimaryActivityItem: false
* };
*
* this.classKit.setBinaryItem(binaryItem)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Adds activity information that signifies a score out of a possible maximum
* const scoreItem: CCKScoreItem = {
* identifier: "total_score",
* title: "Total Score :-)",
* score: 0.66,
* maxScore: 1.0,
* isPrimaryActivityItem: true
* };
*
* this.classKit.setScoreItem(scoreItem)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
*
* // Activity information that signifies a quantity
* const quantityItem: CCKQuantityItem = {
* identifier: "quantity_item_hints",
* title: "Hints",
* quantity: 12,
* isPrimaryActivityItem: false
* };
*
* this.classKit.setQuantityItem(quantityItem)
* .then(() => console.log("success"))
* .catch(e => console.log("error: ", e));
*
* ```
*
* @interfaces
* CCKContext
* CCKContextType
* CCKContextTopic
* CCKBinaryItem
* CCKBinaryType
* CCKScoreItem
* CCKQuantityItem
*/
@Plugin({
pluginName: 'ClassKit',
plugin: 'cordova-plugin-classkit',
pluginRef: 'CordovaClassKit',
repo: 'https://github.com/sebastianbaar/cordova-plugin-classkit.git',
platforms: ['iOS']
})
@Injectable()
export class ClassKit extends IonicNativePlugin {
/**
* Init contexts defined in XML file 'CCK-contexts.xml'
* @param {string} urlPrefix URL prefix to use for custom URLs to locate activities (deeplink).
* @return {Promise<any>}
*/
@Cordova()
initContextsFromXml(urlPrefix: string): Promise<any> {
return;
}
/**
* Init context with identifier path
* @param {string} urlPrefix URL prefix to use for custom URLs to locate activities (deeplink).
* @param {CCKContext} context Context to initialize.
* @return {Promise<any>}
*/
@Cordova()
addContext(urlPrefix: string, context: CCKContext): Promise<any> {
return;
}
/**
* Remove all contexts
* @return {Promise<any>}
*/
@Cordova()
removeContexts(): Promise<any> {
return;
}
/**
* Remove context with identifier path
* @param {string[]} identifierPath Full identifier path from root, including the context identifier itself.
* @return {Promise<any>}
*/
@Cordova()
removeContext(identifierPath: string[]): Promise<any> {
return;
}
/**
* Begin a new activity or restart an activity for a given context
* @param {string[]} identifierPath Full identifier path from root, including the context identifier itself.
* @param {boolean} asNew Should a new activity be created (or an old activity be restarted).
* @return {Promise<any>}
*/
@Cordova()
beginActivity(identifierPath: string[], asNew: boolean): Promise<any> {
return;
}
/**
* End the active activity
* @return {Promise<any>}
*/
@Cordova()
endActivity(): Promise<any> {
return;
}
/**
* Adds a progress range to the active given activity
* @param {number} fromStart The beginning of the new range to add. This should be fractional value between 0 and 1, inclusive.
* @param {number} toEnd The end of the new range to add. This should be larger than the start value and less than or equal to one.
* @return {Promise<any>}
*/
@Cordova()
setProgressRange(fromStart: number, toEnd: number): Promise<any> {
return;
}
/**
* Adds a progress to the active given activity
* @param {number} progress A measure of progress through the task, given as a fraction in the range [0, 1].
* @return {Promise<any>}
*/
@Cordova()
setProgress(progress: number): Promise<any> {
return;
}
/**
* Adds activity information that is true or false, pass or fail, yes or no
* @param {CCKBinaryItem} binaryItem The binary item to add to the activity.
* @return {Promise<any>}
*/
@Cordova()
setBinaryItem(binaryItem: CCKBinaryItem): Promise<any> {
return;
}
/**
* Adds activity information that signifies a score out of a possible maximum
* @param {CCKScoreItem} scoreItem The score item to add to the activity.
* @return {Promise<any>}
*/
@Cordova()
setScoreItem(scoreItem: CCKScoreItem): Promise<any> {
return;
}
/**
* Activity information that signifies a quantity.
* @param {CCKQuantityItem} quantityItem The quantity item to add to the activity.
* @return {Promise<any>}
*/
@Cordova()
setQuantityItem(quantityItem: CCKQuantityItem): Promise<any> {
return;
}
}

View File

@ -43,12 +43,12 @@ export interface DeeplinkOptions {
* '/about-us': AboutPage, * '/about-us': AboutPage,
* '/universal-links-test': AboutPage, * '/universal-links-test': AboutPage,
* '/products/:productId': ProductPage * '/products/:productId': ProductPage
* }).subscribe((match) => { * }).subscribe(match => {
* // match.$route - the route we matched, which is the matched entry from the arguments to route() * // match.$route - the route we matched, which is the matched entry from the arguments to route()
* // match.$args - the args passed in the link * // match.$args - the args passed in the link
* // match.$link - the full link data * // match.$link - the full link data
* console.log('Successfully matched route', match); * console.log('Successfully matched route', match);
* }, (nomatch) => { * }, nomatch => {
* // nomatch.$link - the full link data * // nomatch.$link - the full link data
* console.error('Got a deeplink that didn\'t match', nomatch); * console.error('Got a deeplink that didn\'t match', nomatch);
* }); * });
@ -61,12 +61,12 @@ export interface DeeplinkOptions {
* this.deeplinks.routeWithNavController(this.navController, { * this.deeplinks.routeWithNavController(this.navController, {
* '/about-us': AboutPage, * '/about-us': AboutPage,
* '/products/:productId': ProductPage * '/products/:productId': ProductPage
* }).subscribe((match) => { * }).subscribe(match => {
* // match.$route - the route we matched, which is the matched entry from the arguments to route() * // match.$route - the route we matched, which is the matched entry from the arguments to route()
* // match.$args - the args passed in the link * // match.$args - the args passed in the link
* // match.$link - the full link data * // match.$link - the full link data
* console.log('Successfully matched route', match); * console.log('Successfully matched route', match);
* }, (nomatch) => { * }, nomatch => {
* // nomatch.$link - the full link data * // nomatch.$link - the full link data
* console.error('Got a deeplink that didn\'t match', nomatch); * console.error('Got a deeplink that didn\'t match', nomatch);
* }); * });

View File

@ -10,9 +10,9 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
* *
* @usage * @usage
* ```typescript * ```typescript
* import { IOSDocumentPicker } from '@ionic-native/document-picker'; * import { DocumentPicker } from '@ionic-native/document-picker';
* *
* constructor(private docPicker: IOSDocumentPicker) { } * constructor(private docPicker: DocumentPicker) { }
* *
* ... * ...
* *

View File

@ -55,9 +55,9 @@ export interface NotificationData {
*/ */
@Plugin({ @Plugin({
pluginName: 'FCM', pluginName: 'FCM',
plugin: 'cordova-plugin-fcm', plugin: 'cordova-plugin-fcm-with-dependecy-updated',
pluginRef: 'FCMPlugin', pluginRef: 'FCMPlugin',
repo: 'https://github.com/fechanique/cordova-plugin-fcm', repo: 'https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated',
platforms: ['Android', 'iOS'] platforms: ['Android', 'iOS']
}) })
@Injectable() @Injectable()

View File

@ -1,5 +1,5 @@
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface HealthKitOptions { export interface HealthKitOptions {
/** /**
@ -13,9 +13,6 @@ export interface HealthKitOptions {
*/ */
aggregation?: string; aggregation?: string;
/**
*
*/
amount?: number; amount?: number;
/** /**
@ -24,19 +21,10 @@ export interface HealthKitOptions {
*/ */
ascending?: boolean; ascending?: boolean;
/**
*
*/
correlationType?: string; correlationType?: string;
/**
*
*/
date?: any; date?: any;
/**
*
*/
distance?: number; distance?: number;
/** /**
@ -49,14 +37,8 @@ export interface HealthKitOptions {
*/ */
duration?: number; duration?: number;
/**
*
*/
endDate?: any; endDate?: any;
/**
*
*/
energy?: number; energy?: number;
/** /**
@ -64,9 +46,6 @@ export interface HealthKitOptions {
*/ */
energyUnit?: string; energyUnit?: string;
/**
*
*/
extraData?: any; extraData?: any;
/** /**
@ -74,39 +53,20 @@ export interface HealthKitOptions {
*/ */
limit?: number; limit?: number;
/**
*
*/
metadata?: any; metadata?: any;
/**
*
*/
quantityType?: string; quantityType?: string;
/** type?: string;
*
*/
readTypes?: any; readTypes?: any;
/**
*
*/
requestWritePermission?: boolean; requestWritePermission?: boolean;
/**
*
*/
samples?: any; samples?: any;
/**
*
*/
sampleType?: string; sampleType?: string;
/**
*
*/
startDate?: any; startDate?: any;
/** /**
@ -114,14 +74,8 @@ export interface HealthKitOptions {
*/ */
unit?: string; unit?: string;
/**
*
*/
requestReadPermission?: boolean; requestReadPermission?: boolean;
/**
*
*/
writeTypes?: any; writeTypes?: any;
} }

View File

@ -24,7 +24,7 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp
* // login * // login
* const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share']; * const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'];
* this.linkedin.login(scopes, true) * this.linkedin.login(scopes, true)
* .then(() => console.log('Logged in!') * .then(() => console.log('Logged in!'))
* .catch(e => console.log('Error logging in', e)); * .catch(e => console.log('Error logging in', e));
* *
* *

View File

@ -10,15 +10,21 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
* ```typescript * ```typescript
* import { NetworkInterface } from '@ionic-native/network-interface'; * import { NetworkInterface } from '@ionic-native/network-interface';
* *
* constructor( private networkInterface: NetworkInterface ) {
* *
* constructor(private networkInterface: NetworkInterface) { } * this.networkInterface.getWiFiIPAddress()
* * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`))
* ... * .catch(error => console.error(`Unable to get IP: ${error}`));
*
* this.networkInterface.getWiFiIPAddress(function (ip) { alert(ip); });
* this.networkInterface.getCarrierIPAddress(function (ip) { alert(ip); });
* *
* this.networkInterface.getCarrierIPAddress()
* .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`))
* .catch(error => console.error(`Unable to get IP: ${error}`));
* *
* const url = 'www.github.com';
* this.networkInterface.getHttpProxyInformation(url)
* .then(proxy => console.info(`Type: ${proxy.type}, Host: ${proxy.host}, Port: ${proxy.port}`))
* .catch(error => console.error(`Unable to get proxy info: ${error}`));
* }
* ``` * ```
*/ */
@Plugin({ @Plugin({
@ -31,28 +37,32 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
@Injectable() @Injectable()
export class NetworkInterface extends IonicNativePlugin { export class NetworkInterface extends IonicNativePlugin {
@Cordova()
getIPAddress(): Promise<string> {
return;
}
/** /**
* Gets the WiFi IP address * Gets the WiFi IP address
* @param success {Function} Callback used when successful * @return {Promise<any>} Returns a Promise that resolves with the IP address information.
* @param error {Function} Callback used when failure
*/ */
@Cordova() @Cordova()
getWiFiIPAddress(): Promise<string> { getWiFiIPAddress(): Promise<any> {
return; return;
} }
/** /**
* Gets the wireless carrier IP address * Gets the wireless carrier IP address
* @param success {Function} Callback used when successful * @return {Promise<any>} Returns a Promise that resolves with the IP address information.
* @param error {Function} Callback used when failure
*/ */
@Cordova() @Cordova()
getCarrierIPAddress(): Promise<string> { getCarrierIPAddress(): Promise<any> {
return; return;
} }
/**
* Gets the relevant proxies for the passed URL in order of application
* @param {url} message The message to display.
* @return {Promise<any>} Returns a Promise that resolves with the proxy information.
*/
@Cordova()
getHttpProxyInformation(url: string): Promise<any> {
return;
}
} }

View File

@ -36,20 +36,21 @@ export interface SQLiteDatabaseConfig {
/** /**
* @hidden * @hidden
*/ */
export interface SQLiteTransaction { export interface DbTransaction {
start: () => void;
executeSql: ( executeSql: (
sql: any, sql: any,
values: any, values?: any[],
success: Function, success?: Function,
error: Function error?: Function
) => void;
addStatement: (
sql: any,
values: any,
success: Function,
error: Function
) => void; ) => void;
}
/**
* @hidden
*/
export interface SQLiteTransaction extends DbTransaction {
start: () => void;
addStatement: DbTransaction['executeSql'];
handleStatementSuccess: (handler: Function, response: any) => void; handleStatementSuccess: (handler: Function, response: any) => void;
handleStatementFailure: (handler: Function, response: any) => void; handleStatementFailure: (handler: Function, response: any) => void;
run: () => void; run: () => void;
@ -73,14 +74,14 @@ export class SQLiteObject {
addTransaction(transaction: (tx: SQLiteTransaction) => void): void {} addTransaction(transaction: (tx: SQLiteTransaction) => void): void {}
/** /**
* @param fn {any} * @param fn {Function}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@CordovaInstance({ @CordovaInstance({
successIndex: 2, successIndex: 2,
errorIndex: 1 errorIndex: 1
}) })
transaction(fn: any): Promise<any> { transaction(fn: (tx: DbTransaction) => void): Promise<any> {
return; return;
} }
@ -119,7 +120,7 @@ export class SQLiteObject {
* ensure it resolved and successfully opened the database. * ensure it resolved and successfully opened the database.
*/ */
@CordovaInstance() @CordovaInstance()
executeSql(statement: string, params: any): Promise<any> { executeSql(statement: string, params?: any[]): Promise<any> {
return; return;
} }

View File

@ -1,18 +1,48 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* Object of options to pass into the playVideo method.
*/
export interface StreamingVideoOptions { export interface StreamingVideoOptions {
/** Executes after success playing audio. */
successCallback?: Function; successCallback?: Function;
/** Executes after error playing video. */
errorCallback?: Function; errorCallback?: Function;
/** Force one orientation for playing video. */
orientation?: string; orientation?: string;
/** Should the video close after it's over. Defaults to true. */
shouldAutoClose?: boolean;
/** Should the video have controls. Defaults to true. Android only. */
controls?: boolean;
} }
/**
* Object of options to pass into the playAudio method.
*/
export interface StreamingAudioOptions { export interface StreamingAudioOptions {
/** Background color for audio player. */
bgColor?: string; bgColor?: string;
/** Background image for audio player. */
bgImage?: string; bgImage?: string;
/**
* Background image scale for audio player.
* Valid values are:
* fit
* stretch
* aspectStretch.
*/
bgImageScale?: string; bgImageScale?: string;
/** Start audio player in full screen. iOS only. */
initFullscreen?: boolean; initFullscreen?: boolean;
/**
* Keeps the screen lit and stops it from locking
* while audio is playing. Android only.
*/
keepAwake?: boolean;
/** Executes after success playing audio. */
successCallback?: Function; successCallback?: Function;
/** Executes after error playing audio. */
errorCallback?: Function; errorCallback?: Function;
} }
@ -30,8 +60,10 @@ export interface StreamingAudioOptions {
* let options: StreamingVideoOptions = { * let options: StreamingVideoOptions = {
* successCallback: () => { console.log('Video played') }, * successCallback: () => { console.log('Video played') },
* errorCallback: (e) => { console.log('Error streaming') }, * errorCallback: (e) => { console.log('Error streaming') },
* orientation: 'landscape' * orientation: 'landscape',
* } * shouldAutoClose: true,
* controls: false
* };
* *
* this.streamingMedia.playVideo('https://path/to/video/stream', options); * this.streamingMedia.playVideo('https://path/to/video/stream', options);
* *