From 170821fe596a7dc2c2e831fe1900e97c8226a8c8 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring <karl.hasselbring@gmx.de> Date: Thu, 19 Sep 2019 10:24:36 +0200 Subject: [PATCH] Production adjustments --- resources/assets/js/OfflineModule.js | 5 +++++ resources/assets/js/OfflineModuleAndroidConnector.js | 11 +++++++++++ resources/assets/js/SearchModule.js | 7 +++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/OfflineModule.js b/resources/assets/js/OfflineModule.js index 842b3db..530fa71 100644 --- a/resources/assets/js/OfflineModule.js +++ b/resources/assets/js/OfflineModule.js @@ -353,6 +353,11 @@ OfflineModule.prototype.updateDownloadSizeExpectation = function( }; OfflineModule.prototype.startDownload = function(offlineModule, selectedArea) { + if (!offlineModule.androidConnector.isInternetAvailable) { + alert("Sie haben zurzeit kein Internet."); + return; + } + if (!offlineModule.reassureDownloadIfNoWireless(offlineModule)) { return; } diff --git a/resources/assets/js/OfflineModuleAndroidConnector.js b/resources/assets/js/OfflineModuleAndroidConnector.js index 34cdce5..b94fbc9 100644 --- a/resources/assets/js/OfflineModuleAndroidConnector.js +++ b/resources/assets/js/OfflineModuleAndroidConnector.js @@ -40,6 +40,17 @@ OfflineModuleAndroidConnector.prototype.isWireless = function() { } }; +OfflineModuleAndroidConnector.prototype.isInternetAvailable = function() { + if ( + typeof android != "undefined" && + typeof android["isInternetAvailable"] == "function" + ) { + return android.isInternetAvailable(); + } else { + throw 'Android does not have function "isInternetAvailable"'; + } +}; + /** * @return Expected Download size or -1 on error */ diff --git a/resources/assets/js/SearchModule.js b/resources/assets/js/SearchModule.js index 87a6a21..7e1fac5 100644 --- a/resources/assets/js/SearchModule.js +++ b/resources/assets/js/SearchModule.js @@ -58,10 +58,9 @@ SearchModule.prototype.addOptionsMenu = function() { $("#search-addon #options").show("slow"); // If this is the App in the correct version we will show the Offline Module if ( - (typeof android != "undefined" && - typeof android.getVersionCode == "function" && - android.getVersionCode() >= 13) || - 1 == 1 + typeof android != "undefined" && + typeof android.getVersionCode == "function" && + android.getVersionCode() >= 20 ) { $("#options > ul > li").click(function() { caller.interactiveMap.switchModule("offline-karten"); -- GitLab