-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSMSComposer.js
47 lines (37 loc) · 999 Bytes
/
SMSComposer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// window.plugins.smsComposer
function SMSComposer() {
this.resultCallback = null; // Function
}
SMSComposer.ComposeResultType = {
Cancelled:0,
Saved:1,
Sent:2,
Failed:3,
NotSent:4
}
SMSComposer.prototype.showSMSComposer = function(body) {
console.log("****************************AVVIATO");
var args = {};
if(body)
args.body = body;
cordova.exec(null, null, "SMSComposer", "showSMSComposer", [args]);
}
SMSComposer.prototype.showSMSComposerWithCallback = function(callback, body) {
this.resultCallback = callback;
this.showSMSComposer.apply(this,[body]);
}
SMSComposer.prototype._didFinishWithResult = function(res) {
this.resultCallback(res);
}
cordova.addConstructor(function() {
console.log("****************************");
if(!window.plugins)
{
window.plugins = {};
}
// shim to work in 1.5 and 1.6
if (!window.Cordova) {
window.Cordova = cordova;
};
window.plugins.smsComposer = new SMSComposer();
});