Add pull to refresh on home screen
This commit is contained in:
parent
21c5113b88
commit
ba185f32b3
@ -5,14 +5,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function loadHomePage() {
|
function loadHomePage(reload) {
|
||||||
|
if (typeof reload == 'undefined') {
|
||||||
|
reload = false;
|
||||||
|
}
|
||||||
$.post(localStorage.getItem("syncurl"), {
|
$.post(localStorage.getItem("syncurl"), {
|
||||||
username: localStorage.getItem("username"),
|
username: localStorage.getItem("username"),
|
||||||
key: localStorage.getItem("key"),
|
key: localStorage.getItem("key"),
|
||||||
action: "listapps"
|
action: "listapps"
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
loadingProgressDialog.setProgress(80);
|
if (!reload) {
|
||||||
|
loadingProgressDialog.setProgress(80);
|
||||||
|
}
|
||||||
var appcards = [];
|
var appcards = [];
|
||||||
Object.keys(data.apps).forEach(function (k) {
|
Object.keys(data.apps).forEach(function (k) {
|
||||||
var app = data.apps[k];
|
var app = data.apps[k];
|
||||||
@ -32,18 +37,35 @@ function loadHomePage() {
|
|||||||
color: app.card.color
|
color: app.card.color
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
loadingProgressDialog.setProgress(90);
|
if (reload) {
|
||||||
router.navigate("/home", {
|
// Make it seem like it's doing something on fast connections
|
||||||
context: {
|
setTimeout(function () {
|
||||||
appcards: appcards
|
app.ptr.done();
|
||||||
}
|
router.navigate("/home", {
|
||||||
});
|
context: {
|
||||||
$(".view-main").on("click", "#applist .applist-item", function () {
|
appcards: appcards
|
||||||
launchapp($(this).data("api"), $(this).data("url"), $(this).data("icon"), $(this).data("title"));
|
},
|
||||||
});
|
reloadCurrent: true
|
||||||
loadingProgressDialog.setProgress(100);
|
});
|
||||||
loadingProgressDialog.close();
|
}, 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 {
|
} else {
|
||||||
|
if (reload) {
|
||||||
|
app.ptr.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadingProgressDialog.close();
|
loadingProgressDialog.close();
|
||||||
app.dialog.alert(data.msg, "Error", function () {
|
app.dialog.alert(data.msg, "Error", function () {
|
||||||
restartApplication();
|
restartApplication();
|
||||||
@ -57,3 +79,8 @@ function loadHomePage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
||||||
|
loadHomePage(true);
|
||||||
|
});
|
@ -11,18 +11,20 @@
|
|||||||
<a href="#" onclick="loadOTPPage()" class="link icon-only">
|
<a href="#" onclick="loadOTPPage()" class="link icon-only">
|
||||||
<i class="fas fa-key"></i>
|
<i class="fas fa-key"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="/settings" class="link icon-only">
|
||||||
|
<i class="fas fa-cog"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="toolbar">
|
<div class="page-content ptr-content">
|
||||||
<div class="toolbar-inner">
|
|
||||||
<a href="#" class="link">Link 1</a>
|
<div class="ptr-preloader">
|
||||||
<a href="#" class="link">Link 2</a>
|
<div class="preloader"></div>
|
||||||
</div>
|
<div class="ptr-arrow"></div>
|
||||||
</div>-->
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Apps</div>
|
<div class="card-header">Apps</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user