handle 'defaultconfig' app type for default configurations

master
Gordon Williams 2025-02-04 12:23:03 +00:00
parent c307f1f760
commit 0c0498886c
6 changed files with 15 additions and 13 deletions

View File

@ -270,6 +270,7 @@ and which gives information about the app for the Launcher.
// 'notify' - provides 'notify' library for showing notifications // 'notify' - provides 'notify' library for showing notifications
// 'locale' - provides 'locale' library for language-specific date/distance/etc // 'locale' - provides 'locale' library for language-specific date/distance/etc
// (a version of 'locale' is included in the firmware) // (a version of 'locale' is included in the firmware)
// 'defaultconfig' - a set of apps that will can be installed and will wipe out all previously installed apps
"tags": "", // comma separated tag list for searching "tags": "", // comma separated tag list for searching
// common types are: // common types are:
// 'clock' - it's a clock // 'clock' - it's a clock

View File

@ -7,11 +7,8 @@ A different default set of apps and configurations. Brings many quality of life
Before installing do this: Before installing do this:
1. Backup your current setup (via the "More..." tab of the App Loader) so you can restore it later if you want. 1. Backup your current setup (via the "More..." tab of the App Loader) so you can restore it later if you want.
2. Factory reset the watch. 2. Install this app (you'll be prompted about all data being removed from your Bangle)
3. Remove all apps via the "More..." tab in the App Loader. 3. Try it out, switch out apps to your favorites and tweak to your liking!
4. Make sure minification is turned off on the App Loader.
5. Then install.
6. Try it out, switch out apps to your favorites and tweak to your liking!
## Features ## Features

View File

@ -3,8 +3,8 @@
"version":"0.06", "version":"0.06",
"description": "A different default set of apps and configurations. Brings many quality of life improvements. Opinionated based on the creators taste. Read more below before installing.", "description": "A different default set of apps and configurations. Brings many quality of life improvements. Opinionated based on the creators taste. Read more below before installing.",
"icon": "app.png", "icon": "app.png",
"type": "RAM", "type": "defaultconfig",
"tags": "system, configuration, config, anotherconfig, thyttan", "tags": "system,configuration,config,anotherconfig,thyttan",
"supports" : ["BANGLEJS2"], "supports" : ["BANGLEJS2"],
"readme": "README.md", "readme": "README.md",
"dependencies" : { "dependencies" : {
@ -13,7 +13,6 @@
"messageicons":"app", "messageicons":"app",
"widmsggrid":"app", "widmsggrid":"app",
"msgwakefup":"app", "msgwakefup":"app",
"msgtwscr":"app",
"delaylock":"app", "delaylock":"app",
"notify":"app", "notify":"app",
"health":"app", "health":"app",

View File

@ -169,7 +169,7 @@ const APP_KEYS = [
const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite']; const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite'];
const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate']; const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate'];
const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports' const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports'
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","textinput","module","clkinfo"]; // values allowed for "type" field const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","textinput","module","clkinfo","defaultconfig"]; // values allowed for "type" field - listed in README.md
const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info
const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ]; const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ];
const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"]; const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"];
@ -207,6 +207,10 @@ apps.forEach((app,appIdx) => {
if (!app.name) ERROR(`App ${app.id} has no name`, {file:metadataFile}); if (!app.name) ERROR(`App ${app.id} has no name`, {file:metadataFile});
var isApp = !app.type || app.type=="app"; var isApp = !app.type || app.type=="app";
var appTags = app.tags ? app.tags.split(",") : []; var appTags = app.tags ? app.tags.split(",") : [];
/*if (appTags.some(tag => tag!=tag.trim()))
WARN(`App ${app.id} 'tag' list contains whitespace ("${app.tags}")`, {file:metadataFile});
if (appTags.some(tag => tag!=tag.toLowerCase()))
WARN(`App ${app.id} 'tag' list contains uppercase ("${app.tags}")`, {file:metadataFile});*/
if (app.name.length>20 && !app.shortName && isApp) ERROR(`App ${app.id} has a long name, but no shortName`, {file:metadataFile}); if (app.name.length>20 && !app.shortName && isApp) ERROR(`App ${app.id} has a long name, but no shortName`, {file:metadataFile});
if (app.type && !METADATA_TYPES.includes(app.type)) if (app.type && !METADATA_TYPES.includes(app.type))
ERROR(`App ${app.id} 'type' is one one of `+METADATA_TYPES, {file:metadataFile}); ERROR(`App ${app.id} 'type' is one one of `+METADATA_TYPES, {file:metadataFile});
@ -296,7 +300,8 @@ apps.forEach((app,appIdx) => {
if (INTERNAL_FILES_IN_APP_TYPE[app.type].includes(file.name)) if (INTERNAL_FILES_IN_APP_TYPE[app.type].includes(file.name))
fileInternal = true; fileInternal = true;
} }
allFiles.push({app: app.id, file: file.name, internal:fileInternal}); if (!app.type=="defaultconfig")
allFiles.push({app: app.id, file: file.name, internal:fileInternal});
if (file.url) if (!fs.existsSync(appDir+file.url)) ERROR(`App ${app.id} file ${file.url} doesn't exist`, {file:metadataFile}); if (file.url) if (!fs.existsSync(appDir+file.url)) ERROR(`App ${app.id} file ${file.url} doesn't exist`, {file:metadataFile});
if (!file.url && !file.content && !app.custom) ERROR(`App ${app.id} file ${file.name} has no contents`, {file:metadataFile}); if (!file.url && !file.content && !app.custom) ERROR(`App ${app.id} file ${file.name} has no contents`, {file:metadataFile});
var fileContents = ""; var fileContents = "";
@ -494,7 +499,7 @@ while(fileA=allFiles.pop()) {
if (isGlob(nameA)||isGlob(nameB)) if (isGlob(nameA)||isGlob(nameB))
ERROR(`App ${fileB.app} ${typeB} file ${nameB} matches app ${fileA.app} ${typeB} file ${nameA}`); ERROR(`App ${fileB.app} ${typeB} file ${nameB} matches app ${fileA.app} ${typeB} file ${nameA}`);
else if (fileA.app != fileB.app && (!fileA.internal) && (!fileB.internal)) else if (fileA.app != fileB.app && (!fileA.internal) && (!fileB.internal))
WARN(`App ${fileB.app} ${typeB} file ${nameB} is also listed as ${typeA} file for app ${fileA.app}`); WARN(`App ${fileB.app} ${typeB} file ${nameB} is also listed as ${typeA} file for app ${fileA.app}`, {file:APPSDIR_RELATIVE+fileB.app+"/metadata.json"});
} }
}) })
} }

2
core

@ -1 +1 @@
Subproject commit bf08b484830ef4e811faf67ec663ebf839b5d09b Subproject commit 3ec8e289a26a545d0d0c50f6945978584fb3d7f8

View File

@ -14,4 +14,4 @@ type AppInfo = {
type AppType = "app" | "clock" | "widget" | "module" | "bootloader" | type AppType = "app" | "clock" | "widget" | "module" | "bootloader" |
"settings" | "clkinfo" | "RAM" | "launch" | "textinput" | "scheduler" | "settings" | "clkinfo" | "RAM" | "launch" | "textinput" | "scheduler" |
"notify" | "locale"; "notify" | "locale" | "defaultconfig";