mirror of
https://github.com/block/buzz.git
synced 2026-11-29 20:52:25 +00:00
## Summary When creating a channel fails, the iOS New channel sheet printed the Dart error's `toString()` under the form: an exception class name, the relay's machine prefix, or an event id. The text also sat about 20 points right of centre and could run off the right edge. This makes both creation sheets say what went wrong in a plain sentence, and lays the iOS error out properly.  **Wording.** A new `createChannelErrorMessage` (`create_channel_error.dart`) is used by the native iOS sheet and the Flutter sheet: | Failure | Before | After | |---|---|---| | Name is taken | `Exception: invalid: an open channel named "general" already exists` | `An open channel named "general" already exists` | | No connection | `Bad state: Relay session is not connected` | `Couldn’t create channel. No connection.` | | Relay silent for 8 seconds | `TimeoutException: Event <64-char id> not acknowledged within 0:00:08.000000` | `Not confirmed. The relay didn't respond.` | | Connection dropped while waiting | raw error text | `Not confirmed. Connection lost.` | | Any other `StateError` | `Bad state: …` | the message without `Bad state:` | The connection sentences follow the composer and reactions: once the event has gone out, they say "not confirmed" instead of "try again", because the relay may have created the channel. `relayErrorMessage` itself is unchanged. **Layout (iOS).** - The error label was the table's `tableFooterView`, framed at x 20 with the width reduced by 40. `UITableView` keeps a table footer's x and overwrites its width, so centred text landed 20 points right and long text ran off the edge. - The error is now the last section's footer: centred within the same margins as the field headings, wrapping inside them, with UIKit's own group spacing above it so it starts at the same height as before. - After a failed Create the sheet scrolls the error into view. Previously it could sit below the fold in landscape or at large text sizes, so a failure showed nothing. **CI.** `scripts/test-mobile-create-channel-accessibility.sh` existed but ran in no lane. It is now in the native lane and in the `mobile` and `mobile-native` path filters. ### Related issue N/A. No existing issue or open PR found for this. Related: #8807 fixed the taken-name text in the Flutter sheet; the native iOS sheet from #8942 did not use that code. ### Testing - `dart format` and `flutter analyze` over `mobile/`, and the affected Dart test files (`create_channel_error_test`, `ios_create_channel_sheet_test`, `channels_page_test`). - `scripts/test-mobile-create-channel-accessibility.sh` at the default and the largest text size, on iPhone and iPad simulators (iOS 27.2). It now asserts the margins, centring, gap, and that a failed Create scrolls the whole error into view, including the three-row Temporary case. - Mutations: reverting either Dart call site, the `StateError` arm, the scroll, the scroll pass count, the centring, or the top gap each fails a test. - Ran the app on an iPhone 17 simulator against a seeded relay for the three failures in the table above (taken name; relay refusing connections; relay accepting but silent). Measured on the frames: the error text's centre is within 0.33 pt of the screen's centre (was about 20 pt right), and its gap below the Visibility group is unchanged at 20.33 pt. Not run: the native assertions on the CI lane's older simulator runtime (this PR's Mobile Swift native job is the first run), VoiceOver, a real device, and the Flutter sheet on an Android device. The screenshot was taken one commit before the head; that last commit changes where the gap value comes from and renders pixel-identically. Known gap, unchanged by this PR: on an iPhone in landscape at the largest text size with the keyboard open, the visible area is shorter than a three-line error, so its first lines stay above the fold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Matt Toohey <contact@matttoohey.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>