Pairing from preview mode reenters onboarding flow at the correct location

This commit is contained in:
James Babcock committed 2026-09-12 00:10:17 -07:00
1 parent 3f2ed42c03
commit 388be40ab4
3 files changed
+23 -9

No files matched your search

+2 -3
View File
@@ -7,14 +7,13 @@
<Label col="2" text="{{ connectionStatusLabel }}" tap="{{ onConnectionStatusTap }}" class="action-bar-status" />
<Label col="3" text="&#x26A0;&#xFE0F;" tap="{{ onWarningIconTap }}" visibility="{{ warningIconVisibility }}" class="action-bar-warning" />
</GridLayout>
<ActionItem text="{{ buttonLabel }}" tap="{{ onTap }}" isEnabled="{{ connectItemEnabled }}" android.position="popup" />
<ActionItem text="{{ buttonLabel }}" tap="{{ onTap }}" isEnabled="{{ connectItemEnabled }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
<ActionItem text="Pair glasses" tap="{{ onPairGlassesTap }}" isEnabled="{{ canRun }}" android.position="popup" />
<ActionItem text="Configure devices" tap="{{ onConfigureTap }}" isEnabled="{{ canRun }}" android.position="popup" />
<ActionItem text="Permissions" tap="{{ onPermissionsTap }}" android.position="popup" />
<ActionItem text="Conversations" tap="{{ onConversationsTap }}" android.position="popup" />
<ActionItem text="Take screenshot" tap="{{ onTakeScreenshotTap }}" android.position="popup" />
<ActionItem text="Record screen" tap="{{ onRecordScreenTap }}" android.position="popup" />
<ActionItem text="Uninstall custom firmware" tap="{{ onUninstallFirmwareTap }}" isEnabled="{{ canRun }}" android.position="popup" />
<ActionItem text="Uninstall custom firmware" tap="{{ onUninstallFirmwareTap }}" isEnabled="{{ canRun }}" visibility="{{ glassesMenuItemsVisibility }}" android.position="popup" />
</ActionBar>
<GridLayout>
+20 -5
View File
@@ -26,6 +26,7 @@ import {
import { sampleBleTraffic } from "../native/ble-traffic";
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";
@@ -886,11 +887,6 @@ export class MainViewModel extends Observable {
}
}
onConfigureTap(): void {
if (!this.canRun) return;
Frame.topmost()?.navigate("phone-ui/config-page");
}
onPermissionsTap(): void {
Frame.topmost()?.navigate({
moduleName: "phone-ui/permissions-page",
@@ -903,6 +899,16 @@ export class MainViewModel extends Observable {
Frame.topmost()?.navigate("phone-ui/conversations-page");
}
/**
* Preview-only users have no glasses paired, so the Connect and Uninstall
* menu items have nothing to act on; hide them until pairing completes.
* The view model is rebuilt on every visit to the main page, so this picks
* up the mode change when pairing/flashing returns here.
*/
get glassesMenuItemsVisibility(): "visible" | "collapse" {
return isPreviewOnlyMode() ? "collapse" : "visible";
}
/**
* Live scan that names each nearby pair by model, colour, and serial and
* checks both arms belong together. A connected arm stops advertising, so
@@ -910,9 +916,18 @@ export class MainViewModel extends Observable {
* state; pairing is a detour, not a Disconnect, so lift the suppression
* right away — nothing dials the glasses until the main page's autoConnect
* runs again on the way back.
*
* In preview-only mode there are no glasses yet, so pairing is really the
* rest of onboarding: re-enter that chain at its "Disconnect Other Apps"
* step, which leads to the scan, the firmware check, and flashing. The
* chain's Back buttons pop history, so its first page returns here.
*/
async onPairGlassesTap(): Promise<void> {
if (!this.canRun) return;
if (isPreviewOnlyMode()) {
Frame.topmost()?.navigate({ moduleName: "phone-ui/onboarding-unpair-page" });
return;
}
if (this.phase === "connected" || this.phase === "charging" || this.phase === "connecting") {
try {
await dashboardController.disconnect();
+1 -1
View File
@@ -336,7 +336,7 @@ export class OnboardingFlashViewModel extends Observable {
this.disposePrompt();
if (!approved) {
this.busy = false;
this.toError("You declined on the glasses. No firmware was written.", () => this.beginPrompt());
this.toError("You declined on the glasses. Firmware was not installed.", () => this.beginPrompt());
return;
}
const lowBattery = this.describeLowBattery(this.promptBattery);