Browse Source

Add icon, add alert sound options, add online maps (needs tweaking), remove node_modules

master
Skylar Ittner 2 years ago
parent
commit
e8b416550d
  1. 8
      config.xml
  2. 1
      package.json
  3. 22
      res/android/drawable/ic_launcher_background.xml
  4. 15
      res/android/drawable/ic_launcher_foreground.xml
  5. 5
      res/android/mipmap-anydpi-v26/ic_launcher.xml
  6. 5
      res/android/mipmap-anydpi-v26/ic_launcher_round.xml
  7. BIN
      res/android/mipmap-hdpi/ic_launcher.png
  8. BIN
      res/android/mipmap-hdpi/ic_launcher_round.png
  9. BIN
      res/android/mipmap-mdpi/ic_launcher.png
  10. BIN
      res/android/mipmap-mdpi/ic_launcher_round.png
  11. BIN
      res/android/mipmap-xhdpi/ic_launcher.png
  12. BIN
      res/android/mipmap-xhdpi/ic_launcher_round.png
  13. BIN
      res/android/mipmap-xxhdpi/ic_launcher.png
  14. BIN
      res/android/mipmap-xxhdpi/ic_launcher_round.png
  15. BIN
      res/android/mipmap-xxxhdpi/ic_launcher.png
  16. BIN
      res/android/mipmap-xxxhdpi/ic_launcher_round.png
  17. BIN
      www/assets/audio/alert.coin.mp3
  18. BIN
      www/assets/audio/alert.jump.mp3
  19. 0
      www/assets/audio/alert.sonar.mp3
  20. 23
      www/assets/js/audio.js
  21. 40
      www/assets/js/map_leaflet.js
  22. 81
      www/assets/js/settings.js
  23. 12
      www/routes.js

8
config.xml

@ -9,6 +9,14 @@
</author>
<content src="index.html"/>
<plugin name="cordova-plugin-whitelist" spec="1"/>
<platform name="android">
<!--<icon background="res/android/drawable/ic_launcher_background.xml" density="ldpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-ldpi/ic_launcher.png" />-->
<icon background="res/android/drawable/ic_launcher_background.xml" density="mdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-mdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="hdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-hdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xhdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xxhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xxhdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xxxhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xxxhdpi/ic_launcher.png" />
</platform>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>

1
package.json

@ -22,6 +22,7 @@
]
},
"dependencies": {
"cordova-android": "^8.0.0",
"cordova-plugin-whitelist": "^1.3.4"
}
}

22
res/android/drawable/ic_launcher_background.xml

@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="270.93"
android:viewportHeight="270.93">
<path
android:pathData="M0,0h270.93v270.93h-270.93z"
android:fillColor="#2196f3"/>
<path
android:pathData="m163.668,261.872l-161.936,0l80.969,-151.985z"
android:fillColor="#1976d2"/>
<path
android:pathData="m243.04,244.482l-126.496,0l63.249,-86.036z"
android:strokeAlpha="0.5"
android:fillColor="#1976d2"
android:fillAlpha="0.5"/>
<path
android:pathData="m203.06,83.663c0.269,-0.701 0.42,-1.468 0.42,-2.268 0,-3.474 -2.819,-6.293 -6.293,-6.293 -1.291,0 -2.498,0.393 -3.494,1.062 -1.816,-3.147 -5.205,-5.258 -9.092,-5.258 -5.795,0 -10.489,4.694 -10.489,10.489 0,0.177 0.007,0.354 0.013,0.531 -3.671,1.291 -6.306,4.792 -6.306,8.909 0,5.212 4.228,9.44 9.44,9.44h24.124c4.635,0 8.391,-3.756 8.391,-8.391 0,-4.058 -2.884,-7.447 -6.713,-8.221z"
android:strokeWidth=".065555"
android:fillColor="#acd6ff"
android:fillAlpha=".46734"/>
</vector>

15
res/android/drawable/ic_launcher_foreground.xml

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="459.12897"
android:viewportHeight="459.1445">
<group android:translateX="161.69948"
android:translateY="161.83725">
<path
android:pathData="m76.331,8.467 l8.467,33.866l0,29.633a4.233,4.233 0,0 1,-4.233 4.233l-25.4,0a4.233,4.233 0,0 1,-4.233 -4.233l0,-29.633l8.467,-33.866z"
android:fillColor="#7ac0f8"/>
<path
android:pathData="m126.787,42.333c0.106,-0.132 0.132,-0.185 0.238,-0.317l-14.896,-27.754a8.467,8.467 0,0 0,-8.043 -5.794l-27.754,0l8.467,33.866zM50.932,42.333 L59.398,8.467l-27.754,0a8.467,8.467 70.438,0 0,-8.043 5.794l-14.896,27.754c0.106,0.132 0.132,0.185 0.238,0.317zM84.798,50.799l0,21.166a4.233,4.233 0,0 1,-4.233 4.233l-25.4,0a4.233,4.233 0,0 1,-4.233 -4.233l0,-21.166l-42.333,0l0,67.732a8.467,8.467 0,0 0,8.467 8.467l101.599,0a8.467,8.467 0,0 0,8.467 -8.467l0,-67.732z"
android:fillColor="#f7fbff"/>
</group>
</vector>

5
res/android/mipmap-anydpi-v26/ic_launcher.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

5
res/android/mipmap-anydpi-v26/ic_launcher_round.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

BIN
res/android/mipmap-hdpi/ic_launcher.png

After

Width: 72  |  Height: 72  |  Size: 1.8 KiB

BIN
res/android/mipmap-hdpi/ic_launcher_round.png

After

Width: 72  |  Height: 72  |  Size: 3.6 KiB

BIN
res/android/mipmap-mdpi/ic_launcher.png

After

Width: 48  |  Height: 48  |  Size: 1.3 KiB

BIN
res/android/mipmap-mdpi/ic_launcher_round.png

After

Width: 48  |  Height: 48  |  Size: 2.3 KiB

BIN
res/android/mipmap-xhdpi/ic_launcher.png

After

Width: 96  |  Height: 96  |  Size: 2.4 KiB

BIN
res/android/mipmap-xhdpi/ic_launcher_round.png

After

Width: 96  |  Height: 96  |  Size: 5.1 KiB

BIN
res/android/mipmap-xxhdpi/ic_launcher.png

After

Width: 144  |  Height: 144  |  Size: 3.6 KiB

BIN
res/android/mipmap-xxhdpi/ic_launcher_round.png

After

Width: 144  |  Height: 144  |  Size: 7.8 KiB

BIN
res/android/mipmap-xxxhdpi/ic_launcher.png

After

Width: 192  |  Height: 192  |  Size: 5.0 KiB

BIN
res/android/mipmap-xxxhdpi/ic_launcher_round.png

After

Width: 192  |  Height: 192  |  Size: 11 KiB

BIN
www/assets/audio/alert.coin.mp3

BIN
www/assets/audio/alert.jump.mp3

0
www/assets/audio/alert.echo.mp3 → www/assets/audio/alert.sonar.mp3

23
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();
}
}
initSFX();

40
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: '&copy; <a href="http://www.openmaptiles.org/" target="_system">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_system">OpenStreetMap</a> contributors'
});
L.tileLayer('assets/tiles/{z}/{x}/{y}.png', {
minZoom: 12,
maxZoom: 16,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> 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,

81
www/assets/js/settings.js

@ -15,4 +15,83 @@ $('.item-content[data-setting=darktheme] .toggle input').on("change", function (
} else {
$("#app").removeClass("theme-dark");
}
})
});
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();
}

12
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",

Loading…
Cancel
Save