|
|
|
@ -5,14 +5,19 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadHomePage() {
|
|
|
|
|
function loadHomePage(reload) {
|
|
|
|
|
if (typeof reload == 'undefined') {
|
|
|
|
|
reload = false;
|
|
|
|
|
}
|
|
|
|
|
$.post(localStorage.getItem("syncurl"), {
|
|
|
|
|
username: localStorage.getItem("username"),
|
|
|
|
|
key: localStorage.getItem("key"),
|
|
|
|
|
action: "listapps"
|
|
|
|
|
}, function (data) {
|
|
|
|
|
if (data.status === 'OK') {
|
|
|
|
|
loadingProgressDialog.setProgress(80);
|
|
|
|
|
if (!reload) {
|
|
|
|
|
loadingProgressDialog.setProgress(80);
|
|
|
|
|
}
|
|
|
|
|
var appcards = [];
|
|
|
|
|
Object.keys(data.apps).forEach(function (k) {
|
|
|
|
|
var app = data.apps[k];
|
|
|
|
@ -32,18 +37,35 @@ function loadHomePage() {
|
|
|
|
|
color: app.card.color
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
loadingProgressDialog.setProgress(90);
|
|
|
|
|
router.navigate("/home", {
|
|
|
|
|
context: {
|
|
|
|
|
appcards: appcards
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$(".view-main").on("click", "#applist .applist-item", function () {
|
|
|
|
|
launchapp($(this).data("api"), $(this).data("url"), $(this).data("icon"), $(this).data("title"));
|
|
|
|
|
});
|
|
|
|
|
loadingProgressDialog.setProgress(100);
|
|
|
|
|
loadingProgressDialog.close();
|
|
|
|
|
if (reload) {
|
|
|
|
|
// Make it seem like it's doing something on fast connections
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
app.ptr.done();
|
|
|
|
|
router.navigate("/home", {
|
|
|
|
|
context: {
|
|
|
|
|
appcards: appcards
|
|
|
|
|
},
|
|
|
|
|
reloadCurrent: true
|
|
|
|
|
});
|
|
|
|
|
}, 500);
|
|
|
|
|
} else {
|
|
|
|
|
loadingProgressDialog.setProgress(90);
|
|
|
|
|
router.navigate("/home", {
|
|
|
|
|
context: {
|
|
|
|
|
appcards: appcards
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$(".view-main").on("click", "#applist .applist-item", function () {
|
|
|
|
|
launchapp($(this).data("api"), $(this).data("url"), $(this).data("icon"), $(this).data("title"));
|
|
|
|
|
});
|
|
|
|
|
loadingProgressDialog.setProgress(100);
|
|
|
|
|
loadingProgressDialog.close();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (reload) {
|
|
|
|
|
app.ptr.done();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
loadingProgressDialog.close();
|
|
|
|
|
app.dialog.alert(data.msg, "Error", function () {
|
|
|
|
|
restartApplication();
|
|
|
|
@ -56,4 +78,9 @@ function loadHomePage() {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
|
|
|
|
loadHomePage(true);
|
|
|
|
|
});
|