Add a consolidated single export to each app

This commit is contained in:
James Babcock committed 2026-08-03 00:51:57 -07:00
1 parent 9b3832d7a7
commit f38366df6e
23 files changed
+597 -337

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { isNotificationListenerEnabled, requestNotificationListenerAccess } from "../../native/notification-access";
import { type AppDefinition } from "../app-definition";
import { createNotificationsAppWindow, NOTIFICATIONS_SURFACE_ID, NOTIFICATIONS_WINDOW_ID } from "./notifications-app";
const notificationsApp: AppDefinition = {
appId: "notifications",
title: "Notifications",
icon: "bell",
launch: (ctx) => {
// Without notification-listener access the tray reads as empty; prompt
// the user on the phone so the on-glasses "grant permission" message is
// actionable. The app still opens to show that message.
if (!isNotificationListenerEnabled()) {
requestNotificationListenerAccess();
}
return ctx.launchInProcessApp(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow);
},
};
export default notificationsApp;
+10 -2
View File
@@ -1,4 +1,5 @@
import { NotificationsListLayer } from "../../ui/notifications";
import { onAndroidNotificationPosted } from "../../native/notification-icons";
import {
createInProcessWindow,
YieldAtRootLayer,
@@ -15,7 +16,9 @@ export const NOTIFICATIONS_SURFACE_ID = "window:notifications";
* opens the detail view with its quick actions.
*/
export function createNotificationsAppWindow(options: InProcessAppOptions): InProcessWindow {
return createInProcessWindow({
// Newly posted notifications repaint the list while the window is open.
let offNotificationPosted: (() => void) | null = null;
const created = createInProcessWindow({
appId: "notifications",
windowId: NOTIFICATIONS_WINDOW_ID,
title: "Notifications",
@@ -27,6 +30,11 @@ export function createNotificationsAppWindow(options: InProcessAppOptions): InPr
submitFrame: options.submitFrame,
setSurfaceVisible: options.setSurfaceVisible,
removeSurface: options.removeSurface,
onClosed: options.onClosed,
onClosed: () => {
offNotificationPosted?.();
options.onClosed();
},
});
offNotificationPosted = onAndroidNotificationPosted(() => created.requestRender());
return created;
}