Skip to content

Commit 0c04988

Browse files
committed
handle 'defaultconfig' app type for default configurations
1 parent c307f1f commit 0c04988

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ and which gives information about the app for the Launcher.
270270
// 'notify' - provides 'notify' library for showing notifications
271271
// 'locale' - provides 'locale' library for language-specific date/distance/etc
272272
// (a version of 'locale' is included in the firmware)
273+
// 'defaultconfig' - a set of apps that will can be installed and will wipe out all previously installed apps
273274
"tags": "", // comma separated tag list for searching
274275
// common types are:
275276
// 'clock' - it's a clock

apps/confthyttan/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ A different default set of apps and configurations. Brings many quality of life
77
Before installing do this:
88

99
1. Backup your current setup (via the "More..." tab of the App Loader) so you can restore it later if you want.
10-
2. Factory reset the watch.
11-
3. Remove all apps via the "More..." tab in the App Loader.
12-
4. Make sure minification is turned off on the App Loader.
13-
5. Then install.
14-
6. Try it out, switch out apps to your favorites and tweak to your liking!
10+
2. Install this app (you'll be prompted about all data being removed from your Bangle)
11+
3. Try it out, switch out apps to your favorites and tweak to your liking!
1512

1613
## Features
1714

apps/confthyttan/metadata.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version":"0.06",
44
"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.",
55
"icon": "app.png",
6-
"type": "RAM",
7-
"tags": "system, configuration, config, anotherconfig, thyttan",
6+
"type": "defaultconfig",
7+
"tags": "system,configuration,config,anotherconfig,thyttan",
88
"supports" : ["BANGLEJS2"],
99
"readme": "README.md",
1010
"dependencies" : {
@@ -13,7 +13,6 @@
1313
"messageicons":"app",
1414
"widmsggrid":"app",
1515
"msgwakefup":"app",
16-
"msgtwscr":"app",
1716
"delaylock":"app",
1817
"notify":"app",
1918
"health":"app",

bin/sanitycheck.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const APP_KEYS = [
169169
const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite'];
170170
const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate'];
171171
const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports'
172-
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","textinput","module","clkinfo"]; // values allowed for "type" field
172+
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
173173
const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info
174174
const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ];
175175
const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"];
@@ -207,6 +207,10 @@ apps.forEach((app,appIdx) => {
207207
if (!app.name) ERROR(`App ${app.id} has no name`, {file:metadataFile});
208208
var isApp = !app.type || app.type=="app";
209209
var appTags = app.tags ? app.tags.split(",") : [];
210+
/*if (appTags.some(tag => tag!=tag.trim()))
211+
WARN(`App ${app.id} 'tag' list contains whitespace ("${app.tags}")`, {file:metadataFile});
212+
if (appTags.some(tag => tag!=tag.toLowerCase()))
213+
WARN(`App ${app.id} 'tag' list contains uppercase ("${app.tags}")`, {file:metadataFile});*/
210214
if (app.name.length>20 && !app.shortName && isApp) ERROR(`App ${app.id} has a long name, but no shortName`, {file:metadataFile});
211215
if (app.type && !METADATA_TYPES.includes(app.type))
212216
ERROR(`App ${app.id} 'type' is one one of `+METADATA_TYPES, {file:metadataFile});
@@ -296,7 +300,8 @@ apps.forEach((app,appIdx) => {
296300
if (INTERNAL_FILES_IN_APP_TYPE[app.type].includes(file.name))
297301
fileInternal = true;
298302
}
299-
allFiles.push({app: app.id, file: file.name, internal:fileInternal});
303+
if (!app.type=="defaultconfig")
304+
allFiles.push({app: app.id, file: file.name, internal:fileInternal});
300305
if (file.url) if (!fs.existsSync(appDir+file.url)) ERROR(`App ${app.id} file ${file.url} doesn't exist`, {file:metadataFile});
301306
if (!file.url && !file.content && !app.custom) ERROR(`App ${app.id} file ${file.name} has no contents`, {file:metadataFile});
302307
var fileContents = "";
@@ -494,7 +499,7 @@ while(fileA=allFiles.pop()) {
494499
if (isGlob(nameA)||isGlob(nameB))
495500
ERROR(`App ${fileB.app} ${typeB} file ${nameB} matches app ${fileA.app} ${typeB} file ${nameA}`);
496501
else if (fileA.app != fileB.app && (!fileA.internal) && (!fileB.internal))
497-
WARN(`App ${fileB.app} ${typeB} file ${nameB} is also listed as ${typeA} file for app ${fileA.app}`);
502+
WARN(`App ${fileB.app} ${typeB} file ${nameB} is also listed as ${typeA} file for app ${fileA.app}`, {file:APPSDIR_RELATIVE+fileB.app+"/metadata.json"});
498503
}
499504
})
500505
}

typescript/types/info.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ type AppInfo = {
1414

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

0 commit comments

Comments
 (0)