[verified] merge upstream c162c8e6 into all-features

This commit is contained in:
MasterControl committed 2026-11-14 23:24:08 +00:00
commit 5790e98d27
176 files changed
+5311 -2307

No files matched your search

+5 -12
View File
@@ -10,11 +10,10 @@ import { drawToggleMenuItem, MenuLayer, type MenuItem } from "./menu";
/** Refresh rows as new sources arrive, keeping the current selection by package. */
export class NotificationFilterLayer implements Layer {
private menu: MenuLayer | null = null;
private menuWidth = 0;
/** Stable row keys, including controls, parallel to the menu's items. */
private packages: string[] = [];
private currentMenu(ctx: LayerContext): MenuLayer {
private currentMenu(): MenuLayer {
readActiveNotifications(ALL_NOTIFICATIONS);
const sources = readNotificationSources().sort((a, b) =>
a.appName.localeCompare(b.appName) || a.packageName.localeCompare(b.packageName));
@@ -44,14 +43,8 @@ export class NotificationFilterLayer implements Layer {
this.packages = ["default", "enable-all", "disable-all", ...sources.map((source) => `source:${source.packageName}`)];
const index = selectedPackage === undefined ? 0 : this.packages.indexOf(selectedPackage);
const width = ctx.stack.getBaseSize().width;
if (!this.menu || width !== this.menuWidth) {
this.menuWidth = width;
this.menu = new MenuLayer("Notification filter", items, {
x: 8, y: 8, width: width - 16,
opaque: true, showBorder: false,
footer: "On = show notifications on glasses",
}).selectItem(Math.max(0, index));
if (!this.menu) {
this.menu = new MenuLayer("Notification filter", items, { page: true, footer: "On = show notifications on glasses" }).selectItem(Math.max(0, index));
} else {
this.menu.setItems(items, index >= 0 ? index : undefined);
}
@@ -59,10 +52,10 @@ export class NotificationFilterLayer implements Layer {
}
paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage {
return this.currentMenu(ctx).paint(ctx, paintBelow);
return this.currentMenu().paint(ctx, paintBelow);
}
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
await this.currentMenu(ctx).handleInput(event, ctx);
await this.currentMenu().handleInput(event, ctx);
}
}