The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(mobile): one-button Connect your computer onboarding
tonyc55a67529f79
diff --git a/mobile/integration_test/first_run_journey_test.dart b/mobile/integration_test/first_run_journey_test.dartindex 8e30a6587..4b399430a 100644--- a/mobile/integration_test/first_run_journey_test.dart+++ b/mobile/integration_test/first_run_journey_test.dart@@ -5,8 +5,8 @@ import 'package:integration_test/integration_test.dart';import 'package:harness_mobile/main.dart' as app;/// A first-time user's walk through the real app on a fresh simulator, a screenshot at each-/// step: the welcome, the sample (hints, answering a question, Find, New with a task, the menu),-/// leaving it, and the way in — email, then setting up a computer.+/// step: the welcome, Get it and its sample (hints, answering a question, Find, New with a task,+/// the menu), leaving it, and the way in — Pair computer, then the other ways and email.////// Signed out on a clean install, so nothing here can reach a real account or a real machine: the/// sample is offline by construction (`lib/demo/`).@@ -41,11 +41,14 @@ void main() {}await app.main();- await waitFor(find.text('Is Harness on your computer?'));+ await waitFor(find.text('Connect your computer'));await shot('welcome');- // The sample: no account, no computer.- await tester.longPress(find.byKey(const ValueKey('welcome-wordmark')));+ // The sample, from Get it: no account, no computer.+ await tester.tap(find.byKey(const ValueKey('set-up-get-it')));+ await wait(800);+ await shot('get-it');+ await tester.tap(find.byKey(const ValueKey('get-it-sample')));await wait(2000);// "Pick up where you left off": the sessions, a tap from their terminals.await shot('sample-pick-up');@@ -103,21 +106,21 @@ void main() {await shot('sample-end-card');await tester.tap(find.text('Set up my computer'));await wait(1500);- await shot('set-up-after-sample');+ // Back on Get it, where the sample was opened.+ await shot('get-it-after-sample');await tester.tap(find.bySemanticsLabel('Back'));await wait(800);await shot('back-to-welcome');- // The two ways in: set it up, or scan the code the desktop app shows.- await tester.tap(find.text('Not yet — set it up'));- await wait(800);- await shot('set-up-computer');- await tester.tap(find.bySemanticsLabel('Back'));- await wait(800);- await tester.tap(find.text('Yes — scan to connect'));+ // The way in: Pair computer scans the code the desktop app shows; without one, the camera's+ // "Can’t scan?" has the accounts and email.+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));await wait(1500);await shot('scan-to-connect');- await tester.tap(find.text('Use email instead'));+ await tester.tap(find.text('Can’t scan? Sign in another way'));+ await wait(800);+ await shot('sign-in-other-ways');+ await tester.tap(find.text('Continue with email'));await wait(800);await shot('sign-in-email');});diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dartindex d58752041..6378d3cb5 100644--- a/mobile/lib/phone/machines_tab.dart+++ b/mobile/lib/phone/machines_tab.dart@@ -170,8 +170,8 @@ class _Body extends StatelessWidget {);}- /// The set-up page over this list — downloads, steps, and a scan that pairs — for a computer not- /// on the account yet.+ /// Connect your computer over this list — the download link, the steps, and a scan that pairs —+ /// for a computer not on the account yet.void _setUpComputer(BuildContext context) => unawaited(Navigator.of(context).push(phoneRoute(diff --git a/mobile/lib/phone/phone_sheet.dart b/mobile/lib/phone/phone_sheet.dartindex 2b499b40e..0dbd08190 100644--- a/mobile/lib/phone/phone_sheet.dart+++ b/mobile/lib/phone/phone_sheet.dart@@ -129,9 +129,8 @@ Future<void> showPhoneSheet(}/// The route [showPhoneSheet] pushes, around content of the caller's own — for a sheet that is not-/// a menu of actions (the download menu of "Get Harness for your computer"). Push it on the root-/// navigator; held, it can be taken away again ([NavigatorState.removeRoute]) when the page that-/// opened it goes.+/// a menu of actions. Push it on the root navigator; held, it can be taken away again+/// ([NavigatorState.removeRoute]) when the page that opened it goes.ModalBottomSheetRoute<T> phoneSheetRoute<T>(BuildContext context, {required WidgetBuilder builder,diff --git a/mobile/lib/phone/tty_controls.dart b/mobile/lib/phone/tty_controls.dartindex 550f44873..837099395 100644--- a/mobile/lib/phone/tty_controls.dart+++ b/mobile/lib/phone/tty_controls.dart@@ -44,10 +44,14 @@ class TtyPrimaryButton extends StatefulWidget {required this.onPressed,this.busy = false,this.busyLabel,+ this.icon,});final String label;+ /// Drawn before [label], in its ink — Pair computer's QR.+ final IconData? icon;+/// Null draws it disabled.final VoidCallback? onPressed;@@ -107,16 +111,29 @@ class _TtyPrimaryButtonState extends State<TtyPrimaryButton> {// One line, as a [TtyText] — but ending in "…" where it does not fit, not cut at the// edge: a busy label names the computer ("Pairing with Tonys-MacBook-Pro.local…"), and// a hostname that long lost its end, and the ellipsis that says it is still working.- child: Text(- widget.busy ? (widget.busyLabel ?? widget.label) : widget.label,- maxLines: 1,- softWrap: false,- overflow: TextOverflow.ellipsis,- style: tty.style(- color: ink,- weight: FontWeight.w600,- size: TtySize.title,- ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (widget.icon case final icon?) ...[+ Icon(icon, size: 20, color: ink),+ const SizedBox(width: 10),+ ],+ Flexible(+ child: Text(+ widget.busy+ ? (widget.busyLabel ?? widget.label)+ : widget.label,+ maxLines: 1,+ softWrap: false,+ overflow: TextOverflow.ellipsis,+ style: tty.style(+ color: ink,+ weight: FontWeight.w600,+ size: TtySize.title,+ ),+ ),+ ),+ ],),),),diff --git a/mobile/lib/phone/welcome/connect_computer.dart b/mobile/lib/phone/welcome/connect_computer.dartindex ccdbe704a..2ea80af37 100644--- a/mobile/lib/phone/welcome/connect_computer.dart+++ b/mobile/lib/phone/welcome/connect_computer.dart@@ -8,34 +8,32 @@ import 'package:flutter/services.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/state/app_state.dart';+import '../phone_navigation.dart' show phoneRoute;import '../settings_page.dart' show PhoneSettingsButton, confirmSignOut;import '../tty.dart';import '../tty_controls.dart';import 'scan_to_connect.dart';import 'set_up_computer.dart';-/// Setting up a computer, for a phone that is signed in — the same page as the first screen's "Not-/// yet" ([SetUpComputerPage]: three steps, the first sending the download to the computer), and the-/// one thing only a signed-in phone can do on it: watch for the computer to appear (every few-/// seconds, since nothing tells the phone) and pair with it by the code its Harness ▸ Add Phone…-/// shows.+/// Connecting a computer, for a phone that is signed in — the same page as the first screen+/// ([SetUpComputerPage], Connect your computer, with Get it behind it), and the one thing only a+/// signed-in phone can do on it: watch for the computer to appear (every few seconds, since nothing+/// tells the phone) and pair with it by the code its Add Phone shows.////// ```-/// Get Harness for ⚙-/// your computer+/// harness▌ ⚙+/// Connect your computer+/// Drive Claude Code and Codex from your phone./// [| Signed in as ada@… Waiting for your computer…]/// Not you? Sign out-///-/// 1 Install Harness on your computer.-/// [⇪ Send it to your computer ›] (the download menu, in a sheet)-/// or open harness.autonomous.ai/desktop there.-/// 2 Open it, and sign in with Google or Apple, as ada@… — the account on this phone.-/// 3 Open Add Phone… and scan its code.-/// On a Mac, it’s in the Harness menu.-/// [Scan to connect]-/// ───-/// Try the sample ›-/// See how it works ▶+/// [ ⊞ Pair computer ]+/// HOW IT WORKS+/// [1] Sign in on your computer+/// With the same account.+/// [2] Not showing up? Scan its code+/// Mac: Harness menu · Linux: Ctrl+Shift+P, “add phone”+/// [3] You’re connected+/// No Harness yet? Get it › (and the sample, while it installs)/// ```////// It replaces a page of its own — an email of the steps, a Terminal/Mac tab, four commands to@@ -49,7 +47,6 @@ class ConnectComputerPage extends StatefulWidget {this.onBack,this.onTrySample,this.scanCamera,- this.loadDownloads,});final AppNotifier notifier;@@ -60,12 +57,11 @@ class ConnectComputerPage extends StatefulWidget {/// Shown as `‹ Back` when set.final VoidCallback? onBack;- /// Opens the sample; see `PhoneWelcome.onTrySample`.+ /// Opens the sample, from Get it; see `PhoneWelcome.onTrySample`.final Future<Object?> Function(BuildContext context)? onTrySample;- /// Stand-ins for the camera and the release manifest, in tests.+ /// Stands in for the camera, in tests.final Widget? scanCamera;- final DesktopDownloadsLoader? loadDownloads;@overrideState<ConnectComputerPage> createState() => _ConnectComputerPageState();@@ -92,12 +88,58 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {}}+ /// Get it, while it is up over this page — see [_openGetIt].+ Route<void>? _getIt;+@overridevoid dispose() {_watch?.cancel();+ // ⚠️ At home this page goes when the computer turns up — the 5-second watch — and Get it, pushed+ // over it, stayed up over the agents. Taken away after this frame: a navigator is not to be+ // changed while the tree is being torn down.+ final getIt = _getIt;+ if (getIt != null) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ final navigator = getIt.navigator;+ if (navigator != null && navigator.mounted && getIt.isActive) {+ navigator.removeRoute(getIt);+ }+ });+ }super.dispose();}+ /// "No Harness on your computer yet? Get it ›": the download sent to the computer, over this+ /// page, and its "Pair computer ›" back to this page's scan. One at a time.+ void _openGetIt() {+ if (_getIt != null) return;+ final route = phoneRoute(+ (page) => Scaffold(+ backgroundColor: Tty.of(page).ground,+ body: SafeArea(+ child: GetHarnessPage(+ onBack: () => Navigator.of(page).maybePop(),+ onPair: () {+ // ⚠️ `pop`, not `maybePop`: that one waits a microtask, sees the camera pushed over+ // Get it meanwhile, and drops the pop — Get it stayed under the camera, and the scan's+ // answer (or Computers' back on success) landed on it instead of this page.+ Navigator.of(page).pop();+ if (mounted) unawaited(_scanToPair());+ },+ // Over Get it, which its end card's "set up" comes back to.+ onTrySample: widget.onTrySample == null+ ? null+ : () => unawaited(widget.onTrySample!(page)),+ ),+ ),+ ),+ );+ _getIt = route;+ unawaited(+ Navigator.of(context).push(route).whenComplete(() => _getIt = null),+ );+ }+void _say(String? message, {bool failed = false}) => setState(() {_scanned = message;_scanFailed = failed;@@ -157,11 +199,7 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {final machineId = code.machineId, pairCode = code.pairCode;if (machineId == null || pairCode == null) {if (!mounted) return;- _say(- 'That isn’t an Add Phone code. Open Add Phone… on the computer and '- 'scan its code.',- failed: true,- );+ _say('That’s not the Add Phone code.', failed: true);return;}if (mounted) _say('Pairing…');@@ -246,11 +284,13 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {child: SetUpComputerPage(onBack: widget.onBack,onScan: () => unawaited(_scanToPair()),- loadDownloads: widget.loadDownloads,+ onGetIt: _openGetIt,// The computer has to join this account, so the steps name it — from Computers too// ("Set up another computer", which does not watch), where a second computer signed in// to another account is likeliest.account: email,+ // At home the account is watched, and the computer turns up here by itself.+ watching: widget.signedIn,// At home there is no back, and this page is where a phone signed in to an account with// no computer stays: Settings — and Sign out — has to be reachable from it.topTrailing: widget.onBack == null@@ -274,44 +314,28 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {? Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- if (widget.signedIn) _Watching(account: email),- // Right under the account it names: the wrong one is the likeliest reason this- // page never moves on — Continue with Google, and another of the person's- // Google accounts.+ if (widget.signedIn) const _Watching(),+ // The account, said once, right under the watch: the wrong one is the+ // likeliest reason this page never moves on — Continue with Google, and+ // another of the person's Google accounts.if (widget.signedIn && email != null)- Align(- alignment: Alignment.centerLeft,- child: Transform.translate(- // The button's own inset, so its words sit on the gutter.- offset: const Offset(-12, 0),- child: TtyTextButton(- key: const ValueKey('connect-sign-out'),- label: 'Not you? Sign out',- color: tty.faint,- onPressed: () => unawaited(- confirmSignOut(context, widget.notifier),- ),- ),- ),+ _AccountLine(+ email: email,+ onSignOut: () =>+ unawaited(confirmSignOut(context, widget.notifier)),),],): null,- onTrySample: widget.onTrySample == null- ? null- : () => unawaited(widget.onTrySample!(context)),),),);}}-/// `Looking for your computer…` with a terminal spinner — the page is watching.+/// `Waiting for your computer…` with a terminal spinner — the page is watching.class _Watching extends StatefulWidget {- const _Watching({this.account});-- /// Whose computer it is waiting for.- final String? account;+ const _Watching();@overrideState<_Watching> createState() => _WatchingState();@@ -352,10 +376,7 @@ class _WatchingState extends State<_Watching> {const SizedBox(width: 10),Expanded(child: Text(- widget.account == null- ? 'Waiting for your computer…'- : 'Signed in as ${widget.account}. Waiting for your '- 'computer…',+ 'Waiting for your computer…',style: tty.style(size: TtySize.meta, color: tty.text),),),@@ -365,6 +386,52 @@ class _WatchingState extends State<_Watching> {}}+/// `[email protected] · Not you? Sign out` — the account this phone is signed in to, and the way out of+/// it, on one line that wraps. The whole line signs out (after asking, [confirmSignOut]).+class _AccountLine extends StatelessWidget {+ const _AccountLine({required this.email, required this.onSignOut});++ final String email;+ final VoidCallback onSignOut;++ @override+ Widget build(BuildContext context) {+ final tty = Tty.of(context);+ return Semantics(+ button: true,+ label: 'Signed in as $email. Not you? Sign out',+ excludeSemantics: true,+ child: GestureDetector(+ key: const ValueKey('connect-sign-out'),+ behavior: HitTestBehavior.opaque,+ onTap: () {+ HapticFeedback.selectionClick();+ onSignOut();+ },+ child: ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 44),+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 10),+ child: Text.rich(+ TextSpan(+ children: [+ TextSpan(text: '$email · '),+ TextSpan(+ text: 'Not you? Sign out',+ style: tty.style(color: tty.text, size: TtySize.meta),+ ),+ ],+ ),+ textAlign: TextAlign.center,+ style: tty.style(color: tty.faint, size: TtySize.meta),+ ),+ ),+ ),+ ),+ );+ }+}+/// What the account said of a scanned computer ([_ConnectComputerPageState._lookUp]).enum _Lookup {/// On the account.diff --git a/mobile/lib/phone/welcome/pairing_with_code.dart b/mobile/lib/phone/welcome/pairing_with_code.dartindex c94598c13..dd4e9078d 100644--- a/mobile/lib/phone/welcome/pairing_with_code.dart+++ b/mobile/lib/phone/welcome/pairing_with_code.dart@@ -78,11 +78,7 @@ class _PairingWithCodeState extends State<PairingWithCode> {if (scanned == null) return;final pairCode = scanned.pairCode;if (scanned.machineId == null || pairCode == null) {- setState(- () => _error =- 'That isn’t an Add Phone code. Open Add Phone… on $name and scan '- 'its code.',- );+ setState(() => _error = 'That’s not the Add Phone code.');return;}if (scanned.machineId != widget.machineId) {diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dartindex e736063d5..9d67ceaae 100644--- a/mobile/lib/phone/welcome/phone_welcome.dart+++ b/mobile/lib/phone/welcome/phone_welcome.dart@@ -9,6 +9,7 @@ import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/state/app_state.dart';import '../exit_app.dart';+import '../phone_sheet.dart' show phoneSheetRoute;import '../tty.dart';import '../tty_controls.dart';import 'connect_code.dart';@@ -16,42 +17,30 @@ import 'scan_to_connect.dart';import 'set_up_computer.dart';import 'sign_in_provider_button.dart';-/// The phone's first screen, signed out: what Harness is in one breath, one question anyone can-/// answer — is Harness on your computer? — and the account, for whoever would rather start there.+/// The phone's first screen, signed out: Connect your computer ([SetUpComputerPage]) — one button,+/// Pair computer, and Get it for somebody with no Harness on the computer yet ([GetHarnessPage]).////// ```/// harness▌-///-/// Claude Code and Codex-/// run on your computer.-/// Drive them from here.-///-/// Is Harness on your computer?-/// ┌──────────────────────────────┐-/// │ Yes — scan to connect › │-/// └──────────────────────────────┘-/// ┌──────────────────────────────┐-/// │ Not yet — set it up › │-/// └──────────────────────────────┘-/// ──────── or sign in with ────────-/// ┌──────────────────────────────┐-/// │ G Continue with Google │-/// └──────────────────────────────┘-/// ┌──────────────────────────────┐-/// │ Continue with Apple │-/// └──────────────────────────────┘+/// Connect your computer+/// [ ⊞ Pair computer ] → the camera → Can’t scan? Sign in another way (a sheet)+/// HOW IT WORKS 1 Open Add Phone… 2 Scan its code 3 You’re connected+/// No Harness yet? Get it › → Get it → Installed? Pair computer ›+/// Try the sample while you wait/// ```///-/// **Yes** scans the code the desktop app shows ([ScanToConnectPage]), and the scan signs the phone-/// in: the QR carries a one-time code the computer's own sign-in minted+/// **Pair computer** scans the code the desktop app shows ([ScanToConnectPage]), and the scan signs+/// the phone in: the QR carries a one-time code the computer's own sign-in minted/// ([AppNotifier.signInWithScan]). A QR without one — an older computer — or one that has expired/// names the account instead: the email is filled in and its code sent, so signing in is the four-/// digits (`viewer/email_code_api.dart`, no browser). **Not yet** gets Harness onto the computer ([SetUpComputerPage]). Both-/// buttons weigh the same: the question decides, not us.+/// digits (`viewer/email_code_api.dart`, no browser).///-/// Under them, the two accounts the desktop and web sign in with ([SignInProviderButton]): the-/// SSO page opens in the app on that account ([AppNotifier.signInWithProvider]). Nothing else is-/// on the screen — no pretend agents, no diagram — for someone who has never seen Harness.+/// The accounts — Google, Apple, an emailed code — are in a sheet behind the camera's "Can’t scan?"+/// ([_OtherWaysSheet]): the way in for a computer with only the command line, which shows no code,+/// or a phone that cannot scan — found out there, at the camera, not from a gear on the first screen+/// that read as Settings (owner, 2026-10-09). ⚠️ They used to share the first screen with "Is+/// Harness on your computer? Yes / Not yet": six ways on before anything was explained (owner,+/// 2026-10-08).class PhoneWelcome extends StatefulWidget {const PhoneWelcome({super.key,@@ -61,12 +50,8 @@ class PhoneWelcome extends StatefulWidget {this.signIn,this.signInWithScan,this.scanCamera,- this.loadDownloads,});- /// Stands in for the desktop release manifest on the set-up page, in tests and renders.- final DesktopDownloadsLoader? loadDownloads;-/// Stands in for the camera on the scan page, in tests and renders. Null opens the real one.final Widget? scanCamera;@@ -85,8 +70,9 @@ class PhoneWelcome extends StatefulWidget {State<PhoneWelcome> createState() => _PhoneWelcomeState();}-/// [signInFirst]: a computer's own sign-in QR was scanned — see [_SignInFirst].-enum _Step { hello, setUp, scan, signInFirst, email, code }+/// [getIt]: Harness onto the computer ([GetHarnessPage]). [signInFirst]: a computer's own sign-in+/// QR was scanned — see [_SignInPage].+enum _Step { hello, getIt, scan, signInFirst, email, code }class _PhoneWelcomeState extends State<PhoneWelcome> {_Step _step = _Step.hello;@@ -100,23 +86,16 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// Between a scan and the session it signs in: the scan page says so.bool _signingInWithScan = false;- /// The code step was reached from a scan that could not sign the phone in by itself- /// ([_emailCodeFromScan]): the step says why an email is in the way. Kept on the code step only.- bool _codeFromScan = false;-- /// Where the camera was opened from — the first screen's "Yes", or "Scan to connect" on the- /// set-up page — and so where back from it goes ([_backFrom]). Back from the camera always went- /// to the first screen, and somebody who had stepped over from set-up — the steps they were- /// following on it — had to find their way back to them.+ /// Where the camera was opened from — Pair computer on the first screen, or on Get it — and so+ /// where back from it goes ([_backFrom])._Step _scanFrom = _Step.hello;- /// The scan page's step 1, ahead of opening Add Phone… — a step, not a note under the hint: a- /// desktop app opens signed out (its guest mode), and its Add Phone then shows no code, only- /// "Sign in to add your phone." beside a Sign in… button. Google or Apple by name: the sign-in's- /// third way, "Scan with your phone", needs a phone already signed in. Two lines at most — it- /// shares the page with the camera.- static const _signInThereFirst =- 'On your computer, sign in to Harness with Google or Apple.';+ /// Where the email was chosen from — the other ways' sheet over the first screen or the camera,+ /// or a scan that could not sign in by itself — and so where back from it goes.+ _Step _emailFrom = _Step.hello;++ /// The other ways to sign in, while their sheet is up — see [_openOtherWays].+ ModalBottomSheetRoute<void>? _otherWays;String? _error;int _resendIn = 0;@@ -127,6 +106,18 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {@overridevoid dispose() {+ // ⚠️ **The sheet can outlive the page.** Signed in from it, the app swaps this page for home,+ // and the sheet — the root navigator's — stayed up over the agents. Taken away after this frame:+ // a navigator is not to be changed while the tree is being torn down.+ final sheet = _otherWays;+ if (sheet != null) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ final navigator = sheet.navigator;+ if (navigator != null && navigator.mounted && sheet.isActive) {+ navigator.removeRoute(sheet);+ }+ });+ }_resendTimer?.cancel();_email.dispose();_code.dispose();@@ -135,27 +126,41 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {super.dispose();}- /// The offline sample, offered on welcome and setup. Its end card can lead to setup.+ /// The offline sample, offered on Get it while the computer installs. Its end card leads back.Future<void> _trySample() async {final result = await widget.onTrySample!(context);if (!mounted || result != 'set-up') return;- _go(_Step.setUp);+ _go(_Step.getIt);}/// A code the desktop app showed. Its pairing code is held until its computer shows up, when the/// phone pairs with it instead of asking for a password (`AppNotifier.pendingPairing`). Its/// sign-in code signs the phone in there and then; without one, or when it has expired, the/// account's email is filled in and a code sent, so signing in is the four digits.+ ///+ /// ⚠️ **Read under the other ways' sheet too.** The camera runs on beneath it, so a computer in+ /// frame is read while Google's page may be waited on: the scan wins — the sheet goes, the account's+ /// page is let go of and waited out ([_signInFree]) — or [AppNotifier.signInWithScan], which does+ /// nothing while another sign-in is under way, dropped the code without a word, and the camera,+ /// which reads one code, read nothing more.Future<void> _onScanned(ConnectCode code) async {+ _closeOtherWays();final machineId = code.machineId, pairCode = code.pairCode;if (machineId != null && pairCode != null) {widget.notifier.pendingPairing = (machineId: machineId, code: pairCode);}_email.text = code.email;+ // Past the account's page and its exchange, that sign-in is going in: the code's computer is held+ // for it ([AppNotifier.pendingPairing]), and that is all there is left to do with the scan.+ if (_entering) return;final signIn = code.signIn;if (signIn != null) {setState(() => _signingInWithScan = true);try {+ if (!await _signInFree()) {+ throw StateError('Another sign-in is under way');+ }+ if (!mounted) return;await (widget.signInWithScan ?? widget.notifier.signInWithScan)(signIn);return;} catch (_) {@@ -171,16 +176,14 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// The scan could not sign the phone in by itself — an older computer's QR has no sign-in code,/// and one that has may be spent or expired — so the email in it is sent a code instead.///- /// Said on the code step ([_codeFromScan]): somebody who pointed the camera at a computer and- /// landed on "Check your email" was never told why. And when even the email cannot go — the- /// address in the QR does not pass, the network is down — the email step takes over, with the- /// reason under its field and the address there to correct. ⚠️ Left on the scan page, as it used+ /// The code step says only where the code went (owner, 2026-10-08: little text). And when even the+ /// email cannot go — the address in the QR does not pass, the network is down — the email step+ /// takes over, with the reason under its field and the address there to correct. ⚠️ Left on the scan page, as it used/// to be, the failure was said nowhere (that page shows no errors) and its camera, which stops/// reading after one code, read nothing more: a screen that looked alive and did nothing.Future<void> _emailCodeFromScan() async {// Gone from the camera while the scan's own sign-in was tried: the person chose another way.if (_step != _Step.scan) return;- _codeFromScan = true;// The scan page goes on saying "Signing in…" while the code is sent — it is the same sign-in,// and the page's own title back for that second read as the scan having been dropped.setState(() => _signingInWithScan = true);@@ -209,25 +212,28 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// it happened on.void _go(_Step step, {String? error}) {// Leaving for another way in takes the account's page with it: whatever it came back with- // would sign the phone in behind the step the person chose instead. Any step that is left — two- // of them offer the accounts now, the first screen and [_SignInFirst].+ // would sign the phone in behind the step the person chose instead. Any step that is left — the+ // accounts are offered over the first screen and the camera ([_OtherWaysSheet]) and on+ // [_SignInPage].if (step != _step) widget.notifier.cancelProviderSignIn();// A computer's sign-in code is held only on the way to the sign-in it asked for — its own step,- // and the email and code it may send the person to. Back at the start, at set-up or at the+ // and the email and code it may send the person to. Back at the start, at Get it or at the// camera, it is let go: a sign-in from there must not end in a computer to approve.- if (step == _Step.hello || step == _Step.setUp || step == _Step.scan) {+ if (step == _Step.hello || step == _Step.getIt || step == _Step.scan) {widget.notifier.pendingComputerSignIn = null;}- // Only a step that opens the camera says where it was opened from: back from the computer's- // own sign-in step ([_SignInFirst]) returns to the camera, which still goes back where it was- // first opened from.- if (step == _Step.scan && (_step == _Step.hello || _step == _Step.setUp)) {+ // Where the camera and the email were opened from is where back from them goes. Back from the+ // computer's own sign-in step ([_SignInPage]) returns to the camera, which still goes back where+ // it was first opened from.+ if (step == _Step.scan && (_step == _Step.hello || _step == _Step.getIt)) {_scanFrom = _step;}+ if (step == _Step.email && (_step == _Step.hello || _step == _Step.scan)) {+ _emailFrom = _step;+ }setState(() {_step = step;_error = error;- if (step != _Step.code) _codeFromScan = false;});if (step == _Step.email) _emailFocus.requestFocus();if (step == _Step.code) _codeFocus.requestFocus();@@ -313,7 +319,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// Where back goes from [step] — the system's back and each page's own `‹ Back` alike._Step _backFrom(_Step step) => switch (step) {_Step.code => _Step.email,- _Step.email when _forComputer => _Step.signInFirst,+ _Step.email => _forComputer ? _Step.signInFirst : _emailFrom,_Step.signInFirst => _Step.scan,_Step.scan => _scanFrom,_ => _Step.hello,@@ -322,6 +328,85 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// A computer's sign-in code is waiting on this sign-in ([AppNotifier.pendingComputerSignIn]).bool get _forComputer => widget.notifier.pendingComputerSignIn != null;+ /// An account's sign-in is past its page and the exchange: the phone is going in, and there is+ /// nothing left to cancel.+ bool get _entering =>+ widget.notifier.signingIn &&+ widget.notifier.status == AppStatus.bootstrapping;++ /// Waits, briefly, for a sign-in already under way to let go — an account's page just cancelled —+ /// so the scan's own finds the way clear. False when it did not.+ Future<bool> _signInFree() async {+ final notifier = widget.notifier;+ if (!notifier.signingIn) return true;+ final free = Completer<void>();+ void check() {+ if (!notifier.signingIn && !free.isCompleted) free.complete();+ }++ notifier.addListener(check);+ try {+ await free.future.timeout(const Duration(seconds: 3));+ return true;+ } on TimeoutException {+ return false;+ } finally {+ notifier.removeListener(check);+ }+ }++ /// Takes the other ways' sheet down when a code read under it starts a sign-in of its own, and+ /// lets go of an account's page still waited on in it.+ void _closeOtherWays() {+ final sheet = _otherWays;+ if (sheet == null) return;+ final navigator = sheet.navigator;+ if (navigator != null && navigator.mounted && sheet.isActive) {+ if (sheet.isCurrent) {+ navigator.pop();+ } else {+ navigator.removeRoute(sheet);+ }+ }+ _otherWays = null;+ if (widget.notifier.signInProvider != null && !_entering) {+ widget.notifier.cancelProviderSignIn();+ }+ }++ /// The other ways to sign in — Google, Apple, an emailed code — in a sheet over the camera, from+ /// its "Can’t scan?". One at a time.+ Future<void> _openOtherWays() async {+ if (_otherWays != null) return;+ final notifier = widget.notifier;+ final sheet = phoneSheetRoute<void>(+ context,+ builder: (sheetContext) => SafeArea(+ child: _OtherWaysSheet(+ notifier: notifier,+ onEmail: () {+ Navigator.of(sheetContext).pop();+ _go(_Step.email);+ },+ ),+ ),+ );+ _otherWays = sheet;+ try {+ await Navigator.of(context, rootNavigator: true).push(sheet);+ } finally {+ // Only its own: taken down by [_closeOtherWays], a sheet opened since may be the one up now.+ if (identical(_otherWays, sheet)) _otherWays = null;+ }+ // Put away while an account's page was up: that sign-in goes with it, as it does when any+ // step is left ([_go]). Past the page, the phone is already going in and there is nothing to+ // cancel. Not when another sheet is up by now — its page is that one's.+ if (!mounted || _otherWays != null || notifier.signInProvider == null) {+ return;+ }+ if (!_entering) notifier.cancelProviderSignIn();+ }+@overrideWidget build(BuildContext context) {AppTheme.watch(context);@@ -350,26 +435,20 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {backgroundColor: tty.ground,body: SafeArea(child: switch (_step) {- _Step.hello => _Hello(+ _Step.hello => SetUpComputerPage(onScan: () => _go(_Step.scan),- onSetUp: () => _go(_Step.setUp),- onSample: widget.onTrySample == null- ? null- : () => unawaited(_trySample()),- onProvider: onProvider,- waitingOn: widget.notifier.signInProvider,- signedOutReason: widget.notifier.signedOutReason,- entering: entering,- onCancel: widget.notifier.cancelProviderSignIn,- error: _error,+ onGetIt: () => _go(_Step.getIt),+ status: switch (widget.notifier.signedOutReason) {+ final reason? => _SignedOutNotice(reason: reason),+ null => null,+ },),- _Step.setUp => SetUpComputerPage(- onScan: () => _go(_Step.scan),+ _Step.getIt => GetHarnessPage(onBack: () => _go(_Step.hello),+ onPair: () => _go(_Step.scan),onTrySample: widget.onTrySample == null? null: () => unawaited(_trySample()),- loadDownloads: widget.loadDownloads,),_Step.scan => ScanToConnectPage(camera: widget.scanCamera,@@ -378,16 +457,23 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {// who chose "Scan with your phone" there — nothing happening was all they used to get.// Held for the sign-in this phone needs before it can approve that computer.onSignInCode: (code) {+ // Read under the other ways' sheet, it does not open its step beneath it.+ _closeOtherWays();widget.notifier.pendingComputerSignIn = code.code;_go(_Step.signInFirst);},- firstStep: _signInThereFirst,signingIn: _signingInWithScan,- onUseEmail: () => _go(_Step.email),+ // The way in without a camera, or for a computer with no code to show: the accounts.+ fallbackLabel: 'Can’t scan? Sign in another way',+ onUseEmail: () => unawaited(_openOtherWays()),onBack: () => _go(_backFrom(_Step.scan)),),- _Step.signInFirst => _SignInFirst(+ _Step.signInFirst => _SignInPage(+ titleKey: const ValueKey('welcome-sign-in-first'),onBack: () => _go(_backFrom(_Step.signInFirst)),+ title: 'Sign in on this phone first',+ lines: const ['Sign in here, then approve your computer.'],+ emailLabel: 'Use email instead',onProvider: onProvider,waitingOn: widget.notifier.signInProvider,entering: entering,@@ -398,16 +484,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {_Step.email => _Form(onBack: () => _go(_backFrom(_Step.email)),title: 'Your email',- lines: [- _forComputer- // The computer is not signed in yet: the account is chosen here, for both.- ? 'The account to sign this phone and your computer in with. We’ll send you a '- '4-digit code.'- // Not "the one Harness on your computer is signed in with": a desktop app- // opens signed out, and this step is where its person may be choosing it.- : 'The account to use on this phone and on your computer. We’ll send you '- 'a 4-digit code.',- ],+ lines: const ['We’ll send you a $_codeLength-digit code.'],field: TtyField(key: const Key('welcome-email'),controller: _email,@@ -430,10 +507,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {onBack: () => _go(_Step.email),title: 'Check your email',lines: [- _codeFromScan- ? 'The code you scanned couldn’t sign this phone in by itself, so we sent a '- '$_codeLength-digit code to ${_sentTo ?? 'your email'}.'- : 'We sent a $_codeLength-digit code to ${_sentTo ?? 'your email'}.',+ 'We sent a $_codeLength-digit code to ${_sentTo ?? 'your email'}.',],field: _CodeField(controller: _code,@@ -480,131 +554,9 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}}-/// The first thing anyone sees: the headline, the question and its two answers, and the two-/// accounts under them.-class _Hello extends StatelessWidget {- const _Hello({- required this.onScan,- required this.onSetUp,- required this.onProvider,- required this.onCancel,- this.onSample,- this.waitingOn,- this.entering = false,- this.error,- this.signedOutReason,- });-- /// Why the phone is back here when it was signed in a moment ago ([AppNotifier.signedOutReason]):- /// said above the question, or the welcome reads as a first run with no account behind it.- final String? signedOutReason;-- final VoidCallback onScan;- final VoidCallback onSetUp;-- /// Behind a long press on the wordmark — see `_PhoneWelcomeState._trySample`.- final VoidCallback? onSample;-- /// "Continue with …" pressed. Null while any sign-in is in flight, which both buttons wait out.- final ValueChanged<SignInProvider>? onProvider;-- /// The account whose page is up — its button says so, and [onCancel] is offered under it.- final SignInProvider? waitingOn;-- /// The page is done with and the phone is going in: the button says so, and there is nothing- /// left to cancel.- final bool entering;- final VoidCallback onCancel;-- /// Why the last account's sign-in did not finish.- final String? error;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- final hero = tty- .style(size: TtySize.display, weight: FontWeight.w600)- .copyWith(height: 34 / 28, letterSpacing: -0.6);- return Padding(- padding: const EdgeInsets.fromLTRB(Tty.origin, 24, Tty.origin, 24),- // ⚠️ **Scrolls when it does not fit.** The spacer holds the question at the foot where there- // is room; on a small phone at a large text size the headline alone outgrew the screen, and- // the column overflowed with both answers — the only ways on — pushed off its foot.- child: LayoutBuilder(- builder: (context, box) => SingleChildScrollView(- child: ConstrainedBox(- constraints: BoxConstraints(minHeight: box.maxHeight),- child: IntrinsicHeight(- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- GestureDetector(- key: const ValueKey('welcome-wordmark'),- behavior: HitTestBehavior.opaque,- onLongPress: onSample,- child: Row(- children: [- TtyText(- 'harness',- size: TtySize.title,- weight: FontWeight.w600,- ),- Container(- width: 9,- height: 18,- margin: const EdgeInsets.only(left: 2),- color: tty.green,- ),- ],- ),- ),- const SizedBox(height: 48),- Text(- 'Claude Code and Codex\nrun on your computer.\nDrive them from here.',- style: hero,- ),- const Spacer(),- if (signedOutReason case final reason?) ...[- _SignedOutNotice(reason: reason),- const SizedBox(height: 18),- ],- // Wraps where it does not fit — a 320pt phone at the largest text size — rather than- // losing its question mark at the edge, as a one-line TtyText did.- Text(- 'Is Harness on your computer?',- style: tty.style(color: tty.faint, size: TtySize.row),- ),- const SizedBox(height: 12),- _Answer(label: 'Yes — scan to connect', onTap: onScan),- const SizedBox(height: 10),- _Answer(label: 'Not yet — set it up', onTap: onSetUp),- const SizedBox(height: 18),- const _OrDivider(label: 'or sign in with'),- const SizedBox(height: 14),- _ProviderSignIn(- onProvider: onProvider,- waitingOn: waitingOn,- entering: entering,- onCancel: onCancel,- error: error,- ),- if (onSample != null) ...[- const SizedBox(height: 8),- TtyTextButton(label: 'Try the sample', onPressed: onSample),- ],- ],- ),- ),- ),- ),- ),- );- }-}-/// The two accounts the desktop and web sign in with ([SignInProviderButton]), and what goes with/// them while one is waited on: its button saying so, Cancel under it, and why the last one did not-/// finish. On the first screen ([_Hello]) and on [_SignInFirst].+/// finish. On both [_SignInPage]s.class _ProviderSignIn extends StatelessWidget {const _ProviderSignIn({required this.onProvider,@@ -665,37 +617,45 @@ class _ProviderSignIn extends StatelessWidget {}}-/// A computer's own sign-in QR, read by a phone that is not signed in: "Scan with your phone" on the-/// desktop app's sign-in sheet — the button someone adding a phone is most likely to press there,-/// and where a new desktop app's Add Phone sends them, since it opens signed out and its Add Phone-/// only says "Sign in to add your phone.".-///-/// Only a signed-in phone can approve that code, so this one signs in first. The code is held-/// meanwhile ([AppNotifier.pendingComputerSignIn]); once in, the phone asks to approve the computer-/// (`phone_shell.dart`), and the computer then asks its person to confirm the account — this one.-/// Both end up on one account, which is all it takes for them to trust each other.+/// A page of the accounts — Google, Apple ([_ProviderSignIn]) and an emailed code under them — with+/// back, a title and a line or two of why: **Sign in on this phone first** ([_Step.signInFirst]),+/// for a computer's own sign-in QR read by a phone that is not signed in — "Scan with your phone" on+/// the desktop app's sign-in sheet. Only a signed-in phone can approve that code, so this one signs+/// in first. The code is held meanwhile ([AppNotifier.pendingComputerSignIn]); once in, the phone+/// asks to approve the computer (`phone_shell.dart`), and the computer then asks its person to+/// confirm the account — this one.////// ```/// ‹ Back/// Sign in on this phone first-/// That code lets a signed-in phone sign your computer in. …+/// Sign in here, then approve your computer.////// [G Continue with Google]/// [ Continue with Apple ]/// Use email instead/// ```-class _SignInFirst extends StatelessWidget {- const _SignInFirst({+class _SignInPage extends StatelessWidget {+ const _SignInPage({required this.onBack,+ required this.title,+ required this.lines,+ required this.emailLabel,required this.onProvider,required this.onCancel,required this.onUseEmail,+ this.titleKey,this.waitingOn,this.entering = false,this.error,});final VoidCallback onBack;+ final String title;+ final Key? titleKey;+ final List<String> lines;++ /// The emailed code's way in, under the accounts.+ final String emailLabel;final ValueChanged<SignInProvider>? onProvider;final VoidCallback onCancel;final VoidCallback onUseEmail;@@ -720,21 +680,14 @@ class _SignInFirst extends StatelessWidget {children: [// A Text and not a TtyText: at a large size the title wraps rather than being cut off.Text(- 'Sign in on this phone first',- key: const ValueKey('welcome-sign-in-first'),+ title,+ key: titleKey,style: tty.style(size: 24, weight: FontWeight.w600),),- const SizedBox(height: 12),- Text(- 'That code lets a signed-in phone sign your computer in. Sign in here, and the '- 'phone asks you to approve the computer next.',- style: faint,- ),- const SizedBox(height: 6),- Text(- 'Leave the code on the computer’s screen until then.',- style: faint,- ),+ for (final (index, line) in lines.indexed) ...[+ SizedBox(height: index == 0 ? 12 : 6),+ Text(line, style: faint),+ ],const SizedBox(height: 24),_ProviderSignIn(onProvider: onProvider,@@ -746,7 +699,7 @@ class _SignInFirst extends StatelessWidget {const SizedBox(height: 8),Center(child: TtyTextButton(- label: 'Use email instead',+ label: emailLabel,color: tty.faint,// Not while an account's page is up: the email would sign in behind it.onPressed: onProvider == null ? null : onUseEmail,@@ -760,55 +713,102 @@ class _SignInFirst extends StatelessWidget {}}-/// One of the question's two answers: a raised row the width of the screen, its words and a `›`.-/// Equal weight — neither is the "primary" — because which one is right depends on the person.-class _Answer extends StatelessWidget {- const _Answer({required this.label, required this.onTap});+/// **Sign in another way**, in a sheet: Google, Apple ([_ProviderSignIn]) and an emailed code — for a+/// computer with only the command line, which shows no code, or a phone that cannot scan. Its own+/// sign-in, said in it: the account's page, waited on with Cancel, and why it did not finish.+///+/// ```+/// Sign in another way+/// Use the same account as your computer.+/// [G Continue with Google]+/// [ Continue with Apple ]+/// Continue with email+/// ```+class _OtherWaysSheet extends StatefulWidget {+ const _OtherWaysSheet({required this.notifier, required this.onEmail});- final String label;- final VoidCallback onTap;+ final AppNotifier notifier;++ /// "Continue with email": the sheet goes, and the email step comes.+ final VoidCallback onEmail;++ @override+ State<_OtherWaysSheet> createState() => _OtherWaysSheetState();+}++class _OtherWaysSheetState extends State<_OtherWaysSheet> {+ /// Why the last account's sign-in did not finish; a cancel says nothing.+ String? _error;++ Future<void> _signIn(SignInProvider provider) async {+ final notifier = widget.notifier;+ if (notifier.signingIn) return;+ setState(() => _error = null);+ try {+ await notifier.signInWithProvider(provider);+ } catch (e) {+ if (!mounted) return;+ setState(() => _error = _PhoneWelcomeState._plain(e.toString()));+ }+ }@overrideWidget build(BuildContext context) {final tty = Tty.of(context);- return Semantics(- button: true,- label: label,- excludeSemantics: true,- child: GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- HapticFeedback.selectionClick();- onTap();- },- child: Container(- height: 56,- padding: const EdgeInsets.symmetric(horizontal: 16),- decoration: BoxDecoration(- color: ttyRaised(tty),- borderRadius: BorderRadius.circular(10),- ),- child: Row(+ return ListenableBuilder(+ listenable: widget.notifier,+ builder: (context, _) {+ final notifier = widget.notifier;+ final signingIn = notifier.signingIn;+ // Past the page and the exchange, the phone is going in: nothing to cancel any more.+ final entering =+ signingIn && notifier.status == AppStatus.bootstrapping;+ return SingleChildScrollView(+ padding: const EdgeInsets.fromLTRB(Tty.origin, 18, Tty.origin, 12),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,children: [- // Wraps rather than cut "Yes — scan to connect" short on a narrow phone at a large- // text size; one line wherever it fits.- Expanded(- child: Text(- label,- style: tty.style(size: TtySize.row, weight: FontWeight.w600),+ Text(+ 'Sign in another way',+ key: const ValueKey('welcome-other-ways-title'),+ style: tty.style(size: TtySize.title, weight: FontWeight.w600),+ ),+ const SizedBox(height: 6),+ Text(+ 'Use the same account as your computer.',+ style: tty+ .style(color: tty.faint, size: TtySize.meta)+ .copyWith(height: 1.5),+ ),+ const SizedBox(height: 16),+ _ProviderSignIn(+ onProvider: signingIn+ ? null+ : (provider) => unawaited(_signIn(provider)),+ waitingOn: notifier.signInProvider,+ entering: entering,+ onCancel: notifier.cancelProviderSignIn,+ error: _error,+ ),+ const SizedBox(height: 4),+ Center(+ child: TtyTextButton(+ label: 'Continue with email',+ // Not while an account's page is up: the email would sign in behind it.+ onPressed: signingIn ? null : widget.onEmail,),),- Icon(LucideIcons.chevronRight300, size: 18, color: tty.faint),],),- ),- ),+ );+ },);}}-/// Why a phone that was signed in is back on the welcome: a raised block over the question, the-/// sign-out mark in the terminal's yellow beside the sentence. Not the red of [_Hello.error] — the+/// Why a phone that was signed in is back on the welcome: a raised block under the title, the+/// sign-out mark in the terminal's yellow beside the sentence. Not the red of a sign-in's error — the/// person did nothing wrong, and signing in again is the whole of what to do.class _SignedOutNotice extends StatelessWidget {const _SignedOutNotice({required this.reason});@@ -845,44 +845,6 @@ class _SignedOutNotice extends StatelessWidget {}}-/// The line between the question's answers and the accounts: a rule each side of a few faint-/// words, in the terminal's own furniture colour.-class _OrDivider extends StatelessWidget {- const _OrDivider({required this.label});-- final String label;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- final rule = Expanded(child: Container(height: 1, color: tty.dim));- // Its own width, and the rules give way around it — up to most of the screen's. ⚠️ Past that- // it wraps: one unbreakable line overflowed a small phone at the app's largest text size (2x)- // in a face whose letters run wider than SF Mono's. Capped by the screen, not a LayoutBuilder:- // the first screen is measured for its height (`IntrinsicHeight`), which a LayoutBuilder- // cannot answer.- return Row(- children: [- rule,- ConstrainedBox(- constraints: BoxConstraints(- maxWidth: MediaQuery.sizeOf(context).width * 0.7,- ),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 10),- child: Text(- label,- textAlign: TextAlign.center,- style: tty.style(color: tty.faint, size: TtySize.meta),- ),- ),- ),- rule,- ],- );- }-}-/// One step of signing in: back, a title, a line or two, a field, the button.class _Form extends StatelessWidget {const _Form({diff --git a/mobile/lib/phone/welcome/scan_to_connect.dart b/mobile/lib/phone/welcome/scan_to_connect.dartindex fe8277127..0e616ba8f 100644--- a/mobile/lib/phone/welcome/scan_to_connect.dart+++ b/mobile/lib/phone/welcome/scan_to_connect.dart@@ -15,42 +15,30 @@ import '../tty.dart';import '../tty_controls.dart';import 'connect_code.dart';-/// Where Add Phone… is on the computer, for somebody who has never opened it. The Mac keeps it in-/// the Harness menu; the desktop app's Linux menu strip has no row for it, so there it is the-/// command palette's (`navigation.commands`, Ctrl+Shift+P, finds the "Add phone" command).-///-/// Under the step that names Add Phone… ([ScanToConnectPage.step]), so each line says only where.-const kAddPhoneWhere =- 'Mac: Harness menu ▸ Add Phone…\n'- 'Linux: Ctrl+Shift+P, then “add phone”';--/// **Yes — scan to connect**: the camera, reading the code the desktop app shows under-/// Harness ▸ Add Phone… ([ConnectCode]). The scan signs the phone in; [signingIn] says so while it-/// does.+/// Where Add Phone… is on the computer, for somebody who has never opened it — Connect your+/// computer's first step (`set_up_computer.dart`). The Mac keeps it in the Harness menu; the desktop+/// app's Linux menu strip has no row for it, so there it is the command palette's+/// (`navigation.commands`, Ctrl+Shift+P, finds the "Add phone" command).+const kAddPhoneWhere = 'Mac: Harness menu · Linux: Ctrl+Shift+P, “add phone”';++/// **Pair computer**: the camera, reading the code the desktop app shows in Add Phone+/// ([ConnectCode]). The scan signs the phone in; [signingIn] says so while it does.////// ```/// ‹/// ┌──────────────────────────────┐/// │ [ camera view ] │/// └──────────────────────────────┘-/// Scan the code on your computer-/// 1 On your computer, sign in to Harness with Google or Apple. ([firstStep])-/// 2 Open Add Phone… and point this camera at its code. ([step])-/// Mac: Harness menu ▸ Add Phone… ([hint])-/// Linux: Ctrl+Shift+P, then “add phone”+/// Scan the code on your computer///-/// 🔒 End-to-end encrypted, phone to computer.-/// Use email instead+/// Can’t scan? Sign in another way ([fallbackLabel])/// ```///-/// With no [firstStep] the one step left goes unnumbered.-///-/// ⚠️ **Steps, not notes (owner, 2026-10-07).** Under the camera there were the hint, the line on-/// encryption and "Computer asks you to sign in? Sign in there…", one after another in the same-/// faint 13pt: nothing said which to read first, and the sign-in — which has to happen before the-/// computer shows any code — read as a footnote. It is a step of its own now, ahead of the scan,-/// and the camera stands at the top rather than centred in the room left, which had put every word-/// at the foot of the screen under an empty band.+/// ⚠️ **Only the scan here (owner, 2026-10-08).** What has to happen on the computer first — get+/// Harness, open it, sign in, open Add Phone, and where that is — is the page this one is opened+/// from (`set_up_computer.dart`, Connect your computer), and so is the line on encryption: the camera+/// at the top and its title are the page. Centred in the room left, the camera had put every word at+/// the foot of the screen under an empty band.////// The camera runs only while this page is up. A code that is not ours is ignored, so a stray QR/// in frame does nothing. A camera refused says where to turn it on, with a link to this app's@@ -68,12 +56,7 @@ class ScanToConnectPage extends StatefulWidget {this.onSignInCode,this.acceptConnectCodes = true,this.title = 'Scan the code on your computer',- this.step = 'Open Add Phone… and point this camera at its code.',- // Where it is on each, not "In Harness on your computer: Add Phone…": someone who has never- // opened the desktop app does not know where Add Phone lives, and it is not in the same place- // on a Mac and on Linux.- this.hint = kAddPhoneWhere,- this.firstStep,+ this.step,});final ValueChanged<ConnectCode> onCode;@@ -81,20 +64,14 @@ class ScanToConnectPage extends StatefulWidget {/// A computer's sign-in QR ([SignInCode]) was read — offered only where the page takes one.final ValueChanged<SignInCode>? onSignInCode;- /// What has to be done on the computer before it shows the code — step 1, ahead of [step]. Null- /// for a phone already signed in, whose computer is on its account: the scan is the only step.- final String? firstStep;-/// Whether an Add Phone QR ([ConnectCode]) is one this page takes.final bool acceptConnectCodes;final String title;- /// The scan's own step: what to open on the computer, and that the camera goes to its code.- final String step;-- /// Under [step], quieter: where that is on the computer. Null says nothing more.- final String? hint;+ /// Under the title, quieter: where the code is on the computer, when the page it is opened from+ /// has not said so already. Null says nothing more.+ final String? step;final VoidCallback onUseEmail;final VoidCallback onBack;@@ -225,7 +202,6 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>AppTheme.watch(context);final tty = Tty.of(context);final faint = tty.style(size: TtySize.meta, color: tty.faint);- final firstStep = widget.firstStep;return Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [@@ -283,12 +259,12 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>),),// Texts that wrap, not one-line TtyTexts: at a narrow phone's width the- // title and the hint's second half were cut off at the screen's edge — the- // half that says where to look.+ // title and the line under it were cut off at the screen's edge — the half+ // that says where to look.Padding(padding: const EdgeInsets.fromLTRB(Tty.origin,- 20,+ 22,Tty.origin,0,),@@ -297,69 +273,34 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>children: [Text(widget.signingIn ? 'Signing in…' : widget.title,+ textAlign: TextAlign.center,style: tty.style(size: TtySize.title,weight: FontWeight.w600,),),- const SizedBox(height: 12),- if (firstStep != null) ...[- _ScanStep(- key: const ValueKey('scan-first-step'),- number: 1,- text: firstStep,+ if (widget.step case final step?) ...[+ const SizedBox(height: 6),+ Text(+ step,+ key: const ValueKey('scan-hint'),+ textAlign: TextAlign.center,+ style: faint.copyWith(height: 1.5),),- const SizedBox(height: 12),],- _ScanStep(- number: firstStep == null ? null : 2,- text: widget.step,- detail: widget.hint,- ),],),),const Spacer(),const SizedBox(height: 20),- // The one line of trust on the way in: the scan hands a phone the run of a- // computer, and the first-time reviewer's question was what stops anyone- // else reading it. Centred over the way out, the two read as the page's- // foot rather than as more steps.- Center(- child: Padding(- padding: const EdgeInsets.symmetric(- horizontal: Tty.origin,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.only(top: 2),- child: Icon(- LucideIcons.lock300,- size: 13,- color: tty.faint,- ),- ),- const SizedBox(width: 6),- Flexible(- child: Text(- 'End-to-end encrypted, phone to computer.',- textAlign: TextAlign.center,- style: faint,- ),- ),- ],- ),- ),- ),- const SizedBox(height: 2),Center(child: TtyTextButton(label: widget.fallbackLabel,color: tty.faint,- onPressed: widget.onUseEmail,+ // Not while the scan signs in: the other way would start a second.+ onPressed: widget.signingIn+ ? null+ : widget.onUseEmail,),),const SizedBox(height: 12),@@ -384,52 +325,6 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>static const double _minSquare = 220;}-/// One step under the camera: its number in the terminal's green in a column of its own — none-/// when it is the only step — the words beside it, and [detail] under them, quieter.-class _ScanStep extends StatelessWidget {- const _ScanStep({super.key, required this.text, this.number, this.detail});-- final int? number;- final String text;- final String? detail;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- final style = tty.style(size: TtySize.row);- final words = Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Text(text, style: style),- if (detail case final detail?)- Padding(- padding: const EdgeInsets.only(top: 4),- child: Text(- detail,- key: const ValueKey('scan-hint'),- style: tty.style(size: TtySize.meta, color: tty.faint),- ),- ),- ],- );- final number = this.number;- if (number == null) return words;- return Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- // One digit in a monospace face: every number is the same width, so the steps' words line- // up without a column of fixed width that a larger text size would outgrow.- Text(- '$number',- style: style.copyWith(color: tty.green, fontWeight: FontWeight.w600),- ),- const SizedBox(width: 12),- Expanded(child: words),- ],- );- }-}-/// What stands in the camera's square when it cannot run: what happened, and what fixes it.////// ⚠️ **A refused permission and a missing camera are told apart**, because only one of them is@@ -446,23 +341,16 @@ class _CameraProblem extends StatelessWidget {Widget build(BuildContext context) {final tty = Tty.of(context);final refused = code == MobileScannerErrorCode.permissionDenied;+ // One line each, and the button that fixes it where one does (owner, 2026-10-08: little text).final (title, detail) = switch (code) {MobileScannerErrorCode.permissionDenied => ('Camera access is off',- // Where the switch is, in each OS's words: iOS opens straight onto it; Android opens App- // info, one screen short of it.- Platform.isAndroid- ? 'Allow Camera for Harness in Settings, under Permissions › Camera.'- : 'Turn on Camera for Harness in Settings to scan the code.',- ),- MobileScannerErrorCode.unsupported => (- 'No camera on this device',- 'Scanning needs a camera. Use the option below instead.',- ),- _ => (- 'The camera didn’t start',- 'Go back and try again, or use the option below.',+ // iOS's Settings opens straight onto the switch; Android's opens App info, one screen short+ // of it, so that one says where.+ Platform.isAndroid ? 'In Settings: Permissions › Camera' : null,),+ MobileScannerErrorCode.unsupported => ('No camera on this device', null),+ _ => ('The camera didn’t start. Try again.', null),};// Scrolls rather than overflows: the square shrinks with a small phone, the words grow with the// UI size.@@ -479,14 +367,16 @@ class _CameraProblem extends StatelessWidget {textAlign: TextAlign.center,style: tty.style(size: TtySize.row, weight: FontWeight.w600),),- const SizedBox(height: 6),- Text(- detail,- textAlign: TextAlign.center,- style: tty- .style(size: TtySize.meta, color: tty.faint)- .copyWith(height: 1.5),- ),+ if (detail != null) ...[+ const SizedBox(height: 6),+ Text(+ detail,+ textAlign: TextAlign.center,+ style: tty+ .style(size: TtySize.meta, color: tty.faint)+ .copyWith(height: 1.5),+ ),+ ],if (refused) ...[const SizedBox(height: 6),TtyTextButton(@@ -558,8 +448,7 @@ Future<SignInCode?> scanForSignIn(BuildContext context, {Widget? camera}) asyncchild: ScanToConnectPage(camera: camera,title: 'Scan the code on the computer',- step: 'On the computer: Sign in ▸ Scan with your phone.',- hint: null,+ step: 'On the computer: Sign in ▸ Scan with your phone',fallbackLabel: 'Not now',acceptConnectCodes: false,onCode: (_) {},diff --git a/mobile/lib/phone/welcome/set_up_computer.dart b/mobile/lib/phone/welcome/set_up_computer.dartindex 5db06f160..822111d49 100644--- a/mobile/lib/phone/welcome/set_up_computer.dart+++ b/mobile/lib/phone/welcome/set_up_computer.dart@@ -1,7 +1,5 @@import 'dart:async';-import 'dart:convert';-import 'package:dio/dio.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:lucide_icons_flutter/lucide_icons.dart';@@ -9,226 +7,114 @@ import 'package:share_plus/share_plus.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';-import '../phone_sheet.dart' show phoneSheetRoute;import '../tty.dart';import '../tty_controls.dart';-import 'how_it_works_video.dart';+import 'scan_to_connect.dart' show kAddPhoneWhere;-/// Where the desktop app is downloaded, for someone typing it on the computer — and every row's-/// link when the release manifest cannot be read.+/// Where Harness is downloaded: the website's download page, which offers each computer its own+/// file — the Mac's, Linux's, the command line's.const kDesktopDownloadUrl = 'https://harness.autonomous.ai/desktop';-/// The desktop release manifest: the one the website's download menu and the desktop app's own-/// updater read, so each row below sends the current build of its file.-const kDesktopManifestUrl =- 'https://storage.googleapis.com/s3-autonomous-upgrade-3/harness/desktop/metadata.json';--/// The `harness` command alone, for a computer with no desktop — the website menu's CLI row.-const kCliInstall =- 'curl -fsSL https://harness.autonomous.ai/cli/install.sh | bash';--/// One row of the website's download menu: its manifest key, what it says, and its icon.-typedef DesktopPlatform = ({- String key,- String label,- String note,- IconData icon,-});--/// The website's download menu (autonomous.ai/harness-app), row for row — with a word more on-/// the two Macs, for somebody who never had to know which theirs is: Apple Silicon is every-/// M-series Mac.-const kDesktopPlatforms = <DesktopPlatform>[- (- key: 'desktop-macos-arm64-dmg',- label: 'macOS',- note: 'Apple Silicon · M1 or later',- icon: Icons.apple,- ),- (- key: 'desktop-macos-dmg',- label: 'macOS',- note: 'Intel · older Macs',- icon: Icons.apple,- ),- (- key: 'desktop-linux-x64',- label: 'Linux',- note: 'Intel/AMD · Ubuntu, Omarchy and more',- icon: LucideIcons.monitor300,- ),- (- key: 'desktop-linux-arm64',- label: 'Linux',- note: 'ARM · Raspberry Pi, ARM servers',- icon: LucideIcons.monitor300,- ),-];--/// Manifest key → the file's URL. Empty when the manifest cannot be read.-typedef DesktopDownloadsLoader = Future<Map<String, String>> Function();--Future<Map<String, String>> loadDesktopDownloads({Dio? dio}) async {- try {- final res =- await (dio ??- Dio(- BaseOptions(- connectTimeout: const Duration(seconds: 10),- receiveTimeout: const Duration(seconds: 10),- ),- ))- .get<Object?>(kDesktopManifestUrl);- final raw = res.data;- final data = raw is String ? jsonDecode(raw) : raw;- if (data is! Map) return const {};- return {- for (final MapEntry(:key, :value) in data.entries)- if (key is String && value is Map && value['url'] is String)- key: value['url'] as String,- };- } catch (_) {- return const {};- }-}--/// **Not yet — set it up**: getting Harness onto the computer, from the phone — three steps, in the-/// order they are done on the computer, and the scan that ends them.+/// **Connect your computer** — the page a phone with no computer stands on: signed out (the first+/// screen, `phone_welcome.dart`), signed in to an account with none (`connect_computer.dart`), and+/// Computers ▸ Set up another computer. One button, what it takes, and the way for somebody who has+/// no Harness on the computer yet ([GetHarnessPage]).////// ```-/// ‹ ⚙-/// Get Harness for-/// your computer-/// [status — signed in, the watch for the computer]+/// harness▌ (⚙ once signed in: Settings)+/// Connect your computer+/// Drive Claude Code and Codex from your phone.+/// [status]+/// [ ⊞ Pair computer ]///-/// 1 Install Harness on your computer.-/// ┌────────────────────────────────────┐-/// │ ⇪ Send it to your computer › │ → the download menu, in a sheet-/// │ macOS · Linux · Command line │-/// └────────────────────────────────────┘-/// or open harness.autonomous.ai/desktop there.-/// 2 Open it, and sign in with Google or Apple.-/// 3 Open Add Phone… and scan its code.-/// On a Mac, it’s in the Harness menu.-/// [ Scan to connect ]-/// ─────────────────────────────────────────-/// Try the sample ›-/// No account or computer needed.-/// See how it works ▶+/// HOW IT WORKS+/// [1] Open Add Phone on your computer+/// Mac: Harness menu · Linux: Ctrl+Shift+P+/// [2] Scan its code+/// [3] You’re connected+/// End-to-end encrypted.+///+/// No Harness yet? Get it ›/// ```///-/// ⚠️ **The download menu is a sheet, not the page (owner, 2026-10-07).** Laid out on the page —-/// five rows under "Send it to your computer:", then "Then, on your computer:" and its steps — it-/// read as a catalogue of files: half the first screen went to rows of which a person needs one, and-/// the scan that ends the set-up was a line of text at the foot, below the screen's edge once the-/// watch for the computer was up. Folded into step 1, the page is the steps, and the scan is the-/// button of the step it belongs to.-class SetUpComputerPage extends StatefulWidget {+/// Nothing else on it, signed out: the other ways to sign in are the camera's "Can’t scan?", where+/// a computer with no code or a phone with no camera finds out it needs them, and the sample is+/// Get it's, for somebody waiting on the computer (owner, 2026-10-09).+///+/// Short on purpose (owner, 2026-10-08): a line under a step only where the step cannot be done+/// without it — where Add Phone is, which account.+///+/// ⚠️ **One button, after Orca's (owner, 2026-10-08).** The first screen used to ask "Is Harness on+/// your computer?" — Yes to the camera, Not yet to a page of download rows, steps and a second scan —+/// beside Google and Apple: six ways on before anything was explained. Somebody who has Harness+/// presses Pair computer; somebody who has not follows Get it, and comes back to the same button.+class SetUpComputerPage extends StatelessWidget {const SetUpComputerPage({super.key,required this.onScan,+ required this.onGetIt,this.onBack,- this.onTrySample,this.status,- this.trailing = const [],- this.loadDownloads,this.account,+ this.watching = false,this.topTrailing,this.scanStatus,});- /// At the right of the top row, across from `‹ Back` — on the home screen, where there is no back,- /// the way to Settings (`PhoneSettingsButton`).- final Widget? topTrailing;-- /// What the last scan came to — pairing, or why it did not — right under "Scan to connect".- ///- /// ⚠️ **Under the button that started it, not under the title.** [status] is the page's top, and- /// the button further down: on a small phone, scrolled down to press it, the person came back from- /// the camera to a page that looked unchanged — the answer had gone in above the screen's edge,- /// and pushed the button down besides.- final Widget? scanStatus;-- /// The account this phone is signed in to, when it is: the computer has to sign in to the same- /// one, and the steps say so by name. Null for a phone not signed in yet — its scan signs it in- /// to whichever account the computer chose.- final String? account;-- /// Back to the first screen's other answer, once the app is on the computer — or, signed in,- /// the scan that pairs this phone with the computer just set up.+ /// Pair computer: the camera, for the code the computer's Add Phone shows — it pairs this phone+ /// with it (and, signed out, signs it in).final VoidCallback onScan;- /// Null draws no back button: the page is a home screen, not a pushed one.- final VoidCallback? onBack;+ /// "No Harness yet? Get it ›" — [GetHarnessPage].+ final VoidCallback onGetIt;- /// Opens the offline sample before the user sets up a computer.- final VoidCallback? onTrySample;+ /// Null draws the wordmark instead of a back button: the page is a home screen, not a pushed one.+ final VoidCallback? onBack;- /// A line under the title about what is going on — signed in, the watch for the computer.+ /// Under the words, over the button: what is going on — the watch for the computer once signed+ /// in, or why the phone was signed out.final Widget? status;- /// Rows after everything else.- final List<Widget> trailing;-- /// Stands in for the manifest in tests. Null reads [kDesktopManifestUrl].- final DesktopDownloadsLoader? loadDownloads;-- @override- State<SetUpComputerPage> createState() => _SetUpComputerPageState();-}--class _SetUpComputerPageState extends State<SetUpComputerPage> {- /// Read as the page opens, so a tap in the menu shares at once; a tap before it lands waits for it.- late final Future<Map<String, String>> _downloads =- (widget.loadDownloads ?? loadDesktopDownloads)();+ /// The account this phone is signed in to, when it is: the computer has to sign in to the same+ /// one, and the first step says so by name.+ final String? account;- /// The download menu while it is up — see [_openDownloads].- ModalBottomSheetRoute<void>? _menu;+ /// Whether the page is watching the account for the computer (signed in, at home): it then+ /// shows up by itself, with no code.+ final bool watching;- @override- void dispose() {- // ⚠️ **The page can go with its menu up.** At home this page is there only while the account- // has no computer, so the computer turning up — the 5-second watch — takes it away; the menu is- // the root navigator's, and stayed, over the agents. Taken away after this frame: a navigator- // is not to be changed while the tree is being torn down.- final menu = _menu;- if (menu != null) {- WidgetsBinding.instance.addPostFrameCallback((_) {- // The whole app going in the same frame takes the navigator, and the menu, with it.- final navigator = menu.navigator;- if (navigator != null && navigator.mounted && menu.isActive) {- navigator.removeRoute(menu);- }- });- }- super.dispose();- }+ /// At the right of the top row, across from the wordmark or `‹ Back` — Settings+ /// (`PhoneSettingsButton`) once signed in.+ final Widget? topTrailing;- /// Step 1's download menu, in a sheet. One at a time: a second tap while it rises is not a- /// second sheet.- Future<void> _openDownloads() async {- if (_menu != null) return;- final menu = phoneSheetRoute<void>(- context,- builder: (_) => SafeArea(child: _DownloadMenu(downloads: _downloads)),- );- _menu = menu;- try {- await Navigator.of(context, rootNavigator: true).push(menu);- } finally {- _menu = null;- }- }+ /// What the last scan came to — pairing, or why it did not — right under Pair computer, the+ /// button that started it.+ final Widget? scanStatus;- /// Step 2. Signed in, the account is named: a computer signed in to another one never shows up- /// here, and nothing else on the page says so.- String get _signInStep => switch (widget.account) {- final account? =>- 'Open it, and sign in with Google or Apple, as $account — the account '- 'on this phone.',- null => 'Open it, and sign in with Google or Apple.',+ /// The steps, signed out: open Add Phone (and where it is), scan its code. Signed in: sign in on+ /// the computer with the same account — it then turns up by itself, with no code — and Add Phone,+ /// and where it is, for one that does not.+ ///+ /// ⚠️ **Where Add Phone is is said either way.** Signed in, it was left out as needed only for the+ /// scan — and that is exactly when it is needed: a computer whose account already has this phone+ /// does not open Add Phone by itself, and one slow to read the phone's key does not turn up.+ ({String title, String? note}) get _firstStep => switch (account) {+ null => (title: 'Open Add Phone on your computer', note: kAddPhoneWhere),+ _ when watching => (+ title: 'Sign in on your computer',+ note: 'With the same account.',+ ),+ // From Computers nothing above names the account.+ final account => (+ title: 'Sign in on your computer',+ note: 'With $account.',+ ),};+ ({String title, String? note}) get _secondStep => account == null+ ? (title: 'Scan its code', note: null)+ : (title: 'Not showing up? Scan its code', note: kAddPhoneWhere);+@overrideWidget build(BuildContext context) {AppTheme.watch(context);@@ -238,124 +124,217 @@ class _SetUpComputerPageState extends State<SetUpComputerPage> {crossAxisAlignment: CrossAxisAlignment.stretch,children: [// One row whatever is in it: the back button's height, so the page starts at the same place- // with a back, a trailing control, both, or neither.+ // with a back or the wordmark, a trailing control or none.SizedBox(height: 44,child: Row(children: [- if (widget.onBack case final onBack?)- TtyBackButton(onPressed: onBack),+ if (onBack case final onBack?)+ TtyBackButton(onPressed: onBack)+ else+ const Padding(+ padding: EdgeInsets.only(left: Tty.origin),+ child: _Wordmark(),+ ),const Spacer(),- ?widget.topTrailing,+ ?topTrailing,],),),Expanded(child: ListView(- padding: const EdgeInsets.fromLTRB(Tty.origin, 8, Tty.origin, 24),+ padding: const EdgeInsets.fromLTRB(Tty.origin, 32, Tty.origin, 28),children: [- Text(- 'Get Harness for\nyour computer',- style: tty- .style(size: TtySize.display, weight: FontWeight.w600)- .copyWith(height: 34 / 28, letterSpacing: -0.6),+ const _Hero(+ title: 'Connect your computer',+ body: 'Drive Claude Code and Codex from your phone.',),- if (widget.status case final status?) ...[+ if (status case final status?) ...[const SizedBox(height: 18),status,],- const SizedBox(height: 28),- // ⚠️ **Sign in, and with which buttons.** The desktop app opens signed out, and shows- // no code until it is signed in — "Then open it, and scan the code it shows" sent- // people to an Add Phone that only said "Sign in to add your phone.". Google or Apple- // by name: its third way, "Scan with your phone", needs a phone already signed in.- _SetUpStep(+ const SizedBox(height: 26),+ Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 300),+ child: TtyPrimaryButton(+ key: const ValueKey('set-up-scan'),+ icon: LucideIcons.qrCode300,+ label: 'Pair computer',+ onPressed: onScan,+ ),+ ),+ ),+ if (scanStatus case final scanStatus?) ...[+ const SizedBox(height: 10),+ scanStatus,+ ],+ const SizedBox(height: 40),+ Text(+ 'HOW IT WORKS',+ style: faint.copyWith(+ fontSize: 11.5,+ letterSpacing: 1.1,+ fontWeight: FontWeight.w600,+ ),+ ),+ const SizedBox(height: 4),+ _HowItWorksRow(number: 1,- text: 'Install Harness on your computer.',- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- _SendButton(onTap: () => unawaited(_openDownloads())),- const SizedBox(height: 8),- Text.rich(- TextSpan(- children: [- const TextSpan(text: 'or open '),- TextSpan(- text: kDesktopDownloadUrl.replaceFirst(- 'https://',- '',- ),- style: tty.style(size: TtySize.meta),- ),- const TextSpan(text: ' there.'),- ],- ),- style: faint,+ title: _firstStep.title,+ note: _firstStep.note,+ ),+ _HowItWorksRow(+ number: 2,+ title: _secondStep.title,+ note: _secondStep.note,+ ),+ const _HowItWorksRow(+ number: 3,+ title: 'You’re connected',+ note: 'End-to-end encrypted.',+ last: true,+ ),+ const SizedBox(height: 24),+ Center(+ child: _TextLink(+ key: const ValueKey('set-up-get-it'),+ lead: 'No Harness yet? ',+ action: 'Get it ›',+ onTap: onGetIt,+ ),+ ),+ ],+ ),+ ),+ ],+ );+ }+}++/// **Get it** — Harness onto the computer, from the phone: the download page, sent to the computer+/// (a phone cannot install it), then back to Pair computer.+///+/// ```+/// ‹+/// Get Harness on your computer+/// For Mac and Linux.+/// [ ⇪ Send to my computer ]+/// or open harness.autonomous.ai/desktop on it+/// ─────────────────────────────────────+/// Installed? Pair computer ›+/// Try the sample while you wait+/// ```+///+/// The page sends the website, not a file: it offers each computer its own download (Mac, Linux,+/// the command line), which a phone cannot tell apart.+class GetHarnessPage extends StatelessWidget {+ const GetHarnessPage({+ super.key,+ required this.onBack,+ required this.onPair,+ this.onTrySample,+ });++ final VoidCallback onBack;++ /// "Pair computer ›": the camera, the same as the button on [SetUpComputerPage].+ final VoidCallback onPair;++ /// The offline sample — what Harness is like, for somebody waiting on the computer to install.+ final VoidCallback? onTrySample;++ /// The share sheet with the download page: AirDrop to the Mac beside you, or Messages or email to+ /// yourself, opened on the computer. Anchored to the button for iPad, where the sheet is a popover.+ Future<void> _sendLink(BuildContext button) async {+ final box = button.findRenderObject() as RenderBox?;+ final origin = box == null || !box.attached+ ? null+ : box.localToGlobal(Offset.zero) & box.size;+ try {+ await SharePlus.instance.share(+ ShareParams(+ uri: Uri.parse(kDesktopDownloadUrl),+ subject: 'Get Harness for your computer',+ sharePositionOrigin: origin,+ ),+ );+ } catch (_) {+ // No share sheet came up: the address under the button is the way on, and the button can be+ // pressed again.+ }+ }++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ final tty = Tty.of(context);+ final faint = tty.style(color: tty.faint, size: TtySize.meta);+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Align(+ alignment: Alignment.centerLeft,+ child: TtyBackButton(onPressed: onBack),+ ),+ Expanded(+ child: ListView(+ padding: const EdgeInsets.fromLTRB(Tty.origin, 32, Tty.origin, 28),+ children: [+ const _Hero(+ title: 'Get Harness on your computer',+ body: 'For Mac and Linux.',+ ),+ const SizedBox(height: 26),+ Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 300),+ child: Builder(+ builder: (button) => _SolidButton(+ key: const ValueKey('get-it-send'),+ icon: LucideIcons.share300,+ label: 'Send to my computer',+ onPressed: () => unawaited(_sendLink(button)),),- ],+ ),),),- _SetUpStep(number: 2, text: _signInStep),- _SetUpStep(- number: 3,- text: 'Open Add Phone… and scan its code.',- note: 'On a Mac, it’s in the Harness menu.',- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,+ const SizedBox(height: 12),+ Text.rich(+ TextSpan(children: [- // The page's one filled button: the scan is what the set-up comes to.- TtyPrimaryButton(- key: const ValueKey('set-up-scan'),- label: 'Scan to connect',- onPressed: widget.onScan,+ const TextSpan(text: 'or open '),+ TextSpan(+ text: kDesktopDownloadUrl.replaceFirst('https://', ''),+ style: tty.style(size: TtySize.meta),),- if (widget.scanStatus case final scanStatus?) ...[- const SizedBox(height: 10),- scanStatus,- ],+ const TextSpan(text: ' on it'),],),+ textAlign: TextAlign.center,+ style: faint,),- const SizedBox(height: 4),+ const SizedBox(height: 40),Container(height: 1, color: tty.dim.withValues(alpha: 0.6)),- const SizedBox(height: 6),- // Not at the computer, or not yet: the sample, and what it is like in 30 seconds —- // after the steps, which are what this page is for.- if (widget.onTrySample case final onTrySample?)- TtyTap(- onTap: onTrySample,- semanticsLabel:- 'Try the sample. No account or computer needed.',- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 10),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- TtyText('Try the sample ›', size: TtySize.row),- const SizedBox(height: 4),- Text('No account or computer needed.', style: faint),- ],- ),- ),+ const SizedBox(height: 20),+ // Nothing about signing in there: the desktop app asks for it itself, and opens Add+ // Phone by itself once it is.+ Center(+ child: _TextLink(+ key: const ValueKey('get-it-pair'),+ lead: 'Installed? ',+ action: 'Pair computer ›',+ onTap: onPair,),- Align(- alignment: Alignment.centerLeft,- child: Transform.translate(- // The button's own inset, so its words sit on the gutter.- offset: const Offset(-12, 0),- child: TtyTextButton(- label: 'See how it works ▶',- color: tty.faint,- onPressed: () => Navigator.of(context).push(- MaterialPageRoute<void>(- builder: (_) => const HowItWorksVideoPage(),- ),- ),+ ),+ if (onTrySample case final onTrySample?)+ Center(+ child: _TextLink(+ key: const ValueKey('get-it-sample'),+ action: 'Try the sample while you wait',+ onTap: onTrySample,),),- ),- ...widget.trailing,],),),@@ -364,58 +343,125 @@ class _SetUpComputerPageState extends State<SetUpComputerPage> {}}-/// One numbered step: the number in the terminal's green in a column of its own, the words beside-/// it wrapping under themselves rather than under the number — then [note], quieter, and what the-/// step is done with ([child]): the download menu, the scan.-class _SetUpStep extends StatelessWidget {- const _SetUpStep({+/// A page's title and the sentence under it, centred.+class _Hero extends StatelessWidget {+ const _Hero({required this.title, required this.body});++ final String title;+ final String body;++ @override+ Widget build(BuildContext context) {+ final tty = Tty.of(context);+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ title,+ textAlign: TextAlign.center,+ style: tty+ .style(size: 24, weight: FontWeight.w600)+ .copyWith(height: 1.25, letterSpacing: -0.4),+ ),+ const SizedBox(height: 12),+ Text(+ body,+ textAlign: TextAlign.center,+ style: tty.style(color: tty.faint, size: 14).copyWith(height: 1.55),+ ),+ ],+ );+ }+}++/// `harness▌`: the app's name and the terminal's cursor, where a home screen has no back.+class _Wordmark extends StatelessWidget {+ const _Wordmark();++ @override+ Widget build(BuildContext context) {+ final tty = Tty.of(context);+ return Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ TtyText('harness', size: TtySize.row, weight: FontWeight.w600),+ Container(+ width: 8,+ height: 16,+ margin: const EdgeInsets.only(left: 2),+ color: tty.green,+ ),+ ],+ );+ }+}++/// One row of HOW IT WORKS: its number in a raised square, what to do, and a quieter line under it+/// when one is needed — a rule between rows.+class _HowItWorksRow extends StatelessWidget {+ const _HowItWorksRow({required this.number,- required this.text,+ required this.title,this.note,- this.child,+ this.last = false,});final int number;- final String text;+ final String title;final String? note;- final Widget? child;+ final bool last;@overrideWidget build(BuildContext context) {final tty = Tty.of(context);- final style = tty.style(size: TtySize.row);- return Padding(- padding: const EdgeInsets.only(bottom: 24),+ return Container(+ padding: const EdgeInsets.symmetric(vertical: 14),+ decoration: BoxDecoration(+ border: last+ ? null+ : Border(bottom: BorderSide(color: tty.dim.withValues(alpha: 0.6))),+ ),child: Row(crossAxisAlignment: CrossAxisAlignment.start,children: [- // One digit in a monospace face: every number is the same width, so the steps' words- // line up without a column of fixed width that a larger text size would outgrow.- Text(- '$number',- style: style.copyWith(- color: tty.green,- fontWeight: FontWeight.w600,+ Container(+ width: 28,+ height: 28,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: ttyRaised(tty),+ borderRadius: BorderRadius.circular(6),+ ),+ child: Text(+ '$number',+ style: tty.style(color: tty.faint, size: TtySize.meta),),),- const SizedBox(width: 12),+ const SizedBox(width: 14),Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- Text(text, style: style),- if (note case final note?)- Padding(- padding: const EdgeInsets.only(top: 3),+ // Centred on the number's square while it is one line; wraps under itself after.+ ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 28),+ child: Align(+ alignment: Alignment.centerLeft,child: Text(- note,- style: tty.style(color: tty.faint, size: TtySize.meta),+ title,+ style: tty.style(+ size: TtySize.row,+ weight: FontWeight.w600,+ ),),),- if (child case final child?)- Padding(- padding: const EdgeInsets.only(top: 12),- child: child,+ ),+ if (note case final note?)+ Text(+ note,+ style: tty+ .style(color: tty.faint, size: TtySize.meta)+ .copyWith(height: 1.45),),],),@@ -426,253 +472,134 @@ class _SetUpStep extends StatelessWidget {}}-/// Step 1's door to the download menu: what it does, and for which computers — on the raised-/// ground the menu's own rows stand on.-class _SendButton extends StatelessWidget {- const _SendButton({required this.onTap});+/// A small centred link: faint words, and the part that acts in the terminal's green — "No Harness+/// yet? Get it ›", "Pair computer ›". With no [lead] at all the whole link is the+/// faint words ("Try the sample while you wait").+class _TextLink extends StatelessWidget {+ const _TextLink({+ super.key,+ required this.action,+ required this.onTap,+ this.lead,+ });+ final String? lead;+ final String action;final VoidCallback onTap;- /// `macOS · Linux · Command line`: the menu's computers, read off the menu itself.- static final _kinds = [- ...{for (final platform in kDesktopPlatforms) platform.label},- 'Command line',- ].join(' · ');-@overrideWidget build(BuildContext context) {final tty = Tty.of(context);- return ClipRRect(- borderRadius: BorderRadius.circular(12),- child: ColoredBox(- color: ttyRaised(tty),- child: TtyTap(- key: const ValueKey('set-up-send'),- onTap: onTap,- semanticsLabel: 'Send it to your computer: $_kinds',+ final lead = this.lead;+ return Semantics(+ button: true,+ label: '${lead ?? ''}$action',+ excludeSemantics: true,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () {+ HapticFeedback.selectionClick();+ onTap();+ },+ child: ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 44),child: Padding(- padding: const EdgeInsets.fromLTRB(16, 12, 14, 12),- child: Row(- children: [- Icon(LucideIcons.share300, size: 22, color: tty.faint),- const SizedBox(width: 16),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- 'Send it to your computer',- style: tty.style(- size: TtySize.row,- weight: FontWeight.w600,- ),- ),- const SizedBox(height: 2),- Text(- _kinds,- style: tty.style(color: tty.faint, size: TtySize.meta),- ),- ],- ),- ),- const SizedBox(width: 12),- Icon(LucideIcons.chevronRight300, size: 18, color: tty.faint),- ],- ),- ),- ),- ),- );- }-}--/// The download menu, in its sheet: the website's (autonomous.ai/harness-app), row for row — with-/// a word more on the two Macs. A row SENDS its file (AirDrop to the Mac beside you, or Messages or-/// email to yourself) because a phone cannot install it; the command line is copied.-class _DownloadMenu extends StatefulWidget {- const _DownloadMenu({required this.downloads});-- /// The page's read of the manifest — see `_SetUpComputerPageState._downloads`.- final Future<Map<String, String>> downloads;-- @override- State<_DownloadMenu> createState() => _DownloadMenuState();-}--class _DownloadMenuState extends State<_DownloadMenu> {- bool _copied = false;- Timer? _copiedTimer;-- @override- void dispose() {- _copiedTimer?.cancel();- super.dispose();- }-- /// The share sheet with [platform]'s file: AirDrop straight to the computer beside you, or- /// Messages or email to yourself. Anchored to the row for iPad, where the sheet is a popover.- Future<void> _send(BuildContext row, DesktopPlatform platform) async {- final box = row.findRenderObject() as RenderBox?;- final origin = box == null || !box.attached- ? null- : box.localToGlobal(Offset.zero) & box.size;- final url = (await widget.downloads)[platform.key] ?? kDesktopDownloadUrl;- try {- await SharePlus.instance.share(- ShareParams(- uri: Uri.parse(url),- subject: 'Harness for ${platform.label} (${platform.note})',- sharePositionOrigin: origin,- ),- );- } catch (_) {- // No share sheet came up: the menu stays as it was, and the row can be tapped again.- }- }-- void _copy() {- unawaited(Clipboard.setData(const ClipboardData(text: kCliInstall)));- HapticFeedback.selectionClick();- _copiedTimer?.cancel();- setState(() => _copied = true);- _copiedTimer = Timer(const Duration(seconds: 2), () {- if (mounted) setState(() => _copied = false);- });- }-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- // The sheet's title, as the app's other sheets set theirs; no Cancel — a tap outside it,- // or a drag down, puts it away.- Padding(- padding: const EdgeInsets.fromLTRB(Tty.origin, 14, Tty.origin, 2),- child: Text(- 'Send it to your computer',- style: tty.style(size: TtySize.title, weight: FontWeight.w600),- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(Tty.origin, 0, Tty.origin, 12),- child: Text(- 'AirDrop it to a Mac nearby, or send it to yourself.',- style: tty.style(color: tty.faint, size: TtySize.meta),- ),- ),- Flexible(- child: ListView(- key: const ValueKey('set-up-downloads'),- shrinkWrap: true,- padding: const EdgeInsets.fromLTRB(Tty.origin, 0, Tty.origin, 12),- children: [- DecoratedBox(- decoration: BoxDecoration(- color: ttyRaised(tty),- borderRadius: BorderRadius.circular(12),- ),- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 6),- child: Column(- children: [- for (final platform in kDesktopPlatforms)- Builder(- builder: (row) => _DownloadRow(- icon: platform.icon,- label: platform.label,- note: platform.note,- action: LucideIcons.share300,- actionLabel: 'Send',- onTap: () => unawaited(_send(row, platform)),+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),+ child: Text.rich(+ TextSpan(+ children: [+ if (lead != null) TextSpan(text: lead),+ TextSpan(+ text: action,+ style: lead == null+ ? null+ : tty.style(+ color: tty.green,+ size: TtySize.meta,+ weight: FontWeight.w600,),- ),- _DownloadRow(- icon: LucideIcons.squareTerminal300,- // Not "CLI": the one row a newcomer would have to look up.- label: 'Command line',- note: _copied- ? 'copied'- : 'curl -fsSL …/install.sh | bash',- noteColor: _copied ? tty.green : null,- action: LucideIcons.copy300,- actionLabel: 'Copy',- onTap: _copy,- ),- ],),- ),+ ],),- ],+ textAlign: TextAlign.center,+ style: tty.style(color: tty.faint, size: TtySize.meta),+ ),),),- ],+ ),);}}-/// One row of the menu: its icon, what it is and for which computer, and what a tap does.-class _DownloadRow extends StatelessWidget {- const _DownloadRow({+/// [TtyPrimaryButton]'s shape in the terminal's ink rather than its green: a page's one action when+/// it is not the scan — Send to my computer.+class _SolidButton extends StatefulWidget {+ const _SolidButton({+ super.key,required this.icon,required this.label,- required this.note,- required this.action,- required this.actionLabel,- required this.onTap,- this.noteColor,+ required this.onPressed,});final IconData icon;final String label;- final String note;- final Color? noteColor;- final IconData action;- final String actionLabel;- final VoidCallback onTap;+ final VoidCallback onPressed;++ @override+ State<_SolidButton> createState() => _SolidButtonState();+}++class _SolidButtonState extends State<_SolidButton> {+ bool _down = false;@overrideWidget build(BuildContext context) {final tty = Tty.of(context);+ final fill = _down+ ? Color.alphaBlend(Colors.black.withValues(alpha: 0.14), tty.text)+ : tty.text;return Semantics(button: true,- label: '$actionLabel $label, $note',+ label: widget.label,excludeSemantics: true,child: GestureDetector(behavior: HitTestBehavior.opaque,- onTap: onTap,- child: Padding(- padding: const EdgeInsets.fromLTRB(16, 10, 14, 10),+ onTapDown: (_) => setState(() => _down = true),+ onTapCancel: () => setState(() => _down = false),+ onTapUp: (_) => setState(() => _down = false),+ onTap: () {+ HapticFeedback.lightImpact();+ widget.onPressed();+ },+ child: Container(+ constraints: const BoxConstraints(minHeight: TtyPrimaryButton.height),+ padding: const EdgeInsets.symmetric(+ horizontal: Tty.origin,+ vertical: 10,+ ),+ decoration: BoxDecoration(+ color: fill,+ borderRadius: BorderRadius.circular(6),+ ),+ alignment: Alignment.center,child: Row(+ mainAxisSize: MainAxisSize.min,children: [- Icon(icon, size: 22, color: tty.faint),- const SizedBox(width: 16),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- label,- style: tty.style(- size: TtySize.row,- weight: FontWeight.w600,- ),- ),- const SizedBox(height: 2),- Text(- note,- style: tty.style(- color: noteColor ?? tty.faint,- size: TtySize.meta,- ),- ),- ],+ Icon(widget.icon, size: 20, color: tty.ground),+ const SizedBox(width: 10),+ Flexible(+ child: Text(+ widget.label,+ maxLines: 1,+ softWrap: false,+ overflow: TextOverflow.ellipsis,+ style: tty.style(+ color: tty.ground,+ weight: FontWeight.w600,+ size: TtySize.title,+ ),),),- const SizedBox(width: 12),- Icon(action, size: 18, color: tty.faint),],),),diff --git a/mobile/lib/phone/welcome/unlock_computer.dart b/mobile/lib/phone/welcome/unlock_computer.dartindex d53d8d462..7a6e03b20 100644--- a/mobile/lib/phone/welcome/unlock_computer.dart+++ b/mobile/lib/phone/welcome/unlock_computer.dart@@ -140,11 +140,7 @@ class _UnlockComputerState extends State<UnlockComputer> {final machine = widget.machineState.machine;final pairCode = code.pairCode;if (code.machineId == null || pairCode == null) {- setState(- () => _error =- 'That isn’t an Add Phone code. Open Add Phone… on '- '${machine.displayName} and scan its code.',- );+ setState(() => _error = 'That’s not the Add Phone code.');return;}if (code.machineId != machine.machineId) {diff --git a/mobile/test/connect_computer_test.dart b/mobile/test/connect_computer_test.dartindex 56e72d39b..a92fa62fa 100644--- a/mobile/test/connect_computer_test.dart+++ b/mobile/test/connect_computer_test.dart@@ -44,12 +44,13 @@ class _Links implements PeerLinkClient {Future<String?> unlink(String machineId) async => null;}-/// Setting up a computer from a signed-in phone is the first screen's download menu, plus what only-/// a signed-in phone can do there: watch for the computer, and pair with it by its code.+/// Setting up a computer from a signed-in phone is the first screen's Connect your computer, plus+/// what only a signed-in phone can do there: watch for the computer, and pair with it by its code.void main() {late _Links links;late AppNotifier app;late List<bool> backs;+ late int samples;setUp(() {links = _Links();@@ -63,6 +64,7 @@ void main() {// scanned computer is looked for, and none is on it unless a test says so.app.api = FakeApi();backs = [];+ samples = 0;});tearDown(() => app.dispose());@@ -75,9 +77,11 @@ void main() {home: ConnectComputerPage(notifier: app,onBack: () => backs.add(true),- onTrySample: (_) async => null,+ onTrySample: (_) async {+ samples++;+ return null;+ },scanCamera: const SizedBox(),- loadDownloads: () async => const {},),),);@@ -98,21 +102,38 @@ void main() {await tester.pump(const Duration(seconds: 6));}- testWidgets('the download menu, watching, and the sample to try meanwhile', (+ testWidgets('Connect your computer, watching, and Get it behind it', (tester,) async {await pump(tester);expect(find.byType(SetUpComputerPage), findsOneWidget);- expect(find.textContaining('Waiting for your computer'), findsOneWidget);- expect(find.text('Try the sample ›'), findsOneWidget);+ expect(find.text('Connect your computer'), findsOneWidget);+ expect(find.text('Waiting for your computer…'), findsOneWidget);+ // The sample is Get it's, for somebody waiting on the computer to install — not this page's.+ expect(find.byKey(const ValueKey('get-it-sample')), findsNothing);// The old page's second way of saying all this is gone.expect(find.text('Email me the setup link'), findsNothing);expect(find.textContaining('remote-password'), findsNothing);- // The download menu is step 1's sheet.- expect(find.text('Apple Silicon · M1 or later'), findsNothing);- await tester.tap(find.byKey(const ValueKey('set-up-send')));++ // No Harness yet: the download to send, and the sample to try meanwhile.+ await tester.tap(find.byKey(const ValueKey('set-up-get-it')));+ await tester.pumpAndSettle();+ expect(find.byType(GetHarnessPage), findsOneWidget);+ expect(find.text('For Mac and Linux.'), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey('get-it-sample')));+ await tester.pumpAndSettle();+ expect(samples, 1);++ // Installed: Get it goes, and the camera comes up over this page — not over Get it.+ await tester.tap(find.byKey(const ValueKey('get-it-pair')));+ await tester.pumpAndSettle();+ expect(find.byType(ScanToConnectPage), findsOneWidget);+ expect(find.byType(GetHarnessPage), findsNothing);+ tester.widget<ScanToConnectPage>(find.byType(ScanToConnectPage)).onBack();await tester.pumpAndSettle();- expect(find.text('Apple Silicon · M1 or later'), findsOneWidget);+ expect(find.byType(ScanToConnectPage), findsNothing);+ expect(find.text('Connect your computer'), findsOneWidget);+ expect(backs, isEmpty);await unmount(tester);});diff --git a/mobile/test/first_computer_flow_test.dart b/mobile/test/first_computer_flow_test.dartindex cb916aae5..f4adc3e85 100644--- a/mobile/test/first_computer_flow_test.dart+++ b/mobile/test/first_computer_flow_test.dart@@ -66,7 +66,8 @@ void main() {}await settle();- expect(find.text('Get Harness for\nyour computer'), findsOneWidget);+ expect(find.text('Connect your computer'), findsOneWidget);+ expect(find.text('Waiting for your computer…'), findsOneWidget);// It appears — awake, and waiting for its phone password.const studio = Machine(diff --git a/mobile/test/phone_edge/welcome_behavior_test.dart b/mobile/test/phone_edge/welcome_behavior_test.dartindex 576a26164..ea80a1c86 100644--- a/mobile/test/phone_edge/welcome_behavior_test.dart+++ b/mobile/test/phone_edge/welcome_behavior_test.dart@@ -89,9 +89,6 @@ void main() {if (scanFails) throw StateError('expired');},scanCamera: const SizedBox(),- loadDownloads: () async => const {- 'desktop-macos-arm64-dmg': 'https://example.com/harness.dmg',- },),),);@@ -99,13 +96,20 @@ void main() {return (app: app, sent: sent, scans: scans);}+ /// Pair computer, then the camera's "Can’t scan?" sheet, then its email.+ Future<void> toEmail(WidgetTester tester) async {+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));+ await frames(tester);+ await tester.tap(find.text('Can’t scan? Sign in another way'));+ await frames(tester);+ await tester.tap(find.text('Continue with email'));+ await frames(tester);+ }+testWidgets('a wrong email, then a short code, then a wrong one, then the ''right one', (tester) async {final (:app, :sent, scans: _) = await welcome(tester);- await tester.tap(find.text('Yes — scan to connect'));- await frames(tester);- await tester.tap(find.text('Use email instead'));- await frames(tester);+ await toEmail(tester);await tester.enterText(find.byType(TextField), 'not-an-email');await tester.tap(find.text('Send code'));@@ -139,13 +143,17 @@ void main() {await frames(tester);expect(sent, hasLength(2));- // Change email, then Back all the way out.+ // Change email, then Back all the way out: the camera the email was chosen over, then the+ // first screen.await tester.tap(find.text('Change email'));await frames(tester);expect(find.text('Your email'), findsOneWidget);await tester.binding.handlePopRoute();await frames(tester);- expect(find.text('Yes — scan to connect'), findsOneWidget);+ expect(find.text('Scan the code on your computer'), findsOneWidget);+ await tester.binding.handlePopRoute();+ await frames(tester);+ expect(find.text('Connect your computer'), findsOneWidget);await close(tester, app);});@@ -153,10 +161,7 @@ void main() {tester,) async {final (:app, sent: _, scans: _) = await welcome(tester);- await tester.tap(find.text('Yes — scan to connect'));- await frames(tester);- await tester.tap(find.text('Use email instead'));- await frames(tester);+ await toEmail(tester);await tester.enterText(find.byType(TextField), '[email protected]');await tester.testTextInput.receiveAction(TextInputAction.go);await frames(tester);@@ -166,32 +171,34 @@ void main() {await close(tester, app);});- testWidgets('set up first, then scan from there, then back', (+ testWidgets('Get it first, then Pair computer from there, then back', (tester,) async {final (:app, sent: _, scans: _) = await welcome(tester);- await tester.tap(find.text('Not yet — set it up'));+ await tapInView(tester, find.byKey(const ValueKey('set-up-get-it')));await frames(tester);- await tapInView(tester, find.text('Scan to connect'));+ await tapInView(tester, find.byKey(const ValueKey('get-it-pair')));await frames(tester);expect(find.text('Scan the code on your computer'), findsOneWidget);- // Back from the camera is the steps it was opened from, and back from those the question.+ // Back from the camera is Get it, where it was opened, and back from that the first screen.await tester.tap(find.bySemanticsLabel(RegExp('Back')).first);await frames(tester);- expect(find.text('Get Harness for\nyour computer'), findsOneWidget);+ expect(find.text('Get Harness on your computer'), findsOneWidget);await tester.tap(find.bySemanticsLabel(RegExp('Back')).first);await frames(tester);- expect(find.text('Yes — scan to connect'), findsOneWidget);+ expect(find.text('Connect your computer'), findsOneWidget);await close(tester, app);});- testWidgets('the visible sample action leads back to setup', (- tester,- ) async {+ testWidgets('the sample, on Get it, leads back to Get it', (tester) async {final (:app, sent: _, scans: _) = await welcome(tester, sample: 'set-up');- await tester.tap(find.text('Try the sample'));+ // Not on the first screen: it is for somebody waiting on the computer to install.+ expect(find.text('Try the sample while you wait'), findsNothing);+ await tapInView(tester, find.byKey(const ValueKey('set-up-get-it')));await frames(tester);- expect(find.text('Get Harness for\nyour computer'), findsOneWidget);+ await tapInView(tester, find.text('Try the sample while you wait'));+ await frames(tester);+ expect(find.text('Get Harness on your computer'), findsOneWidget);await close(tester, app);});});@@ -257,12 +264,11 @@ void main() {if (fails) throw StateError('expired');},scanCamera: const SizedBox(),- loadDownloads: () async => const {},),),);await frames(tester);- await tester.tap(find.text('Yes — scan to connect'));+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));await frames(tester);tester.widget<ScanToConnectPage>(find.byType(ScanToConnectPage))@@ -285,10 +291,10 @@ void main() {});});- // The old page (email the steps, a Terminal/Mac tab, four commands) is the set-up page now,- // plus a sample to try while waiting — see connect_computer_test.dart for the signed-in half.+ // The old page (email the steps, a Terminal/Mac tab, four commands) is Connect your computer+ // now, with the sample on Get it — see connect_computer_test.dart for the signed-in half.testWidgets(- 'set up your computer: the download menu, and the sample while you wait',+ 'set up your computer: Get it, and the sample while you wait',(tester) async {setPhone(tester, largePhone);final app = edgeApp(noMachines: true);@@ -299,47 +305,38 @@ void main() {notifier: app,signedIn: false,onTrySample: (_) async => samples++,- loadDownloads: () async => const {},),),);await frames(tester);- expect(find.text('Send it to your computer'), findsOneWidget);+ expect(find.text('Connect your computer'), findsOneWidget);+ // Not watching: nothing says it is waiting for the computer.+ expect(find.text('Waiting for your computer…'), findsNothing);expect(find.text('Email me the setup link'), findsNothing);- await tapInView(tester, find.text('Try the sample ›'));+ await tapInView(tester, find.byKey(const ValueKey('set-up-get-it')));+ await frames(tester);+ await tapInView(tester, find.text('Try the sample while you wait'));await frames(tester);expect(samples, 1);await close(tester, app);},);- testWidgets('the set-up page: send the app, copy the CLI, see how it works', (+ testWidgets('Get it: the download page goes to the share sheet', (tester,) async {setPhone(tester, largePhone);await tester.pumpWidget(phoneApp(Scaffold(- body: SetUpComputerPage(- onScan: () {},- onBack: () {},- loadDownloads: () async => const {},- ),+ body: GetHarnessPage(onBack: () {}, onPair: () {}),),),);await frames(tester);- // The download menu is step 1's sheet.- await tester.tap(find.byKey(const ValueKey('set-up-send')));+ await tester.tap(find.byKey(const ValueKey('get-it-send')));await frames(tester);- await tester.tap(find.text('Apple Silicon · M1 or later'));- await frames(tester);- expect(platformCalls.where((call) => call.contains('share')), isNotEmpty);- await tester.tap(find.text('Command line'));- await tester.pump();- expect(find.text('copied'), findsOneWidget);- await tester.pump(const Duration(seconds: 3));- expect(find.text('copied'), findsNothing);+ expect(platformCalls.where((call) => call.contains('share')), hasLength(1));await tester.pumpWidget(const SizedBox());await tester.pump(const Duration(seconds: 3));});diff --git a/mobile/test/phone_edge/welcome_layout_test.dart b/mobile/test/phone_edge/welcome_layout_test.dartindex 2280ee0e2..c3c8289dd 100644--- a/mobile/test/phone_edge/welcome_layout_test.dart+++ b/mobile/test/phone_edge/welcome_layout_test.dart@@ -20,8 +20,8 @@ import 'edge_fixture.dart';/// phone, scale and brightness, with an account and a computer whose names are long. None may/// report an overflow.///-/// ⚠️ Nothing here reaches anything real: the downloads manifest, the camera, the account service-/// and the computer are all stand-ins, and no screen is left up long enough for a poll to fire.+/// ⚠️ Nothing here reaches anything real: the camera, the account service and the computer are all+/// stand-ins, and no screen is left up long enough for a poll to fire.void main() {setUpAll(loadRealFontsIfAsked);@@ -46,7 +46,6 @@ void main() {),signInWithScan: (_) async {},scanCamera: const SizedBox(),- loadDownloads: () async => const {},);testWidgets('the first screen', (tester) async {@@ -54,18 +53,24 @@ void main() {final app = edgeApp(noMachines: true);addTearDown(app.dispose);await pump(tester, welcome(app), scale, brightness);- expect(find.text('Yes — scan to connect'), findsOneWidget);+ expect(find.text('Connect your computer'), findsOneWidget);+ await tester.drag(find.byType(ListView), const Offset(0, -2000));+ await frames(tester);});});- testWidgets('scan, then email, then a code that fails', (tester) async {+ testWidgets('scan, the other ways, then email, then a code that fails', (+ tester,+ ) async {await expectNoLayoutErrors(tester, (scale, brightness) async {final app = edgeApp(noMachines: true);addTearDown(app.dispose);await pump(tester, welcome(app), scale, brightness);- await tapInView(tester, find.text('Yes — scan to connect'));+ await tapInView(tester, find.byKey(const ValueKey('set-up-scan')));+ await frames(tester);+ await tapInView(tester, find.text('Can’t scan? Sign in another way'));await frames(tester);- await tapInView(tester, find.text('Use email instead'));+ await tapInView(tester, find.text('Continue with email'));await frames(tester);await tester.enterText(find.byType(TextField),@@ -84,13 +89,14 @@ void main() {});});- testWidgets('the set-up page', (tester) async {+ testWidgets('Get it', (tester) async {await expectNoLayoutErrors(tester, (scale, brightness) async {final app = edgeApp(noMachines: true);addTearDown(app.dispose);await pump(tester, welcome(app), scale, brightness);- await tapInView(tester, find.text('Not yet — set it up'));+ await tapInView(tester, find.byKey(const ValueKey('set-up-get-it')));await frames(tester);+ expect(find.text('Get Harness on your computer'), findsOneWidget);await tester.drag(find.byType(ListView), const Offset(0, -2000));await frames(tester);});@@ -135,7 +141,6 @@ void main() {notifier: app,onBack: () {},onTrySample: (_) async => null,- loadDownloads: () async => const {},),scale,brightness,diff --git a/mobile/test/phone_welcome_first_screen_test.dart b/mobile/test/phone_welcome_first_screen_test.dartindex 8e4ca4599..84c31d3b4 100644--- a/mobile/test/phone_welcome_first_screen_test.dart+++ b/mobile/test/phone_welcome_first_screen_test.dart@@ -5,16 +5,16 @@ import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness_mobile/auth/auth_session.dart';import 'package:harness_mobile/core/config.dart';+import 'package:harness_mobile/phone/tty_controls.dart';import 'package:harness_mobile/phone/welcome/connect_code.dart';import 'package:harness_mobile/phone/welcome/phone_welcome.dart';import 'package:harness_mobile/phone/welcome/scan_to_connect.dart';import 'package:harness_mobile/phone/welcome/set_up_computer.dart';import 'package:harness_mobile/state/app_state.dart';-import 'viewer/fake_http.dart';--/// The first screen: what Harness is, one question, and its two answers — scan the code the-/// desktop app shows, or get Harness onto the computer.+/// The first screen: Connect your computer — one button, Pair computer, that scans the code the+/// desktop app shows; Get it behind it for a computer with no Harness yet; and the other ways to sign+/// in behind the camera's "Can’t scan?".void main() {group('ConnectCode', () {test('reads the desktop app\'s link, all of it in the fragment', () {@@ -73,11 +73,20 @@ void main() {});tearDown(() => notifier.dispose());- Future<void> pump(WidgetTester tester, {Widget? camera}) async {+ Future<void> pump(+ WidgetTester tester, {+ Widget? camera,+ Future<Object?> Function(BuildContext context)? onTrySample,+ }) async {+ // A phone's height, so the whole page is on screen.+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(430, 1400);+ addTearDown(tester.view.reset);await tester.pumpWidget(MaterialApp(home: PhoneWelcome(notifier: notifier,+ onTrySample: onTrySample,sendCode: (email) async => sent.add(email),signIn: (_, _) async {},signInWithScan: (code) async {@@ -86,146 +95,107 @@ void main() {if (scanFails case final error?) throw error;},scanCamera: camera ?? const SizedBox(),- loadDownloads: () async => const {},),),);await tester.pump();}- testWidgets('one question, two answers, and nothing else', (tester) async {- await pump(tester);- expect(find.text('Is Harness on your computer?'), findsOneWidget);- expect(find.text('Yes — scan to connect'), findsOneWidget);- expect(find.text('Not yet — set it up'), findsOneWidget);+ Future<void> pairComputer(WidgetTester tester) async {+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));+ await tester.pump();+ expect(find.byType(ScanToConnectPage), findsOneWidget);+ }++ ScanToConnectPage camera(WidgetTester tester) =>+ tester.widget<ScanToConnectPage>(find.byType(ScanToConnectPage));++ Future<void> openOtherWays(WidgetTester tester) async {+ await tester.tap(find.text('Can’t scan? Sign in another way'));+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('welcome-other-ways-title')), findsOneWidget);+ }++ testWidgets('one button, how it works, Get it, and nothing else', (+ tester,+ ) async {+ await pump(tester, onTrySample: (_) async => null);+ expect(find.text('Connect your computer'), findsOneWidget);+ expect(find.text('Pair computer'), findsOneWidget);+ for (final line in [+ 'Open Add Phone on your computer',+ kAddPhoneWhere,+ 'Scan its code',+ 'You’re connected',+ ]) {+ expect(find.text(line), findsOneWidget, reason: line);+ }+ expect(find.byKey(const ValueKey('set-up-get-it')), findsOneWidget);+ // The accounts are behind the camera's "Can’t scan?", and the sample behind Get it.+ expect(find.text('Continue with Google'), findsNothing);expect(find.text('Continue with email'), findsNothing);- expect(find.text('Try it first'), findsNothing);+ expect(find.byKey(const ValueKey('get-it-sample')), findsNothing);+ expect(find.text('Is Harness on your computer?'), findsNothing);});testWidgets(- 'not yet: three steps, the website\'s download menu in step 1, each row sent to the computer',+ 'Get it: the download page, sent to the computer, then back to Pair computer',(tester) async {- // A phone's height, so the whole page is on screen.- tester.view.devicePixelRatio = 1;- tester.view.physicalSize = const Size(430, 1400);- addTearDown(tester.view.reset);- await pump(tester);- await tester.tap(find.text('Not yet — set it up'));- await tester.pump();- expect(find.byType(SetUpComputerPage), findsOneWidget);- for (final line in [- 'Install Harness on your computer.',- 'Open it, and sign in with Google or Apple.',- 'Open Add Phone… and scan its code.',- 'Scan to connect',- ]) {- expect(find.text(line), findsOneWidget, reason: line);- }- expect(- find.textContaining('harness.autonomous.ai/desktop'),- findsOneWidget,- );-- // Step 1's button opens the menu, row for row.- expect(find.text('macOS · Linux · Command line'), findsOneWidget);- expect(find.text('curl -fsSL …/install.sh | bash'), findsNothing);- await tester.tap(find.byKey(const ValueKey('set-up-send')));- await tester.pumpAndSettle();- for (final row in [- 'Apple Silicon · M1 or later',- 'Intel · older Macs',- 'Intel/AMD · Ubuntu, Omarchy and more',- 'ARM · Raspberry Pi, ARM servers',- 'curl -fsSL …/install.sh | bash',- ]) {- expect(find.text(row), findsOneWidget, reason: row);- }- expect(find.text('macOS'), findsNWidgets(2));- expect(find.text('Linux'), findsNWidgets(2));- expect(find.text('Command line'), findsOneWidget);-- // The CLI row copies the website's command, and says so.- String? copied;+ String? shared;tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(- SystemChannels.platform,+ const MethodChannel('dev.fluttercommunity.plus/share'),(call) async {- if (call.method == 'Clipboard.setData') {- copied = (call.arguments as Map)['text'] as String?;- }- return null;+ shared = (call.arguments as Map)['uri'] as String?;+ return 'dev.fluttercommunity.plus/share/dismissed';},);addTearDown(() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(- SystemChannels.platform,+ const MethodChannel('dev.fluttercommunity.plus/share'),null,),);- await tester.tap(find.text('curl -fsSL …/install.sh | bash'));+ await pump(tester);+ await tester.tap(find.byKey(const ValueKey('set-up-get-it')));await tester.pump();- expect(copied, kCliInstall);+ expect(find.byType(GetHarnessPage), findsOneWidget);+ expect(find.text('Get Harness on your computer'), findsOneWidget);+ expect(find.text('For Mac and Linux.'), findsOneWidget);expect(- kCliInstall,- 'curl -fsSL https://harness.autonomous.ai/cli/install.sh | bash',+ find.textContaining('harness.autonomous.ai/desktop'),+ findsOneWidget,);- expect(find.text('copied'), findsOneWidget);- await tester.pump(const Duration(seconds: 2));- expect(find.text('copied'), findsNothing);+ // No sample to offer, no link to it.+ expect(find.byKey(const ValueKey('get-it-sample')), findsNothing);- // A tap above the sheet puts it away, onto the steps.- await tester.tapAt(const Offset(215, 40));- await tester.pumpAndSettle();- expect(find.text('curl -fsSL …/install.sh | bash'), findsNothing);+ // The page goes, not a file: the computer's browser picks its own download.+ await tester.tap(find.byKey(const ValueKey('get-it-send')));+ await tester.pump();+ await tester.pump();+ expect(shared, kDesktopDownloadUrl);+ expect(kDesktopDownloadUrl, 'https://harness.autonomous.ai/desktop');- // Back is the first screen.+ // Installed: the camera, and back from it is Get it, and back from that the first screen.+ await tester.tap(find.byKey(const ValueKey('get-it-pair')));+ await tester.pump();+ expect(find.byType(ScanToConnectPage), findsOneWidget);await tester.tap(find.bySemanticsLabel('Back'));await tester.pump();- expect(find.text('Is Harness on your computer?'), findsOneWidget);+ expect(find.byType(GetHarnessPage), findsOneWidget);+ await tester.tap(find.bySemanticsLabel('Back'));+ await tester.pump();+ expect(find.text('Connect your computer'), findsOneWidget);},);- test('each row\'s file comes from the desktop release manifest', () async {- final manifest = FakeHttp({- kDesktopManifestUrl: (- status: 200,- body: {- 'desktop-macos-arm64-dmg': {- 'version': '1.2.6',- 'url': 'https://cdn.autonomous.ai/harness/desktop/1.2.6/Harness-macos-arm64.dmg',- },- 'desktop-linux-x64': {- 'url': 'https://cdn.example/Harness-linux-x64.AppImage',- },- 'broken': 'not an entry',- },- ),- });- final downloads = await loadDesktopDownloads(dio: manifest.dio());- expect(downloads, {- 'desktop-macos-arm64-dmg': 'https://cdn.autonomous.ai/harness/desktop/1.2.6/Harness-macos-arm64.dmg',- 'desktop-linux-x64': 'https://cdn.example/Harness-linux-x64.AppImage',- });- // Every row names a key the manifest publishes.- expect(kDesktopPlatforms.map((p) => p.key), [- 'desktop-macos-arm64-dmg',- 'desktop-macos-dmg',- 'desktop-linux-x64',- 'desktop-linux-arm64',- ]);- // Offline: no files, and every row falls back to the download page.- expect(await loadDesktopDownloads(dio: FakeHttp({}).dio()), isEmpty);- });-testWidgets('a scanned code fills in the account and sends its code', (tester,) async {await pump(tester);- await tester.tap(find.text('Yes — scan to connect'));- await tester.pump();- final page = tester.widget<ScanToConnectPage>(- find.byType(ScanToConnectPage),- );- page.onCode(ConnectCode.parse(ConnectCode.link('[email protected]'))!);+ await pairComputer(tester);+ camera(+ tester,+ ).onCode(ConnectCode.parse(ConnectCode.link('[email protected]'))!);await tester.pump();await tester.pump();expect(sent, ['[email protected]']);@@ -238,12 +208,8 @@ void main() {(tester) async {scanGate = Completer<void>();await pump(tester);- await tester.tap(find.text('Yes — scan to connect'));- await tester.pump();- final page = tester.widget<ScanToConnectPage>(- find.byType(ScanToConnectPage),- );- page.onCode(+ await pairComputer(tester);+ camera(tester).onCode(ConnectCode.parse(ConnectCode.link(@@ -255,6 +221,18 @@ void main() {);await tester.pump();expect(find.text('Signing in…'), findsOneWidget);+ // Not while the scan signs in: the other way would start a second.+ expect(+ tester+ .widget<TtyTextButton>(+ find.widgetWithText(+ TtyTextButton,+ 'Can’t scan? Sign in another way',+ ),+ )+ .onPressed,+ isNull,+ );scanGate!.complete();await tester.pump();expect(scanned, ['hnh_one']);@@ -269,15 +247,12 @@ void main() {) async {scanFails = Exception('That code has expired. Scan the new one.');await pump(tester);- await tester.tap(find.text('Yes — scan to connect'));- await tester.pump();- tester- .widget<ScanToConnectPage>(find.byType(ScanToConnectPage))- .onCode(- ConnectCode.parse(- ConnectCode.link('[email protected]', signIn: 'hnh_old'),- )!,- );+ await pairComputer(tester);+ camera(tester).onCode(+ ConnectCode.parse(+ ConnectCode.link('[email protected]', signIn: 'hnh_old'),+ )!,+ );await tester.pump();await tester.pump();await tester.pump();@@ -286,12 +261,89 @@ void main() {expect(find.text('Check your email'), findsOneWidget);});- testWidgets('no code at hand: email instead', (tester) async {+ testWidgets('can’t scan: the other ways, in a sheet over the camera', (+ tester,+ ) async {await pump(tester);- await tester.tap(find.text('Yes — scan to connect'));+ await pairComputer(tester);+ await openOtherWays(tester);+ expect(find.text('Continue with Google'), findsOneWidget);+ expect(find.text('Continue with Apple'), findsOneWidget);+ await tester.tap(find.text('Continue with email'));+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('welcome-other-ways-title')), findsNothing);+ expect(find.text('Your email'), findsOneWidget);+ // Back from the email is the camera it was chosen over.+ await tester.binding.handlePopRoute();+ await tester.pumpAndSettle();+ expect(find.byType(ScanToConnectPage), findsOneWidget);+ });++ testWidgets('a code read under the sheet takes it down and signs in', (+ tester,+ ) async {+ await pump(tester);+ await pairComputer(tester);+ await openOtherWays(tester);+ // The camera runs on under the sheet.+ camera(tester).onCode(+ ConnectCode.parse(+ ConnectCode.link(+ '[email protected]',+ machineId: 'mac',+ pairCode: 'K7QM4XPT9D2W',+ signIn: 'hnh_one',+ ),+ )!,+ );+ await tester.pumpAndSettle();+ expect(find.byKey(const ValueKey('welcome-other-ways-title')), findsNothing);+ expect(scanned, ['hnh_one']);+ expect(sent, isEmpty);+ expect(notifier.pendingPairing, (machineId: 'mac', code: 'K7QM4XPT9D2W'));+ });++ testWidgets(+ 'a computer\'s own sign-in QR read under the sheet: the sheet goes, then sign in first',+ (tester) async {+ await pump(tester);+ await pairComputer(tester);+ await openOtherWays(tester);+ final code = 'hnq_${'a' * 43}';+ camera(tester).onSignInCode!(SignInCode(code));+ await tester.pumpAndSettle();+ expect(+ find.byKey(const ValueKey('welcome-other-ways-title')),+ findsNothing,+ );+ expect(+ find.byKey(const ValueKey('welcome-sign-in-first')),+ findsOneWidget,+ );+ expect(notifier.pendingComputerSignIn, code);+ // Back is the camera, and the computer's code is let go there.+ await tester.binding.handlePopRoute();+ await tester.pumpAndSettle();+ expect(find.byType(ScanToConnectPage), findsOneWidget);+ expect(notifier.pendingComputerSignIn, isNull);+ },+ );++ testWidgets('the sample, from Get it, comes back to Get it', (tester) async {+ var samples = 0;+ await pump(+ tester,+ onTrySample: (_) async {+ samples++;+ return 'set-up';+ },+ );+ await tester.tap(find.byKey(const ValueKey('set-up-get-it')));await tester.pump();- await tester.tap(find.text('Use email instead'));+ await tester.tap(find.byKey(const ValueKey('get-it-sample')));await tester.pump();- expect(find.text('Your email'), findsOneWidget);+ await tester.pump();+ expect(samples, 1);+ expect(find.byType(GetHarnessPage), findsOneWidget);});}diff --git a/mobile/test/render/phone_screens_render_test.dart b/mobile/test/render/phone_screens_render_test.dartindex b18984336..aca74142d 100644--- a/mobile/test/render/phone_screens_render_test.dart+++ b/mobile/test/render/phone_screens_render_test.dart@@ -372,22 +372,35 @@ void main() {sendCode: (_) async {},signIn: (_, _) async {},scanCamera: const SizedBox(),- loadDownloads: () async => const {},);+ /// Pair computer, then the camera's "Can’t scan?": the other ways to sign in, in a sheet.+ Future<void> otherWays(WidgetTester tester) async {+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));+ await tester.pump(const Duration(milliseconds: 300));+ await tester.tap(find.text('Can’t scan? Sign in another way'));+ await tester.pump(const Duration(milliseconds: 300));+ await tester.pump(const Duration(milliseconds: 300));+ }+testWidgets('welcome, scan', skip: skip, (tester) async {final key = await pumpScreen(tester, welcome());- await tester.tap(find.text('Yes — scan to connect'));+ await tester.tap(find.byKey(const ValueKey('set-up-scan')));await tester.pump(const Duration(milliseconds: 300));// [shoot] takes the screen down after it: one capture per test.await shoot(tester, key, '0a-welcome-scan');});+ testWidgets('welcome, other ways', skip: skip, (tester) async {+ final key = await pumpScreen(tester, welcome());+ await otherWays(tester);+ await shoot(tester, key, '0a-welcome-other-ways');+ });+testWidgets('welcome, email', skip: skip, (tester) async {final key = await pumpScreen(tester, welcome());- await tester.tap(find.text('Yes — scan to connect'));- await tester.pump(const Duration(milliseconds: 300));- await tester.tap(find.text('Use email instead'));+ await otherWays(tester);+ await tester.tap(find.text('Continue with email'));await tester.pump(const Duration(milliseconds: 300));await tester.enterText(find.byKey(const Key('welcome-email')).last,@@ -408,9 +421,8 @@ void main() {scanCamera: const SizedBox(),),);- await tester.tap(find.text('Yes — scan to connect'));- await tester.pump(const Duration(milliseconds: 300));- await tester.tap(find.text('Use email instead', findRichText: true));+ await otherWays(tester);+ await tester.tap(find.text('Continue with email'));await tester.pump(const Duration(milliseconds: 300));await tester.enterText(find.byType(TextField), '[email protected]');await tester.tap(find.text('Send code'));@@ -426,30 +438,28 @@ void main() {ConnectComputerPage(notifier: notifier,onTrySample: (_) async => null,- loadDownloads: () async => const {},),);await shoot(tester, key, '0d-connect-computer');});- testWidgets('set up, download menu', skip: skip, (tester) async {+ testWidgets('get it', skip: skip, (tester) async {final key = await pumpScreen(tester,Builder(builder: (context) => Scaffold(backgroundColor: Tty.of(context).ground,body: SafeArea(- child: SetUpComputerPage(- onScan: () {},+ child: GetHarnessPage(onBack: () {},+ onPair: () {},onTrySample: () {},- loadDownloads: () async => const {},),),),),);- await shoot(tester, key, '0e-set-up');+ await shoot(tester, key, '0e-get-it');});void addOtherComputers() {diff --git a/mobile/test/unlock_by_scan_test.dart b/mobile/test/unlock_by_scan_test.dartindex 1cc262848..22e0ff803 100644--- a/mobile/test/unlock_by_scan_test.dart+++ b/mobile/test/unlock_by_scan_test.dart@@ -133,9 +133,8 @@ void main() {expect(links.codes, isEmpty);expect(unlocked, isEmpty);// Says what to scan instead: the computer's own Add Phone code.- expect(find.textContaining('isn’t an Add Phone code'), findsOneWidget);expect(- find.textContaining('Open Add Phone… on studio and scan its code.'),+ find.textContaining('That’s not the Add Phone code.'),findsOneWidget,);});