diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index 3eeeff32c5..d22083a10c 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -118,7 +118,7 @@

<@- if doc.decorators @> <@ for prop in doc.decorators[0].argumentInfo @> -
$ <@ if prop.install @><$ prop.install $><@ else @>cordova plugin add <$ prop.plugin $><@ endif -@>
+
$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif -@>

Repo: <$ prop.repo $> diff --git a/src/index.ts b/src/index.ts index 6044e5dea9..1996c02348 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,11 +25,13 @@ import {DeviceMotion} from './plugins/devicemotion'; import {DeviceOrientation} from './plugins/deviceorientation'; import {Diagnostic} from './plugins/diagnostic'; import {Dialogs} from './plugins/dialogs'; +import {EmailComposer} from './plugins/emailcomposer'; import {Facebook} from './plugins/facebook'; import {File} from './plugins/file'; import {Flashlight} from './plugins/flashlight'; import {Geolocation} from './plugins/geolocation'; import {Globalization} from './plugins/globalization'; +import {GoogleAnalytics} from './plugins/googleanalytics'; import {Hotspot} from './plugins/hotspot'; import {ImagePicker} from './plugins/imagepicker'; import {InAppBrowser} from './plugins/inappbrowser'; @@ -46,6 +48,7 @@ import {StatusBar} from './plugins/statusbar'; import {Toast} from './plugins/toast'; import {TouchID} from './plugins/touchid'; import {Vibration} from './plugins/vibration'; +import {WebIntent} from './plugins/webintent'; export { ActionSheet, @@ -69,11 +72,13 @@ export { DeviceOrientation, Dialogs, Diagnostic, + EmailComposer, Facebook, File, Flashlight, Geolocation, Globalization, + GoogleAnalytics, Hotspot, ImagePicker, InAppBrowser, @@ -89,7 +94,8 @@ export { StatusBar, Toast, TouchID, - Vibration + Vibration, + WebIntent } export * from './plugins/plugin'; @@ -117,11 +123,13 @@ window['IonicNative'] = { DeviceOrientation: DeviceOrientation, Dialogs: Dialogs, Diagnostic: Diagnostic, + EmailComposer: EmailComposer, Facebook: Facebook, File: File, Flashlight: Flashlight, Geolocation: Geolocation, Globalization: Globalization, + GoogleAnalytics: GoogleAnalytics, Hotspot: Hotspot, ImagePicker: ImagePicker, InAppBrowser: InAppBrowser, @@ -137,7 +145,8 @@ window['IonicNative'] = { StatusBar: StatusBar, Toast: Toast, TouchID: TouchID, - Vibration: Vibration + Vibration: Vibration, + WebIntent: WebIntent }; // To help developers using cordova, we listen for the device ready event and diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index 8c0189ff83..bf1719a647 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -38,10 +38,10 @@ export class ActionSheet { * |-------------------------------|-----------|----------------------------------------------| * | title |`string` | The title for the actionsheet | * | buttonLabels |`string[]` | the labels for the buttons. Uses the index x | - * | androidTheme |`number` | Theme to bue used on Android | + * | androidTheme |`number` | Theme to be used on Android | * | androidEnableCancelButton |`boolean` | Enable a cancel on Android | - * | winphoneEnableCancelButton |`boolean` | Enable a cancel on Android | - * | addCancelButtonWithLabel |`string` | Add a cancle button with text | + * | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone | + * | addCancelButtonWithLabel |`string` | Add a cancel button with text | * | addDestructiveButtonWithLabel |`string` | Add a destructive button with text | * | position |`number[]` | On an iPad, set the X,Y position | * diff --git a/src/plugins/batterystatus.ts b/src/plugins/batterystatus.ts index a71f2c052e..b8e738cecd 100644 --- a/src/plugins/batterystatus.ts +++ b/src/plugins/batterystatus.ts @@ -37,7 +37,7 @@ export class BatteryStatus { */ @Cordova({ eventObservable: true, - event: 'batterylevel' + event: 'batterystatus' }) static onChange () : Observable {return} @@ -73,4 +73,4 @@ export interface StatusObject { * A boolean that indicates whether the device is plugged in */ isPlugged : boolean -} \ No newline at end of file +} diff --git a/src/plugins/devicemotion.ts b/src/plugins/devicemotion.ts index 0dc6676ecb..3156c2a7b2 100644 --- a/src/plugins/devicemotion.ts +++ b/src/plugins/devicemotion.ts @@ -52,7 +52,7 @@ export interface accelerometerOptions { * ); * * // Watch device acceleration - * var subscription = DeviceMotion.watchPosition().subscribe(acceleration => { + * var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => { * console.log(acceleration); * }); * diff --git a/src/plugins/emailcomposer.ts b/src/plugins/emailcomposer.ts new file mode 100644 index 0000000000..d07e46d495 --- /dev/null +++ b/src/plugins/emailcomposer.ts @@ -0,0 +1,99 @@ +import {Plugin, Cordova} from './plugin'; + +declare var cordova; + +/** + * Email object for Opening Email Composer + */ +export interface email { + app?: string, + to: string | Array, + cc: string | Array, + bcc: string | Array, + attachments: Array, + subject: string, + body: string, + isHtml: boolean +} + +/** + * @name Email Composer + * @description + * + * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer). + * + * @usage + * ```ts + * import {EmailComposer} from 'ionic-native'; + * + * + * EmailComposer.isAvailable().then((available) =>{ + * if(available) { + * //Now we know we can send + * } + * }); + * + * let email = { + * to: 'max@mustermann.de', + * cc: 'erika@mustermann.de', + * bcc: ['john@doe.com', 'jane@doe.com'], + * attachments: [ + * 'file://img/logo.png', + * 'res://icon.png', + * 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...', + * 'file://README.pdf' + * ], + * subject: 'Cordova Icons', + * body: 'How are you? Nice greetings from Leipzig', + * isHtml: true + * }; + * + * // Send a text message using default options + * EmailComposer.send(email); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-email-composer', + pluginRef: 'cordova.plugins.email', + repo: 'https://github.com/katzer/cordova-plugin-email-composer.git', + platforms: ['Android', 'iOS', 'Windows Phone 8'] +}) +export class EmailComposer { + + /** + * Verifies if sending emails is supported on the device. + * + * @param app {string?} An optional app id or uri scheme. Defaults to mailto. + * @param scope {any?} An optional scope for the promise + * @returns {Promise} Resolves promise with boolean whether EmailComposer is available + */ + static isAvailable (app? : string, scope? : any) : Promise { + return new Promise((resolve, reject) => { + cordova.plugins.email.isAvailable(app, resolve, scope); + }); + } + + /** + * Adds a new mail app alias. + * + * @param alias {string} The alias name + * @param packageName {string} The package name + */ + @Cordova() + static addAlias(alias : string, packageName : string): void {} + + /** + * Displays the email composer pre-filled with data. + * + * @param email {email} Email + * @param scope {any?} An optional scope for the promise + * @returns {Promise} Resolves promise when the EmailComposer has been opened + */ + @Cordova({ + successIndex: 1, + errorIndex: 3 + }) + static open(email : email, scope? : any) : Promise {return} + +} diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 98abe5d141..6bbc7c8857 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -35,8 +35,8 @@ import {Plugin, Cordova} from './plugin'; * * // Schedule delayed notification * LocalNotifications.schedule({ - * t ext: "Delayed Notification", - * at: new Date(new Date() + 3600), + * text: "Delayed Notification", + * at: new Date(new Date().getTime() + 3600), * led: "FF0000", * sound: null * }); @@ -273,4 +273,4 @@ export interface Notification { * Default: FFFFFF */ led? : string -} \ No newline at end of file +} diff --git a/src/plugins/statusbar.ts b/src/plugins/statusbar.ts index cc04e569b4..3be40ae6de 100644 --- a/src/plugins/statusbar.ts +++ b/src/plugins/statusbar.ts @@ -74,7 +74,7 @@ export class StatusBar { * Set the status bar to a specific named color. Valid options: * black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown. * - * iOS note: you must call StatusBar.setOverlay(false) to enable color changing. + * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing. * * @param {string} colorName The name of the color (from above) */ @@ -86,7 +86,7 @@ export class StatusBar { /** * Set the status bar to a specific hex color (CSS shorthand supported!). * - * iOS note: you must call StatusBar.setOverlay(false) to enable color changing. + * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing. * * @param {string} hexString The hex value of the color. */ diff --git a/src/plugins/webintent.ts b/src/plugins/webintent.ts new file mode 100644 index 0000000000..f23c2d241c --- /dev/null +++ b/src/plugins/webintent.ts @@ -0,0 +1,38 @@ +import {Cordova, CordovaProperty, Plugin} from './plugin'; +declare var window; +@Plugin({ + plugin: 'https://github.com/Initsogar/cordova-webintent.git', + pluginRef: 'window.plugins.webintent', + repo: 'https://github.com/Initsogar/cordova-webintent.git' +}) +export class WebIntent { + + @CordovaProperty + static get ACTION_VIEW () { + return window.plugins.webintent.ACTION_VIEW; + } + + @CordovaProperty + static get EXTRA_TEXT () { + return window.plugins.webintent.EXTRA_TEXT; + } + + @Cordova() + static startActivity (options : {action:any,url:string}) : Promise {return} + + @Cordova() + static hasExtra (extra : any) : Promise {return} + + @Cordova() + static getExtra (extra : any) : Promise {return} + + @Cordova() + static getUri () : Promise {return}; + + @Cordova() + static onNewIntent() : Promise {return}; + + @Cordova() + static sendBroadcast(options : {action:string, extras?:{option:boolean}}) : Promise {return} + +} \ No newline at end of file