mirror of https://github.com/espruino/BangleApps
Fix for issue where launcher would fast-load back to clock even if the clock didn't have widgets
parent
18510d4583
commit
779b16b671
|
@ -57,3 +57,4 @@
|
|||
Remove support for 2v11 and earlier firmware
|
||||
0.51: Remove patches for 2v10 firmware (BEEPSET and setUI)
|
||||
Add patch to ensure that compass heading is corrected
|
||||
Ensure clock is only fast-loaded if it doesn't contain widgets
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// This runs after a 'fresh' boot
|
||||
var s = require("Storage").readJSON("setting.json",1)||{};
|
||||
/* If were being called from JS code in order to load the clock quickly (eg from a launcher)
|
||||
and the clock in question doesn't have widgets, force a normal 'load' as this will then
|
||||
reset everything and remove the widgets. */
|
||||
if (global.__FILE__ && !s.clockHasWidgets) {load();throw "Clock has no widgets, can't fast load";}
|
||||
// Otherwise continue to try and load the clock
|
||||
var _clkApp = require("Storage").read(s.clock);
|
||||
if (!_clkApp) {
|
||||
_clkApp = require("Storage").list(/\.info$/)
|
||||
|
@ -14,6 +19,7 @@ if (!_clkApp) {
|
|||
if (_clkApp){
|
||||
s.clock = _clkApp.src;
|
||||
_clkApp = require("Storage").read(_clkApp.src);
|
||||
s.clockHasWidgets = _clkApp.includes("Bangle.loadWidgets");
|
||||
require("Storage").writeJSON("setting.json", s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ E.showScroller({
|
|||
});
|
||||
g.flip(); // force a render before widgets have finished drawing
|
||||
|
||||
function returnToClock() {
|
||||
let returnToClock = function() {
|
||||
// unload everything manually
|
||||
// ... or we could just call `load();` but it will be slower
|
||||
Bangle.setUI(); // remove scroller's handling
|
||||
|
@ -85,7 +85,7 @@ if (process.env.HWVERSION==2) {
|
|||
// 10s of inactivity goes back to clock
|
||||
Bangle.setLocked(false); // unlock initially
|
||||
let lockTimeout;
|
||||
function lockHandler(locked) {
|
||||
let lockHandler = function(locked) {
|
||||
if (lockTimeout) clearTimeout(lockTimeout);
|
||||
lockTimeout = undefined;
|
||||
if (locked)
|
||||
|
|
|
@ -57,4 +57,4 @@
|
|||
0.50: Add Bangle.js 2 touchscreen calibration - for 2v16 or 2v15 cutting edge builds
|
||||
0.51: Add setting for configuring a launcher
|
||||
0.52: Add option for left-handed users
|
||||
|
||||
0.53: Ensure that when clock is set, clockHasWidgets is set correctly too
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "setting",
|
||||
"name": "Settings",
|
||||
"version": "0.52",
|
||||
"version": "0.53",
|
||||
"description": "A menu for setting up Bangle.js",
|
||||
"icon": "settings.png",
|
||||
"tags": "tool,system",
|
||||
|
|
|
@ -39,6 +39,7 @@ function resetSettings() {
|
|||
timezone: 0, // Set the timezone for the device
|
||||
HID: false, // BLE HID mode, off by default
|
||||
clock: null, // a string for the default clock's name
|
||||
// clockHasWidgets: false, // Does the clock in 'clock' contain the string 'Bangle.loadWidgets'
|
||||
"12hour" : false, // 12 or 24 hour clock?
|
||||
firstDayOfWeek: 0, // 0 -> Sunday (default), 1 -> Monday
|
||||
brightness: 1, // LCD brightness from 0 to 1
|
||||
|
@ -674,11 +675,10 @@ function showClockMenu() {
|
|||
label = "* " + label;
|
||||
}
|
||||
clockMenu[label] = () => {
|
||||
if (settings.clock !== app.src) {
|
||||
settings.clock = app.src;
|
||||
settings.clockHasWidgets = require("Storage").read(app.src).includes("Bangle.loadWidgets");
|
||||
updateSettings();
|
||||
showMainMenu();
|
||||
}
|
||||
};
|
||||
});
|
||||
if (clockApps.length === 0) {
|
||||
|
@ -703,11 +703,9 @@ function showLauncherMenu() {
|
|||
label = "* " + label;
|
||||
}
|
||||
launcherMenu[label] = () => {
|
||||
if (settings.launcher !== app.src) {
|
||||
settings.launcher = app.src;
|
||||
updateSettings();
|
||||
showMainMenu();
|
||||
}
|
||||
};
|
||||
});
|
||||
if (launcherApps.length === 0) {
|
||||
|
|
Loading…
Reference in New Issue