Fixed two buzzes and use AppInfo instead of AppInfoFile
parent
032b7c03f5
commit
4dfdc8ab63
|
|
@ -133,9 +133,9 @@
|
||||||
var entry = grid_1[x][y];
|
var entry = grid_1[x][y];
|
||||||
switch (entry.type) {
|
switch (entry.type) {
|
||||||
case "app":
|
case "app":
|
||||||
Bangle.buzz();
|
|
||||||
var infoFile = storage_1.readJSON(entry.id + '.info', false);
|
var infoFile = storage_1.readJSON(entry.id + '.info', false);
|
||||||
load(infoFile.src);
|
load(infoFile.src);
|
||||||
|
break;
|
||||||
case "folder":
|
case "folder":
|
||||||
Bangle.buzz();
|
Bangle.buzz();
|
||||||
resetTimeout_1();
|
resetTimeout_1();
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,8 @@
|
||||||
// Get the icon and text, skip if the space is empty. Always draw text for folders even if disabled
|
// Get the icon and text, skip if the space is empty. Always draw text for folders even if disabled
|
||||||
switch (entry.type) {
|
switch (entry.type) {
|
||||||
case 'app':
|
case 'app':
|
||||||
let app: AppInfoFile = storage.readJSON(entry.id + '.info', false);
|
let app: AppInfo = storage.readJSON(entry.id + '.info', false);
|
||||||
icon = storage.read(app.icon)!;
|
icon = storage.read(app.icon!)!;
|
||||||
text = app.name;
|
text = app.name;
|
||||||
empty = false;
|
empty = false;
|
||||||
fontSize = config.display.font;
|
fontSize = config.display.font;
|
||||||
|
|
@ -185,9 +185,10 @@
|
||||||
let entry: GridEntry = grid[x]![y]!;
|
let entry: GridEntry = grid[x]![y]!;
|
||||||
switch (entry.type) {
|
switch (entry.type) {
|
||||||
case "app":
|
case "app":
|
||||||
Bangle.buzz();
|
// Bangle.buzz();
|
||||||
let infoFile = storage.readJSON(entry.id + '.info', false);
|
let infoFile = storage.readJSON(entry.id + '.info', false);
|
||||||
load(infoFile.src);
|
load(infoFile.src);
|
||||||
|
break;
|
||||||
case "folder":
|
case "folder":
|
||||||
Bangle.buzz();
|
Bangle.buzz();
|
||||||
resetTimeout();
|
resetTimeout();
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* @return negative if a should go first, positive if b should go first, zero if equivalent.
|
||||||
*/
|
*/
|
||||||
let infoFileSorter = (a: string, b: string): number => {
|
let infoFileSorter = (a: string, b: string): number => {
|
||||||
let aJson: AppInfoFile = storage.readJSON(a, false);
|
let aJson: AppInfo = storage.readJSON(a, false);
|
||||||
let bJson: AppInfoFile = storage.readJSON(b, false);
|
let bJson: AppInfo = storage.readJSON(b, false);
|
||||||
var n = (0 | aJson.sortorder!) - (0 | bJson.sortorder!);
|
var n = (0 | aJson.sortorder!) - (0 | bJson.sortorder!);
|
||||||
if (n) return n; // do sortorder first
|
if (n) return n; // do sortorder first
|
||||||
if (aJson.name < bJson.name) return -1;
|
if (aJson.name < bJson.name) return -1;
|
||||||
|
|
@ -110,7 +110,7 @@ export = {
|
||||||
infoFiles.sort(infoFileSorter);
|
infoFiles.sort(infoFileSorter);
|
||||||
|
|
||||||
for (let infoFile of infoFiles) {
|
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 the app is to be hidden by policy, exclude it completely
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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) {
|
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] = {
|
menu[appInfo.name] = {
|
||||||
value: config.hidden.includes(app),
|
value: config.hidden.includes(app),
|
||||||
format: (value: boolean) => (value ? 'Yes' : 'No'),
|
format: (value: boolean) => (value ? 'Yes' : 'No'),
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
E.showMenu(menu);
|
E.showMenu(menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
let getAppInfo = (id: string): AppInfoFile => {
|
let getAppInfo = (id: string): AppInfo => {
|
||||||
return storage.readJSON(id + '.info', false);
|
return storage.readJSON(id + '.info', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 = {
|
type Folder = {
|
||||||
folders: { // name: folder pairs of all nested folders
|
folders: { // name: folder pairs of all nested folders
|
||||||
[key: string]: Folder
|
[key: string]: Folder
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue