mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-22 04:51:24 +08:00
Refactor isAvailable
This commit is contained in:
parent
f96ec32be7
commit
ce92e6ac8f
@ -1,5 +1,7 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
declare var cordova;
|
||||
|
||||
/**
|
||||
* Email object for Opening Email Composer
|
||||
*/
|
||||
@ -25,6 +27,12 @@ export interface email {
|
||||
* import {EmailComposer} from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* EmailComposer.isAvailable().then((available) =>{
|
||||
* if(available) {
|
||||
* //Now we know we can send
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* let email = {
|
||||
* to: 'max@mustermann.de',
|
||||
* cc: 'erika@mustermann.de',
|
||||
@ -53,24 +61,39 @@ export interface email {
|
||||
})
|
||||
export class EmailComposer {
|
||||
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 3
|
||||
})
|
||||
static isAvailable(app: string, scope: any) : Promise<boolean> {return}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
static isAvailable (app? : string, scope? : any) : Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
cordova.plugins.email.isAvailable(app, resolve, scope);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new mail app alias.
|
||||
*
|
||||
* @param alias {string} The alias name
|
||||
* @param packageName {string} The package name
|
||||
*/
|
||||
@Cordova()
|
||||
static addAlias(alias : string, packageName : string): void {}
|
||||
|
||||
/**
|
||||
* Opens Email Composer with email contents
|
||||
* Displays the email composer pre-filled with data.
|
||||
*
|
||||
* @param email {email} Email
|
||||
* @param scope {any?} An optional scope for the promise
|
||||
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 3
|
||||
})
|
||||
static open(email: email, scope: any) : Promise<any> {return}
|
||||
static open(email : email, scope? : any) : Promise<any> {return}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user