From 0c0498886cc8c23d025faef4cecd409f7fbea493 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 4 Feb 2025 12:23:03 +0000 Subject: [PATCH] handle 'defaultconfig' app type for default configurations --- README.md | 1 + apps/confthyttan/README.md | 7 ++----- apps/confthyttan/metadata.json | 5 ++--- bin/sanitycheck.js | 11 ++++++++--- core | 2 +- typescript/types/info.d.ts | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ddcf23f25..13da10b0a 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,7 @@ and which gives information about the app for the Launcher. // 'notify' - provides 'notify' library for showing notifications // 'locale' - provides 'locale' library for language-specific date/distance/etc // (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 // common types are: // 'clock' - it's a clock diff --git a/apps/confthyttan/README.md b/apps/confthyttan/README.md index 5f7819171..e9b952c82 100644 --- a/apps/confthyttan/README.md +++ b/apps/confthyttan/README.md @@ -7,11 +7,8 @@ A different default set of apps and configurations. Brings many quality of life 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. -2. Factory reset the watch. -3. Remove all apps via the "More..." tab in the App Loader. -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! +2. Install this app (you'll be prompted about all data being removed from your Bangle) +3. Try it out, switch out apps to your favorites and tweak to your liking! ## Features diff --git a/apps/confthyttan/metadata.json b/apps/confthyttan/metadata.json index c706d45f5..5fd18c7e9 100644 --- a/apps/confthyttan/metadata.json +++ b/apps/confthyttan/metadata.json @@ -3,8 +3,8 @@ "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.", "icon": "app.png", - "type": "RAM", - "tags": "system, configuration, config, anotherconfig, thyttan", + "type": "defaultconfig", + "tags": "system,configuration,config,anotherconfig,thyttan", "supports" : ["BANGLEJS2"], "readme": "README.md", "dependencies" : { @@ -13,7 +13,6 @@ "messageicons":"app", "widmsggrid":"app", "msgwakefup":"app", - "msgtwscr":"app", "delaylock":"app", "notify":"app", "health":"app", diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js index 086c2e551..80f8abe24 100755 --- a/bin/sanitycheck.js +++ b/bin/sanitycheck.js @@ -169,7 +169,7 @@ const APP_KEYS = [ const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite']; 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","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 VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ]; 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}); var isApp = !app.type || app.type=="app"; 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.type && !METADATA_TYPES.includes(app.type)) 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)) 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 && !file.content && !app.custom) ERROR(`App ${app.id} file ${file.name} has no contents`, {file:metadataFile}); var fileContents = ""; @@ -494,7 +499,7 @@ while(fileA=allFiles.pop()) { if (isGlob(nameA)||isGlob(nameB)) ERROR(`App ${fileB.app} ${typeB} file ${nameB} matches app ${fileA.app} ${typeB} file ${nameA}`); 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"}); } }) } diff --git a/core b/core index bf08b4848..3ec8e289a 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit bf08b484830ef4e811faf67ec663ebf839b5d09b +Subproject commit 3ec8e289a26a545d0d0c50f6945978584fb3d7f8 diff --git a/typescript/types/info.d.ts b/typescript/types/info.d.ts index c305b0261..21014ff8f 100644 --- a/typescript/types/info.d.ts +++ b/typescript/types/info.d.ts @@ -14,4 +14,4 @@ type AppInfo = { type AppType = "app" | "clock" | "widget" | "module" | "bootloader" | "settings" | "clkinfo" | "RAM" | "launch" | "textinput" | "scheduler" | - "notify" | "locale"; + "notify" | "locale" | "defaultconfig";