Add choose-your-devices page to start of the onboarding flow
This commit is contained in:
1 parent
b353483ac2
commit
41ef3b88a0
12 files changed
+589
-102
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import { EventData, Page } from "@nativescript/core";
|
||||
|
||||
import { OnboardingDevicesViewModel } from "./onboarding-devices-view-model";
|
||||
|
||||
export function navigatingTo(args: EventData): void {
|
||||
const page = args.object as Page;
|
||||
if (!page.bindingContext) {
|
||||
page.bindingContext = new OnboardingDevicesViewModel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" actionBarHidden="true">
|
||||
<GridLayout rows="*,auto" class="p-20">
|
||||
<ScrollView row="0">
|
||||
<StackLayout>
|
||||
<Label text="Your Devices" class="h1 text-center m-t-24" textWrap="true" />
|
||||
<Label
|
||||
text="Which devices do you have? The rest of setup will be tailored to them."
|
||||
class="body-text m-t-24" textWrap="true" />
|
||||
|
||||
<Label text="Glasses" class="h2 pairing-section m-t-24" />
|
||||
<Repeater items="{{ glassesOptions }}">
|
||||
<Repeater.itemsLayout>
|
||||
<StackLayout />
|
||||
</Repeater.itemsLayout>
|
||||
<Repeater.itemTemplate>
|
||||
<GridLayout columns="*,auto" rows="auto" class="{{ rowClass }}" tap="{{ onRowTap }}">
|
||||
<StackLayout col="0" verticalAlignment="center">
|
||||
<Label text="{{ label }}" class="pairing-title" />
|
||||
<Label text="{{ note }}" class="permissions-description" textWrap="true" visibility="{{ noteVisibility }}" />
|
||||
</StackLayout>
|
||||
<Label col="1" text="✓" class="permissions-check" verticalAlignment="center" visibility="{{ checkVisibility }}" />
|
||||
</GridLayout>
|
||||
</Repeater.itemTemplate>
|
||||
</Repeater>
|
||||
|
||||
<Label text="Accessories" class="h2 pairing-section m-t-16" />
|
||||
<GridLayout columns="*,auto" rows="auto" class="pairing-row">
|
||||
<Label col="0" text="Even R1 ring" class="pairing-title" verticalAlignment="center" />
|
||||
<Switch col="1" checked="{{ hasRing }}" verticalAlignment="center" margin="0" />
|
||||
</GridLayout>
|
||||
<GridLayout columns="*,auto" rows="auto" class="pairing-row">
|
||||
<Label col="0" text="{{ watchLabel }}" class="pairing-title" verticalAlignment="center" />
|
||||
<Switch col="1" checked="{{ hasWatch }}" verticalAlignment="center" margin="0" />
|
||||
</GridLayout>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
|
||||
<GridLayout row="1" columns="*,*" class="m-t-20">
|
||||
<Button col="0" text="Back" tap="{{ onBackTap }}" />
|
||||
<Button col="1" text="Next" tap="{{ onNextTap }}" class="-primary" />
|
||||
</GridLayout>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -0,0 +1,109 @@
|
||||
import { EventData, Frame, Observable, View } from "@nativescript/core";
|
||||
|
||||
import { glassesTypeSetting, type GlassesType } from "../ui/dashboard-settings";
|
||||
import { isPreviewOnlyMode, ownsRing, ownsWatch, setOwnsRing, setOwnsWatch, setPreviewOnlyMode } from "./onboarding-state";
|
||||
|
||||
/** A row in the glasses list: a kind of glasses, or no glasses at all. */
|
||||
type GlassesChoice = GlassesType | "preview";
|
||||
|
||||
const GLASSES_OPTIONS: { choice: GlassesChoice; label: string; description?: string }[] = [
|
||||
{ choice: "g1", label: "Even G1" },
|
||||
{ choice: "g2", label: "Even G2" },
|
||||
{ choice: "rayneo-io", label: "RayNeo iO" },
|
||||
{ choice: "preview", label: "Preview Only", description: "No glasses: explore Faceclaw on your phone's screen" },
|
||||
];
|
||||
|
||||
/** Why this choice can't be made on this phone, or "" when it can. */
|
||||
function unavailableReason(choice: GlassesChoice): string {
|
||||
// FaceclawCommunicatorBridge refuses to start a session with one on iOS.
|
||||
return choice === "rayneo-io" && global.isIOS ? "Not supported on iOS yet" : "";
|
||||
}
|
||||
|
||||
export type GlassesOptionItem = {
|
||||
choice: GlassesChoice;
|
||||
label: string;
|
||||
selectable: boolean;
|
||||
note: string;
|
||||
noteVisibility: "visible" | "collapse";
|
||||
rowClass: string;
|
||||
/** Hidden, not collapsed: the check is what sets a row's height, so collapsing it would shift the list on every selection. */
|
||||
checkVisibility: "visible" | "hidden";
|
||||
onRowTap: (args: EventData) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* The Your Devices onboarding page, between the splash and the disclaimer: one
|
||||
* kind of glasses (or Preview Only) plus any accessories, which later setup
|
||||
* pages tailor themselves to. Pairing still has the last word on the glasses,
|
||||
* since it can tell what it heard.
|
||||
*
|
||||
* Preview Only is the persisted preview-only flag, and leaves the glasses type
|
||||
* alone; the Permissions page then finishes onboarding instead of moving on to
|
||||
* the firmware step.
|
||||
*/
|
||||
export class OnboardingDevicesViewModel extends Observable {
|
||||
get glassesOptions(): GlassesOptionItem[] {
|
||||
const selected: GlassesChoice = isPreviewOnlyMode() ? "preview" : glassesTypeSetting.get();
|
||||
return GLASSES_OPTIONS.map(({ choice, label, description }) => {
|
||||
const reason = unavailableReason(choice);
|
||||
const note = reason || description || "";
|
||||
const isSelected = choice === selected;
|
||||
return {
|
||||
choice,
|
||||
label,
|
||||
selectable: !reason,
|
||||
note,
|
||||
noteVisibility: note ? "visible" : "collapse",
|
||||
rowClass: isSelected ? "pairing-row pairing-row-selected" : reason ? "pairing-row pairing-row-incomplete" : "pairing-row",
|
||||
checkVisibility: isSelected ? "visible" : "hidden",
|
||||
onRowTap: this.onGlassesRowTap,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// Arrow property: NativeScript fires XML event handlers with `this` bound to
|
||||
// the tapped view's bindingContext (the row item), not the view model.
|
||||
readonly onGlassesRowTap = (args: EventData): void => {
|
||||
const item = (args.object as View).bindingContext as GlassesOptionItem | undefined;
|
||||
if (!item?.selectable) return;
|
||||
setPreviewOnlyMode(item.choice === "preview");
|
||||
if (item.choice !== "preview") glassesTypeSetting.set(item.choice);
|
||||
this.notifyPropertyChange("glassesOptions", this.glassesOptions);
|
||||
};
|
||||
|
||||
get hasRing(): boolean {
|
||||
return ownsRing();
|
||||
}
|
||||
|
||||
set hasRing(value: boolean) {
|
||||
setOwnsRing(value);
|
||||
}
|
||||
|
||||
get hasWatch(): boolean {
|
||||
return ownsWatch();
|
||||
}
|
||||
|
||||
set hasWatch(value: boolean) {
|
||||
setOwnsWatch(value);
|
||||
}
|
||||
|
||||
get watchLabel(): string {
|
||||
return global.isIOS ? "Apple Watch" : "Wear OS watch";
|
||||
}
|
||||
|
||||
onNextTap(): void {
|
||||
Frame.topmost()?.navigate({
|
||||
moduleName: "phone-ui/onboarding-page",
|
||||
context: { step: 2 },
|
||||
});
|
||||
}
|
||||
|
||||
onBackTap(): void {
|
||||
const frame = Frame.topmost();
|
||||
if (frame?.canGoBack()) {
|
||||
frame.goBack();
|
||||
return;
|
||||
}
|
||||
frame?.navigate({ moduleName: "phone-ui/onboarding-page", clearHistory: true });
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ require('@nativescript/core/bundle-entry-points');
|
||||
// iOS reuses Android's NativeScript XML forms and view models.
|
||||
global.registerModule('phone-ui/onboarding-page', () => require('./onboarding-page'));
|
||||
global.registerModule('phone-ui/onboarding-page.xml', () => require('./onboarding-page.xml'));
|
||||
global.registerModule('phone-ui/onboarding-devices-page', () => require('./onboarding-devices-page'));
|
||||
global.registerModule('phone-ui/onboarding-devices-page.xml', () => require('./onboarding-devices-page.xml'));
|
||||
global.registerModule('phone-ui/onboarding-unpair-page', () => require('./onboarding-unpair-page'));
|
||||
global.registerModule('phone-ui/onboarding-unpair-page.xml', () => require('./onboarding-unpair-page.xml'));
|
||||
global.registerModule('phone-ui/pairing-page', () => require('./pairing-page'));
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { ApplicationSettings } from "@nativescript/core";
|
||||
|
||||
import { getBooleanSetting, setBooleanSetting } from "../native/settings-store";
|
||||
|
||||
const ONBOARDING_COMPLETE_KEY = "onboarding.complete";
|
||||
const PREVIEW_ONLY_KEY = "onboarding.previewOnly";
|
||||
// The "onboarding." prefix keeps these on this phone in config transfers and
|
||||
// lets scripts/resetOnboarding.sh clear them.
|
||||
const OWNS_RING_KEY = "onboarding.ownsRing";
|
||||
const OWNS_WATCH_KEY = "onboarding.ownsWatch";
|
||||
|
||||
export function hasCompletedOnboarding(): boolean {
|
||||
return ApplicationSettings.getBoolean(ONBOARDING_COMPLETE_KEY, false);
|
||||
@@ -27,3 +33,24 @@ export function isPreviewOnlyMode(): boolean {
|
||||
export function setPreviewOnlyMode(previewOnly: boolean): void {
|
||||
ApplicationSettings.setBoolean(PREVIEW_ONLY_KEY, previewOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessories chosen on the Your Devices onboarding page, for tailoring the
|
||||
* rest of setup. The glasses chosen there go in glassesTypeSetting instead.
|
||||
*/
|
||||
export function ownsRing(): boolean {
|
||||
return getBooleanSetting(OWNS_RING_KEY, false);
|
||||
}
|
||||
|
||||
export function setOwnsRing(owns: boolean): void {
|
||||
setBooleanSetting(OWNS_RING_KEY, owns);
|
||||
}
|
||||
|
||||
/** An Apple Watch on iOS, a Wear OS watch on Android. */
|
||||
export function ownsWatch(): boolean {
|
||||
return getBooleanSetting(OWNS_WATCH_KEY, false);
|
||||
}
|
||||
|
||||
export function setOwnsWatch(owns: boolean): void {
|
||||
setBooleanSetting(OWNS_WATCH_KEY, owns);
|
||||
}
|
||||
@@ -4,10 +4,11 @@
|
||||
<StackLayout>
|
||||
<Label text="Disconnect Other Apps" class="h1 text-center m-t-24" textWrap="true" />
|
||||
<Label
|
||||
text="Your glasses can only be connected to one app or phone at a time. If they're connected to another app (such as Even Realities or MentraOS) or another phone, disconnect them there before continuing. If nothing else is connected, you can continue."
|
||||
text="{{ otherAppsInstructions }}"
|
||||
class="body-text m-t-24" textWrap="true" />
|
||||
<Label
|
||||
text="{{ evenAppInstructions }}"
|
||||
visibility="{{ evenAppVisibility }}"
|
||||
class="body-text m-t-16" textWrap="true" />
|
||||
<Button text="Open Even App Settings" tap="{{ onOpenEvenAppSettingsTap }}" visibility="{{ settingsButtonVisibility }}" width="{{ settingsButtonWidth }}" horizontalAlignment="center" class="-primary m-t-24" />
|
||||
</StackLayout>
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
import { Frame, Observable, Screen } from "@nativescript/core";
|
||||
|
||||
import { openEvenAppSettings } from "../native/even-app-conflict";
|
||||
import { glassesTypeSetting } from "../ui/dashboard-settings";
|
||||
import { hasCompletedOnboarding } from "./onboarding-state";
|
||||
|
||||
export class OnboardingUnpairViewModel extends Observable {
|
||||
/**
|
||||
* Setting up a RayNeo iO, so the Even app doesn't apply. Only during first-run
|
||||
* setup: "Pair glasses" in the main menu also opens this page, and you may be
|
||||
* pairing something other than the glasses you paired before.
|
||||
*/
|
||||
private readonly settingUpIo = !hasCompletedOnboarding() && glassesTypeSetting.get() === "rayneo-io";
|
||||
|
||||
get otherAppsInstructions(): string {
|
||||
const apps = this.settingUpIo ? "another app" : "another app (such as Even Realities or MentraOS)";
|
||||
return `Your glasses can only be connected to one app or phone at a time. If they're connected to ${apps} or another phone, disconnect them there before continuing. If nothing else is connected, you can continue.`;
|
||||
}
|
||||
|
||||
get evenAppVisibility(): "visible" | "collapse" {
|
||||
return this.settingUpIo ? "collapse" : "visible";
|
||||
}
|
||||
|
||||
get settingsButtonVisibility(): "visible" | "collapse" {
|
||||
return global.isAndroid ? "visible" : "collapse";
|
||||
return global.isAndroid && !this.settingUpIo ? "visible" : "collapse";
|
||||
}
|
||||
|
||||
get evenAppInstructions(): string {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { finishOnboardingNavigation } from "./onboarding-navigation";
|
||||
import { Frame, Observable, Screen } from "@nativescript/core";
|
||||
import { IOS_PRIVACY_NOTICE } from "../analytics/privacy-disclosure";
|
||||
import { glassesTypeSetting, type GlassesType } from "../ui/dashboard-settings";
|
||||
|
||||
import { setOnboardingCompleted, setPreviewOnlyMode } from "./onboarding-state";
|
||||
import { isPreviewOnlyMode } from "./onboarding-state";
|
||||
|
||||
/** Steps are separate pages in the flow; the devices page follows the splash. */
|
||||
type OnboardingStep = 1 | 2 | 3;
|
||||
|
||||
type StepContent = {
|
||||
@@ -17,52 +18,85 @@ type StepContent = {
|
||||
showSecondary: boolean;
|
||||
};
|
||||
|
||||
const STEP_CONTENT: Record<OnboardingStep, StepContent> = {
|
||||
1: {
|
||||
headline: "Faceclaw",
|
||||
tagline: "Perching on the faces of giants",
|
||||
body: "",
|
||||
primaryLabel: "Next",
|
||||
secondaryLabel: "",
|
||||
splash: true,
|
||||
showSecondary: false,
|
||||
},
|
||||
2: {
|
||||
headline: "Before You Continue",
|
||||
tagline: "",
|
||||
body: "This software provides a custom user interface and functionality for the Even Realities G2 and G1 smart glasses. It is not created or supported by Even Realities. If this software somehow breaks your headset, this is not Even's fault and is not covered by the hardware's warranty. If this software doesn't break you headset, using this software may void the hardware's warranty anyways, at the sole discretion of Even Realities. This software is beta; don't rely on it for anything critically important." +
|
||||
(global.isIOS ? "\n\niOS / TestFlight privacy\n\n" + IOS_PRIVACY_NOTICE : ""),
|
||||
primaryLabel: "Agree",
|
||||
secondaryLabel: "Back",
|
||||
splash: false,
|
||||
showSecondary: true,
|
||||
},
|
||||
3: {
|
||||
headline: "Custom Firmware Required",
|
||||
tagline: "",
|
||||
body: "Faceclaw only runs on Even Realities G2 or G1 glasses that have Faceclaw's custom firmware installed. You have two choices:\n\n• Preview Only — explore Faceclaw's interface on your phone's screen without pairing any glasses. Nothing is written to a headset.\n\n• Flash Firmware — install the custom firmware on your glasses now, then use Faceclaw for real.\n\nFlashing replaces the official firmware. On a G2 you can uninstall and return to the official firmware later, by reconnecting the official Even Realities app; on a G1 that takes a computer. Installing custom firmware is not covered by warranty.",
|
||||
primaryLabel: "Flash Firmware",
|
||||
secondaryLabel: "Preview Only",
|
||||
splash: false,
|
||||
showSecondary: true,
|
||||
},
|
||||
type Makers = { product: string; maker: string; makerPossessive: string };
|
||||
|
||||
const GLASSES_MAKER: Record<GlassesType, Makers> = {
|
||||
g1: { product: "Even Realities G1", maker: "Even Realities", makerPossessive: "Even's" },
|
||||
g2: { product: "Even Realities G2", maker: "Even Realities", makerPossessive: "Even's" },
|
||||
"rayneo-io": { product: "RayNeo iO", maker: "RayNeo", makerPossessive: "RayNeo's" },
|
||||
};
|
||||
|
||||
/** Preview Only: no particular glasses yet, so the disclaimer covers every kind Faceclaw supports. */
|
||||
const ANY_GLASSES_MAKER: Makers = { product: "Even Realities G1 and G2 and RayNeo iO", maker: "Even Realities or RayNeo", makerPossessive: "their" };
|
||||
|
||||
const WARRANTY_NOTE = "Installing custom firmware is not covered by warranty.";
|
||||
// Preview Only is chosen on Your Devices, which is three pages back from here.
|
||||
const PREVIEW_HINT = "Not ready? Go back to Your Devices and choose Preview Only to explore Faceclaw on your phone's screen instead.";
|
||||
|
||||
function firmwareBody(glasses: GlassesType): string {
|
||||
// Pairing skips the firmware pages for an iO: the app has no flasher for it.
|
||||
if (glasses === "rayneo-io") {
|
||||
return `Faceclaw only runs on a RayNeo iO that has Faceclaw's custom firmware installed. This app can't install it on an iO, so that has to be done separately before you pair your glasses. ${WARRANTY_NOTE}\n\n${PREVIEW_HINT}`;
|
||||
}
|
||||
const restore = glasses === "g1"
|
||||
? "Returning to the official firmware later takes a computer."
|
||||
: "You can uninstall and return to the official firmware later, by reconnecting the official Even Realities app.";
|
||||
return `Faceclaw only runs on ${GLASSES_MAKER[glasses].product} glasses that have Faceclaw's custom firmware installed. Next, Faceclaw will pair with your glasses, check their firmware, and install the custom firmware if it isn't there yet.\n\nFlashing replaces the official firmware. ${restore} ${WARRANTY_NOTE}\n\n${PREVIEW_HINT}`;
|
||||
}
|
||||
|
||||
function stepContent(step: OnboardingStep, glasses: GlassesType, previewOnly: boolean): StepContent {
|
||||
const { product, maker, makerPossessive } = previewOnly ? ANY_GLASSES_MAKER : GLASSES_MAKER[glasses];
|
||||
switch (step) {
|
||||
case 1:
|
||||
return {
|
||||
headline: "Faceclaw",
|
||||
tagline: "Perching on the faces of giants",
|
||||
body: "",
|
||||
primaryLabel: "Next",
|
||||
secondaryLabel: "",
|
||||
splash: true,
|
||||
showSecondary: false,
|
||||
};
|
||||
case 2:
|
||||
return {
|
||||
headline: "Before You Continue",
|
||||
tagline: "",
|
||||
body: `This software provides a custom user interface and functionality for the ${product} smart glasses. It is not created or supported by ${maker}. If this software somehow breaks your headset, this is not ${makerPossessive} fault and is not covered by the hardware's warranty. If this software doesn't break your headset, using this software may void the hardware's warranty anyways, at the sole discretion of ${maker}. This software is beta; don't rely on it for anything critically important.` +
|
||||
(global.isIOS ? "\n\niOS / TestFlight privacy\n\n" + IOS_PRIVACY_NOTICE : ""),
|
||||
primaryLabel: "Agree",
|
||||
secondaryLabel: "Back",
|
||||
splash: false,
|
||||
showSecondary: true,
|
||||
};
|
||||
case 3:
|
||||
return {
|
||||
headline: "Custom Firmware Required",
|
||||
tagline: "",
|
||||
body: firmwareBody(glasses),
|
||||
primaryLabel: glasses === "rayneo-io" ? "Pair Glasses" : "Flash Firmware",
|
||||
secondaryLabel: "Back",
|
||||
splash: false,
|
||||
showSecondary: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class OnboardingViewModel extends Observable {
|
||||
private _step: OnboardingStep = 1;
|
||||
private readonly step: OnboardingStep;
|
||||
private readonly content: StepContent;
|
||||
|
||||
constructor(initialStep?: number) {
|
||||
super();
|
||||
if (initialStep === 2 || initialStep === 3) this._step = initialStep;
|
||||
this.publish();
|
||||
this.step = initialStep === 2 || initialStep === 3 ? initialStep : 1;
|
||||
this.content = stepContent(this.step, glassesTypeSetting.get(), isPreviewOnlyMode());
|
||||
}
|
||||
|
||||
onPrimaryTap(): void {
|
||||
if (this._step === 1) {
|
||||
this.setStep(2);
|
||||
if (this.step === 1) {
|
||||
Frame.topmost()?.navigate({ moduleName: "phone-ui/onboarding-devices-page" });
|
||||
return;
|
||||
}
|
||||
if (this._step === 2) {
|
||||
if (this.step === 2) {
|
||||
// The Permissions screen sits between the disclaimer and the firmware
|
||||
// step; it navigates forward to a fresh onboarding page at step 3.
|
||||
Frame.topmost()?.navigate({
|
||||
@@ -93,49 +127,47 @@ export class OnboardingViewModel extends Observable {
|
||||
});
|
||||
}
|
||||
|
||||
/** Back, on the disclaimer and firmware steps. */
|
||||
onSecondaryTap(): void {
|
||||
if (this._step === 2) {
|
||||
this.setStep(1);
|
||||
const frame = Frame.topmost();
|
||||
if (frame?.canGoBack()) {
|
||||
frame.goBack();
|
||||
return;
|
||||
}
|
||||
if (this._step === 3) {
|
||||
// Step 3 secondary: skip flashing, use the on-phone preview only.
|
||||
setPreviewOnlyMode(true);
|
||||
setOnboardingCompleted(true);
|
||||
finishOnboardingNavigation();
|
||||
}
|
||||
// The disconnect page's Back can open step 3 on a fresh history.
|
||||
frame?.navigate({ moduleName: "phone-ui/onboarding-devices-page", clearHistory: true });
|
||||
}
|
||||
|
||||
get headline(): string {
|
||||
return STEP_CONTENT[this._step].headline;
|
||||
return this.content.headline;
|
||||
}
|
||||
|
||||
get tagline(): string {
|
||||
return STEP_CONTENT[this._step].tagline;
|
||||
return this.content.tagline;
|
||||
}
|
||||
|
||||
get body(): string {
|
||||
return STEP_CONTENT[this._step].body;
|
||||
return this.content.body;
|
||||
}
|
||||
|
||||
get primaryLabel(): string {
|
||||
return STEP_CONTENT[this._step].primaryLabel;
|
||||
return this.content.primaryLabel;
|
||||
}
|
||||
|
||||
get secondaryLabel(): string {
|
||||
return STEP_CONTENT[this._step].secondaryLabel;
|
||||
return this.content.secondaryLabel;
|
||||
}
|
||||
|
||||
get showSecondary(): boolean {
|
||||
return STEP_CONTENT[this._step].showSecondary;
|
||||
return this.content.showSecondary;
|
||||
}
|
||||
|
||||
get splashVisibility(): "visible" | "collapse" {
|
||||
return STEP_CONTENT[this._step].splash ? "visible" : "collapse";
|
||||
return this.content.splash ? "visible" : "collapse";
|
||||
}
|
||||
|
||||
get contentVisibility(): "visible" | "collapse" {
|
||||
return STEP_CONTENT[this._step].splash ? "collapse" : "visible";
|
||||
return this.content.splash ? "collapse" : "visible";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,25 +185,6 @@ export class OnboardingViewModel extends Observable {
|
||||
|
||||
/** License and privacy-policy links, shown only under the disclaimer step. */
|
||||
get footerVisibility(): "visible" | "collapse" {
|
||||
return this._step === 2 ? "visible" : "collapse";
|
||||
}
|
||||
|
||||
private setStep(step: OnboardingStep): void {
|
||||
if (this._step === step) return;
|
||||
this._step = step;
|
||||
this.publish();
|
||||
}
|
||||
|
||||
private publish(): void {
|
||||
this.notifyPropertyChange("headline", this.headline);
|
||||
this.notifyPropertyChange("tagline", this.tagline);
|
||||
this.notifyPropertyChange("body", this.body);
|
||||
this.notifyPropertyChange("primaryLabel", this.primaryLabel);
|
||||
this.notifyPropertyChange("secondaryLabel", this.secondaryLabel);
|
||||
this.notifyPropertyChange("showSecondary", this.showSecondary);
|
||||
this.notifyPropertyChange("splashVisibility", this.splashVisibility);
|
||||
this.notifyPropertyChange("contentVisibility", this.contentVisibility);
|
||||
this.notifyPropertyChange("secondaryVisibility", this.secondaryVisibility);
|
||||
this.notifyPropertyChange("footerVisibility", this.footerVisibility);
|
||||
return this.step === 2 ? "visible" : "collapse";
|
||||
}
|
||||
}
|
||||
@@ -45,29 +45,31 @@
|
||||
</Repeater.itemTemplate>
|
||||
</Repeater>
|
||||
|
||||
<Label text="Ring (optional)" class="h2 pairing-section m-t-16" />
|
||||
<Label text="{{ emptyRingMessage }}" class="pairing-empty" textWrap="true" visibility="{{ emptyRingVisibility }}" />
|
||||
<Repeater items="{{ ringRows }}">
|
||||
<Repeater.itemsLayout>
|
||||
<StackLayout />
|
||||
</Repeater.itemsLayout>
|
||||
<Repeater.itemTemplate>
|
||||
<GridLayout columns="84,*,auto" rows="auto" class="{{ rowClass }}" tap="{{ onRowTap }}">
|
||||
<Image col="0" src="{{ imagePath }}" stretch="aspectFit" width="56" height="30" class="pairing-art" />
|
||||
<StackLayout col="1" class="m-l-8">
|
||||
<GridLayout columns="auto,auto">
|
||||
<Label col="0" text="{{ modelTitle }}" class="pairing-title" />
|
||||
<Label col="1" text="{{ badge }}" class="pairing-badge m-l-6" visibility="{{ badgeVisibility }}" />
|
||||
</GridLayout>
|
||||
<Label text="{{ proximityLine }}" class="{{ proximityClass }}" />
|
||||
<Label text="{{ deviceName }}" class="pairing-serial" />
|
||||
<Label text="{{ armsSummary }}" class="pairing-arms" textWrap="true" visibility="{{ armsVisibility }}" />
|
||||
<Label text="{{ warning }}" class="pairing-warning" textWrap="true" visibility="{{ warningVisibility }}" />
|
||||
</StackLayout>
|
||||
<Label col="2" text="{{ chevron }}" class="pairing-chevron" verticalAlignment="center" />
|
||||
</GridLayout>
|
||||
</Repeater.itemTemplate>
|
||||
</Repeater>
|
||||
<StackLayout visibility="{{ ringSectionVisibility }}">
|
||||
<Label text="Ring (optional)" class="h2 pairing-section m-t-16" />
|
||||
<Label text="{{ emptyRingMessage }}" class="pairing-empty" textWrap="true" visibility="{{ emptyRingVisibility }}" />
|
||||
<Repeater items="{{ ringRows }}">
|
||||
<Repeater.itemsLayout>
|
||||
<StackLayout />
|
||||
</Repeater.itemsLayout>
|
||||
<Repeater.itemTemplate>
|
||||
<GridLayout columns="84,*,auto" rows="auto" class="{{ rowClass }}" tap="{{ onRowTap }}">
|
||||
<Image col="0" src="{{ imagePath }}" stretch="aspectFit" width="56" height="30" class="pairing-art" />
|
||||
<StackLayout col="1" class="m-l-8">
|
||||
<GridLayout columns="auto,auto">
|
||||
<Label col="0" text="{{ modelTitle }}" class="pairing-title" />
|
||||
<Label col="1" text="{{ badge }}" class="pairing-badge m-l-6" visibility="{{ badgeVisibility }}" />
|
||||
</GridLayout>
|
||||
<Label text="{{ proximityLine }}" class="{{ proximityClass }}" />
|
||||
<Label text="{{ deviceName }}" class="pairing-serial" />
|
||||
<Label text="{{ armsSummary }}" class="pairing-arms" textWrap="true" visibility="{{ armsVisibility }}" />
|
||||
<Label text="{{ warning }}" class="pairing-warning" textWrap="true" visibility="{{ warningVisibility }}" />
|
||||
</StackLayout>
|
||||
<Label col="2" text="{{ chevron }}" class="pairing-chevron" verticalAlignment="center" />
|
||||
</GridLayout>
|
||||
</Repeater.itemTemplate>
|
||||
</Repeater>
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout class="pairing-selection m-t-16" visibility="{{ selectionVisibility }}">
|
||||
<Label text="Selected" class="h2 pairing-section" />
|
||||
|
||||
@@ -17,9 +17,9 @@ import {
|
||||
type RayNeoCandidate,
|
||||
type RingCandidate,
|
||||
} from "../g2/pairing-candidates";
|
||||
import { glassesTypeSetting } from "../ui/dashboard-settings";
|
||||
import { glassesTypeSetting, type GlassesType } from "../ui/dashboard-settings";
|
||||
import { DeviceDiscoveryBridge } from "../native/device-discovery";
|
||||
import { setPreviewOnlyMode } from "./onboarding-state";
|
||||
import { hasCompletedOnboarding, ownsRing, setPreviewOnlyMode } from "./onboarding-state";
|
||||
|
||||
/** One Repeater row: the presentation plus the display-only fields the XML binds. */
|
||||
export type PairingRowItem = PairingRowPresentation & {
|
||||
@@ -45,6 +45,12 @@ export type PairingRowItem = PairingRowPresentation & {
|
||||
const REFRESH_INTERVAL_MS = 500;
|
||||
const NO_RESULTS_HINT_AFTER_MS = 10_000;
|
||||
|
||||
const SETUP_GLASSES_NAME: Record<GlassesType, string> = {
|
||||
g1: "G1 glasses",
|
||||
g2: "G2 glasses",
|
||||
"rayneo-io": "RayNeo iO",
|
||||
};
|
||||
|
||||
/**
|
||||
* Live pairing scan. Streams advertisements into a `DiscoveryAggregator`,
|
||||
* re-renders the pair/ring lists at a calm cadence, and saves the chosen
|
||||
@@ -72,10 +78,21 @@ export class PairingViewModel extends Observable {
|
||||
private selectedIo: RayNeoCandidate | null = null;
|
||||
private readonly previouslyPairedSerial: string | null;
|
||||
private readonly previouslyPairedRing: string;
|
||||
/**
|
||||
* The glasses chosen on the Your Devices page, during first-run setup. Null
|
||||
* otherwise: the main menu's "Pair glasses" also comes here with onboarding
|
||||
* set, to pair whatever you've got now, so it offers everything. Only the
|
||||
* wording follows this; any glasses heard are still listed, so a wrong choice
|
||||
* can't strand anyone.
|
||||
*/
|
||||
private readonly setupGlasses: GlassesType | null;
|
||||
private readonly showRings: boolean;
|
||||
|
||||
constructor(options?: { onboarding?: boolean }) {
|
||||
super();
|
||||
this.onboarding = options?.onboarding ?? false;
|
||||
this.setupGlasses = this.onboarding && !hasCompletedOnboarding() ? glassesTypeSetting.get() : null;
|
||||
this.showRings = !this.setupGlasses || ownsRing();
|
||||
this.previouslyPairedSerial = loadPairedGlassesIdentity()?.serial ?? null;
|
||||
this.previouslyPairedRing = loadDeviceAddresses().ring;
|
||||
// A backgrounded phone (Home, screen lock, a call) must not keep the
|
||||
@@ -185,6 +202,14 @@ export class PairingViewModel extends Observable {
|
||||
}
|
||||
|
||||
get instructions(): string {
|
||||
if (this.setupGlasses) {
|
||||
const name = SETUP_GLASSES_NAME[this.setupGlasses];
|
||||
const ready = this.setupGlasses === "g1"
|
||||
? "Put the glasses in their case with the lid open"
|
||||
: "Wear the glasses or take them out of the case";
|
||||
return `Select your ${name}${this.showRings ? " and your R1 ring" : ""} below. ${ready}, and keep them near your phone. ` +
|
||||
"If they are not detected, make sure no other apps are connected.";
|
||||
}
|
||||
return (
|
||||
"Select your G2 or G1 glasses or RayNeo iO, and your R1 ring if you have one, below. Wear the glasses or take them out of the case " +
|
||||
"(a G1 pairs only in its case, with the lid open), and keep the glasses and phone nearby. If your glasses are not detected, " +
|
||||
@@ -240,11 +265,15 @@ export class PairingViewModel extends Observable {
|
||||
const elapsed = Date.now() - this.startedAtMs;
|
||||
if (elapsed < NO_RESULTS_HINT_AFTER_MS) return "Listening for glasses…";
|
||||
return (
|
||||
"No glasses heard yet. Make sure they are out of the case and not connected to another app. " +
|
||||
`No glasses heard yet. Make sure they are ${this.setupGlasses === "g1" ? "in their case with the lid open" : "out of the case"} and not connected to another app. ` +
|
||||
"On Android 11 and older, Location must also be switched on for Bluetooth scanning to return results."
|
||||
);
|
||||
}
|
||||
|
||||
get ringSectionVisibility(): "visible" | "collapse" {
|
||||
return this.showRings ? "visible" : "collapse";
|
||||
}
|
||||
|
||||
get emptyRingVisibility(): "visible" | "collapse" {
|
||||
return this._ringRows.length ? "collapse" : "visible";
|
||||
}
|
||||
@@ -429,7 +458,7 @@ export class PairingViewModel extends Observable {
|
||||
private refresh(): void {
|
||||
this.aggregator.prune(Date.now(), DEFAULT_STALE_AFTER_MS);
|
||||
const pairs = this.aggregator.pairs();
|
||||
const rings = this.aggregator.rings();
|
||||
const rings = this.showRings ? this.aggregator.rings() : [];
|
||||
const rayneos = this.aggregator.rayneos();
|
||||
if (this.selectedIo) {
|
||||
this.selectedIo = rayneos.find((candidate) => candidate.id === this.selectedIo!.id) ?? null;
|
||||
|
||||
@@ -16,6 +16,8 @@ import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } fro
|
||||
import { hasAllFilesAccess, requestAllFilesAccess } from "../native/file-access";
|
||||
import { isNotificationListenerEnabled, requestNotificationListenerAccess } from "../native/notification-access";
|
||||
import { mediaControllerBridge } from "../native/media-controller";
|
||||
import { finishOnboardingNavigation } from "./onboarding-navigation";
|
||||
import { isPreviewOnlyMode, setOnboardingCompleted } from "./onboarding-state";
|
||||
|
||||
type PermissionDefinition = {
|
||||
id: string;
|
||||
@@ -228,6 +230,13 @@ export class PermissionsViewModel extends Observable {
|
||||
});
|
||||
if (!proceed) return;
|
||||
}
|
||||
if (isPreviewOnlyMode()) {
|
||||
// Preview Only was chosen on Your Devices: with no glasses to set up,
|
||||
// this is the last page.
|
||||
setOnboardingCompleted(true);
|
||||
finishOnboardingNavigation();
|
||||
return;
|
||||
}
|
||||
// Continue the onboarding chain at the Custom Firmware Required step.
|
||||
Frame.topmost()?.navigate({
|
||||
moduleName: "phone-ui/onboarding-page",
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs'), vm = require('node:vm'), ts = require('typescript');
|
||||
|
||||
function load(file, modules, globals) {
|
||||
const context = { exports: {}, require: name => {
|
||||
if (!(name in modules)) throw new Error(`Missing mock: ${name} in ${file}`);
|
||||
return modules[name];
|
||||
}, setInterval, clearInterval, Date, ...globals };
|
||||
vm.runInNewContext(ts.transpileModule(fs.readFileSync(file, 'utf8'), {
|
||||
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
||||
}).outputText, context);
|
||||
return context.exports;
|
||||
}
|
||||
|
||||
function fixture({ glasses = 'g2', ios = false, completed = false, ring = false, watch = false, previewOnly = false } = {}) {
|
||||
const state = { glasses, ring, watch, navigations: [], backs: 0, previewOnly, completed };
|
||||
const frame = { navigate: entry => state.navigations.push(entry), goBack: () => { state.backs++; }, canGoBack: () => true, backStack: [] };
|
||||
class Observable { notifyPropertyChange() {} }
|
||||
const core = {
|
||||
Observable, Frame: { topmost: () => frame }, Screen: { mainScreen: { heightDIPs: 800, widthDIPs: 400 } },
|
||||
Application: { on() {}, off() {}, suspendEvent: 'suspend', resumeEvent: 'resume' },
|
||||
};
|
||||
const onboardingState = {
|
||||
hasCompletedOnboarding: () => state.completed,
|
||||
setOnboardingCompleted: value => { state.completed = value; },
|
||||
isPreviewOnlyMode: () => state.previewOnly, setPreviewOnlyMode: value => { state.previewOnly = value; },
|
||||
ownsRing: () => state.ring, setOwnsRing: value => { state.ring = value; },
|
||||
ownsWatch: () => state.watch, setOwnsWatch: value => { state.watch = value; },
|
||||
};
|
||||
const settings = { glassesTypeSetting: { get: () => state.glasses, set: value => { state.glasses = value; } } };
|
||||
const globals = { global: { isIOS: ios, isAndroid: !ios } };
|
||||
const modules = {
|
||||
'@nativescript/core': core, './onboarding-state': onboardingState, '../ui/dashboard-settings': settings,
|
||||
'./onboarding-navigation': { finishOnboardingNavigation: () => state.navigations.push('finish') },
|
||||
'../analytics/privacy-disclosure': { IOS_PRIVACY_NOTICE: 'privacy' },
|
||||
'../native/even-app-conflict': { openEvenAppSettings() {} },
|
||||
'../native/ble-permissions': { ensureBlePermissions: async () => {} },
|
||||
'../g2/device-addresses': {
|
||||
loadDeviceAddresses: () => ({ right: '', left: '', ring: '' }), loadPairedGlassesIdentity: () => null,
|
||||
saveDeviceAddresses() {}, savePairedGlassesIdentity() {},
|
||||
},
|
||||
'../util/format-error': { formatErrorMessage: String },
|
||||
'../g2/pairing-candidates': {
|
||||
DiscoveryAggregator: class { prune() {} pairs() { return []; } rings() { return []; } rayneos() { return []; } clear() {} },
|
||||
DEFAULT_STALE_AFTER_MS: 1, nearestCandidateId: () => null,
|
||||
},
|
||||
'../native/device-discovery': { DeviceDiscoveryBridge: class {} },
|
||||
};
|
||||
// Permission checks: everything granted.
|
||||
const granted = new Proxy({}, { get: () => () => true });
|
||||
for (const name of ['../native/ios-bluetooth', '../g2/android-permissions', '../native/calendar-permissions', '../native/battery-optimization',
|
||||
'../native/file-access', '../native/notification-access']) modules[name] = granted;
|
||||
modules['../native/media-controller'] = { mediaControllerBridge: { hasAccess: () => true } };
|
||||
const loadPage = file => load(`app/phone-ui/${file}.ts`, modules, globals);
|
||||
return { state, loadPage };
|
||||
}
|
||||
|
||||
const rowFor = (model, choice) => model.glassesOptions.find(option => option.choice === choice);
|
||||
const selected = model => model.glassesOptions.filter(option => option.checkVisibility === 'visible').map(option => option.choice).join();
|
||||
const tap = (model, type) => model.onGlassesRowTap({ object: { bindingContext: rowFor(model, type) } });
|
||||
|
||||
test('the devices page sits between the splash and the disclaimer', () => {
|
||||
const { state, loadPage } = fixture();
|
||||
const { OnboardingViewModel } = loadPage('onboarding-view-model');
|
||||
new OnboardingViewModel().onPrimaryTap();
|
||||
assert.equal(state.navigations.pop().moduleName, 'phone-ui/onboarding-devices-page');
|
||||
|
||||
const { OnboardingDevicesViewModel } = loadPage('onboarding-devices-view-model');
|
||||
new OnboardingDevicesViewModel().onNextTap();
|
||||
const next = state.navigations.pop();
|
||||
assert.equal(next.moduleName, 'phone-ui/onboarding-page');
|
||||
assert.equal(next.context.step, 2);
|
||||
const disclaimer = new OnboardingViewModel(next.context.step);
|
||||
assert.equal(disclaimer.headline, 'Before You Continue');
|
||||
|
||||
// Backing out of the disclaimer lands on the devices page, not the splash.
|
||||
disclaimer.onSecondaryTap();
|
||||
assert.equal(state.backs, 1);
|
||||
assert.equal(state.navigations.length, 0);
|
||||
});
|
||||
|
||||
test('iOS registers the devices page, which it cannot resolve otherwise', () => {
|
||||
const source = fs.readFileSync('app/phone-ui/onboarding-register.ios.ts', 'utf8');
|
||||
assert.match(source, /registerModule\('phone-ui\/onboarding-devices-page', /);
|
||||
assert.match(source, /registerModule\('phone-ui\/onboarding-devices-page\.xml', /);
|
||||
});
|
||||
|
||||
test('choosing glasses selects exactly one, and the accessories are stored', () => {
|
||||
const { state, loadPage } = fixture();
|
||||
const { OnboardingDevicesViewModel } = loadPage('onboarding-devices-view-model');
|
||||
const model = new OnboardingDevicesViewModel();
|
||||
assert.equal(model.glassesOptions.map(option => option.choice).join(), 'g1,g2,rayneo-io,preview');
|
||||
assert.equal(selected(model), 'g2');
|
||||
|
||||
tap(model, 'rayneo-io');
|
||||
assert.equal(state.glasses, 'rayneo-io');
|
||||
assert.equal(selected(model), 'rayneo-io');
|
||||
|
||||
assert.equal(model.hasRing, false);
|
||||
model.hasRing = true;
|
||||
model.hasWatch = true;
|
||||
assert.equal(state.ring, true);
|
||||
assert.equal(state.watch, true);
|
||||
assert.equal(new OnboardingDevicesViewModel().hasRing, true);
|
||||
});
|
||||
|
||||
test('the watch follows the platform, and iOS can\'t choose a RayNeo iO', () => {
|
||||
const android = fixture();
|
||||
const onAndroid = new (android.loadPage('onboarding-devices-view-model').OnboardingDevicesViewModel)();
|
||||
assert.equal(onAndroid.watchLabel, 'Wear OS watch');
|
||||
assert.equal(rowFor(onAndroid, 'rayneo-io').noteVisibility, 'collapse');
|
||||
|
||||
const ios = fixture({ ios: true });
|
||||
const onIos = new (ios.loadPage('onboarding-devices-view-model').OnboardingDevicesViewModel)();
|
||||
assert.equal(onIos.watchLabel, 'Apple Watch');
|
||||
assert.equal(rowFor(onIos, 'rayneo-io').noteVisibility, 'visible');
|
||||
tap(onIos, 'rayneo-io');
|
||||
assert.equal(ios.state.glasses, 'g2');
|
||||
});
|
||||
|
||||
test('the disclaimer and firmware steps name only the chosen glasses', () => {
|
||||
const copy = glasses => {
|
||||
const { OnboardingViewModel } = fixture({ glasses }).loadPage('onboarding-view-model');
|
||||
return { disclaimer: new OnboardingViewModel(2), firmware: new OnboardingViewModel(3) };
|
||||
};
|
||||
const g2 = copy('g2'), g1 = copy('g1'), io = copy('rayneo-io');
|
||||
|
||||
assert.match(g2.disclaimer.body, /for the Even Realities G2 smart glasses/);
|
||||
assert.doesNotMatch(g2.disclaimer.body, /G1|RayNeo/);
|
||||
assert.match(g1.disclaimer.body, /for the Even Realities G1 smart glasses/);
|
||||
assert.match(io.disclaimer.body, /for the RayNeo iO smart glasses\. It is not created or supported by RayNeo\./);
|
||||
assert.doesNotMatch(io.disclaimer.body, /Even/);
|
||||
|
||||
assert.match(g2.firmware.body, /reconnecting the official Even Realities app/);
|
||||
assert.doesNotMatch(g2.firmware.body, /computer|G1/);
|
||||
assert.match(g1.firmware.body, /takes a computer/);
|
||||
assert.doesNotMatch(g1.firmware.body, /reconnecting|G2/);
|
||||
assert.equal(g2.firmware.primaryLabel, 'Flash Firmware');
|
||||
assert.equal(g1.firmware.primaryLabel, 'Flash Firmware');
|
||||
// The app has no flasher for an iO.
|
||||
assert.equal(io.firmware.primaryLabel, 'Pair Glasses');
|
||||
assert.doesNotMatch(io.firmware.body, /Flash Firmware|Even/);
|
||||
|
||||
// Preview Only moved to Your Devices: the firmware step only goes forward or back.
|
||||
for (const { firmware } of [g2, g1, io]) {
|
||||
assert.equal(firmware.secondaryLabel, 'Back');
|
||||
assert.doesNotMatch(firmware.body, /two choices/);
|
||||
assert.match(firmware.body, /Go back to Your Devices and choose Preview Only/);
|
||||
}
|
||||
});
|
||||
|
||||
test('Preview Only is a glasses choice that skips the firmware step', () => {
|
||||
const { state, loadPage } = fixture({ glasses: 'rayneo-io' });
|
||||
const { OnboardingDevicesViewModel } = loadPage('onboarding-devices-view-model');
|
||||
const devices = new OnboardingDevicesViewModel();
|
||||
assert.equal(rowFor(devices, 'preview').noteVisibility, 'visible');
|
||||
|
||||
tap(devices, 'preview');
|
||||
assert.equal(state.previewOnly, true);
|
||||
assert.equal(state.glasses, 'rayneo-io');
|
||||
assert.equal(selected(devices), 'preview');
|
||||
assert.equal(selected(new OnboardingDevicesViewModel()), 'preview');
|
||||
|
||||
// The disclaimer can't name glasses nobody chose.
|
||||
const { OnboardingViewModel } = loadPage('onboarding-view-model');
|
||||
assert.match(new OnboardingViewModel(2).body, /for the Even Realities G1 and G2 and RayNeo iO smart glasses\. It is not created or supported by Even Realities or RayNeo\./);
|
||||
|
||||
// Permissions is the last page: onboarding completes there, in preview mode.
|
||||
const { PermissionsViewModel } = loadPage('permissions-view-model');
|
||||
return new PermissionsViewModel({ onboarding: true }).onPrimaryTap().then(async () => {
|
||||
assert.equal(state.completed, true);
|
||||
assert.deepEqual(state.navigations, ['finish']);
|
||||
|
||||
// Choosing glasses again turns preview off, and Permissions leads to the firmware step.
|
||||
state.completed = false;
|
||||
state.navigations.length = 0;
|
||||
tap(devices, 'g1');
|
||||
assert.equal(state.previewOnly, false);
|
||||
assert.equal(state.glasses, 'g1');
|
||||
await new PermissionsViewModel({ onboarding: true }).onPrimaryTap();
|
||||
assert.equal(state.completed, false);
|
||||
assert.equal(state.navigations[0].moduleName, 'phone-ui/onboarding-page');
|
||||
assert.equal(state.navigations[0].context.step, 3);
|
||||
|
||||
// And that step's Back returns to Permissions.
|
||||
new OnboardingViewModel(3).onSecondaryTap();
|
||||
assert.equal(state.backs, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('the disconnect page drops the Even app instructions only when setting up an iO', () => {
|
||||
const page = options => new (fixture(options).loadPage('onboarding-unpair-view-model').OnboardingUnpairViewModel)();
|
||||
const setup = page({ glasses: 'rayneo-io' });
|
||||
assert.equal(setup.evenAppVisibility, 'collapse');
|
||||
assert.equal(setup.settingsButtonVisibility, 'collapse');
|
||||
assert.doesNotMatch(setup.otherAppsInstructions, /Even/);
|
||||
|
||||
for (const options of [{ glasses: 'g2' }, { glasses: 'rayneo-io', completed: true }]) {
|
||||
const model = page(options);
|
||||
assert.equal(model.evenAppVisibility, 'visible');
|
||||
assert.equal(model.settingsButtonVisibility, 'visible');
|
||||
assert.match(model.otherAppsInstructions, /Even Realities/);
|
||||
}
|
||||
});
|
||||
|
||||
test('pairing during setup follows the choices; from the menu it offers everything', () => {
|
||||
const page = (options, onboarding = true) => new (fixture(options).loadPage('pairing-view-model').PairingViewModel)({ onboarding });
|
||||
|
||||
const g1 = page({ glasses: 'g1' });
|
||||
assert.match(g1.instructions, /^Select your G1 glasses below\. Put the glasses in their case with the lid open/);
|
||||
assert.equal(g1.ringSectionVisibility, 'collapse');
|
||||
|
||||
const io = page({ glasses: 'rayneo-io', ring: true });
|
||||
assert.match(io.instructions, /^Select your RayNeo iO and your R1 ring below\. Wear the glasses/);
|
||||
assert.equal(io.ringSectionVisibility, 'visible');
|
||||
|
||||
// Past setup, "Pair glasses" re-enters with onboarding set, including for an
|
||||
// install from before the devices page existed (nothing stored: no ring).
|
||||
for (const model of [page({ glasses: 'g2', completed: true }), page({ glasses: 'g2' }, false)]) {
|
||||
assert.match(model.instructions, /G2 or G1 glasses or RayNeo iO, and your R1 ring if you have one/);
|
||||
assert.equal(model.ringSectionVisibility, 'visible');
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user