|
|
|
@ -16,7 +16,7 @@ function loadHomePage(reload) {
|
|
|
|
|
}, function (data) {
|
|
|
|
|
if (data.status === 'OK') {
|
|
|
|
|
if (!reload) {
|
|
|
|
|
loadingProgressDialog.setProgress(80);
|
|
|
|
|
loadingProgressDialog.setProgress(70);
|
|
|
|
|
}
|
|
|
|
|
var appcards = [];
|
|
|
|
|
Object.keys(data.apps).forEach(function (k) {
|
|
|
|
@ -37,30 +37,53 @@ function loadHomePage(reload) {
|
|
|
|
|
color: app.card.color
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
if (reload) {
|
|
|
|
|
// Make it seem like it's doing something on fast connections
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
app.ptr.done();
|
|
|
|
|
if (!reload) {
|
|
|
|
|
loadingProgressDialog.setProgress(80);
|
|
|
|
|
loadingProgressDialog.setText('Notifications');
|
|
|
|
|
}
|
|
|
|
|
getNotifications(function (notifs) {
|
|
|
|
|
notifications = [];
|
|
|
|
|
if (notifs != false) {
|
|
|
|
|
Object.keys(notifs).forEach(function (k) {
|
|
|
|
|
var notif = notifs[k];
|
|
|
|
|
if (!notif.seen) {
|
|
|
|
|
notifications.push(notif);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (notifications == []) {
|
|
|
|
|
notifications = false;
|
|
|
|
|
}
|
|
|
|
|
if (reload) {
|
|
|
|
|
// Make it seem like it's doing something on fast connections
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
app.ptr.done();
|
|
|
|
|
router.navigate("/home", {
|
|
|
|
|
context: {
|
|
|
|
|
appcards: appcards,
|
|
|
|
|
notifications: notifications,
|
|
|
|
|
unreadnotifications: (notifications != false && notifications != [])
|
|
|
|
|
},
|
|
|
|
|
reloadCurrent: true
|
|
|
|
|
});
|
|
|
|
|
}, 500);
|
|
|
|
|
} else {
|
|
|
|
|
loadingProgressDialog.setText('Home');
|
|
|
|
|
loadingProgressDialog.setProgress(90);
|
|
|
|
|
router.navigate("/home", {
|
|
|
|
|
context: {
|
|
|
|
|
appcards: appcards
|
|
|
|
|
},
|
|
|
|
|
reloadCurrent: true
|
|
|
|
|
appcards: appcards,
|
|
|
|
|
notifications: notifications,
|
|
|
|
|
unreadnotifications: (notifications != false && notifications != [])
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, 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();
|
|
|
|
|
}
|
|
|
|
|
$(".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();
|
|
|
|
@ -83,4 +106,9 @@ function loadHomePage(reload) {
|
|
|
|
|
|
|
|
|
|
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
|
|
|
|
loadHomePage(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(".view-main").on("swipeout:deleted", ".notificationlist-item", function () {
|
|
|
|
|
var id = $(this).data("id");
|
|
|
|
|
deleteNotification(id);
|
|
|
|
|
});
|