diff --git a/resources/assets/js/OfflineModule.js b/resources/assets/js/OfflineModule.js index 842b3dbd077c046173259f9605f8a06356a8bf85..530fa713a1055c3e829c214207c692fac2d41b7d 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 34cdce5fd3a4b0b2bc8e1a0982ad696b9a2d6f70..b94fbc90555b0656f7c6a29a1bdf6926c4a0c9bc 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 87a6a213e84590cb59f64e5d5e31e6199019d40b..7e1fac5d48a0125a8183c07469286baea5f35514 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");