forked from Blendman974/faceclaw
Merge upstream main preserving custom feature integrations
This commit is contained in:
commit
6150a1ac57
228 files changed
+16844
-1388
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
import { dashboardController, type MirrorTouchKind } from "../g2/dashboard-controller";
|
||||
import { formatBatteryLine } from "../g2/glasses-display-state";
|
||||
import {
|
||||
glassesModelName,
|
||||
mirrorTouchSetting,
|
||||
onAnySettingChanged,
|
||||
showBleBandwidthSetting,
|
||||
@@ -26,10 +27,13 @@ import { isValidMacAddress, loadDeviceAddresses } from "../g2/device-addresses";
|
||||
import { isAutoReconnectSuppressed, resumeAutoReconnect } from "../g2/reconnect-policy";
|
||||
import { isPreviewOnlyMode } from "./onboarding-state";
|
||||
import { formatErrorMessage } from "../util/format-error";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../graphics/image";
|
||||
import { screenHeight, screenWidth } from "../ui/shell/geometry";
|
||||
import { type PhoneUiButton } from "../apps/evenhub/manager";
|
||||
|
||||
const LENS_ASPECT_RATIO = G2_LENS_WIDTH / G2_LENS_HEIGHT;
|
||||
/** The paired glasses' screen aspect (4:3 on the G2, 27:11 on the RayNeo iO). */
|
||||
function lensAspectRatio(): number {
|
||||
return screenWidth() / screenHeight();
|
||||
}
|
||||
|
||||
type LayoutOrientation = "portrait" | "landscape";
|
||||
|
||||
@@ -96,6 +100,7 @@ export class MainViewModel extends RemoteControlsViewModel {
|
||||
this.batteryLine = formatBatteryLine(
|
||||
snapshot.batteries,
|
||||
snapshot.phase === "connected" || snapshot.phase === "charging",
|
||||
glassesModelName(),
|
||||
);
|
||||
this.activeTextSettingId = snapshot.activeTextSettingId;
|
||||
this.activeTextEditorTitle = snapshot.activeTextEditorTitle;
|
||||
@@ -246,7 +251,7 @@ export class MainViewModel extends RemoteControlsViewModel {
|
||||
}
|
||||
|
||||
get displayPreviewHeight(): number {
|
||||
return Screen.mainScreen.widthDIPs / LENS_ASPECT_RATIO;
|
||||
return Screen.mainScreen.widthDIPs / lensAspectRatio();
|
||||
}
|
||||
|
||||
get landscapeDisplayPreviewWidth(): number {
|
||||
@@ -262,8 +267,8 @@ export class MainViewModel extends RemoteControlsViewModel {
|
||||
// and controls, and updates for rotation, split-screen, and the keyboard.
|
||||
const { width, height } = args.object.getActualSize();
|
||||
if (width <= 0 || height <= 0) return;
|
||||
const previewHeight = Math.min(height, width / LENS_ASPECT_RATIO);
|
||||
const previewWidth = previewHeight * LENS_ASPECT_RATIO;
|
||||
const previewHeight = Math.min(height, width / lensAspectRatio());
|
||||
const previewWidth = previewHeight * lensAspectRatio();
|
||||
if (previewWidth === this._landscapePreviewWidth && previewHeight === this._landscapePreviewHeight) return;
|
||||
this._landscapePreviewWidth = previewWidth;
|
||||
this._landscapePreviewHeight = previewHeight;
|
||||
@@ -672,6 +677,14 @@ export class MainViewModel extends RemoteControlsViewModel {
|
||||
* auto-reconnect suppression right away.
|
||||
*/
|
||||
async onPrepareFontsTap(): Promise<void> {
|
||||
await this.openFirmwareCheck();
|
||||
}
|
||||
|
||||
async onCheckFirmwareTap(): Promise<void> {
|
||||
await this.openFirmwareCheck();
|
||||
}
|
||||
|
||||
private async openFirmwareCheck(): Promise<void> {
|
||||
this.setWarningsModalVisible(false);
|
||||
if (this.phase === "connected" || this.phase === "charging" || this.phase === "connecting") {
|
||||
try {
|
||||
@@ -919,8 +932,9 @@ export class MainViewModel extends RemoteControlsViewModel {
|
||||
}
|
||||
|
||||
private async openFlashPage(mode: "install" | "uninstall"): Promise<void> {
|
||||
// The flasher needs the glasses to itself, so drop the main connection first.
|
||||
if (this.phase === "connected" || this.phase === "charging") {
|
||||
// The flasher needs the glasses to itself, so drop the main connection first. That includes a session
|
||||
// still retrying: an install brings arms back at the addresses it is dialling.
|
||||
if (this.phase === "connected" || this.phase === "charging" || this.phase === "connecting") {
|
||||
try {
|
||||
await dashboardController.disconnect();
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user