forked from Blendman974/faceclaw
Phone UI: show the glasses, charging case and R1 battery levels
A line under the mirror lists each device whose level is known, e.g. "G2 100% · Case 98% ⚡ · R1 72%" (⚡ = charging), in portrait and landscape. The case level joins the shell's battery state beside the glasses and R1 (it is not drawn in the glasses' top bar) and reaches the page through the dashboard snapshot. Like the glasses level it is kept across disconnects: the case only reports while the glasses are docked and only drains while charging them.
This commit is contained in:
1 parent
acfcf79787
commit
9c0535014a
6 files changed
+70
-6
No files matched your search
@@ -103,6 +103,8 @@ type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging"
|
||||
|
||||
export type DashboardSnapshot = {
|
||||
phase: ConnectionPhase;
|
||||
/** Last-known battery levels: the glasses, their charging case, the R1 ring and a Wear OS watch. */
|
||||
batteries: ReturnType<typeof shell.getBatteryLevels>;
|
||||
status: string;
|
||||
displayPreview: ImageSource | null;
|
||||
/**
|
||||
@@ -333,6 +335,7 @@ class DashboardController {
|
||||
private offState: (() => void) | null = null;
|
||||
private offRing: (() => void) | null = null;
|
||||
private offBattery: (() => void) | null = null;
|
||||
private offCaseBattery: (() => void) | null = null;
|
||||
private offSilentMode: (() => void) | null = null;
|
||||
private offWearState: (() => void) | null = null;
|
||||
private offPhoneLockState: (() => void) | null = null;
|
||||
@@ -1130,6 +1133,7 @@ class DashboardController {
|
||||
alarmReliabilityMessage: this.alarmReliabilityMessage,
|
||||
previewMode: this.isPreviewDisplayActive(),
|
||||
evenHubPhoneUi: phoneUiButton(),
|
||||
batteries: shell.getBatteryLevels(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1584,6 +1588,12 @@ class DashboardController {
|
||||
// the watch state, so refresh both consumers on every report.
|
||||
this.emit();
|
||||
});
|
||||
this.offCaseBattery = communicator.onCaseState((state) => {
|
||||
// Kept across disconnects: the case only reports while the glasses are
|
||||
// docked and only drains while charging them, so the last level holds.
|
||||
shell.setBatteryLevels({ case: state.battery, caseCharging: state.charging });
|
||||
this.emit();
|
||||
});
|
||||
this.offEvenAppConflict = communicator.onEvenAppConflict((message) => {
|
||||
this.refreshEvenAppStatus();
|
||||
if (!this.evenNotificationActive) {
|
||||
@@ -1704,6 +1714,8 @@ class DashboardController {
|
||||
this.offRing = null;
|
||||
this.offBattery?.();
|
||||
this.offBattery = null;
|
||||
this.offCaseBattery?.();
|
||||
this.offCaseBattery = null;
|
||||
this.offSilentMode?.();
|
||||
this.offSilentMode = null;
|
||||
this.offWearState?.();
|
||||
@@ -1816,6 +1828,8 @@ class DashboardController {
|
||||
this.offRing = null;
|
||||
this.offBattery?.();
|
||||
this.offBattery = null;
|
||||
this.offCaseBattery?.();
|
||||
this.offCaseBattery = null;
|
||||
this.offSilentMode?.();
|
||||
this.offSilentMode = null;
|
||||
this.offWearState?.();
|
||||
|
||||
Reference in new issue
Block a user