refactor(email):

This commit is contained in:
Guille 2016-07-08 00:58:21 +02:00
parent bc3f10cbc1
commit dcd7ad430f

View File

@ -1,5 +1,8 @@
import {Plugin, Cordova} from './plugin'; import { Cordova, Plugin } from './plugin';
declare var cordova: any; declare var cordova: any;
/** /**
* @name Email Composer * @name Email Composer
* @description * @description
@ -53,7 +56,7 @@ export class EmailComposer {
* @param app {string?} An optional app id or uri scheme. * @param app {string?} An optional app id or uri scheme.
* @returns {Promise<boolean>} Resolves if available, rejects if not available * @returns {Promise<boolean>} Resolves if available, rejects if not available
*/ */
static isAvailable (app?: string): Promise<any> { static isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => { return new Promise<boolean>((resolve, reject) => {
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); }); if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); }); else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
@ -67,7 +70,7 @@ export class EmailComposer {
* @param packageName {string} The package name * @param packageName {string} The package name
*/ */
@Cordova() @Cordova()
static addAlias(alias: string, packageName: string): void {} static addAlias(alias: string, packageName: string): void { }
/** /**
* Displays the email composer pre-filled with data. * Displays the email composer pre-filled with data.
@ -80,9 +83,10 @@ export class EmailComposer {
successIndex: 1, successIndex: 1,
errorIndex: 3 errorIndex: 3
}) })
static open(email: Email, scope?: any): Promise<any> {return; } static open(email: Email, scope?: any): Promise<any> { return; }
} }
export interface Email { export interface Email {
app?: string; app?: string;
to?: string | Array<string>; to?: string | Array<string>;