forked from Blendman974/faceclaw
Turn on screen when Android notifications are received
This commit is contained in:
1 parent
468291aac3
commit
5a92637537
7 files changed
+205
-12
No files matched your search
+13
-1
@@ -50,7 +50,7 @@ import {
|
||||
import { Layer, LayerActions, LayerStack, type DashboardInputEvent, type LayerContext } from "./layers";
|
||||
import { drawRightValueMenuItem, drawToggleMenuItem, MenuLayer } from "./menu";
|
||||
import { StopwatchLayer } from "./apps/stopwatch";
|
||||
import { NotificationsListLayer } from "./notifications";
|
||||
import { NotificationsListLayer, SingleNotificationLayer } from "./notifications";
|
||||
import { TranscribeLayer } from "./apps/transcribe";
|
||||
import { TelepromptLayer } from "./apps/teleprompt";
|
||||
import { ScreenTestLayer } from "./apps/screen-test";
|
||||
@@ -268,6 +268,18 @@ export function openTelepromptDocument(text?: string): void {
|
||||
dashboardLayers.push(new TelepromptLayer(dashboardState.telepromptDocumentText));
|
||||
}
|
||||
|
||||
export function openAndroidNotificationFromSleep(notificationKey: string, nowMs = Date.now()): boolean {
|
||||
if (!notificationKey || dashboardState.screenOn) return false;
|
||||
|
||||
dashboardState.lastInputAtMs = nowMs;
|
||||
dashboardState.screenOn = true;
|
||||
dashboardState.tiledWakePaintPending = dashboardState.wakeMode === "tiled";
|
||||
dashboardLayers.clearToBase();
|
||||
dashboardLayers.push(createRootMenuLayer());
|
||||
dashboardLayers.push(new SingleNotificationLayer(notificationKey));
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resetDashboardSleepTimerAndWake(nowMs = Date.now()): boolean {
|
||||
dashboardState.lastInputAtMs = nowMs;
|
||||
if (dashboardState.screenOn) return false;
|
||||
|
||||
@@ -113,7 +113,7 @@ export class NotificationsListLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
class SingleNotificationLayer implements Layer {
|
||||
export class SingleNotificationLayer implements Layer {
|
||||
private selectedMenuIndex = 0;
|
||||
|
||||
constructor(private readonly notificationKey: string) {}
|
||||
|
||||
Reference in new issue
Block a user