1
0
Fork 0

Fixed two buzzes and use AppInfo instead of AppInfoFile

master
Bruce Blore 2023-05-13 08:07:42 -07:00
parent 032b7c03f5
commit 4dfdc8ab63
5 changed files with 10 additions and 22 deletions

View File

@ -133,9 +133,9 @@
var entry = grid_1[x][y];
switch (entry.type) {
case "app":
Bangle.buzz();
var infoFile = storage_1.readJSON(entry.id + '.info', false);
load(infoFile.src);
break;
case "folder":
Bangle.buzz();
resetTimeout_1();

View File

@ -115,8 +115,8 @@
// Get the icon and text, skip if the space is empty. Always draw text for folders even if disabled
switch (entry.type) {
case 'app':
let app: AppInfoFile = storage.readJSON(entry.id + '.info', false);
icon = storage.read(app.icon)!;
let app: AppInfo = storage.readJSON(entry.id + '.info', false);
icon = storage.read(app.icon!)!;
text = app.name;
empty = false;
fontSize = config.display.font;
@ -185,9 +185,10 @@
let entry: GridEntry = grid[x]![y]!;
switch (entry.type) {
case "app":
Bangle.buzz();
// Bangle.buzz();
let infoFile = storage.readJSON(entry.id + '.info', false);
load(infoFile.src);
break;
case "folder":
Bangle.buzz();
resetTimeout();

View File

@ -77,8 +77,8 @@ function cleanAndSave(config: Config): Config {
* @return negative if a should go first, positive if b should go first, zero if equivalent.
*/
let infoFileSorter = (a: string, b: string): number => {
let aJson: AppInfoFile = storage.readJSON(a, false);
let bJson: AppInfoFile = storage.readJSON(b, false);
let aJson: AppInfo = storage.readJSON(a, false);
let bJson: AppInfo = storage.readJSON(b, false);
var n = (0 | aJson.sortorder!) - (0 | bJson.sortorder!);
if (n) return n; // do sortorder first
if (aJson.name < bJson.name) return -1;
@ -110,7 +110,7 @@ export = {
infoFiles.sort(infoFileSorter);
for (let infoFile of infoFiles) {
let app: AppInfoFile = storage.readJSON(infoFile, false);
let app: AppInfo = storage.readJSON(infoFile, false);
// If the app is to be hidden by policy, exclude it completely
if (

View File

@ -24,7 +24,7 @@
onchange // Do nothing, but stop typescript from yelling at me for this function being unused. It gets used by eval. I know eval is evil, but the menus are a bit limited.
for (let app in config.apps) {
let appInfo: AppInfoFile = storage.readJSON(app + '.info', false);
let appInfo: AppInfo = storage.readJSON(app + '.info', false);
menu[appInfo.name] = {
value: config.hidden.includes(app),
format: (value: boolean) => (value ? 'Yes' : 'No'),
@ -35,7 +35,7 @@
E.showMenu(menu);
};
let getAppInfo = (id: string): AppInfoFile => {
let getAppInfo = (id: string): AppInfo => {
return storage.readJSON(id + '.info', false);
}

View File

@ -1,16 +1,3 @@
type AppInfoFile = { // Contents of a .info file
id: string,
name: string,
type?: string,
src?: string,
icon: string,
version: string,
tags: string,
files: string,
data: string,
sortorder?: number
};
type Folder = {
folders: { // name: folder pairs of all nested folders
[key: string]: Folder