Skip to content

Commit

Permalink
fix(emailcomposer): fix isAvailable function
Browse files Browse the repository at this point in the history
function now returns a promise that resolves if email composer is available, and rejects if it's not

partially fixes #168
  • Loading branch information
ihadeed committed May 20, 2016
1 parent 3c49fac commit 2a568d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/emailcomposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ 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
* @param app {string?} An optional app id or uri scheme.
* @returns {Promise<boolean>} Resolves if available, rejects if not available
*/
static isAvailable (app?: string, scope?: any): Promise<boolean> {
static isAvailable (app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
cordova.plugins.email.isAvailable(app, resolve, scope);
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
});
}

Expand Down

0 comments on commit 2a568d2

Please sign in to comment.