Commit Graph

4 Commits

Author SHA1 Message Date
Tom Brow
bc0b552894 fix(mobile): report failed reaction publishes instead of throwing (#9813)
Tapping a reaction while the relay is disconnected threw an uncaught
`RelayNotConnectedError` (a `StateError`) from
`RelaySessionNotifier.publish`, reported by Sentry from 1.5.0 builds.
Every reaction call site fires `addReaction` or `removeReaction` without
awaiting it, so any publish failure escaped as an unhandled error and
the pill just didn't change.

Now each of those call sites (pill taps, the `+` picker, the long-press
quick-reaction row and grouped system rows) hands its publish to
`reportReactionFailure`, which shows an error notice. It's a toast drawn
above any Flutter route or sheet, including the Android reaction details
sheet. While the native iOS reaction details sheet is open, that sheet
shows the notice itself as an alert, since UIKit covers Flutter's
overlay:

- "Couldn’t add reaction. No connection." (or "remove") when the relay
isn't connected;
- "Reaction not confirmed. Connection lost." or "… The relay didn't
respond." (or "Removal not confirmed. …") when the acknowledgement was
lost or late, since the relay may have accepted it;
- nothing for the relay's `duplicate:` reply to a reaction you already
have (a double tap, or re-picking it from the picker), which is a
success;
- "Couldn’t add reaction. Try again." for anything else. Errors that
aren't relay outcomes (for example the signer failing) still escape
afterwards with their stack, so the uncaught-error handler reports them
as before.

| Before (offline tap) | After (offline tap) |
| --- | --- |
| <img alt="before"
src="https://github.com/user-attachments/assets/7745ec5b-8f54-41a2-ba3d-b8dd599f127c"
width="300"> | <img alt="after"
src="https://github.com/user-attachments/assets/066fba0b-9580-4250-966e-cd0b99831ecc"
width="300"> |

### Regressions

- Successful reactions behave exactly as before: the UI still doesn't
await the publish, and the notice only appears on failure.
- Removing a reaction from a grouped system row publishes every deletion
at once as before, and shows at most one notice if any fail.
- Unexpected local errors reach diagnostics just as they did on main.
- No new state or retries: a failed reaction isn't queued. It's reported
instead of thrown.

### Validation

- Added tests in
[`reaction_row_test.dart`](https://github.com/block/buzz/blob/fix-reaction-publish-stateerror/mobile/test/features/channels/reaction_row_test.dart):
offline add and remove, a lost ack, a duplicate and an unexpected signer
failure, each with the notice it should show (or none), and whether the
error escapes; plus a failed toggle from the reaction details sheet on
Android and iOS.
- Simulator run (iPhone 17 Pro, signed in to a Builderlab community, in
a QA chat): add and remove online through the long-press quick-reaction
row, the `+` picker and the reaction details sheet. The before and after
captures come from builds that force reaction publishes to fail as if
offline (the simulator can't drop its own network). The after build
shows the toast once the quick-reaction sheet has closed.
- A failed removal from the reaction details sheet shows its notice
above the sheet, which stays open. Widget tests cover the Flutter sheet
and the native-sheet `notice` call; a simulator run with a build that
forces removals to fail showed the native alert on the iOS sheet:

After: failed removal in the native reaction details sheet

https://github.com/user-attachments/assets/b8d808f0-e86b-411f-82c0-c3d19a51b231

---------

Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-20 15:52:59 -05:00
Tom Brow
f6f6d9a673 chore(mobile): delete dead code with no remaining UI path (#8880)
## Summary

Deletes mobile code that no longer has a user-reachable path and has no
counterpart in buzz-app, so it is unlikely to come back for parity. Net:
104 files, about 5,500 lines removed. No intended behavior change.

- **iOS native message menu and action surface:**
`NativeMessageMenu.swift` and `NativeMessageActionSurface.swift`, the
`message`/`supportsMessage` coordinator branches, and the Dart selection
hook. Dart stopped creating this view in
[#8280](https://github.com/block/buzz/pull/8280). The native reactions
sheet in the same coordinator is kept.
- **Old home quick-actions launcher and `ComposeMorphIcon`:** only
instantiated in tests since the nav-bar creation actions replaced them.
- **Retired local theme stack:** `ThemeNotifier`, `AccentNotifier`,
`SchemeNotifier`, `adaptive_theme.dart`, `AccentPickerPage`, the
appearance-mode sheet and their helpers. These predate per-community
theme sync. The legacy prefs migration in
`community_theme_preference.dart` is kept.
- **Unused widgets:** `ProfileAvatar` and `MaskedAvatarBadge`.
- **Push permission-status plumbing:** the iOS
`notificationAuthorizationStatus`/`openNotificationSettings` handlers,
plus the uncalled strict age-gate snapshot registration and its Swift
`syncAgeGatePushSnapshot` path.
- **Orphaned files** with no importer: `profile_text_edit_sheet`,
`editor_option_button`, `retained_page_transition`,
`tappable_flapping_bee`, `agent_model_info`, `community_bot_profiles`,
`sheet_divider`, `success_haptic`.
- **Uncalled helpers:** the `pickAndUpload*`/camera helpers in
`media_upload.dart`, unused `NostrFilters` builders,
`mediaGetHeadersFor*`, and about 20 other uncalled functions, providers
and styles.
- **Removed-UI leftovers:** the never-wired invite directory providers,
`AuthNotifier.signOut` and `removeActiveCommunityForSignOut` (the Sign
out row is gone), `renameCommunity`,
`HomePage.profilePageBuilder`/`SettingsPage.embedded`, and the
create-forum branches of the create-channel sheet. Forum viewing is
unchanged.

Tests that only covered deleted code are removed. Tests of surviving
code that used deleted helpers as drivers were repointed to the
surviving API.

An audit of `mobile/android` found no dead Kotlin, resources, manifest
entries or Gradle dependencies, so Android code is unchanged.

## Validation

- `flutter analyze`: no issues.
- After rebasing onto main
([93b8b8f](https://github.com/block/buzz/commit/93b8b8febc)), `just
mobile-check` is clean (format and analyze), and `just mobile-test`
passes (4,070 passed, 35 skipped, 0 failed, plus the push-unconfigured
and secp256k1 suites).
- `dart format`: clean.
- Android: `just mobile-build-android` builds the debug APK, and
`./gradlew :app:testDebugUnitTest` passes.
- iOS: `build-for-testing` succeeds and BuzzPushKit `swift test` passes
(65 tests). In RunnerTests, 97 of 98 pass.
`testNativeNavigationTitleExpandsAgainAtTop` fails, but it fails the
same way on unmodified `main` (acf56fff6f) on the same machine (Xcode
27, iPhone 17 Pro simulator), so it is not caused by this change.
- Agent review of the diff ran. Its one blocker (stale `project.pbxproj`
entries for the deleted Swift files) is fixed.
- In-app smoke run at
[66141c1](66141c10b9):
a debug build on a fresh iPhone 17 Pro simulator (iOS 27), signed in to
the internal community. The following flows all worked with no errors:
- Home: the New menu (channel, DM, workspace, chat) and the
create-channel sheet, including its channel-type options.
- A chat, with the message action sheet (reactions row, Reply, Copy
link, Remind me, Mark unread, Copy text, Edit and Delete).
  - Appearance: the previews, and cycling the System and Light modes.
- Settings: the profile header, the display name editor, and Edit photo
(Image and Emoji tabs).
  - The Agents directory.
- Search, including the Channels filter, plus opening a team channel
from the results.
- Tapping a reaction summary, which opens the native iOS Reactions
sheet.
- The recording isn't attached here because it shows internal channels
and messages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:09:50 -08:00
klopez4212
b5223d2525 Use grouped message action sheets and fix date layering (#8280)
## Summary
Replace message long-press popovers with the shared grouped bottom
sheet: an emoji row, Reply / Copy link / Remind me tiles, and remaining
actions in regular sections. Match emoji backgrounds to the sections and
use the theme primary color for the selected reaction.

Keep the scrolling date above the navigation blur in channels and
threads. Restore composer focus when the sheet is canceled, keep section
gaps consistent, and soften shared dividers to 7% opacity.

The reaction details sheet shows all reactors by default. Emoji count
chips toggle your own reaction, show your selected state, and update
live without dismissing the sheet. Unselected reactions have visible
outlines; adding a supported emoji plays the chat-style burst and
respects reduced motion.

### Related issue
No matching issue found. Related sheet styling: #4911.

### Testing
- Full mobile checks and tests passed, including 23 reaction tests and
composer-focus regression coverage.
- Analysis and file-size checks passed; signed iOS build installed and
launched on a physical iPhone.
- Full `just ci` stopped during Rust compilation due to low disk space.
- On-device visual capture unavailable.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
2026-10-13 12:55:07 -04:00
klopez4212
ea143ea64b feat(mobile): native iOS message menus and reaction sheets (#8055) 2026-10-02 20:59:05 +01:00