-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevapp.js
50 lines (46 loc) · 1.67 KB
/
devapp.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
48
49
50
jQuery.sap.declare("GPSTracker.devapp");
jQuery.sap.require("GPSTracker.devlogon");
GPSTracker.devapp = {
smpInfo: {},
//the variable hold GPSTracker.devlogon instance
devLogon: null,
//Application Constructor
initialize: function() {
this.bindEvents();
},
//========================================================================
// Bind Event Listeners
//========================================================================
bindEvents: function() {
//add an event listener for the Cordova deviceReady event.
document.addEventListener("deviceready", jQuery.proxy(this.onDeviceReady, this), false);
},
//========================================================================
//Cordova Device Ready
//========================================================================
onDeviceReady: function() {
if (window.sap_webide_FacadePreview) {
startApp();
} else {
var that = this;
$.getJSON(".project.json", function(data) {
if (data && data.hybrid && data.hybrid.plugins.kapsel.logon.selected) {
that.smpInfo.server = data.hybrid.msType === 0 ? data.hybrid.hcpmsServer : data.hybrid.server;
that.smpInfo.port = data.hybrid.msType === 0 ? "443" : data.hybrid.port;
that.smpInfo.appID = data.hybrid.appid;
}
if (that.smpInfo.server && that.smpInfo.server.length > 0) {
var context = {
"serverHost": that.smpInfo.server,
"https": data.hybrid.msType === 0 ? "true" : "false",
"serverPort": that.smpInfo.port
};
that.devLogon = new GPSTracker.devlogon();
that.devLogon.doLogonInit(context, that.smpInfo.appID);
} else {
startApp();
}
});
}
}
};