mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-04-24 03:00:11 -04:00
52 lines
914 B
JavaScript
52 lines
914 B
JavaScript
/**
|
|
* SMS Composer plugin for Cordova
|
|
* window.plugins.SMSComposer
|
|
*
|
|
* @constructor
|
|
*/
|
|
function SMSComposer()
|
|
{
|
|
this.resultCallback = null;
|
|
}
|
|
|
|
SMSComposer.ComposeResultType =
|
|
{
|
|
Cancelled:0,
|
|
Sent:1,
|
|
Failed:2,
|
|
NotSent:3
|
|
}
|
|
|
|
SMSComposer.prototype.showSMSComposer = function(toRecipients, body)
|
|
{
|
|
|
|
var args = {};
|
|
|
|
if(toRecipients)
|
|
args.toRecipients = toRecipients;
|
|
|
|
if(body)
|
|
args.body = body;
|
|
|
|
cordova.exec("SMSComposer.showSMSComposer",args);
|
|
}
|
|
|
|
SMSComposer.prototype.showSMSComposerWithCB = function(cbFunction,toRecipients,body)
|
|
{
|
|
this.resultCallback = cbFunction;
|
|
this.showSMSComposer.apply(this,[toRecipients,body]);
|
|
}
|
|
|
|
SMSComposer.prototype._didFinishWithResult = function(res)
|
|
{
|
|
this.resultCallback(res);
|
|
}
|
|
|
|
cordova.addConstructor(function() {
|
|
|
|
if(!window.plugins) {
|
|
window.plugins = {};
|
|
}
|
|
window.plugins.smsComposer = new SMSComposer();
|
|
});
|