Clear notification popups when they're dismissed on the phone, and avoid showing some notifications that are spurious

This commit is contained in:
James Babcock committed 2026-10-14 02:03:51 -07:00
1 parent 42c2d5cd55
commit 63e0d71e2f
16 files changed
+420 -70

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ import {
} from "../../../graphics/battery";
import { type GrayImage, type UiFont } from "../../../graphics/image";
import { ensureLocationPermission, hasLocationPermission } from "../../../native/location-permissions";
import { onAndroidNotificationPosted, readActiveNotificationIcons } from "../../../native/notification-icons";
import { onAndroidNotificationsChanged, readActiveNotificationIcons } from "../../../native/notification-icons";
import { readPhoneBatteryState } from "../../../native/phone-battery";
import { weatherBridge } from "../../../native/weather";
import { formatClockDate, formatClockTime } from "../../../ui/clock-format";
@@ -162,7 +162,7 @@ export class SystemCardWidget implements GlanceWidget {
start(requestRender: () => void): void {
this.requestRender = requestRender;
this.scheduleMinuteTick();
this.unsubscribeNotifications = onAndroidNotificationPosted(() => this.requestRender?.());
this.unsubscribeNotifications = onAndroidNotificationsChanged(() => this.requestRender?.());
this.unsubscribeSettings = onAnySettingChanged(() => this.requestRender?.());
this.unsubscribeTimers = timerEngine.onChange(() => {
this.syncSecondTick();
+4 -4
View File
@@ -1,6 +1,6 @@
import { NotificationsListLayer } from "../../ui/notifications";
import { NotificationFilterLayer } from "../../ui/notification-filter";
import { onAndroidNotificationPosted } from "../../native/notification-icons";
import { onAndroidNotificationsChanged } from "../../native/notification-icons";
import {
createInProcessWindow,
YieldAtRootLayer,
@@ -18,7 +18,7 @@ export const NOTIFICATIONS_SURFACE_ID = "window:notifications";
*/
export function createNotificationsAppWindow(options: InProcessAppOptions): InProcessWindow {
// Newly posted notifications repaint the list while the window is open.
let offNotificationPosted: (() => void) | null = null;
let offNotificationsChanged: (() => void) | null = null;
const created = createInProcessWindow({
appId: "notifications",
windowId: NOTIFICATIONS_WINDOW_ID,
@@ -39,10 +39,10 @@ export function createNotificationsAppWindow(options: InProcessAppOptions): InPr
setSurfaceVisible: options.setSurfaceVisible,
removeSurface: options.removeSurface,
onClosed: () => {
offNotificationPosted?.();
offNotificationsChanged?.();
options.onClosed();
},
});
offNotificationPosted = onAndroidNotificationPosted(() => created.requestRender());
offNotificationsChanged = onAndroidNotificationsChanged(() => created.requestRender());
return created;
}