Use AngularJS promise if available

This commit is contained in:
Ibby Hadeed
2017-12-29 10:15:44 -05:00
parent fc9dcc8e64
commit 0cc1a2b2ff
8 changed files with 64 additions and 49 deletions
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Cordova, CordovaCheck, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
export interface EmailComposerOptions {
@@ -119,7 +119,7 @@ export class EmailComposer extends IonicNativePlugin {
*/
@CordovaCheck()
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
return getPromise<boolean>((resolve, reject) => {
if (app) {
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {