awesome-cordova-plugins/src/plugins/emailcomposer.ts

77 lines
1.8 KiB
TypeScript
Raw Normal View History

import {Plugin, Cordova} from './plugin';
/**
* Email object for Opening Email Composer
*/
export interface email {
2016-04-06 19:00:26 +08:00
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';
*
*
* 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',
2016-04-05 22:24:50 +08:00
pluginRef: 'cordova.plugins.email',
repo: 'https://github.com/katzer/cordova-plugin-email-composer.git',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class EmailComposer {
2016-04-05 22:24:50 +08:00
2016-04-06 19:00:26 +08:00
@Cordova({
successIndex: 1,
errorIndex: 3
})
static isAvailable(app: string, scope: any) : Promise<boolean> {return}
2016-04-05 22:24:50 +08:00
@Cordova()
2016-04-06 19:00:26 +08:00
static addAlias(alias: string, packageName: string): void {}
2016-04-05 22:24:50 +08:00
/**
* Opens Email Composer with email contents
* @param email {email} Email
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
*/
2016-04-05 22:24:50 +08:00
@Cordova({
successIndex: 1,
errorIndex: 3
})
2016-04-06 19:00:26 +08:00
static open(email: email, scope: any) : Promise<any> {return}
}