diff --git a/README.md b/README.md index 967bb1db..976c5d4d 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,10 @@ export class MyComponent { constructor(private geolocation: Geolocation, private platform: Platform) { - platform.ready().then(() => { + this.platform.ready().then(() => { // get position - geolocation.getCurrentPosition().then(pos => { + this.geolocation.getCurrentPosition().then(pos => { console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) }); @@ -67,7 +67,6 @@ export class MyComponent { // watch position const watch = geolocation.watchPosition().subscribe(pos => { console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) - this.position = pos; }); // to stop watching @@ -169,7 +168,7 @@ providers: [ Here's the full example: ```typescript -import { NgModule, ErrorHandler } from '@angular/core'; +import { ErrorHandler, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { MyApp } from './app.component'; @@ -177,26 +176,29 @@ import { HomePage } from '../pages/home/home'; import { Camera } from '@ionic-native/camera/ngx'; +import { HomePage } from '../pages/home/home'; +import { MyApp } from './app.component'; + class CameraMock extends Camera { getPicture(options) { return new Promise((resolve, reject) => { - resolve("BASE_64_ENCODED_DATA_GOES_HERE"); - }) + resolve('BASE_64_ENCODED_DATA_GOES_HERE'); + }); } } @NgModule({ declarations: [ - MyApp, + MyApp, HomePage ], imports: [ - BrowserModule, + BrowserModule, IonicModule.forRoot(MyApp) ], bootstrap: [IonicApp], entryComponents: [ - MyApp, + MyApp, HomePage ], providers: [ @@ -205,6 +207,7 @@ class CameraMock extends Camera { ] }) 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) +Daniel Sogl - [@sogldaniel](https://twitter.com/sogldaniel) + Tim Lancina - [@timlancina](https://twitter.com/timlancina) Mike Hartington - [@mhartington](https://twitter.com/mhartington) diff --git a/gulpfile.js b/gulpfile.js index 1bf2f98a..95ec3009 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,6 @@ const gulp = require('gulp'), minimist = require('minimist'), rename = require("gulp-rename"), tslint = require('gulp-tslint'), - decamelize = require('decamelize'), replace = require('gulp-replace'), _ = require('lodash'); diff --git a/package-lock.json b/package-lock.json index 7d9b80f8..008c0bf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16310,6 +16310,12 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", "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 } } } diff --git a/package.json b/package.json index 1230a4d6..deff9cc8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "conventional-changelog-cli": "^2.0.1", "cpr": "^3.0.1", "cz-conventional-changelog": "^2.1.0", - "decamelize": "^2.0.0", "dgeni": "^0.4.9", "dgeni-packages": "0.16.10", "fs-extra": "^6.0.1", diff --git a/src/@ionic-native/plugins/abbyy-rtr/index.ts b/src/@ionic-native/plugins/abbyy-rtr/index.ts new file mode 100644 index 00000000..7881d954 --- /dev/null +++ b/src/@ionic-native/plugins/abbyy-rtr/index.ts @@ -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; + + /** + * Recognition language selected by default. + */ + recognitionLanguages?: Array; + + /** + * 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 + }; + + /** + * 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, + 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} + */ + @CordovaCheck() + startTextCapture(options: TextCaptureOptions): Promise { + return new Promise((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} + */ + @CordovaCheck() + startDataCapture(options: DataCaptureOptions): Promise { + return new Promise((resolve, reject) => { + AbbyyRtrSdk.startDataCapture((result: DataCaptureResult) => { + if (result.error) { + reject(result); + } else { + resolve(result); + } + }, options); + }); + } +} diff --git a/src/@ionic-native/plugins/alipay/index.ts b/src/@ionic-native/plugins/alipay/index.ts index 2e4a7670..47771c5b 100644 --- a/src/@ionic-native/plugins/alipay/index.ts +++ b/src/@ionic-native/plugins/alipay/index.ts @@ -1,83 +1,20 @@ import { Injectable } from '@angular/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 * @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 * ```typescript - * import { Alipay, AlipayOrder } from '@ionic-native/alipay'; + * import { Alipay } from '@ionic-native/alipay'; * * constructor(private alipay: Alipay) { * - * // Should get from server side with sign. - * const alipayOrder: AlipayOrder = { - * ... - * } - * - * + * //alipayOrder is a string that has been generated and signed by the server side. * this.alipay.pay(alipayOrder) * .then(result => { * console.log(result); // Success @@ -88,31 +25,26 @@ export interface AlipayOrder { * * } * - * * ``` - * - * @interfaces - * AlipayOrder */ @Plugin({ pluginName: 'Alipay', - plugin: 'cordova-alipay-base', - pluginRef: 'Alipay.Base', - repo: 'https://github.com/xueron/cordova-alipay-base', - install: - 'ionic cordova plugin add cordova-alipay-base --variable ALI_PID=your_app_id', - installVariables: ['ALI_PID'], + plugin: 'cordova-plugin-gubnoi-alipay', + pluginRef: 'Alipay', + repo: 'https://github.com/jing-zhou/cordova-plugin-alipay', + install: 'ionic cordova plugin add cordova-plugin-gubnoi-alipay --variable APP_ID=your_app_id', + installVariables: ['APP_ID'], platforms: ['Android', 'iOS'] }) @Injectable() export class Alipay extends IonicNativePlugin { /** * Open Alipay to perform App pay - * @param { AlipayOrder | string } order alipay options + * @param {string} order alipay order string * @returns {Promise} Returns a Promise that resolves with the success return, or rejects with an error. */ @Cordova() - pay(order: AlipayOrder | string): Promise { + pay(order: string): Promise { return; } } diff --git a/src/@ionic-native/plugins/app-version/index.ts b/src/@ionic-native/plugins/app-version/index.ts index d87f884d..5bb68156 100644 --- a/src/@ionic-native/plugins/app-version/index.ts +++ b/src/@ionic-native/plugins/app-version/index.ts @@ -36,28 +36,30 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export class AppVersion extends IonicNativePlugin { /** - * Returns the name of the app + * Returns the name of the app, e.g.: "My Awesome App" * @returns {Promise} */ @Cordova() getAppName(): Promise { return; } /** - * Returns the package name of the app + * Returns the package name of the app, e.g.: "com.example.myawesomeapp" * @returns {Promise} */ @Cordova() getPackageName(): Promise { return; } /** - * Returns the build identifier of the app - * @returns {Promise} + * Returns the build identifier of the app. + * 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} */ @Cordova() - getVersionCode(): Promise { return; } + getVersionCode(): Promise { return; } /** - * Returns the version of the app + * Returns the version of the app, e.g.: "1.2.3" * @returns {Promise} */ @Cordova() diff --git a/src/@ionic-native/plugins/barcode-scanner/index.ts b/src/@ionic-native/plugins/barcode-scanner/index.ts index 9a81c4c8..3a23fbc5 100644 --- a/src/@ionic-native/plugins/barcode-scanner/index.ts +++ b/src/@ionic-native/plugins/barcode-scanner/index.ts @@ -68,7 +68,7 @@ export interface BarcodeScanResult { | 'ITF' | 'RSS14' | 'RSS_EXPANDED' - | 'PDF417' + | 'PDF_417' | 'AZTEC' | 'MSI'; cancelled: boolean; diff --git a/src/@ionic-native/plugins/ble/index.ts b/src/@ionic-native/plugins/ble/index.ts index c8c8cc39..e7814571 100644 --- a/src/@ionic-native/plugins/ble/index.ts +++ b/src/@ionic-native/plugins/ble/index.ts @@ -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 * ``` - * BLE.autoConnect('12:34:56:78:9A:BC').subscribe(peripheralData => { - * console.log(peripheralData); - * }, - * peripheralData => { - * console.log('disconnected'); - * }); + * someFunction() { + * this.ble.autoConnect(deviceId, onConnected.bind(this), onDisconnected.bind(this)); + * } + * + * 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 - * @return {Observable} 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({ - observable: true, - clearFunction: 'disconnect', - clearWithArgs: true - }) - autoConnect(deviceId: string): Observable { + @Cordova({ sync: true }) + autoConnect(deviceId: string, connectCallback: any, disconnectCallback: any) { return; } @@ -579,4 +588,41 @@ export class BLE extends IonicNativePlugin { readRSSI(deviceId: string): Promise { 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} Returns a promise with a list of peripheral objects + */ + @Cordova() + connectedPeripheralsWithServices (services: string[]): Promise { + return; + } + + /** + * Find the connected peripherals offering the listed service UUIDs. + * iOS only + * + * @param {string[]} uuids List of peripheral UUIDs + * @returns {Promise} Returns a promise with a list of peripheral objects + */ + @Cordova() + peripheralsWithIdentifiers (uuids: string[]): Promise { + return; + } + + /** + * Find the bonded devices + * Android only + * + * @returns {Promise} Returns a promise with a list of peripheral objects + */ + @Cordova() + bondedDevices (): Promise { + return; + } } diff --git a/src/@ionic-native/plugins/class-kit/index.ts b/src/@ionic-native/plugins/class-kit/index.ts new file mode 100644 index 00000000..4c96c628 --- /dev/null +++ b/src/@ionic-native/plugins/class-kit/index.ts @@ -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 can’t test ClassKit behavior in Simulator because Schoolwork isn’t 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} + */ + @Cordova() + initContextsFromXml(urlPrefix: string): Promise { + 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} + */ + @Cordova() + addContext(urlPrefix: string, context: CCKContext): Promise { + return; + } + + /** + * Remove all contexts + * @return {Promise} + */ + @Cordova() + removeContexts(): Promise { + return; + } + + /** + * Remove context with identifier path + * @param {string[]} identifierPath Full identifier path from root, including the context identifier itself. + * @return {Promise} + */ + @Cordova() + removeContext(identifierPath: string[]): Promise { + 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} + */ + @Cordova() + beginActivity(identifierPath: string[], asNew: boolean): Promise { + return; + } + + /** + * End the active activity + * @return {Promise} + */ + @Cordova() + endActivity(): Promise { + 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} + */ + @Cordova() + setProgressRange(fromStart: number, toEnd: number): Promise { + 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} + */ + @Cordova() + setProgress(progress: number): Promise { + 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} + */ + @Cordova() + setBinaryItem(binaryItem: CCKBinaryItem): Promise { + 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} + */ + @Cordova() + setScoreItem(scoreItem: CCKScoreItem): Promise { + return; + } + + /** + * Activity information that signifies a quantity. + * @param {CCKQuantityItem} quantityItem The quantity item to add to the activity. + * @return {Promise} + */ + @Cordova() + setQuantityItem(quantityItem: CCKQuantityItem): Promise { + return; + } +} diff --git a/src/@ionic-native/plugins/deeplinks/index.ts b/src/@ionic-native/plugins/deeplinks/index.ts index 97f7c7ae..0d1736d5 100644 --- a/src/@ionic-native/plugins/deeplinks/index.ts +++ b/src/@ionic-native/plugins/deeplinks/index.ts @@ -43,12 +43,12 @@ export interface DeeplinkOptions { * '/about-us': AboutPage, * '/universal-links-test': AboutPage, * '/products/:productId': ProductPage - * }).subscribe((match) => { + * }).subscribe(match => { * // match.$route - the route we matched, which is the matched entry from the arguments to route() * // match.$args - the args passed in the link * // match.$link - the full link data * console.log('Successfully matched route', match); - * }, (nomatch) => { + * }, nomatch => { * // nomatch.$link - the full link data * console.error('Got a deeplink that didn\'t match', nomatch); * }); @@ -61,12 +61,12 @@ export interface DeeplinkOptions { * this.deeplinks.routeWithNavController(this.navController, { * '/about-us': AboutPage, * '/products/:productId': ProductPage - * }).subscribe((match) => { + * }).subscribe(match => { * // match.$route - the route we matched, which is the matched entry from the arguments to route() * // match.$args - the args passed in the link * // match.$link - the full link data * console.log('Successfully matched route', match); - * }, (nomatch) => { + * }, nomatch => { * // nomatch.$link - the full link data * console.error('Got a deeplink that didn\'t match', nomatch); * }); diff --git a/src/@ionic-native/plugins/document-picker/index.ts b/src/@ionic-native/plugins/document-picker/index.ts index bb1f6252..37223878 100644 --- a/src/@ionic-native/plugins/document-picker/index.ts +++ b/src/@ionic-native/plugins/document-picker/index.ts @@ -10,9 +10,9 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * * @usage * ```typescript - * import { IOSDocumentPicker } from '@ionic-native/document-picker'; + * import { DocumentPicker } from '@ionic-native/document-picker'; * - * constructor(private docPicker: IOSDocumentPicker) { } + * constructor(private docPicker: DocumentPicker) { } * * ... * diff --git a/src/@ionic-native/plugins/fcm/index.ts b/src/@ionic-native/plugins/fcm/index.ts index b37ced26..2b5feb36 100644 --- a/src/@ionic-native/plugins/fcm/index.ts +++ b/src/@ionic-native/plugins/fcm/index.ts @@ -55,9 +55,9 @@ export interface NotificationData { */ @Plugin({ pluginName: 'FCM', - plugin: 'cordova-plugin-fcm', + plugin: 'cordova-plugin-fcm-with-dependecy-updated', pluginRef: 'FCMPlugin', - repo: 'https://github.com/fechanique/cordova-plugin-fcm', + repo: 'https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated', platforms: ['Android', 'iOS'] }) @Injectable() diff --git a/src/@ionic-native/plugins/health-kit/index.ts b/src/@ionic-native/plugins/health-kit/index.ts index dd5abad7..58344ce7 100644 --- a/src/@ionic-native/plugins/health-kit/index.ts +++ b/src/@ionic-native/plugins/health-kit/index.ts @@ -1,5 +1,5 @@ -import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface HealthKitOptions { /** @@ -13,9 +13,6 @@ export interface HealthKitOptions { */ aggregation?: string; - /** - * - */ amount?: number; /** @@ -24,19 +21,10 @@ export interface HealthKitOptions { */ ascending?: boolean; - /** - * - */ correlationType?: string; - /** - * - */ date?: any; - /** - * - */ distance?: number; /** @@ -49,14 +37,8 @@ export interface HealthKitOptions { */ duration?: number; - /** - * - */ endDate?: any; - /** - * - */ energy?: number; /** @@ -64,9 +46,6 @@ export interface HealthKitOptions { */ energyUnit?: string; - /** - * - */ extraData?: any; /** @@ -74,39 +53,20 @@ export interface HealthKitOptions { */ limit?: number; - /** - * - */ metadata?: any; - /** - * - */ quantityType?: string; - /** - * - */ + type?: string; + readTypes?: any; - /** - * - */ requestWritePermission?: boolean; - /** - * - */ samples?: any; - /** - * - */ sampleType?: string; - /** - * - */ startDate?: any; /** @@ -114,14 +74,8 @@ export interface HealthKitOptions { */ unit?: string; - /** - * - */ requestReadPermission?: boolean; - /** - * - */ writeTypes?: any; } diff --git a/src/@ionic-native/plugins/linkedin/index.ts b/src/@ionic-native/plugins/linkedin/index.ts index 0831ff78..3a4db26b 100644 --- a/src/@ionic-native/plugins/linkedin/index.ts +++ b/src/@ionic-native/plugins/linkedin/index.ts @@ -24,7 +24,7 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp * // login * const scopes = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share']; * this.linkedin.login(scopes, true) - * .then(() => console.log('Logged in!') + * .then(() => console.log('Logged in!')) * .catch(e => console.log('Error logging in', e)); * * diff --git a/src/@ionic-native/plugins/network-interface/index.ts b/src/@ionic-native/plugins/network-interface/index.ts index 73182ae7..5dde7307 100644 --- a/src/@ionic-native/plugins/network-interface/index.ts +++ b/src/@ionic-native/plugins/network-interface/index.ts @@ -10,15 +10,21 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; * ```typescript * import { NetworkInterface } from '@ionic-native/network-interface'; * + * constructor( private networkInterface: NetworkInterface ) { * - * constructor(private networkInterface: NetworkInterface) { } - * - * ... - * - * this.networkInterface.getWiFiIPAddress(function (ip) { alert(ip); }); - * this.networkInterface.getCarrierIPAddress(function (ip) { alert(ip); }); + * this.networkInterface.getWiFiIPAddress() + * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`)) + * .catch(error => console.error(`Unable to get IP: ${error}`)); * + * 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({ @@ -31,28 +37,32 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; @Injectable() export class NetworkInterface extends IonicNativePlugin { - @Cordova() - getIPAddress(): Promise { - return; - } - /** * Gets the WiFi IP address - * @param success {Function} Callback used when successful - * @param error {Function} Callback used when failure + * @return {Promise} Returns a Promise that resolves with the IP address information. */ @Cordova() - getWiFiIPAddress(): Promise { + getWiFiIPAddress(): Promise { return; } /** * Gets the wireless carrier IP address - * @param success {Function} Callback used when successful - * @param error {Function} Callback used when failure + * @return {Promise} Returns a Promise that resolves with the IP address information. */ @Cordova() - getCarrierIPAddress(): Promise { + getCarrierIPAddress(): Promise { return; } + + /** + * Gets the relevant proxies for the passed URL in order of application + * @param {url} message The message to display. + * @return {Promise} Returns a Promise that resolves with the proxy information. + */ + @Cordova() + getHttpProxyInformation(url: string): Promise { + return; + } + } diff --git a/src/@ionic-native/plugins/sqlite/index.ts b/src/@ionic-native/plugins/sqlite/index.ts index cfb2c1db..0436bcdf 100644 --- a/src/@ionic-native/plugins/sqlite/index.ts +++ b/src/@ionic-native/plugins/sqlite/index.ts @@ -36,20 +36,21 @@ export interface SQLiteDatabaseConfig { /** * @hidden */ -export interface SQLiteTransaction { - start: () => void; +export interface DbTransaction { executeSql: ( sql: any, - values: any, - success: Function, - error: Function - ) => void; - addStatement: ( - sql: any, - values: any, - success: Function, - error: Function + values?: any[], + success?: Function, + error?: Function ) => void; +} + +/** + * @hidden + */ +export interface SQLiteTransaction extends DbTransaction { + start: () => void; + addStatement: DbTransaction['executeSql']; handleStatementSuccess: (handler: Function, response: any) => void; handleStatementFailure: (handler: Function, response: any) => void; run: () => void; @@ -73,14 +74,14 @@ export class SQLiteObject { addTransaction(transaction: (tx: SQLiteTransaction) => void): void {} /** - * @param fn {any} + * @param fn {Function} * @returns {Promise} */ @CordovaInstance({ successIndex: 2, errorIndex: 1 }) - transaction(fn: any): Promise { + transaction(fn: (tx: DbTransaction) => void): Promise { return; } @@ -119,7 +120,7 @@ export class SQLiteObject { * ensure it resolved and successfully opened the database. */ @CordovaInstance() - executeSql(statement: string, params: any): Promise { + executeSql(statement: string, params?: any[]): Promise { return; } diff --git a/src/@ionic-native/plugins/streaming-media/index.ts b/src/@ionic-native/plugins/streaming-media/index.ts index 7a5bdb34..d9272fac 100644 --- a/src/@ionic-native/plugins/streaming-media/index.ts +++ b/src/@ionic-native/plugins/streaming-media/index.ts @@ -1,18 +1,48 @@ import { Injectable } from '@angular/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; +/** + * Object of options to pass into the playVideo method. + */ export interface StreamingVideoOptions { + /** Executes after success playing audio. */ successCallback?: Function; + /** Executes after error playing video. */ errorCallback?: Function; + /** Force one orientation for playing video. */ 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 { + /** Background color for audio player. */ bgColor?: string; + /** Background image for audio player. */ bgImage?: string; + /** + * Background image scale for audio player. + * Valid values are: + * fit + * stretch + * aspectStretch. + */ bgImageScale?: string; + /** Start audio player in full screen. iOS only. */ 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; + /** Executes after error playing audio. */ errorCallback?: Function; } @@ -30,8 +60,10 @@ export interface StreamingAudioOptions { * let options: StreamingVideoOptions = { * successCallback: () => { console.log('Video played') }, * errorCallback: (e) => { console.log('Error streaming') }, - * orientation: 'landscape' - * } + * orientation: 'landscape', + * shouldAutoClose: true, + * controls: false + * }; * * this.streamingMedia.playVideo('https://path/to/video/stream', options); *