Skip to content

Commit

Permalink
handle 'defaultconfig' app type for default configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Feb 4, 2025
1 parent c307f1f commit 0c04988
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions apps/confthyttan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions apps/confthyttan/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand All @@ -13,7 +13,6 @@
"messageicons":"app",
"widmsggrid":"app",
"msgwakefup":"app",
"msgtwscr":"app",
"delaylock":"app",
"notify":"app",
"health":"app",
Expand Down
11 changes: 8 additions & 3 deletions bin/sanitycheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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"});
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion core
Submodule core updated 4 files
+1 −1 js/appinfo.js
+1 −1 js/comms.js
+16 −3 js/index.js
+1 −1 js/ui.js
2 changes: 1 addition & 1 deletion typescript/types/info.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ type AppInfo = {

type AppType = "app" | "clock" | "widget" | "module" | "bootloader" |
"settings" | "clkinfo" | "RAM" | "launch" | "textinput" | "scheduler" |
"notify" | "locale";
"notify" | "locale" | "defaultconfig";

0 comments on commit 0c04988

Please sign in to comment.