Skip to content

Commit

Permalink
feat(plugin): add email composer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
cmanou committed Apr 5, 2016
1 parent 8e062a9 commit 804c9ee
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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';
Expand Down Expand Up @@ -69,6 +70,7 @@ export {
DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
Facebook,
File,
Flashlight,
Expand Down Expand Up @@ -117,6 +119,7 @@ window['IonicNative'] = {
DeviceOrientation: DeviceOrientation,
Dialogs: Dialogs,
Diagnostic: Diagnostic,
EmailComposer: EmailComposer,
Facebook: Facebook,
File: File,
Flashlight: Flashlight,
Expand Down
63 changes: 63 additions & 0 deletions src/plugins/emailcomposer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {Plugin, Cordova} from './plugin';

/**
* Email object for Opening Email Composer
*/
export interface email {
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';
*
*
* 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: 'emailComposer',
repo: 'https://github.com/katzer/cordova-plugin-email-composer.git',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class EmailComposer {

/**
* Opens Email Composer with email contents
* @param email {email} Email
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
*/
@Cordova()
static open(email: email): Promise<any> { return }

}

0 comments on commit 804c9ee

Please sign in to comment.