Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Apr 25, 2016
2 parents e10d744 + 9702639 commit 9c78837
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 14 deletions.
2 changes: 1 addition & 1 deletion scripts/docs/templates/common.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h1 class="api-title">
<@- if doc.decorators @>

<@ for prop in doc.decorators[0].argumentInfo @>
<pre><code>$ <@ if prop.install @><$ prop.install $><@ else @>cordova plugin add <$ prop.plugin $><@ endif -@></code></pre>
<pre><code>$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif -@></code></pre>
<p>Repo:
<a href="<$ prop.repo $>">
<$ prop.repo $>
Expand Down
13 changes: 11 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand All @@ -69,11 +72,13 @@ export {
DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
Facebook,
File,
Flashlight,
Geolocation,
Globalization,
GoogleAnalytics,
Hotspot,
ImagePicker,
InAppBrowser,
Expand All @@ -89,7 +94,8 @@ export {
StatusBar,
Toast,
TouchID,
Vibration
Vibration,
WebIntent
}

export * from './plugins/plugin';
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/actionsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
*
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/batterystatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class BatteryStatus {
*/
@Cordova({
eventObservable: true,
event: 'batterylevel'
event: 'batterystatus'
})
static onChange () : Observable<StatusObject> {return}

Expand Down Expand Up @@ -73,4 +73,4 @@ export interface StatusObject {
* A boolean that indicates whether the device is plugged in
*/
isPlugged : boolean
}
}
2 changes: 1 addition & 1 deletion src/plugins/devicemotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
* });
*
Expand Down
99 changes: 99 additions & 0 deletions src/plugins/emailcomposer.ts
Original file line number Diff line number Diff line change
@@ -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<string>,
cc: string | Array<string>,
bcc: string | Array<string>,
attachments: Array<any>,
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<boolean>} Resolves promise with boolean whether EmailComposer is available
*/
static isAvailable (app? : string, scope? : any) : Promise<boolean> {
return new Promise<boolean>((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<any>} Resolves promise when the EmailComposer has been opened
*/
@Cordova({
successIndex: 1,
errorIndex: 3
})
static open(email : email, scope? : any) : Promise<any> {return}

}
6 changes: 3 additions & 3 deletions src/plugins/localnotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* });
Expand Down Expand Up @@ -273,4 +273,4 @@ export interface Notification {
* Default: FFFFFF
*/
led? : string
}
}
4 changes: 2 additions & 2 deletions src/plugins/statusbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand All @@ -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.
*/
Expand Down
38 changes: 38 additions & 0 deletions src/plugins/webintent.ts
Original file line number Diff line number Diff line change
@@ -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<any> {return}

@Cordova()
static hasExtra (extra : any) : Promise<any> {return}

@Cordova()
static getExtra (extra : any) : Promise<any> {return}

@Cordova()
static getUri () : Promise<string> {return};

@Cordova()
static onNewIntent() : Promise<string> {return};

@Cordova()
static sendBroadcast(options : {action:string, extras?:{option:boolean}}) : Promise<any> {return}

}

0 comments on commit 9c78837

Please sign in to comment.