forked from Blendman974/faceclaw
Add option to auto-dismiss notifications after a timer
This commit is contained in:
1 parent
9ba5c1988d
commit
448a057d2d
15 files changed
+329
-30
No files matched your search
@@ -14,7 +14,12 @@ const notificationsApp: AppDefinition = {
|
||||
if (listenerState === "no-access" || listenerState === "stuck") {
|
||||
requestNotificationListenerAccess();
|
||||
}
|
||||
return ctx.launchInProcessApp(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, createNotificationsAppWindow);
|
||||
return ctx.launchInProcessApp(NOTIFICATIONS_WINDOW_ID, NOTIFICATIONS_SURFACE_ID, (options) =>
|
||||
createNotificationsAppWindow(options, (section) => {
|
||||
void ctx.launchApp("settings", { section }).catch((error) => {
|
||||
ctx.appendLog(`settings launch failed: ${error}`);
|
||||
});
|
||||
}));
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NotificationsListLayer } from "../../ui/notifications";
|
||||
import { NotificationFilterLayer } from "../../ui/notification-filter";
|
||||
import { NOTIFICATIONS_SETTINGS_SECTION } from "../../ui/dashboard/settings-menus";
|
||||
import { onAndroidNotificationsChanged } from "../../native/notification-icons";
|
||||
import {
|
||||
createInProcessWindow,
|
||||
@@ -14,9 +14,13 @@ export const NOTIFICATIONS_SURFACE_ID = "window:notifications";
|
||||
/**
|
||||
* The Notifications app: the Android-notification list (previously a
|
||||
* dashboard page) in its own in-process window; selecting a notification
|
||||
* opens the detail view with its quick actions.
|
||||
* opens the detail view with its quick actions. `openSettings` opens a
|
||||
* Settings section (the menu's "Settings" goes to Notifications).
|
||||
*/
|
||||
export function createNotificationsAppWindow(options: InProcessAppOptions): InProcessWindow {
|
||||
export function createNotificationsAppWindow(
|
||||
options: InProcessAppOptions,
|
||||
openSettings: (section: string) => void,
|
||||
): InProcessWindow {
|
||||
// Newly posted notifications repaint the list while the window is open.
|
||||
let offNotificationsChanged: (() => void) | null = null;
|
||||
const created = createInProcessWindow({
|
||||
@@ -27,10 +31,10 @@ export function createNotificationsAppWindow(options: InProcessAppOptions): InPr
|
||||
icon: "bell",
|
||||
closeable: true,
|
||||
menuItems: () => [{
|
||||
label: "Notification filter",
|
||||
label: "Settings",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.pop();
|
||||
ctx.stack.push(new NotificationFilterLayer());
|
||||
openSettings(NOTIFICATIONS_SETTINGS_SECTION);
|
||||
},
|
||||
}],
|
||||
actions: options.actions,
|
||||
|
||||
Reference in new issue
Block a user