Ensure settings are saved upon Bangle2 button long-press

pull/3516/head
Travis Evans 2024-07-17 15:07:49 -05:00
parent f7badead2c
commit 8f22d8aa35
1 changed files with 3 additions and 0 deletions

View File

@ -141,14 +141,17 @@ function launchSettingsMenu(backCb) {
const stampLog = new StampLog(LOG_FILENAME, SETTINGS.maxLogLength);
function saveSettings() {
console.log('Saving timestamp log and settings');
stampLog.save();
if (!storage.writeJSON(SETTINGS_FILENAME, SETTINGS)) {
E.showAlert('Trouble saving settings');
}
}
E.on('kill', saveSettings);
function endMenu() {
saveSettings();
E.removeListener('kill', saveSettings);
backCb();
}