Merge pull request #3176 from bobrippling/fix/improve-formatter-check

Improve boolean formatter check
pull/3186/head
thyttan 2024-02-06 11:09:14 +01:00 committed by GitHub
commit 5a2b5405f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 1 additions and 8 deletions

View File

@ -17,7 +17,6 @@
"< Back" : () => back(),
'Show Seconds': {
value: !!settings.showSeconds, // !! converts undefined to false
format: v => v ? "On" : "Off",
onchange: v => {
settings.showSeconds = v;
writeSettings();
@ -25,7 +24,6 @@
},
'Invert Scrolling': {
value: !!settings.invertScrolling, // !! converts undefined to false
format: v => v ? "On" : "Off",
onchange: v => {
settings.invertScrolling = v;
writeSettings();

View File

@ -20,7 +20,6 @@
"< Back": () => back(),
'Front Tap:': {
value: (appSettings.enableTap === true),
format: v => v ? "On" : "Off",
onchange: v => {
appSettings.enableTap = v;
writeSettings();

View File

@ -5,7 +5,6 @@
'': { 'title': 'Welcome App' },
'Run next boot': {
value: !settings.welcomed,
format: v => v ? 'Yes' : 'No',
onchange: v => require('Storage').write('mywelcome.json', {welcomed: !v}),
},
'Run Now': () => load('mywelcome.app.js'),

View File

@ -130,7 +130,6 @@
},
'Date Suffix:': {
value: appSettings.enableSuffix,
format: v => v ? 'Yes' : 'No',
onchange: v => {
appSettings.enableSuffix = v;
writeSettings();
@ -138,7 +137,6 @@
},
'Lead Zero:': {
value: appSettings.enableLeadingZero,
format: v => v ? 'Yes' : 'No',
onchange: v => {
appSettings.enableLeadingZero = v;
writeSettings();

View File

@ -5,7 +5,6 @@
'': { 'title': 'Welcome App' },
'Run next boot': {
value: !settings.welcomed,
format: v => v ? 'Yes' : 'No',
onchange: v => require('Storage').write('welcome.json', {welcomed: !v}),
},
'Run Now': () => load('welcome.app.js'),

View File

@ -263,7 +263,7 @@ apps.forEach((app,appIdx) => {
WARN(`App ${app.id} has a setting file but no corresponding data entry (add \`"data":[{"name":"${app.id}.settings.json"}]\`)`, {file:appDirRelative+file.url});
}
// check for manual boolean formatter
const m = fileContents.match(/format: *\(\) *=>.*["'](yes|on)["']/i);
const m = fileContents.match(/format: *\(?\w*\)? *=>.*["'](yes|on)["']/i);
if (m) {
WARN(`Settings for ${app.id} has a boolean formatter - this is handled automatically, the line can be removed`, {file:appDirRelative+file.url, line: fileContents.substr(0, m.index).split("\n").length});
}