From 712d31669ece07c8115d2b08c61f94f0e56ad267 Mon Sep 17 00:00:00 2001 From: Erik Andresen Date: Mon, 26 Jun 2023 13:59:21 +0200 Subject: [PATCH] mylocation: drop dependency on waypoint --- apps/mylocation/README.md | 2 +- apps/mylocation/metadata.json | 1 - apps/mylocation/settings.js | 9 +++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/mylocation/README.md b/apps/mylocation/README.md index 6e41dd04f..7fecfdfcb 100644 --- a/apps/mylocation/README.md +++ b/apps/mylocation/README.md @@ -9,7 +9,7 @@ next to it - and you can choose your location on a map. **On Bangle.js** go to `Settings -> Apps -> My Location` -* Select one of the preset Cities, setup through the GPS, waypoints or use the webinterface from the AppLoader +* Select one of the preset Cities, setup through the GPS, waypoints (if installed) or use the webinterface from the AppLoader * Other Apps can read this information to do calculations based on location * When the City shows ??? it means the location has been set through the GPS diff --git a/apps/mylocation/metadata.json b/apps/mylocation/metadata.json index 02a6f6f10..7e0d16d16 100644 --- a/apps/mylocation/metadata.json +++ b/apps/mylocation/metadata.json @@ -10,7 +10,6 @@ "tags": "tool,utility", "supports": ["BANGLEJS", "BANGLEJS2"], "interface": "interface.html", - "dependencies" : { "waypoints":"type" }, "storage": [ {"name":"mylocation.settings.js","url":"settings.js"} ], diff --git a/apps/mylocation/settings.js b/apps/mylocation/settings.js index 799baacfe..fcae0389c 100644 --- a/apps/mylocation/settings.js +++ b/apps/mylocation/settings.js @@ -93,9 +93,14 @@ function showMainMenu() { } } }, - /*LANG*/'Set From GPS': ()=>{ setFromGPS(); }, - /*LANG*/'Set From Waypoint': ()=>{ setFromWaypoint(); }, + /*LANG*/'Set From GPS': ()=>{ setFromGPS(); } }; + try { + require("waypoints"); + mainmenu[/*LANG*/'Set From Waypoint'] = ()=>{ setFromWaypoint(); }; + } catch(err) { + // waypoints not installed, thats ok + } return E.showMenu(mainmenu); }