From 1e0b43506415c6c241bcd79f2b385ef7d51638be Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 23 Aug 2019 18:53:11 -0600 Subject: [PATCH] Go to previous page when back button pressed --- www/assets/js/main.js | 2 ++ www/assets/js/platform.js | 27 +++------------------------ www/index.html | 2 ++ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/www/assets/js/main.js b/www/assets/js/main.js index 04b95e5..229e8d8 100644 --- a/www/assets/js/main.js +++ b/www/assets/js/main.js @@ -66,4 +66,6 @@ if (localStorage.getItem("darktheme") == "true") { $("#app").addClass("theme-dark"); } +initPlatform(); + router.navigate("/home"); \ No newline at end of file diff --git a/www/assets/js/platform.js b/www/assets/js/platform.js index 28e989d..69e4874 100644 --- a/www/assets/js/platform.js +++ b/www/assets/js/platform.js @@ -69,23 +69,11 @@ function initCordova() { // Handle back button to close things document.addEventListener("backbutton", function (event) { - router.back(); + router.back({force: true, ignoreCache: true}); }, false); document.addEventListener("deviceready", function () { - app.statusbar.overlaysWebView(true); - StatusBar.backgroundColorByHexString("#000000ff"); - if (cordova.platformId == 'android') { - //StatusBar.backgroundColorByHexString("#324150"); - //StatusBar.styleLightContent(); - } - router.on("routeChange", function (newRoute, previousRoute, router) { - if (newRoute.name == "home") { - StatusBar.styleDefault(); - } else { - StatusBar.styleLightContent(); - } - }); + }, false); openBrowser = function (url) { @@ -110,21 +98,12 @@ function initCordova() { }, { showTorchButton: true, - prompt: "Find a code", + prompt: "Scan barcode", resultDisplayDuration: 0, disableSuccessBeep: true } ); } - - // When running on Android 8.0 (not 7.1.1, not 8.1, just 8.0), the statusbar - // height is incorrectly set to 0px, causing the clock and icons to overlap - // on the TerranQuest UI. - document.addEventListener("deviceready", function () { - if (device.platform == "Android" && device.version.startsWith("8.0") && getComputedStyle(document.documentElement).getPropertyValue('--f7-statusbar-height').startsWith("0")) { - document.documentElement.style.setProperty('--f7-statusbar-height', '24px'); - } - }, false); } function initNW() { diff --git a/www/index.html b/www/index.html index 33aa397..5668540 100644 --- a/www/index.html +++ b/www/index.html @@ -10,6 +10,8 @@ + +