diff --git a/config.xml b/config.xml index 7d17314..6b14c03 100644 --- a/config.xml +++ b/config.xml @@ -9,6 +9,14 @@ + + + + + + + + diff --git a/package.json b/package.json index aee0d76..5214978 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ ] }, "dependencies": { + "cordova-android": "^8.0.0", "cordova-plugin-whitelist": "^1.3.4" } } \ No newline at end of file diff --git a/res/android/drawable/ic_launcher_background.xml b/res/android/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d1d858b --- /dev/null +++ b/res/android/drawable/ic_launcher_background.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/res/android/drawable/ic_launcher_foreground.xml b/res/android/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..80bca98 --- /dev/null +++ b/res/android/drawable/ic_launcher_foreground.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/res/android/mipmap-anydpi-v26/ic_launcher.xml b/res/android/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/res/android/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/res/android/mipmap-anydpi-v26/ic_launcher_round.xml b/res/android/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/res/android/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/res/android/mipmap-hdpi/ic_launcher.png b/res/android/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..1292697 Binary files /dev/null and b/res/android/mipmap-hdpi/ic_launcher.png differ diff --git a/res/android/mipmap-hdpi/ic_launcher_round.png b/res/android/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..cd4565d Binary files /dev/null and b/res/android/mipmap-hdpi/ic_launcher_round.png differ diff --git a/res/android/mipmap-mdpi/ic_launcher.png b/res/android/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..390b976 Binary files /dev/null and b/res/android/mipmap-mdpi/ic_launcher.png differ diff --git a/res/android/mipmap-mdpi/ic_launcher_round.png b/res/android/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..c760111 Binary files /dev/null and b/res/android/mipmap-mdpi/ic_launcher_round.png differ diff --git a/res/android/mipmap-xhdpi/ic_launcher.png b/res/android/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..fbafae3 Binary files /dev/null and b/res/android/mipmap-xhdpi/ic_launcher.png differ diff --git a/res/android/mipmap-xhdpi/ic_launcher_round.png b/res/android/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..c0a4049 Binary files /dev/null and b/res/android/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/res/android/mipmap-xxhdpi/ic_launcher.png b/res/android/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..2be2366 Binary files /dev/null and b/res/android/mipmap-xxhdpi/ic_launcher.png differ diff --git a/res/android/mipmap-xxhdpi/ic_launcher_round.png b/res/android/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..1d56cf9 Binary files /dev/null and b/res/android/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/res/android/mipmap-xxxhdpi/ic_launcher.png b/res/android/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..7fe17e5 Binary files /dev/null and b/res/android/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/res/android/mipmap-xxxhdpi/ic_launcher_round.png b/res/android/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..c72c49b Binary files /dev/null and b/res/android/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/www/assets/audio/alert.coin.mp3 b/www/assets/audio/alert.coin.mp3 new file mode 100644 index 0000000..e409db0 Binary files /dev/null and b/www/assets/audio/alert.coin.mp3 differ diff --git a/www/assets/audio/alert.jump.mp3 b/www/assets/audio/alert.jump.mp3 new file mode 100644 index 0000000..d56caf7 Binary files /dev/null and b/www/assets/audio/alert.jump.mp3 differ diff --git a/www/assets/audio/alert.echo.mp3 b/www/assets/audio/alert.sonar.mp3 similarity index 100% rename from www/assets/audio/alert.echo.mp3 rename to www/assets/audio/alert.sonar.mp3 diff --git a/www/assets/js/audio.js b/www/assets/js/audio.js index 9e9f2db..a586d2b 100644 --- a/www/assets/js/audio.js +++ b/www/assets/js/audio.js @@ -4,13 +4,24 @@ * and open the template in the editor. */ +var sfx = {}; -var sfx = { - "alert": new Audio("assets/audio/alert.echo.mp3"), - "ok": new Audio("assets/audio/ok.mp3"), - "error": new Audio("assets/audio/error.mp3") -}; +function initSFX() { + if (localStorage.getItem("alertsound") == null) { + localStorage.setItem("alertsound", "sonar"); + } + + var alertNoiseName = localStorage.getItem("alertsound"); + + sfx = { + "alert": new Audio("assets/audio/alert." + alertNoiseName + ".mp3"), + "ok": new Audio("assets/audio/ok.mp3"), + "error": new Audio("assets/audio/error.mp3") + }; +} function playSound(sound) { sfx[sound].play(); -} \ No newline at end of file +} + +initSFX(); \ No newline at end of file diff --git a/www/assets/js/map_leaflet.js b/www/assets/js/map_leaflet.js index 77f95d5..398d7d7 100644 --- a/www/assets/js/map_leaflet.js +++ b/www/assets/js/map_leaflet.js @@ -7,20 +7,38 @@ function leafletMap() { var map = L.map('mapbox', { zoomSnap: 0.25, - minZoom: 12, - maxZoom: 16, - zoom: 13, + minZoom: 1, + maxZoom: 20, + zoom: 12, center: L.latLng(46.5966, -112.0180), - maxBounds: L.latLngBounds(L.latLng(46.7384, -112.1429), L.latLng(46.5127, -111.7557)), - //maxBounds: L.latLngBounds(L.latLng(46.9, -112.3), L.latLng(46.35, -111.5)), - attributionControl: false + attributionControl: true, + attribution: '© OpenMapTiles © OpenStreetMap contributors' }); - L.tileLayer('assets/tiles/{z}/{x}/{y}.png', { - minZoom: 12, - maxZoom: 16, - attribution: '© OpenStreetMap contributors' - }).addTo(map); + var mapSources = { + "offline": 'assets/tiles/{z}/{x}/{y}.png', + "liberty": 'https://maps.netsyms.net/styles/osm-liberty/{z}/{x}/{y}.png', + "terrain": 'https://maps.netsyms.net/styles/klokantech-terrain/{z}/{x}/{y}.png' + }; + + if (localStorage.getItem("mapsource") == null) { + localStorage.setItem("mapsource", "offline"); + } + + if (localStorage.getItem("mapsource") == "offline") { + map.setMaxBounds(L.latLngBounds(L.latLng(46.7384, -112.1429), L.latLng(46.5127, -111.7557))); + map.setMinZoom(12); + map.setMaxZoom(16); + L.tileLayer(mapSources[localStorage.getItem("mapsource")], { + minZoom: 12, + maxZoom: 16 + }).addTo(map); + } else { + L.tileLayer(mapSources[localStorage.getItem("mapsource")], { + minZoom: 1, + maxZoom: 20 + }).addTo(map); + } map.locateControl = L.control.locate({ flyTo: true, diff --git a/www/assets/js/settings.js b/www/assets/js/settings.js index 60c0adf..62b2299 100644 --- a/www/assets/js/settings.js +++ b/www/assets/js/settings.js @@ -15,4 +15,83 @@ $('.item-content[data-setting=darktheme] .toggle input').on("change", function ( } else { $("#app").removeClass("theme-dark"); } -}) \ No newline at end of file +}); + +function pickAlertSound() { + var currentalertsound = localStorage.getItem("alertsound"); + app.dialog.create({ + title: 'Alert Sound', + buttons: [ + { + text: 'Sonar' + (currentalertsound == "sonar" ? " (current)" : ""), + }, + { + text: 'Robot' + (currentalertsound == "robot" ? " (current)" : ""), + }, + { + text: 'Coin' + (currentalertsound == "coin" ? " (current)" : ""), + }, + { + text: 'Jump' + (currentalertsound == "jump" ? " (current)" : ""), + } + ], + verticalButtons: true, + onClick: function (dialog, index) { + var alertsound = "sonar"; + switch (index) { + case 1: + alertsound = "robot"; + break; + case 2: + alertsound = "coin"; + break; + case 3: + alertsound = "jump"; + break; + case 0: + default: + alertsound = "sonar"; + } + localStorage.setItem("alertsound", alertsound); + // Reload sound effect stuff to apply new sound + initSFX(); + // Play the selected sound + playSound("alert"); + } + }).open(); +} + +function pickMapSource() { + var currentmapsource = localStorage.getItem("mapsource"); + app.dialog.create({ + title: 'Map', + buttons: [ + { + text: 'Helena Offline' + (currentmapsource == "offline" ? " (current)" : ""), + }, + { + text: 'Liberty' + (currentmapsource == "liberty" ? " (current)" : ""), + }, + { + text: 'Terrain' + (currentmapsource == "terrain" ? " (current)" : ""), + } + ], + verticalButtons: true, + onClick: function (dialog, index) { + var mapsource = "offline"; + switch (index) { + case 1: + mapsource = "liberty"; + break; + case 2: + mapsource = "terrain"; + break; + case 0: + default: + mapsource = "offline"; + } + localStorage.setItem("mapsource", mapsource); + + } + }).open(); +} \ No newline at end of file diff --git a/www/routes.js b/www/routes.js index aba0951..f3282ad 100644 --- a/www/routes.js +++ b/www/routes.js @@ -75,6 +75,12 @@ var routes = [ }, { context: { settings: [ + { + setting: "alertsound", + title: "Alert Sound", + text: "Select which sound to play when a package is nearby.", + onclick: "pickAlertSound()" + }, { setting: "darktheme", title: "Use dark theme", @@ -83,6 +89,12 @@ var routes = [ checked: localStorage.getItem("darktheme") == "true", onclick: "" }, + { + setting: "mapsource", + title: "Map", + text: "Choose which map to use.", + onclick: "pickMapSource()" + }, { setting: "versions", title: "PackageHelper app v1.0.0",