mirror of https://github.com/espruino/BangleApps
mylocation 0.07: Move mylocation app into 'Settings -> Apps'
parent
6b8cf13f6c
commit
3a3a01136b
|
@ -256,6 +256,7 @@ and which gives information about the app for the Launcher.
|
|||
// 'clock' - a clock - required for clocks to automatically start
|
||||
// 'widget' - a widget
|
||||
// 'bootloader' - an app that at startup (app.boot.js) but doesn't have a launcher entry for 'app.js'
|
||||
// 'settings' - apps that appear in Settings->Apps (with appname.settings.js) but that have no 'app.js'
|
||||
// 'RAM' - code that runs and doesn't upload anything to storage
|
||||
// 'launch' - replacement 'Launcher'
|
||||
// 'textinput' - provides a 'textinput' library that allows text to be input on the Bangle
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
0.04: Fixed issue selecting Frankfurt not saved
|
||||
0.05: Fixed issue with back option
|
||||
0.06: renamed source files to match standard
|
||||
0.07: Move mylocation app into 'Settings -> Apps'
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
*Sets and stores GPS lat and lon of your preferred city*
|
||||
|
||||
To access, go to `Settings -> Apps -> My Location`
|
||||
|
||||
* Select one of the preset Cities or setup through the GPS
|
||||
* 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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require("heatshrink").decompress(atob("mEw4UA///gH4AYPO/QPDgNVqtADY/1BYNfBQ0PBQIAB+ALFmoLDrgLF6oLDq4KEgYKDBYPABYcNBYlVuAuIGAwuEAANUBYYKFHgg6Bq4ZCr4DBHgQLBvWq2te1WlBYZGBBYOr1Wq1qSDBYNqBIILDKgQLLgoLHqBqDBfJHLBZBrOgKPCBYiPCU4NaBYe1WYrABBQLCCfgYGCrwVBa4kAirvKNgIAErgLDKgIAEKQQ8EAAY6DBZhIDIww8GHQg8GHQgwGFwowEFwx5EOog8GHQ0AlWpBYNq1AKFWIILBAYOgBYbICytWAgQKCgTgDcwYXGAAgvGAAY8EEgYWGBgoVEA=="))
|
|
@ -2,16 +2,15 @@
|
|||
"name": "My Location",
|
||||
"shortName":"My Location",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
"type": "settings",
|
||||
"screenshots": [{"url":"screenshot_1.png"}],
|
||||
"version":"0.06",
|
||||
"version":"0.07",
|
||||
"description": "Sets and stores the lat and long of your preferred City or it can be set from the GPS. mylocation.json can be used by other apps that need your main location lat and lon. See README",
|
||||
"readme": "README.md",
|
||||
"tags": "tool,utility",
|
||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||
"storage": [
|
||||
{"name":"mylocation.app.js","url":"app.js"},
|
||||
{"name":"mylocation.img","url":"icon.js","evaluate": true }
|
||||
{"name":"mylocation.settings.js","url":"settings.js"}
|
||||
],
|
||||
"data": [
|
||||
{"name":"mylocation.json"}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
(function(back) {
|
||||
|
||||
const SETTINGS_FILE = "mylocation.json";
|
||||
let settings;
|
||||
|
@ -18,7 +17,7 @@ function loadSettings() {
|
|||
}
|
||||
}
|
||||
|
||||
function save() {
|
||||
function saveSettings() {
|
||||
settings = s;
|
||||
require('Storage').write(SETTINGS_FILE, settings);
|
||||
}
|
||||
|
@ -34,29 +33,29 @@ function setFromGPS() {
|
|||
//console.log("fix from GPS");
|
||||
s = {'lat': gps.lat, 'lon': gps.lon, 'location': '???' };
|
||||
Bangle.buzz(1500); // buzz on first position
|
||||
Bangle.setGPSPower(0);
|
||||
save();
|
||||
Bangle.setGPSPower(0, "mylocation");
|
||||
saveSettings();
|
||||
|
||||
Bangle.setUI("updown", ()=>{ load(); });
|
||||
E.showPrompt("Location has been saved from the GPS fix",{
|
||||
title:"Location Saved",
|
||||
buttons : {"OK":1}
|
||||
E.showPrompt(/*LANG*/"Location has been saved from the GPS fix",{
|
||||
title:/*LANG*/"Location Saved",
|
||||
buttons : {/*LANG*/"OK":1}
|
||||
}).then(function(v) {
|
||||
load(); // load default clock
|
||||
});
|
||||
});
|
||||
|
||||
Bangle.setGPSPower(1);
|
||||
E.showMessage("Waiting for GPS fix. Place watch in the open. Could take 10 minutes. Long press to abort", "GPS Running");
|
||||
Bangle.setGPSPower(1, "mylocation");
|
||||
E.showMessage(/*LANG*/"Waiting for GPS fix. Place watch in the open. Could take 10 minutes. Long press to abort", "GPS Running");
|
||||
Bangle.setUI("updown", undefined);
|
||||
}
|
||||
|
||||
function showMainMenu() {
|
||||
//console.log("showMainMenu");
|
||||
const mainmenu = {
|
||||
'': { 'title': 'My Location' },
|
||||
'< Back': ()=>{ load(); },
|
||||
'City': {
|
||||
'': { 'title': /*LANG*/'My Location' },
|
||||
'< Back': ()=>{ back(); },
|
||||
/*LANG*/'City': {
|
||||
value: 0 | locations.indexOf(s.location),
|
||||
min: 0, max: locations.length - 1,
|
||||
format: v => locations[v],
|
||||
|
@ -65,14 +64,15 @@ function showMainMenu() {
|
|||
s.location = locations[v];
|
||||
s.lat = lats[v];
|
||||
s.lon = lons[v];
|
||||
save();
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
},
|
||||
'Set From GPS': ()=>{ setFromGPS(); }
|
||||
/*LANG*/'Set From GPS': ()=>{ setFromGPS(); }
|
||||
};
|
||||
return E.showMenu(mainmenu);
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
showMainMenu();
|
||||
})
|
|
@ -65,7 +65,7 @@ const APP_KEYS = [
|
|||
const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports'];
|
||||
const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate'];
|
||||
const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports'
|
||||
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","textinput","scheduler","notify","locale"]; // values allowed for "type" field
|
||||
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","textinput","scheduler","notify","locale","settings"]; // values allowed for "type" field
|
||||
const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info
|
||||
const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ];
|
||||
const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"];
|
||||
|
@ -140,7 +140,7 @@ apps.forEach((app,appIdx) => {
|
|||
ERROR(`App ${app.id} 'dependencies' must all be tagged 'type' or 'app' right now`);
|
||||
if (app.dependencies[dependency]=="type" && !METADATA_TYPES.includes(dependency))
|
||||
ERROR(`App ${app.id} 'type' dependency must be one of `+METADATA_TYPES);
|
||||
|
||||
|
||||
});
|
||||
} else
|
||||
ERROR(`App ${app.id} 'dependencies' must be an object`);
|
||||
|
|
Loading…
Reference in New Issue