Skip to content

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.

feat(mobile): show welcome message in place of the headline

tony4a3aa7ed7647
diff --git a/mobile/lib/phone/welcome/onboarding_frame.dart b/mobile/lib/phone/welcome/onboarding_frame.dart
index 09cff0d6e..a21dfd8ea 100644
--- a/mobile/lib/phone/welcome/onboarding_frame.dart
+++ b/mobile/lib/phone/welcome/onboarding_frame.dart
@@ -11,9 +11,9 @@ import 'set_up_computer.dart' show StepsTimeline, goToSteps;
/// which every screen after signing in shares (its wait, and the computer joining), so the picture
/// stays put from one to the next.
enum OnboardingLayout {
- /// ① A headline of up to three lines and, under it, the status's two — why a sign-in did not
- /// finish, why the phone was signed out; the two accounts and, under them, one quiet line —
- /// Continue with email · QR code, or Cancel in their place — at the foot.
+ /// ① A headline of up to three lines — or, in its place while it is up, the status's two: why a
+ /// sign-in did not finish, why the phone was signed out; the two accounts and, under them, one
+ /// quiet line — Continue with email · QR code, or Cancel in their place — at the foot.
welcome,
/// ② The headline, the link and the steps on the computer under it — "Not you? Sign out" under
@@ -30,7 +30,7 @@ enum OnboardingLayout {
///
/// Manage all your agents on all headline: 22pt mono semibold, up to three lines
/// your computers from your phone. [underHeadline] — ②'s link and steps
-/// ⇥ You were signed out. Sign in… status, on ① — left, under the headline
+/// ⇥ You were signed out. Sign in… status, on ① — in the headline's place while it is up
///
/// ┌──────────────────┐
/// │ picture │ the middle, the same place on every screen of a [layout]
@@ -76,8 +76,9 @@ class OnboardingFrame extends StatelessWidget {
/// The picture, laid out in the middle at its own 320 × 300 proportions.
final Widget picture;
- /// One centred line under the picture ([OnboardingStatus]) — on the welcome, under the headline
- /// instead, where what it says is read first. Its room is kept whether it is up or not.
+ /// One centred line under the picture ([OnboardingStatus]) — on the welcome, in the headline's
+ /// place instead while it is up (owner, 2026-10-14): what it says is what to read first, and the
+ /// headline comes back as it goes.
final Widget? status;
/// The foot: the accounts and the quiet line under them.
@@ -123,13 +124,13 @@ class OnboardingFrame extends StatelessWidget {
final quiet = math.max(44.0, scaler.scale(quietSize) * 1.45);
// Room for two lines of status: a sign-in's failure can run to a second.
final statusRow = 2 * scaler.scale(quietSize) * 1.45;
- // ① says it under the headline; ② under the picture.
- final statusUnderHeadline = layout == OnboardingLayout.welcome;
+ // ① says it in the headline's place; ② under the picture.
+ final statusInHeadline = layout == OnboardingLayout.welcome;
final (head, foot) = switch (layout) {
- // The headline's three lines and the status's two; the two accounts and the quiet line under
- // them.
+ // The headline's three lines, or the status's two in their place; the two accounts and the
+ // quiet line under them.
OnboardingLayout.welcome => (
- 3 * line + _statusGap + statusRow,
+ math.max(3 * line, statusRow),
2 * button + 2 * _buttonGap + quiet + 8,
),
// Two lines of headline, the link and the steps; one quiet line.
@@ -143,7 +144,7 @@ class OnboardingFrame extends StatelessWidget {
quiet + 8,
),
};
- final underPicture = statusUnderHeadline ? 0.0 : 10 + statusRow;
+ final underPicture = statusInHeadline ? 0.0 : 10 + statusRow;
return LayoutBuilder(
builder: (context, box) {
@@ -177,7 +178,7 @@ class OnboardingFrame extends StatelessWidget {
),
),
),
- if (status case final status? when !statusUnderHeadline)
+ if (status case final status? when !statusInHeadline)
Positioned(
left: side,
right: side,
@@ -192,7 +193,7 @@ class OnboardingFrame extends StatelessWidget {
headline: headline,
headlineKey: headlineKey,
under: underHeadline,
- status: statusUnderHeadline ? status : null,
+ status: statusInHeadline ? status : null,
),
),
if (actions case final actions?)
@@ -208,9 +209,6 @@ class OnboardingFrame extends StatelessWidget {
}
static const double _underGap = 23;
-
- /// ①'s status under the headline: the gap above it.
- static const double _statusGap = 14;
static const double _buttonGap = 10;
}
@@ -292,7 +290,8 @@ class OnboardingStage extends StatelessWidget {
}
/// The headline, and what goes under it, changing together: the new words rise 8pt into place as
-/// the old fade. The welcome's [status] under them comes and goes on its own, the headline still.
+/// the old fade. The welcome's [status] takes their place the same way while it is up, and gives
+/// it back to the headline as it goes.
class _Words extends StatelessWidget {
const _Words({
required this.headline,
@@ -310,7 +309,7 @@ class _Words extends StatelessWidget {
Widget build(BuildContext context) {
final tty = Tty.of(context);
final still = MediaQuery.maybeDisableAnimationsOf(context) ?? false;
- final words = AnimatedSwitcher(
+ return AnimatedSwitcher(
duration: Duration(milliseconds: still ? 200 : 250),
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeIn,
@@ -331,39 +330,34 @@ class _Words extends StatelessWidget {
),
),
),
- child: Column(
- key: ValueKey(headline),
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.min,
- children: [
- Semantics(
- header: true,
- child: Text(
- headline,
- key: headlineKey,
- maxLines: 3,
- overflow: TextOverflow.ellipsis,
- style: OnboardingFrame.headlineStyle(tty),
+ child: switch (status) {
+ // Its own key whatever it says: one message giving way to another is not a new screen.
+ final status? => KeyedSubtree(
+ key: const ValueKey(#status),
+ child: status,
+ ),
+ null => Column(
+ key: ValueKey(headline),
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Semantics(
+ header: true,
+ child: Text(
+ headline,
+ key: headlineKey,
+ maxLines: 3,
+ overflow: TextOverflow.ellipsis,
+ style: OnboardingFrame.headlineStyle(tty),
+ ),
),
- ),
- if (under case final under?) ...[
- const SizedBox(height: OnboardingFrame._underGap),
- under,
+ if (under case final under?) ...[
+ const SizedBox(height: OnboardingFrame._underGap),
+ under,
+ ],
],
- ],
- ),
- );
- // One column whether the status is up or not, so the headline is not built anew as it comes.
- return Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.min,
- children: [
- words,
- if (status case final status?) ...[
- const SizedBox(height: OnboardingFrame._statusGap),
- status,
- ],
- ],
+ ),
+ },
);
}
}
diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dart
index 9de0a5505..9ffc989b2 100644
--- a/mobile/lib/phone/welcome/phone_welcome.dart
+++ b/mobile/lib/phone/welcome/phone_welcome.dart
@@ -55,9 +55,12 @@ import 'sign_in_provider_button.dart';
/// No sample, no "Is Harness on your computer?", no tips.
///
/// ⚠️ **The foot never changes height.** While an account's page is up, the line of lesser ways in
-/// under the buttons becomes Cancel; why it did not finish is said under the headline, in room
-/// kept for it — so the picture, in the same place on every onboarding screen ([OnboardingFrame]),
-/// never moves for it.
+/// under the buttons becomes Cancel; why it did not finish is said in the headline's place — so the
+/// picture, in the same place on every onboarding screen ([OnboardingFrame]), never moves for it.
+///
+/// ⚠️ **A message takes the headline's place** (owner, 2026-10-14): why the phone was signed out,
+/// why a sign-in did not finish, what to do next. Pressing any way in — Google, Apple, Continue
+/// with email, QR code — lets it go, and the headline comes back.
class PhoneWelcome extends StatefulWidget {
const PhoneWelcome({
super.key,
@@ -97,9 +100,13 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
String? _error;
- /// A line under the headline that is neither a failure nor a sign-out: what to do next.
+ /// A line in the headline's place that is neither a failure nor a sign-out: what to do next.
String? _notice;
+ /// A way in was pressed: the sign-out's reason has been read, and gives the headline back for
+ /// good. Kept here, not cleared on the notifier, which says why the phone was signed out.
+ bool _reasonRead = false;
+
int _resendIn = 0;
Timer? _resendTimer;
@@ -117,10 +124,15 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
}
/// "Continue with Google / Apple": the account's own sign-in page, in the app. Its failure is
- /// said under the headline; a cancel says nothing ([AppNotifier.signInWithProvider]).
+ /// said in the headline's place; a cancel says nothing ([AppNotifier.signInWithProvider]).
Future<void> _signInWith(SignInProvider provider) async {
if (widget.notifier.signingIn) return;
- setState(() => _error = null);
+ // A way in pressed: whatever was said lets the headline back.
+ setState(() {
+ _error = null;
+ _notice = null;
+ _reasonRead = true;
+ });
try {
await widget.notifier.signInWithProvider(provider);
} catch (e) {
@@ -347,7 +359,7 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
key: const ValueKey('welcome-notice'),
icon: LucideIcons.monitorSmartphone300,
),
- (null, null, final reason?) => _Said(reason),
+ (null, null, final reason?) when !_reasonRead => _Said(reason),
_ => null,
},
actions: _Accounts(
@@ -357,8 +369,15 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {
waitingOn: notifier.signInProvider,
entering: entering,
onCancel: notifier.cancelProviderSignIn,
- onEmail: () => _go(_Step.email),
- onScan: () => _go(_Step.scan),
+ // Either way in lets the message go, as the accounts do: back here, the headline.
+ onEmail: () {
+ _reasonRead = true;
+ _go(_Step.email);
+ },
+ onScan: () {
+ _reasonRead = true;
+ _go(_Step.scan);
+ },
),
),
_Step.scan => ScanToConnectPage(
@@ -628,10 +647,10 @@ class _Dot extends StatelessWidget {
}
}
-/// A line under the headline, in the status line's place: why an account's sign-in did not finish
-/// (the terminal's red ✗), why a phone that was signed in is back here (the sign-out mark in its
-/// yellow — not red: the person did nothing wrong, and signing in again is the whole of what to do),
-/// or what to do next ([icon] in place of the sign-out mark).
+/// A line in the headline's place, until a way in is pressed: why an account's sign-in did not
+/// finish (the terminal's red ✗), why a phone that was signed in is back here (the sign-out mark in
+/// its yellow — not red: the person did nothing wrong, and signing in again is the whole of what to
+/// do), or what to do next ([icon] in place of the sign-out mark).
class _Said extends StatelessWidget {
const _Said(
this.text, {
@@ -669,7 +688,7 @@ class _Said extends StatelessWidget {
TextSpan(text: text),
],
),
- // Left, on the headline's edge, as the words above it are.
+ // Left, on the headline's edge, where the headline was.
textAlign: TextAlign.start,
maxLines: 2,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/test/phone_edge/welcome_layout_test.dart b/mobile/test/phone_edge/welcome_layout_test.dart
index 6f0cc3cf8..969843b7c 100644
--- a/mobile/test/phone_edge/welcome_layout_test.dart
+++ b/mobile/test/phone_edge/welcome_layout_test.dart
@@ -62,7 +62,12 @@ void main() {
'You were signed out because this phone was removed from your account on another device.';
addTearDown(app.dispose);
await pump(tester, welcome(app), scale, brightness);
- expect(find.text(OnboardingCopy.welcome), findsOneWidget);
+ // The reason in the headline's place, the headline back once a way in is pressed.
+ expect(
+ find.textContaining('removed from your account on another device'),
+ findsOneWidget,
+ );
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
});
});
diff --git a/mobile/test/phone_welcome_first_screen_test.dart b/mobile/test/phone_welcome_first_screen_test.dart
index 420092794..c81472229 100644
--- a/mobile/test/phone_welcome_first_screen_test.dart
+++ b/mobile/test/phone_welcome_first_screen_test.dart
@@ -181,31 +181,145 @@ void main() {
},
);
- testWidgets('why the phone was signed out is said under the headline', (
+ final headline = find.byKey(const ValueKey('welcome-headline'));
+
+ /// Past the headline's 250ms swap: the words going out are gone, the ones coming in in place.
+ Future<void> settle(WidgetTester tester) async {
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 300));
+ }
+
+ /// [notifier] as one whose accounts' pages are [provider], not the real sign-in.
+ void stubAccounts(Future<void> Function(SignInProvider) provider) {
+ notifier.dispose();
+ notifier = _StubAccounts(provider);
+ }
+
+ testWidgets('why the phone was signed out takes the headline\'s place', (
tester,
) async {
await pump(tester);
final before = picture(tester);
+ final words = tester.getRect(headline);
notifier.signedOutReason = 'You were signed out on another device.';
notifier.notifyListeners();
- await tester.pump();
+ await settle(tester);
final said = find.byKey(const ValueKey('welcome-signed-out'));
expect(said, findsOneWidget);
expect(
find.textContaining('You were signed out on another device.'),
findsOneWidget,
);
- // Between the headline and the picture, on the headline's left edge.
- final headline = tester.getRect(
- find.byKey(const ValueKey('welcome-headline')),
- );
- final line = tester.getRect(said);
- expect(line.top, greaterThan(headline.bottom));
- expect(line.left, headline.left);
- expect(line.bottom, lessThanOrEqualTo(before.top));
+ // The headline gone, the reason where it was, on its left edge; the picture still.
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
+ expect(tester.getRect(said).topLeft, words.topLeft);
expect(picture(tester), before);
});
+ // Each way in lets the reason go, and the headline comes back — on the welcome, or on the way
+ // back to it.
+ for (final way in [
+ 'Continue with Google',
+ 'Continue with Apple',
+ OnboardingCopy.continueWithEmail,
+ OnboardingCopy.qrCode,
+ ]) {
+ testWidgets('$way pressed: the reason goes, the headline is back', (
+ tester,
+ ) async {
+ final pages = <SignInProvider>[];
+ stubAccounts((provider) async => pages.add(provider));
+ notifier.signedOutReason = 'You were signed out on another device.';
+ await pump(tester);
+ final before = picture(tester);
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
+
+ await tester.tap(find.text(way));
+ await settle(tester);
+ if (way == OnboardingCopy.continueWithEmail) {
+ expect(find.text('Your email'), findsOneWidget);
+ } else if (way == OnboardingCopy.qrCode) {
+ expect(find.byType(ScanToConnectPage), findsOneWidget);
+ } else {
+ expect(pages, hasLength(1));
+ }
+ if (find.text(OnboardingCopy.welcome).evaluate().isEmpty) {
+ await tester.binding.handlePopRoute();
+ await settle(tester);
+ }
+
+ expect(find.text(OnboardingCopy.welcome), findsOneWidget);
+ expect(find.byKey(const ValueKey('welcome-signed-out')), findsNothing);
+ expect(picture(tester), before);
+ });
+ }
+
+ testWidgets(
+ 'a sign-in that fails says why in the headline\'s place, until the next way in',
+ (tester) async {
+ stubAccounts(
+ (_) async => throw Exception(
+ 'Could not open the sign-in page. Check your connection and try again.',
+ ),
+ );
+ await pump(tester);
+ final before = picture(tester);
+ final words = tester.getRect(headline);
+
+ await tester.tap(find.text('Continue with Google'));
+ await settle(tester);
+ final said = find.byKey(const ValueKey('welcome-error'));
+ expect(said, findsOneWidget);
+ expect(
+ find.textContaining('Could not open the sign-in page.'),
+ findsOneWidget,
+ );
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
+ expect(tester.getRect(said).topLeft, words.topLeft);
+ expect(picture(tester), before);
+
+ // The email, and back: the failure was the account's, and is gone with it.
+ await tester.tap(email);
+ await settle(tester);
+ expect(find.text('Your email'), findsOneWidget);
+ await tester.binding.handlePopRoute();
+ await settle(tester);
+ expect(find.text(OnboardingCopy.welcome), findsOneWidget);
+ expect(said, findsNothing);
+
+ // Failing again says so again, in the same place.
+ await tester.tap(find.text('Continue with Apple'));
+ await settle(tester);
+ expect(said, findsOneWidget);
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
+ },
+ );
+
+ testWidgets(
+ 'a computer\'s own sign-in code read first: what to do next, in the headline\'s place',
+ (tester) async {
+ stubAccounts((_) async {});
+ await pump(tester);
+ await tester.tap(scan);
+ await settle(tester);
+ tester
+ .widget<ScanToConnectPage>(find.byType(ScanToConnectPage))
+ .onSignInCode!(const SignInCode('hnq_computer'));
+ await settle(tester);
+ expect(notifier.pendingComputerSignIn, 'hnq_computer');
+ expect(find.byKey(const ValueKey('welcome-notice')), findsOneWidget);
+ expect(find.textContaining(OnboardingCopy.signInFirst), findsOneWidget);
+ expect(find.text(OnboardingCopy.welcome), findsNothing);
+
+ // An account pressed lets it go; the code is still held for after the sign-in.
+ await tester.tap(find.text('Continue with Google'));
+ await settle(tester);
+ expect(find.byKey(const ValueKey('welcome-notice')), findsNothing);
+ expect(find.text(OnboardingCopy.welcome), findsOneWidget);
+ expect(notifier.pendingComputerSignIn, 'hnq_computer');
+ },
+ );
+
testWidgets('QR code: the camera, with no "Use email instead" — back is the way out', (
tester,
) async {
@@ -255,3 +369,19 @@ void main() {
await tester.pump(const Duration(seconds: 31));
});
}
+
+/// The app's notifier, its accounts' pages stubbed: [provider] stands in for the real sign-in.
+class _StubAccounts extends AppNotifier {
+ _StubAccounts(this.provider)
+ : super(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ );
+
+ final Future<void> Function(SignInProvider) provider;
+
+ @override
+ Future<void> signInWithProvider(SignInProvider provider) =>
+ this.provider(provider);
+}