Optimize phone CPU usage

This commit is contained in:
James Babcock committed 2026-09-27 23:16:41 -07:00
1 parent 449cb0bf73
commit 45d2ece0d2
19 files changed
+485 -103

No files matched your search

+10
View File
@@ -51,9 +51,19 @@ export function installedEvenHubPackageId(appId: string): string | null {
}
}
// The parsed index for the last stored value: the launcher and the watch
// state both list installed apps on every refresh, and the sort's
// localeCompare dominated the cost.
let parsedIndex: { raw: string; apps: InstalledEvenHubApp[] } | null = null;
export function getInstalledEvenHubApps(): InstalledEvenHubApp[] {
const raw = getStringSetting(STORAGE_KEY, "");
if (!raw) return [];
if (parsedIndex?.raw !== raw) parsedIndex = { raw, apps: parseInstalledIndex(raw) };
return parsedIndex.apps.map((app) => ({ ...app }));
}
function parseInstalledIndex(raw: string): InstalledEvenHubApp[] {
try {
const parsed = JSON.parse(raw);
if (!Array.isArray(parsed)) return [];