361 Commits

Author SHA1 Message Date
Tom Brow
1a5c6939c5 perf(mobile): save the open-channel directory and catch it up (#9513)
Search and invite recovery read a community's open-channel directory
(every open, listed channel's kind 39000 metadata) from the relay, and
match names on the device. Until now the app kept that directory in
memory for 30 seconds only, so every search session after that, and the
first search after every launch, downloaded the whole directory again.
This follows [#9466 directory-only search
load](https://github.com/block/buzz/pull/9466) and [#9457 directory
keeps message times](https://github.com/block/buzz/pull/9457), which
made each of those downloads cheaper; this one makes most of them
unnecessary.

Now the directory is saved in a file per community and account, next to
the image cache, and search reads it from there:

- **What's saved.** Only the latest revision of each open, listed,
non-DM channel. The relay's directory read also returns the user's own
private, unlisted and DM channels; those are never held or saved as the
directory, and a channel whose latest revision is no longer discoverable
drops out.
- **First read.** The first time search opens, the app downloads the
whole directory, as before, and saves it.
- **Catch-up.** When search opens later, it shows the saved copy at
once. At most once a minute, it asks the relay in the background only
for directory changes since the newest saved one, or since the last read
started by the device clock if that is earlier (less a minute of
overlap), and merges them in. The relay can stamp a busy channel's
metadata minutes ahead of wall time, so the newest saved stamp alone
could skip channels created meanwhile. A catch-up that brings back
nothing new saves nothing and leaves the list alone, and a search opened
while a background read is still running shares it rather than starting
another.
- **Offline open.** A search opened before the session connects shows
the saved copy and runs its check on the next connect.
- **Daily full read.** Once the last full read is a day old (or dated in
the future, by a clock since set back), the next check downloads the
whole directory in the background and replaces the saved copy, which
drops channels that became private or unlisted or were deleted. A
catch-up can't see those: the relay never serves them to a non-member.
- **Gone on open.** Opening a saved result that the relay no longer
serves (private or deleted) drops it from the directory at once, and no
directory read already in flight (background check, list refresh or
Retry) brings it back. A restore from disk never overrides a full read
already running, and a background read never displaces one.
- **Invite recovery** still downloads the whole directory, as on main:
it needs fresh memberships, and its read also refreshes the saved copy.
- **Cleanup.** Signing out of a community, replacing its account, or
leaving it deletes the file.

The saved events omit signatures (the relay signed them; the copy is a
cache of what it served). The file's JSON is encoded and decoded off the
UI isolate, and an unavailable caches directory (or one that takes over
3 seconds) just means no saved copy. A file that is unreadable, from
another version, or over 20,000 channels or 16 MiB is discarded and read
again from the relay. There is no relay change. `CONTEXT.md` gains an
"Open-channel directory" entry.

### Validation

| Workflow (small community, 63 open channels) | Directory bytes before
| Directory bytes after |
| --- | --- | --- |
| First search after install | 39.5 KB (2 requests) | 39.5 KB (2
requests) |
| Search again 2 minutes later | 39.5 KB (2 requests) | 0.6 KB (2
requests) |
| Relaunch, then search | 39.5 KB (2 requests) | 0.6 KB (2 requests) |

Measured on an iOS simulator signed in to a test community, with a
temporary local counter on each relay query response (not part of this
PR), main at
[6974237](69742376a9)
vs this branch. The full read grows with the number of open channels
(about 600 bytes each); the catch-up grows only with what changed.
Search results were identical on both builds, and opening an unjoined
result from the saved directory still showed its preview with Join.

Tests:

- A journey test drives the real channel list against a fake relay that
honors `since`, with a real file and a fake clock: the first reader
saves the directory without signatures; more readers within a minute ask
nothing; a minute later a reader asks only for changes since the newest
saved one less a minute; after a relaunch the saved copy serves at once
and the catch-up starts from it; a channel that turned private stays
until the daily full read replaces the copy; the search status never
shows loading for the background reads; a catch-up of only held events
leaves the list identical and the file unwritten; a second search a
minute into a slow full read shares it; and opening a channel the relay
no longer serves drops it, even with a read in flight. Each guard was
checked by breaking it: removing the once-a-minute limit, dropping
`since`, never doing the full read, merging the full read instead of
replacing, removing the drop-on-open, the no-change check, the shared
in-flight read, or the in-flight drop fence each fail the test.
- Focused cases against the same fake relay and real file, each checked
by breaking its guard: member-only private, unlisted and DM metadata is
never saved, and a saved channel that turns private drops out on
catch-up; a catch-up starts no later than the last read's start, across
a relaunch, so a channel created after a burst-stamped one is found; a
full read or check dated in the future by a clock set back is due; a
search opened before the session connects checks on connect; a restore
leaves a running full read's status alone and is not displaced by a
catch-up; a list or Retry full read in flight does not bring back a
channel dropped on open.
- Storage tests: the round trip omits signatures; unusable data is
discarded; a directory over the bounds leaves no stale copy; a closed
store neither reads nor writes; cleanup keeps only each community's
current account and its save in progress.
- The community test now also checks that replacing an account deletes
the old account's saved directory (fails without the cleanup call).
- Full mobile test suite and `flutter analyze` pass.

No visible change, so no screenshots: the same results appear, just
without a download on later searches.

### Regressions

- A channel that turns private or is deleted can still appear in search
for up to a day, until the daily full read, unless you open it (the
first open in a session asks the relay, drops it at once, and the relay
withholds its content). A channel already previewed earlier in the same
session reopens from its cached details without asking the relay, so it
stays until the daily read or a relaunch. Before, it disappeared from
the next search at least 30 seconds later.
- A channel that turns unlisted can also appear in search for up to a
day. Opening it does not drop it, and its content stays readable,
because the relay serves an unlisted open channel to anyone who names
it.
- A channel created while search is open appears the next time search
opens, not while it stays open. That was already the case within the
30-second window.
- The saved file costs some disk per community (about 30 KB for 63
channels, roughly 0.5 KB per channel), deleted on sign-out or leaving.

---------

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>
2026-11-15 12:31:58 -07:00
Tom Brow
44c8206bea fix(mobile): wrap inline Markdown links with their sentence (#9462)
A link inside a sentence used to be drawn as its own little widget, so a
long label jumped to a line of its own and the words after it started
yet another line. Plain links are now text in the sentence: a long label
breaks mid-label, and the words after it continue on the same line.

Tap still opens the link, a finger on it still tints it, and a hold
still opens the link sheet (Open, Copy, Share) instead of the message
menu. Buzz chips (channel and message links), audio attachments and
repository links keep their current widget look.

| Before | After |
| --- | --- |
| <img alt="before"
src="https://github.com/user-attachments/assets/e77aa97a-6ac5-43b9-bc44-cc43fb169c8f"
width="300"> | <img alt="after"
src="https://github.com/user-attachments/assets/4c76bb23-e6df-4244-bf7e-e1753b727d7b"
width="300"> |

A finger on a text link tints it, across every line of a wrapped label:

<img alt="Pressed tint on a wrapped link"
src="https://github.com/user-attachments/assets/1cde5a1a-39aa-4bc7-90f8-8d95b15ee852"
width="400">


https://github.com/user-attachments/assets/021dd099-d24b-4370-bf75-e60f273e2a92

### Regressions

One tradeoff, accepted so links can wrap:

- **VoiceOver users lose Copy and Share on text links.** VoiceOver still
opens the link, but a text span can only expose a tap to accessibility,
so the link sheet (Copy, Share) can't be reached on text links with
VoiceOver. Chips and repository links keep it. A link nothing can open
(such as mailto) shows its sheet on a tap, so it isn't dead for
VoiceOver users.

Nothing else gets worse. The pressed tint is a translucent paint-only
layer drawn on top of the message's Markdown over the link's text boxes,
so inline code and table header backgrounds can't hide it, so a press
repaints that message and rebuilds nothing; a tint that spans a wrapped
label covers both lines, and it stays inside what's visible (a long link
in a scrolled table cell tints only inside the table). Each message
reuses one recognizer per link across rebuilds and disposes them when
its text changes or the message goes away, and a scroll that starts on a
link cancels the hold, so it never opens the sheet. Only plain links
change shape (including any inline code inside a link label, which now
taps and holds as part of the link); chips, media and code outside links
are untouched.

### Validation

Added tests:
- A long link label in a narrow message breaks across lines, and the
following words continue on the line where it ends.
- Holding a link and then sliding off it before the hold delay opens
nothing (no sheet, no message menu, no open).
- Pressing a text link tints it, and lifting or sliding off clears the
tint; lifting a second finger keeps the tint.
- A pressed link in a horizontally scrolled table cell is tinted inside
the table and nothing past its edge.
- Tapping a link nothing can open (mailto), by finger or screen reader
activate, shows Copy and Share.
- A pressed link in inline code (plain and in a bubble) or in a table
header shows its tint (these fail with the tint drawn underneath).
- Code inside a link label taps and holds as part of the link; a hold
across an edit that removes the link does nothing; a second finger
mid-hold doesn't restart it.

Existing link tests (tap, hold sheet, copy and open from the sheet,
message menu beside a link, swipe to reply from a link, attachment
links) now find links inside their paragraph. They all pass, along with
the full mobile suite and analyze.

Automated simulator run (iPhone 17 Pro, internal community, synthetic
message): pressing a wrapped link tinted all three of its lines; holding
a text link opened its sheet; holding the text right after it opened the
message menu; tapping the second line of a wrapped link opened it in
Safari; a scroll starting on a link scrolled the list and opened
nothing.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-15 09:06:30 -08:00
Tom Brow
934a16f2ff feat(mobile): message the Bestie from Siri and Shortcuts (#9517)
Adds a **Message my Bestie** action for Siri and Shortcuts. Siri asks
what to say, confirms with the Bestie's name ("Send “…” to Astra?"), and
posts the message in your DM with the Bestie, without opening Buzz. The
Bestie's reply arrives as a normal notification, in the same DM the Home
star opens.

This is the iOS 16+ App Shortcut from [ADR
0005](https://github.com/block/buzz/blob/mobile-siri-bestie-dm/docs/adr/0005-quick-send-uses-the-system-send-message-action.md).
Follow-ups, not in this PR: the iOS 27 `messages.sendMessage` schema
intent, naming other recipients, a separate "Start a chat with my
Bestie" intent for a new Solo chat, and opening Buzz with a draft when a
send fails.

### How it works

- The App Intent runs without opening the app and hands the text to Dart
over a method channel. It waits up to 20 s for Home to say it is ready,
and runs one send at a time.
- A background launch already starts the Flutter engine and builds Home
([ADR
0004](https://github.com/block/buzz/blob/mobile-siri-bestie-dm/docs/adr/0004-background-work-runs-in-the-app-engine.md)
records the measurement). So a small `QuickSendHost`, which the app
hands Home as an invisible background widget, takes the send. Nothing is
reimplemented natively.
- Before confirming, Swift asks Dart for the saved Bestie's pubkey and
name; the send then goes to exactly that agent, so a choice this phone
hasn't synced yet is caught at the confirmation.
- The send reuses the Home star's lookup for the Bestie DM (opening it
with the relay's find-or-create DM command when it isn't loaded) and
posts with the same `SendMessage` the composer uses.
- If Buzz has been in the background past its 5 s grace period, the
relay session has closed its socket. The send reopens it, then lets the
normal background pause start over.
- A message the relay rate-limits is retried (up to 3 tries); the relay
turned it away, so a retry can't duplicate it. Any other failure isn't
retried, since the message might have landed.
- The confirmation is pinned to the community and account it was shown
in: if Buzz switches either before the message goes out, the send is
refused.
- If the send fails, or Buzz can't tell whether it landed (no answer
from the relay), the message is saved as the Bestie DM's composer draft,
after any draft already there, and Siri says so ("Buzz isn't sure that
sent. Check your Bestie DM before trying again." when the outcome is
unknown). A successful send leaves the draft alone. Limits: if the DM
can't be found or opened, there is nowhere to save it and Siri says the
message wasn't saved, and the app being killed mid-send isn't covered.
- Refusals (no Bestie, offline, empty or too long, switched community)
come back as a short message Siri reads.

### Regressions

- Nothing existing changes behavior: the host only answers this method
channel, and the action does nothing until someone runs it. Its bugs
stay inside the quick send path.
- The Home star's DM lookup moved into `cachedBestieConversation`
unchanged, so the star behaves as before.
- A composer that is open on screen now shows a draft another writer
saved for it (here, a failed quick send) instead of overwriting it with
the next keystroke. It listens without rebuilding, and its own saves are
ignored.
- A background wake pays the cost of starting the app's Dart code, which
iOS already does for this launch.

### Before / after

| Before: no Buzz actions in Shortcuts | After |
| --- | --- |
| <img width="300" alt="Shortcuts Library before"
src="https://github.com/user-attachments/assets/b0870e3d-2823-4c7d-be0e-a242a3fdafd7">
| <img width="300" alt="Shortcuts Library after, listing Buzz Dev under
Apps"
src="https://github.com/user-attachments/assets/8c092006-76b9-4313-a401-68189f5674cf">
|

| Asks what to say | Confirms (names the Bestie) | Sent |
| --- | --- | --- |
| <img width="250" alt="Prompt"
src="https://github.com/user-attachments/assets/a2eaf44a-5287-48b6-9c5a-2aaefc90c0a8">
| Shows "Send “…” to *Bestie's name*?" (capture omitted: it shows an
internal agent name) | <img width="250" alt="Sent"
src="https://github.com/user-attachments/assets/07fe66e3-4480-4d06-be52-623416e567b8">
|

The DM result and a demo video show internal names, so they're shared
internally rather than here.

### Testing

- Added test, `quick_send_test.dart` journey: Home reports ready; Siri's
Bestie lookup is refused with no Bestie, then returns the chosen
Bestie's pubkey and name; a send confirmed for another community is
refused; an empty send is refused without publishing; a send while Buzz
is backgrounded and its socket closed reconnects, opens the DM with the
Bestie, survives a rate-limited first try, posts the message in that DM
tagged to the Bestie, and hands the session back to its background
pause; a second send goes to the same DM and leaves the person's draft
there as it was; a send whose answer is lost is reported as unsure and
kept in that draft after the person's own text, with its mentions; a
socket that drops just before the message goes out keeps it too; leaving
Home reports unready. Removing the rate-limit retry, the community check
or the draft save fails it.
- Extended the composer's share-delivery journey: a draft saved by
another writer while the composer is open shows in the composer and
survives the next keystroke, and survives an ordinary send that was
pending when it arrived and then fails. Removing the composer's listener
or its revision bump fails it.
- iPhone 17 Pro simulator (iOS 27), Builderlab community with a Bestie,
automated with AXe:
- Cold: Buzz terminated, ran the action from Shortcuts, the confirmation
named the Bestie, "Sent.", and the message was in the Bestie DM with its
reply. No Solo chat was created.
- Warm: Buzz in the background for 10 s, ran it again, "Sent.", same DM.
- At-risk flows: sent a typed message from the DM composer, went back to
Home, and the Home star reopened the same DM.
- `just mobile-check mobile-test` passes.






buzz-review-completed

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-15 09:06:25 -08:00
Tom Brow
bf422ac8e1 perf(mobile): parse each event's thread reference once (#9460)
Every time code asked an event for its parent or thread root
(`threadReference`, `parentEventId`), `parseThreadReference` walked its
tags again and ran a 64-character hex regex over each `e` tag. The
channel store asks that many times per event:

- `_trimReplyOverlay` runs on every live event merged into the window
and re-parsed every overlay event, twice.
- `_reconcilePageSummaries` called `cachedThreadReplyIds(root)` once per
row of a fetched page, and each call re-parsed every cached reply (twice
per reply) to find that root's replies. A 200-row page did 200 full
passes.

Now:

- `parseThreadReference` keeps its result per tag list in an `Expando`.
Event tags are never changed after an event is built (nothing in `lib`
mutates a `NostrEvent`'s tags), so the cached value always matches.
- `_reconcilePageSummaries` indexes cached replies by root once, then
reads each row's count from that map. `cachedThreadReplyIds` keeps its
signature and result and shares the same code.

### Validation

Full mobile test suite and `flutter analyze` pass. Existing
thread-summary, reply-overlay and thread-reference tests cover the
unchanged results.

On the iPhone 12 mini (profile build, Builderlab), same scripted run on
`main` and on this branch: open three threads from Activity, back out
after each.

| Dart CPU in thread-reference code | main | this branch |
| --- | --- | --- |
| First thread (not cached yet) | 5 ms | 2 ms |
| Second thread (loads the channel window) | 27 ms, plus 18 ms trimming
the reply overlay | 3 ms, plus 2 ms |
| Third thread | 10 ms | 0 ms |

The threads opened and showed the same replies in both runs, and the run
covered a channel window load, live events arriving while a thread was
open, and backing out to Home.

### Regressions

None expected. Results are identical; the cache holds one small record
per live tag list and is released with the event.

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>
2026-11-13 14:57:26 -08:00
Tom Brow
c97c85d8fa perf(mobile): load only the directory when search opens (#9466)
Opening search on a list that is already loaded refreshed the whole
channel list to get the open-channel directory: the membership rosters
(kind 39002), member channel metadata, hidden DMs, Huddle starts, DM
names and the latest messages of every joined channel, then the
directory pages. Only the directory was what search needed; everything
else was already in the list and kept current by live updates.

Search now reads only the directory pages and merges them into the
current list: every channel you are not a member of is rebuilt from the
fresh directory (latest revision per channel, open and non-DM only, the
same rules as a full refresh), and joined channels keep their entries
untouched. When the list has not loaded yet, the full refresh runs as
before.

Races:
- A directory-only load is fenced by scope alone (community, identity,
disposal), not by the list-refresh generation, so it neither retires an
in-flight membership refresh nor is retired by one. A community or
identity switch retires it: its response is discarded and it no longer
owns its loading status, so returning to the first community (before or
after the old request ends) lets search load the directory again.
- Directory loads are ordered among themselves: only the newest one
writes the directory and its load status, so an older full refresh
cannot overwrite a newer search load and vice versa.
- A list refresh that merged an older directory and then installs after
a search load landed re-merges the newer directory, so the open channel
search just found does not disappear.
- A list refresh no longer resets a live directory-only load's status to
idle (that reset existed because a refresh used to discard the in-flight
directory, which it no longer does for this kind of load). A load
retired by a scope switch is not live, so the reset still applies to the
status it left behind.

## Results

iPhone 12 mini, profile build, Builderlab account. Typing a query into
search on a loaded list, more than 30 seconds after the last directory
load (two runs each, same numbers both times):

| | HTTP per search | What it read |
| --- | --- | --- |
| main | 3.59 MB | rosters 1.53 MB, channel metadata and directory 1.26
MB, latest messages 0.80 MB |
| This change | 1.26 MB | directory pages only |

Unjoined open channels still appear in results with their Open badge.

## Regressions

The tradeoff we accept: on a search open, joined channels' member
counts, unread badges and latest-message times are not re-read; they
show what the last full refresh found, as updated by live events since.
Live join and leave notices, metadata changes and new messages still
apply as they arrive, and the next ordinary refresh (launch, reconnect,
resume, pull to refresh) re-reads everything. The case that differs is a
change that live delivery missed on a healthy connection (for example a
roster change made while a live chunk was briefly refused): before,
opening search happened to repair it; now the next ordinary refresh
does.

Nothing else changes: open channels are listed under the same visibility
rules, a failed directory load still reports its error to search and
keeps the cached discovery, and the first load is unchanged.

## Testing

- Full mobile suite passes; `flutter analyze` clean.
- New tests: a search load on a loaded list issues only directory
queries (no roster, member metadata, hidden-DM, Huddle or message
reads), lists the new open channel, drops one that became private and
keeps the joined channel object unchanged; a membership refresh during
the load is kept and does not reset its status; a list refresh that
merged the directory before a search load landed keeps the newer
directory; a community switch discards the response; returning to the
first community, both while the old request is in flight and after it
ended, loads the directory again.
- Automated device run on the iPhone 12 mini: launch, two search
sessions typing a query, results list joined and unjoined open channels,
close and reopen search. Rerun on f216dd6afc (after the scope-switch
fix) with the same results: 1.26 MB HTTP per query, unjoined open
channels marked Open.

---------

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>
2026-11-13 14:40:27 -08:00
Tom Brow
5f1cd67985 perf(mobile): stop rebuilding Home's channel list when a route covers it (#9459)
Opening any route or sheet above Home (search, a message's action menu,
a profile sheet, Activity, Settings) rebuilt Home's whole channel list
twice: once when the route started covering Home and once when it
finished. On a phone the open channel sits inside Home's conversation
pane, so a sheet over a channel (long-press menu, profile) did the same.
`HomePage` and `ChannelsPage` read `ModalRoute.of(context)` in their own
builds, which depends on every part of the route's state (whether it's
current, whether it's offstage, and so on). `ChannelsPage` also depended
on the whole `DuoToolbarScope`, whose `active` flag flips whenever a
route covers the pane, through `frostedAppBarHeight`. Every channel row
and the Solo section depended on `ConversationPaneScope` for the
selected channel, and that scope notified all of them when its
route-dependent `active` flag flipped. Each of those rebuilt a fresh
channel inventory, including Solo rows that had scrolled away, which
resubscribed their typing feeds for 30 seconds.

Now:

- Home's native controls (Activity bell, tab bar, Duo rail) read the
route in a small `_NativeControlsGate` leaf, so only they rebuild when
Home is covered.
- `ChannelsPage` mirrors route currency into its header suppression
notifier from a `_RouteCurrencySync` leaf above the header, so the
header still switches in the same frame. The two "wait until this route
is current again" loops read the same notifier.
- `DuoToolbarScope` is an `InheritedModel` with a strip-only lookup,
`maybeStripOf`. The frosted header's height and `ChannelsPage` use it,
so `active` changes no longer reach them. Every other reader keeps
`maybeOf` and its current behavior.
- `ConversationPaneScope`'s `active` flag lives in its own private
inherited widget, read only by `isActiveOf`. Rows that only need the
controller no longer rebuild when it flips.
- Opening a channel looks up the conversation pane instead of depending
on it.

### Validation

New test: opening and closing a sheet above Home rebuilds neither
`HomePage`, `ChannelsPage` nor any channel row. It fails without this
change.

Full mobile test suite, `flutter analyze` and the file-size check pass.

On the iPhone 12 mini (profile build, Builderlab):

Same scripted run on `main` and on this branch (search opened and closed
3 times, then a message's long-press menu and a profile sheet over an
open channel):

| | main | this branch |
| --- | --- | --- |
| Widget builds per search open | 126 to 350 | 56 to 60 |
| Build time per search open | 79 to 90 ms | 29 to 41 ms |
| Build time, long-press menu open | 64 ms | 17 ms |
| Typing subscriptions reopened by the sheets | 9 (about 80 KB of
messages downloaded) | 0 |

The menu, profile sheet, channel header and Home's tab bar and Activity
button behaved the same in both runs.

### Regressions

None expected. The native controls and header switch from the same route
state as before, in the same frame. A `DuoToolbarScope` strip change
still reaches the header and the channel list.

---------

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: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-13 14:40:22 -08:00
Tom Brow
3764a2e4d5 perf(mobile): ask typing subscriptions only for the typing window (#9454)
Every channel that shows a typing indicator (the open channel, and each
Solo row on the home list) subscribes for typing and message events with
`limit: 10` and no `since`, so each subscribe replays that channel's
last 10 stored messages. The handler then ignores every one of them that
is older than the 8 second typing window, so the replay only costs
bytes. On an iPhone 12 mini signed in to Builderlab, seven Solo rows
made this about 66 KB of kind 9 messages on each cold start, and again
on each resubscribe.

The subscription now asks only for events inside the typing window
(`since` = now minus 8 s), which are the only ones the handler can act
on.

### Validation

New test: the typing subscription asks for history starting 8 s before
it subscribes. It fails without this change.

Full mobile test suite and `flutter analyze` pass.

On the iPhone 12 mini (profile build with this change, signed in to
Builderlab), stored and live events on the typing subscriptions in the
first minute or more after a cold start:

| | Subscriptions | Kind 9 messages | Typing events |
| --- | --- | --- | --- |
| Before (60 s) | 7 | 74 (66.6 KB) | 26 (15.6 KB) |
| After (80 s) | 8 | 2 (1.5 KB) | 29 (17.8 KB) |

Typing events are mostly live ones from agents working in Solo chats, so
they stay about the same. The automated run covered a cold start to the
home list and its Solo rows.

### Regressions

- A device clock running more than 8 s fast can make the relay skip a
message that would have ended an indicator. That indicator still clears
when its 8 s window ends, and the handler already drops events it
considers older than the window, so the same skew loses the same events
today.

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>
2026-11-13 14:40:17 -08:00
Tom Brow
9e40bf5d79 perf(mobile): don't treat a Control Center pull as a resume (#9443)
Pulling down Control Center or Notification Center, answering a system
alert, or glancing at the app switcher moves the app to `inactive` and
straight back to `resumed`. The app never leaves the foreground and the
socket stays connected, but every resume listener treated it as a return
from the background. Each glance re-read the channel list (memberships,
metadata, unread catch-up), the four settings documents (mutes, stars,
sections, sort) and the Me groups, and tore down and rebuilt the
community presence subscription. On a heavy Builderlab account that is
about 2.6 MB per glance.

This adds `appForegroundProvider`, which follows the app lifecycle but
ignores `inactive`. The resume refreshes and both presence providers
watch it instead of the raw lifecycle, so they run only when the app
actually comes back from the background. Camera capture keeps watching
the raw lifecycle, since it has to release the camera while the app is
inactive.

### Validation

Added tests: the channel sync journey test now pulls the app through
`inactive` and back without leaving the foreground and expects no
membership read; it fails without this change (2 reads instead of 1).
The existing resume and background cases in that test still pass
unchanged. A second step lets a failed list read's retry come due while
the app is `inactive`; it is read then, not left for a resume that no
longer comes (it fails without the read gate change, 8 reads instead of
9). Full mobile test suite passes.

On an iPhone 12 mini signed in to Block's Builderlab (instrumented
profile build), pulling Control Center down and dismissing it:

| | Downloaded after dismissing it |
| --- | --- |
| Before | 2.6 MB (rosters 1.5 MB, latest messages 0.7 MB, channel
metadata 183 KB, settings, presence resubscribe) |
| After | 6.5 KB (live typing and presence only) |

The same run covered cold start, 5 minutes idle on Messages, and a
resume after 60 s in the background; the resume still refreshed the
channel list, read state and settings documents as before (2.8 MB HTTP,
2.1 MB WebSocket).

### Regressions

None expected. A real return from the background still goes through
`hidden`/`paused` first, so it triggers every refresh it did before. The
only behavior change is for `inactive` alone: no refetch, and the user's
presence no longer flips through a republish of `online`. A channel-list
read that comes due during `inactive` (a membership notice or a retry)
now runs then instead of waiting for a resume, since the socket is still
connected. A missed live event during a Control Center glance is still
caught by the next real resume or reconnect, as before for any time in
the foreground.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-13 14:40:00 -08:00
Tom Brow
15c65c76d9 fix(mobile): keep a superseded roster read out of the offline snapshot (#9452)
The channel member list keeps a snapshot of the last roster it read,
which it shows while the relay is disconnected. When two roster updates
arrive close together, the member list starts a read for each. If the
first read answered after the second, it still wrote its older roster
over the snapshot. The live list stayed correct, but once the app went
offline it showed the older roster: for example, a member just removed,
or a bot role just changed, came back.

A read that a later read has replaced no longer writes the snapshot. The
snapshot cache numbers each read of a channel's roster, and only the
latest read for that channel may write. A read that ends because nothing
is watching the list any more (the user leaves the screen mid-read, or a
one-off lookup such as sending a message) still writes, since its roster
is the newest one.

### Validation

New tests, which fail without this change:

- Two roster updates arrive, the second read answers first and the first
answers after it, with a roster, with no roster event, or with an empty
roster. Once disconnected, the member list still shows the newer roster.
- A roster update arrives and the user leaves before its read answers.
Once disconnected, the member list shows that newer roster. (This passes
on main and guards against fencing on disposal, which an earlier version
of this PR did.)

The rest of the channel management tests pass unchanged. Full mobile
test suite and `flutter analyze` pass.

The race itself needs two roster reads to answer out of order and then a
disconnect, which a device run can't reliably produce. An automated run
on an iPhone 12 mini signed in to Block's Builderlab (profile build of
this head) covered the roster paths it touches: cold start, searching
for and opening buzz-mobile, its details (86 members) and its member
list (49 people, roles shown), scrolling it, backgrounding the app for
60 seconds, resuming, and reopening the member list, which loaded the
same roster.

### Regressions

None. A replaced read's result was already discarded for the live list;
now it is also kept out of the offline snapshot. Reads that nothing
replaced write the snapshot as before.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: corey <2dafccf60ea6d431a568f6d67fc60016c1b2a51e415e09dc8b213b8e3606cf54@buzz.block.builderlab.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
Co-authored-by: perfie <1fc92b08616bef6025a30fa24528ba2417d2a0c82f2c67b62e7f912089235028@buzz.block.builderlab.xyz>
2026-11-13 14:37:45 -08:00
Tom Brow
04af7081c8 fix(mobile): offer role controls for agents (#9475)
Mobile hides every role control for a channel member whose role is
`bot`. On relays running [#8494 bot role from
owner](https://github.com/block/buzz/pull/8494), any agent with a
recorded owner is reported as `bot` whenever it holds an ordinary role.
So if an admin demotes an owned agent from admin to member, the
refreshed roster says `bot` and mobile no longer offers "Make channel
admin": the demotion can't be undone from mobile.

This change gives agents the same role controls as people, matching
desktop:

- The member profile actions offer "Make channel admin" for `bot`
members. "Change to member" still appears only for admins and guests, so
an agent that is already ordinary isn't offered it.
- The members sheet shows the Role selector for agents, with Member
selected for `bot` (the two are permission-equivalent). The row label
still reads "Agent".

**Rollout:** ship this in a mobile release before relays with #8494
deploy.

Review discussion: [buzz-mobile-tomb-review-work
thread](buzz://message?channel=95213a25-483a-458b-9bc3-71891fa5aef6&id=4714950ee67bf04464a59c1deb3470972c0809c7be780183da6b4a2e77243714).

### Regressions

None expected. The relay already accepts admin, member and guest for
agents (owned agents can hold admin today), so the newly shown actions
submit role changes it accepts. On current relays an agent added as
`bot` now also shows these controls; tapping Member on its selector is a
no-op because Member is already selected.

### Validation

Changed tests: the profile-actions role table now expects "Make channel
admin" for `bot`; the promote, demote journey continues with the
refreshed role coming back as `bot` and expects promotion to be offered
again; the members-sheet agent row expects the Role selector with Member
selected.

Full mobile suite: 4,828 passed, 70 skipped, 1 failed. The failure,
`video_controls_test.dart` "iOS timeline requests native Liquid Glass
and fades with the toolbar", is unrelated media-viewer code; it passed
when rerun on its own, and the pre-push hook's full mobile run passed.

Simulator check against a live relay: an agent added with the `bot`
role, viewed by the channel owner in its member profile.

| Before | After |
| --- | --- |
| <img alt="before"
src="https://github.com/user-attachments/assets/2503ae98-b198-46c3-85c9-0b85dae2c4ae"
width="300"> | <img alt="after"
src="https://github.com/user-attachments/assets/82abf55a-de56-45aa-86c5-7917877e388e"
width="300"> |

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>
2026-11-13 14:05:48 -08:00
Tom Brow
237a39fe76 perf(mobile): keep latest-message times on a directory load (#9457)
Opening search loads the channel directory when it is older than 30
seconds. That load reruns the whole channel list read, including each
channel's latest messages (up to 20 per channel, 1 per DM), even though
the list is already showing and its live subscriptions keep those times
current. On an iPhone 12 mini signed in to Block's Builderlab, the
latest-message part was about 700 KB of every search open.

A directory load now skips the latest-message read when a channel list
is already loaded and keeps the loaded times, the same as the background
list reads already do. The first load, when no list is showing yet,
still reads them. Both reads still fetch latest messages for member
channels the list did not already show (for example a DM opened on
another device), so those get a time instead of sorting last in Recent;
before, background list reads left them without one. If that read hits
the relay deadline, the list is marked for a full read and retried with
backoff, as a timed-out full read was before.

### Validation

New test: with a loaded list, a directory load sends no latest-message
requests, adds the directory channel and keeps the member channel's
latest-message time. It fails without this change. A second test: a DM
first listed by a directory load, holding only our own message (which
unread catch-up skips), gets its latest-message time. It fails without
the newly-listed read. Its deadline row (the read that first lists the
DM times out) checks that the backoff retry dates the DM; it fails if
either the revalidation flag or the retry is removed.

Full mobile test suite, `flutter analyze` and the file-size check pass.
To stay under the 1200-line limit, `_advanceLastMessageAt` moved
unchanged into `channel_unread_catch_up.dart`.

On the iPhone 12 mini (profile build, signed in to Builderlab), opening
search 90 seconds after a cold start and typing "buzz":

| | Latest messages | All relay HTTP |
| --- | --- | --- |
| Before | 704 KB | 3.56 MB |
| After | 0 | 2.86 MB |

The automated run covered a cold start, the home list, opening search,
channel results for the query, and closing search back to the home list
with the same order.

### Regressions

- A directory load with a loaded list no longer refreshes cached DM
display names; the next full list read (pull to refresh, cold start, or
a channel action) still does, as for background list reads.
- A latest-message time the live subscriptions missed (for example while
the socket was down) is not corrected by opening search; the next full
list read corrects it.

---------

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>
2026-11-13 13:39:55 -08:00
Tom Brow
d1a8c3607d perf(mobile): use HTTP/2 on Android through app-wide Cronet engines (#9435)
Follows #8897 (iOS HTTP/2), now on main.

## What

Android gets the same app-wide shared sessions as iOS, backed by Cronet
(`cronet_http`) instead of `NSURLSession`:

- One Cronet engine per traffic class (API, media), so requests to a
host multiplex over one HTTP/2 connection and gzip is inflated natively,
off the Dart isolate.
- HTTP/2 on, HTTP cache off, QUIC off. QUIC would be a separate behavior
change, and `cronet_http`'s changelog lists DNS failures with QUIC on
cellular.
- Streamed uploads (media and voice notes) stay on `dart:io` on Android:
`CronetClient` reads a request body into memory before sending it, which
would break upload progress and copy large attachments in full.
- If no Cronet provider is available (no Google Play services), the
engine fails to build and the app keeps `dart:io`, as today.
- Transport error classification covers Cronet failures alongside
`NSURLSession` ones, so invite and pairing errors keep their friendly
messages.

## Measurements

Android emulator (API 36, arm64), profile builds of this branch and
main, signed in to the Feedback community. 8 cold starts per build,
alternating builds in blocks of 4. Times are for relay `/query` requests
started in the first 8 s.

| | main (`dart:io`) | this branch (Cronet) |
|---|---|---|
| First query response | 6.99 s | 1.99 s |
| Startup burst settled | 8.36 s | 2.78 s |
| Burst after the first connection | 1.44 s | 0.77 s |
| Query latency after the first connection, median / p90 | 165 / 1567 ms
| 106 / 158 ms |

**Unexplained stall:** most of main's startup gap is a ~5 s stall before
its first response on every cold start. Its cause is unconfirmed; my
guess is `dart:io` loading its CA store on the emulator, which HTTP/2
itself wouldn't fix, so the first two rows likely overstate the win on
real devices. The rows after the first connection exclude the stall and
are the fairer comparison. I also tried emulated EDGE throttling, but
the emulator's throttle did not slow its traffic, so there are no
slow-link numbers yet.

## Regressions

None found. Devices without Play services keep `dart:io`. Cleartext
`http://` requests keep the handle's own `dart:io` client, as on iOS.

## Testing

- Full mobile suite passes (`flutter test`, 4784 tests).
- Automated app run on the emulator: onboarding, Feedback nsec import,
channel and DM list load, and 16 cold starts with request timing. Media
loading wasn't separately exercised.
- No visible UI change, so no screenshots.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-13 13:33:58 -08:00
Tom Brow
a2d4ba0267 feat(mobile): use HTTP/2 on iOS through app-wide URLSessions (#8897)
On iOS, Buzz's HTTP traffic now uses HTTP/2. Dart's `dart:io` client
speaks only HTTP/1.1, so every feature's client opened its own
connections to the relay, which sits behind Cloudflare and offers
HTTP/2. On a slow link those extra handshakes, and the HTTP/1.1
head-of-line queueing, are a large share of cold-start time.

### What changes

- iOS HTTP goes through two app-wide `NSURLSession`s via
[cupertino_http](https://pub.dev/packages/cupertino_http)
(`lib/shared/http/app_http_client.dart`): one for API traffic (relay
queries, NIP-11, account, admission, pairing) and one for media
(image/video/voice downloads and uploads). Requests to a host multiplex
over one connection per session. Media has its own session so image
bytes can't starve queries on a shared HTTP/2 connection: in prototype
measurements with a single shared session, the channel-list batch query
finished *later* than on HTTP/1.1.
- Callers keep owning and closing their clients; on iOS `close()` leaves
the shared session open. Both sessions are ephemeral with no URL cache
and no cookies, so apart from the protocol (and native gzip, inflated
off the Dart isolate) behavior matches `dart:io`.
- Android, and tests, keep `http.Client()` unchanged, including
`http.runWithClient` overrides.
- Because closing a client no longer cancels a request on a shared
session, the relay query client (both `/query` posts and bounded
snapshot reads) and the dev push-lease fetch abort their request on
timeout instead.
- Non-`https` requests (`http://` media and community icons from other
clients, local dev relays) stay on the handle's own `dart:io` client,
because App Transport Security would block cleartext loads through
URLSession. An HTTPS URL that redirects to `http://` is the one case
that newly fails on iOS (URLSession follows the redirect and ATS blocks
the downgrade); we accept that rather than follow redirects in Dart.
- URLSession failures arrive as `NSErrorClientException`, not
`SocketException`, so pairing and invite-join error messages now also
recognize `NSURLErrorDomain` offline, TLS and timeout codes.
- cupertino_http 3.0.1+ requires native_toolchain_c 0.19 and hooks 2.x,
so `buzz_secp256k1` moves to those. Its build hook compiles unchanged.

### What gets better, and what doesn't get worse

- **Better:** on a slow link, requests reuse one warm connection per
session instead of paying TCP+TLS setup each time, so they complete
where `main` times out (see the table). On Wi-Fi, small queries are
slightly faster.
- **Not worse:** request semantics, caching (none) and cookies (none)
match `dart:io`; Android and tests are untouched; timed-out requests are
aborted so they can't keep using bandwidth on the shared connection;
offline errors keep their friendly messages. The accepted regression is
HTTPS-to-HTTP redirects on iOS, above.

WebSockets stay on `dart:io`. Android (Cronet) is a possible follow-up
using the same seam.

### Validation

Added tests: shared-session handles don't close the session; off iOS the
transport honors `http.runWithClient`; NSURLError code classification;
timed-out relay queries and bounded snapshot reads abort their request;
cleartext requests stay off the shared session.

Focused existing validation: full mobile suite (the only failures are 11
push/notification tests that fail identically on `main` on the same
machine), `flutter analyze`, `buzz_secp256k1` package tests (27/27), and
an iOS release build.

On-device A/B on an iPhone 12 mini against the internal prod relay over
WARP, comparing cold starts of `main` and this branch (profile builds
with local-only request timing, 3 cold starts each):

| | `main` | this branch |
|---|---|---|
| Wi-Fi: first query done (median) | 0.31s | 0.25s |
| Wi-Fi: small-query latency (median) | 0.22s | 0.18s |
| NLC Edge: requests completed in 90s | 0, 0, 0 (29–30 failed) | 12, 14,
16 (5–7 failed) |
| NLC Edge: first request done | never | 6.3–7.0s |

On Wi-Fi the two are about even. Under Edge, every HTTP/1.1 request on
`main` hit its timeout while still opening a connection, and each retry
started a fresh TCP+TLS handshake. The branch reuses one connection, so
queries complete. Connection counts weren't measured on the device,
since no proxy was in the path.

Cold-cache demo on an iOS simulator (this branch, app caches and cached
prefs wiped before launch): avatars, community icons, channel lists,
public channel images, a DM image and custom emoji, video playback,
reactions, and an image and video upload with progress all load. The DM
image and clip are synthetic test media.


https://github.com/user-attachments/assets/039d1a25-46f2-4e0e-b147-f96d0cfabd40

buzz-review-completed (agent review and device validation done; the
human-test step is not applicable under Tom's standing exception for
mobile changes)

---------

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-13 10:48:58 -08:00
Evan Broderick
642ce4165c fix(mobile): show shared chats under Solo (#9348)
## Summary

Mobile puts agent-created and shared Solo chats under Team because it
checks who created the chat. Show unarchived Solo chats the viewer
belongs to under Solo and exclude them from Team. Preserve membership
checks, guest read-only access, legacy chats, and owner-only composing.
This changes mobile classification; it needs no relay changes or data
migration.

**Desktop:**
<img width="557" height="695" alt="Screenshot 2026-11-11 at 10 00 07 AM"
src="https://github.com/user-attachments/assets/d338fa19-7b6f-4b52-a3a6-061025216ed3"
/>

**Mobile (missing solo chats created by agents):**

<img width="423" height="754" alt="Screenshot 2026-11-12 at 11 19 47 AM"
src="https://github.com/user-attachments/assets/18b5da75-38e9-4cca-906c-d0a949cc8cbb"
/>

### Code Changes

Separate Solo list and unread classification from owner-only composing.
Add regression coverage for shared and agent-created chats, Team
exclusion, membership/archive filters, legacy chats, and ordinary
sending from Solo.

### Related issue

Related: #8963 adds mobile access controls and Solo sharing. This PR
fixes the separate Solo/Team placement mismatch. No duplicate found in
searches for mobile Solo issues and PRs.

### Testing

Independent agent review found no blockers.

Device testing could not be completed. Android emulators stalled at
launch, iOS Simulator sign-in was blocked, and iPhone installation
required capabilities unavailable to the Personal Team. Shared Solo
placement and sending remain unverified in an authenticated app;
before/after screenshots remain pending.

Remaining manual checks:

- Have an agent create a Solo chat and include the viewer as a member.
- Confirm it appears once under Solo and is absent from Team.
- Open it, send a message, and confirm owner-only Solo settings are
absent.

Generated with Codex

---------

Signed-off-by: Evan Broderick <ebroderick@squareup.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: coder <e509b66797ba43fd355dc12801a0c1ba376b06924147c65abdafa7ababcf8e2e@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-13 09:11:02 -08:00
Tom Brow
41587e0284 feat(mobile): render messages with gpt_markdown 1.3.4 plusparse (#8945)
Message Markdown on mobile moves from gpt_markdown 1.2.1's legacy regex
pipeline to the CommonMark parser that 1.3 added ("plusparse"). Before
this, passing `inlineComponents` (now deprecated, removed in 2.0.0) kept
every message on the legacy pipeline.

### What changes for users

Rendering moves closer to desktop (react-markdown + remark-gfm):

- `_italic_` and `__bold__` work, backslash escapes and HTML entities
decode, and `[a [b] c](url)` labels are correct.
- Inline code follows CommonMark pairing: `"```npm install```"` in a
sentence is inline code, and four-backtick fences work.
- Setext headings, reference links, footnotes, `~~~` fences, `1)` lists
and CommonMark list/quote continuation render.
- HTML comments are hidden, as on desktop.
- `\[`, `\]`, `\(` and `\)` stay literal, as on desktop. Plusparse
hard-codes them as LaTeX delimiters, so they're written as entities
before rendering.
- Side effect: an unfenced `__init__` now renders as bold "init", and a
line over `---` becomes a heading, same as desktop.

Device benchmark (iPhone SE, profile build, 600 synthetic messages, 3
launches per build): scrolling spends 9% less time building, and frames
with more than 8 ms of build drop from 63 to 22. Jumping onto unbuilt
messages is 11% cheaper, and raster time is unchanged.

App size: the release app grows about 4.6 MB uncompressed (80.6 to 85.2
MB), mostly Dart code from the new math and highlighting packages.

### Before and after

Synthetic messages that reproduce differences found in real channel
history, rendered through `MessageContent` on main and on this branch:


![01-escaped-brackets-in-code](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--01-escaped-brackets-in-code.png)


![02-inline-triple-backticks](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--02-inline-triple-backticks.png)


![03-four-backtick-fence](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--03-four-backtick-fence.png)


![04-entities](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--04-entities.png)


![05-stars-and-underscores](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--05-stars-and-underscores.png)


![06-ordered-list-paren](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--06-ordered-list-paren.png)


![07-setext-heading](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--07-setext-heading.png)


![08-dunder](https://raw.githubusercontent.com/block/buzz/49600d2f9b87c2c41fd1bcac450efd345de0d0db/pr-8945--08-dunder.png)

### Demo

A scroll through synthetic messages covering common formatting
(headings, lists, quotes, links, highlighted code, a table, a task list,
escapes), recorded on an iPhone 17 Pro simulator running this branch:


https://github.com/user-attachments/assets/bdc9680c-d20b-41ec-8e1a-a5b51c602f9d

### How

- Mentions, custom emoji and `#channel` tokens are `InlinePattern`s.
Links go through `inlineLinkBuilder` into the existing `_buildLink`, so
chips, media links and taps are unchanged.
- Removed workarounds the parser makes unnecessary:
  - the render-path escape shielding from #8925
- the `_MarkdownEscapeMd`, `_MarkdownLabelEntityMd` and `_MessageLinkMd`
components
  - the zero-width prefix before a leading `#channel`

Plain-text previews and gallery helpers keep their own escape handling.
`normalizeBareLinks` stays because attachment and gallery detection
depend on its output. Bubble segmentation unescapes a link destination
itself before its imeta lookup, since content no longer arrives
shielded.
- Kept desktop parity where plusparse differs from GFM:
- a table typed directly under a caption line gets a blank line inserted
before it, since plusparse can't start a table mid-paragraph
- `> [!NOTE]` quotes render as quotes (`alertBuilder` returns
`asBlockQuote()`), since desktop has no alerts
- `mapMarkdownProse` now ends an unclosed backtick run at its paragraph.
Before, it could pair with a run in a later block and flip code and
prose for the rest of the message.
- Synthesized autolink labels escape backslashes instead of using
`&#92;`, which the parser leaves undecoded in a URL-shaped label.
- Repo/PR/issue chips keep their own semantics node.
- Forum card previews clip at their 120 px cap instead of overflowing:
blocks now lay out as a column.
- Pinned to exactly 1.3.4. 1.4.0 renders HTML by default and themes
through the separate `material_ui` package, which would need a theme
bridge.

### Validation

- Full mobile suite passes and analyze is clean at 78b9c1a6d0.
- All of #8925's and #8940's backslash-escape cases pass on the new
parser, including the strike-across-lines case that used to be a known
limitation.
- Real-message diff: 2,259 recent messages from 13 busy channels,
rendered through `MessageContent` on main and on this branch. 29
differed in text or styling. On inline and fenced code, the branch
matched desktop's parser (remark-gfm) in 23 of them and main in 7. The
review found the three parity gaps above, now fixed. The rest are
CommonMark behavior that desktop shares.
- Added tests, each confirmed to fail without its fix:
  - a leading `#channel` renders as a link, not a heading
  - a table under its caption renders as a table
  - an alert-marker quote stays a quote
  - an unclosed backtick run doesn't flip later code
- the transcript tests detect a rendered link by its style; the old
`LinkButton` check passed even with autolink on
- Automated simulator run (iPhone 17 Pro, iOS 27, debug build, signed in
to a Builderlab community): channel list, two channels with history
scrolled back several pages (mentions, link previews, thread summaries,
images), an agent Solo chat with long agent messages, and the inbox. No
rendering errors or layout breaks; the Solo chat screen also matched
main's build side by side.

🤖 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-13 08:06:50 -07:00
Tom Brow
2b428f56b8 feat(mobile): share into Buzz from the iOS share sheet (#9433)
Lets people share screenshots, screen recordings, photos, URLs and text
from any iOS app into Buzz. Today Buzz doesn't appear in the share sheet
at all.

- **Plain Buzz icon:** opens a new Solo chat with the items in its
composer.
- **Suggested conversation:** iOS offers channels and DMs the person
recently sent top-level messages in. Choosing one opens that
conversation with the items in its composer. When the conversation is
already open, the share goes to that page's composer instead of opening
a second one; if another page covers it, Buzz stays where it is and
shows "Go back to that conversation to finish sharing", and the items
join the draft when the person goes back.
- The share extension has no UI and sends nothing. It copies the items
into the app group and opens Buzz, which prefills the normal composer,
so drafts, attachments, mentions and failed-send handling all stay the
app's (see [the
ADR](https://github.com/block/buzz/blob/mobile-share-extension-design/docs/adr/0003-share-hands-off-to-the-conversation.md)).
- If the conversation already has a draft, Buzz asks whether to add the
shared items to it or replace it.
- A share to a conversation that's no longer available (a removed
community or channel, or an unreadable share) shows "That conversation
isn't available". A share while signed out shows "Sign in to share".

Suggestions come from an outgoing `INSendMessageIntent` the app donates
after a top-level send or a new Solo chat. The notification extension no
longer donates incoming messages, so receiving a message never makes a
conversation a suggestion; it still turns the push into a communication
notification with the sender's avatar. Both use the same conversation
identifier, now the plain community and channel IDs instead of a hash,
because the extension needs to hand the identifier back to the app.

| Before | After |
| --- | --- |
| <img alt="Share sheet without Buzz"
src="https://github.com/user-attachments/assets/452fac1b-7e87-44c3-a442-099f78d0e07b"
width="300"> | <img alt="Share sheet with Buzz"
src="https://github.com/user-attachments/assets/54b9775d-29b4-49a5-8ab9-5fda8718a02f"
width="300"> |

| Buzz icon: new Solo chat | Suggested DM with a draft | After Add |
| --- | --- | --- |
| <img alt="New Solo chat with the shared photo"
src="https://github.com/user-attachments/assets/c5da4d8b-1dd8-4e30-9e92-9dba515b3623"
width="250"> | <img alt="Add to your draft prompt"
src="https://github.com/user-attachments/assets/2f879f8a-3b9f-48e0-b963-2828e90dc9fe"
width="250"> | <img alt="Draft with the shared link and photo added"
src="https://github.com/user-attachments/assets/12832006-85c5-4447-98b5-62932552c931"
width="250"> |


https://github.com/user-attachments/assets/b9d380fa-e802-4ed7-89a8-592a03784c8f

### Regressions

- Nothing changes for people who never use the share sheet, except that
sending a top-level message or starting a Solo chat now makes one local
`INInteraction.donate` call (skipped while the age restriction is on,
which still purges every interaction).
- Communication notifications look the same. Dropping the incoming
donation removes work (and a deletion fence) from the notification
extension's time budget.
- The share hand-off reuses the existing deep link dispatcher. A share
link is a new link type; notification and message links take the same
paths as before.

### Validation

- Added tests:
- Dispatcher hand-off: a share to a suggested channel opens it with the
shared text and files; shares to a removed community, an unlisted
channel, an unknown manifest version or a missing manifest show the
error and delete the pending share; share links accept only the
extension's UUID ids.
- Composer delivery: with an existing draft, Add appends the shared text
on a new line and attaches the file, Replace clears the draft first, and
the app group copy is deleted either way.
- Notification presenter: specializes the notification from the intent,
or falls back to the ordinary content when that throws (replaces the
donation and deletion-fence tests).
- Full mobile Flutter suite and BuzzPushKit Swift tests pass.
- Automated app run on an iPhone 17 Pro simulator (iOS 27, dev relay
test community), recorded above: sent a DM, shared a photo from Photos
with the Buzz icon from a cold start (new Solo chat with the photo
attached), then handed a link and photo to a DM that had a draft and
chose Add. Also checked that a share's pending files are deleted after
delivery.
- Limitation: the iOS simulator never shows share-sheet conversation
suggestions (it has no `coreduetd`), so the suggested-DM step in the
video is staged by writing the same pending share and link the extension
writes. Choosing a real suggestion still needs a check on a device.
- Known gaps, all confined to sharing: suggestions have no avatar image
yet; a suggestion for a conversation left after signing out shows "isn't
available"; choosing Later in the unfinished-chat dialog keeps the share
until the next new chat; and a pending share the app never receives (for
example when Buzz doesn't open) stays in the app group.

### Before merge

- [x] On a real iPhone, choose a suggested conversation in the share
sheet and confirm the shared items open in that conversation's composer
(the simulator can't show suggestions). Waived before merge: the managed
test iPhone shows no share-sheet suggestions for any app, so this will
be checked on a personal phone after landing.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-12 22:57:21 -08:00
Kalvin C
3c0adc1882 fix(mobile): qualify every namesake mention and keep authored mention casing (#9325)
## problem

When a message mentions two different identities that share a display
name, the mobile composer qualified only the later selection as `@Name
(<64-hex>)` and left the first one bare. A qualified occurrence denies
the plain name on render, so the first mention rendered as plain text on
mobile and desktop. `MessageContent` also displayed every mention in the
lowercased binding key rather than its authored spelling.

## change

- `mention_bindings.dart`:
- `selectedMentionLabel` qualifies a selection whenever another selected
identity shares its name, without regard to case.
- `namesakeRequalifications` and `renameMentions` qualify earlier plain
selections. Each occurrence keeps its authored spelling, and occurrences
in code stay as typed.
- `compose_bar/helpers.dart` and `compose_bar_widget.dart`:
- Selecting a namesake qualifies earlier same-name mentions before the
new label is inserted, keeping the caret in place.
- Occurrences inside code that the composer styles are skipped:
single-backtick spans and closed triple-backtick fences, found by the
same walk the editor uses to draw them. A key whose occurrence stays in
code remains bound beside its qualified label, so its recipient still
sends.
- `agent_mention_prefill.dart`: automatic addressing qualifies every
same-name agent it inserts.
- `message_content.dart`: mentions render in their authored spelling,
and bindings still resolve case-insensitively.
- `docs/mention-editor.md`: describes the behavior, including that
Markdown code forms the composer does not style (tilde fences, indented
code) are qualified like prose.

## tests

- `mention_bindings_test.dart`: requalification, spelling preservation
and code exclusion.
- Composer journeys:
  - picker selections qualify both namesakes and send both keys;
- styled code (fences, list fences, spans, spans after bold or italics)
stays as typed while surrounding prose is qualified;
  - a selection left only in code keeps its recipient;
  - automatic prefill of two same-name agents qualifies both.
- `message_content_exact_mentions_test.dart`: authored casing with
case-insensitive resolution.
- `just mobile-check mobile-test` passes.
- Real relay: composed bodies exchanged through a local relay render as
correctly targeted chips in desktop and in Flutter `MessageContent`.

---------

Signed-off-by: Kalvin Chau <kalvin@block.xyz>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: goose-wayne <ae6b377e5b6d090ee22558d19246413a5731628a127e25371111badfd4861535@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz>
2026-11-12 19:11:37 -08:00
Tom Brow
5bfbda4c33 fix(mobile): never pop Home when archiving from channel settings (#9387)
Archive, Leave, Unarchive and Delete in channel settings wait for the
relay, then close the settings sheet by popping whatever route is on top
of the root navigator. If the user closes the sheet themselves during
that wait (for example: long-press a chat on Home, Archive, confirm,
then tap the close button), that pop lands on Home instead. The
navigator ends up empty: a blank white or black screen with no controls
and no way back short of killing the app.

### Change

- **Close only the route that offered the action.** (Main has since
gained the same guard; after merging main, this part of the diff is a
comment plus the tests below.) After the action completes, the settings
sheet or page closes itself only if it is still on top, with its "close
the conversation too" result, as before. If the user opened something
over it meanwhile (for example a member's profile), it stays open under
that route, which keeps working. If the user already dismissed it,
nothing is popped. The sheet still closes on its own after a successful
archive.
- **Home can no longer be popped.** The app's root route refuses pops. A
stray pop that reaches it is reported through `FlutterError.reportError`
(which fails widget tests) and ignored, so no other caller can leave an
empty navigator either. Local-history pops on the root route (a drawer
or persistent bottom sheet) still close normally. The root route still
rebuilds from the current auth state, so sign-in and sign-out
transitions are unchanged.

### What changes for the user

Only the case where a settings action finishes after the user moved on:

- Settings dismissed mid-flight: before, the completion popped whatever
was on top (Home, the conversation, a thread or a profile). Now nothing
is popped.
- Something opened over settings mid-flight: before, the completion
popped that new route and left settings open. Now that route stays, and
settings stays open under it, as on main. That settings page shows the
channel as it was before the action (for example still offering Archive
after an archive, or a channel that is gone after Delete or Leave), as
on main. Settings following lifecycle changes is part of the follow-up
below.
- Delete or Leave from the pushed settings page, then back out before
the relay answers: before, the stray pop happened to close the
conversation. Now the conversation stays open until the user leaves it
(Leave and Archive show the read-only notice; a deleted conversation
keeps showing its last state). Closing it reliably needs the
conversation to notice its channel is gone, which is a follow-up.

Pops that reach Home were always a bug and are now refused. Every other
pop (sheets, pushed pages, system back above Home) takes the same path
as before.

### Validation

Added tests:
- Channel actions sheet journey: confirm Archive with the relay call
still pending, close the sheet, then let the archive finish. Home stays.
A second pass leaves the sheet open and checks it closes by itself once
the archive completes. Fails on the old code with Home popped.
- Conversation journey: open settings from a conversation, confirm
Archive with the relay call pending, open a member's profile, then let
the archive finish. The profile stays open and current, and its Message
action still opens the DM. Fails if the completion pops the top route,
and fails if it removes the covered settings page (the profile loses the
context it navigates from).
- Root route: normal push and pop still work, a drawer on Home closes on
back, and popping Home is refused, reported, and Home stays on screen.

Full mobile test suite and `mobile-check` pass, including after merging
main.

Automated app run at
[c158c17](c158c1793d)
on an iOS 27 simulator (iPhone 17 Pro, debug build, public Builderlab
community): long-press a solo chat on Home, archive it from the settings
sheet, and confirm the sheet closes by itself with the channel list
intact. Then the race: confirm Archive and immediately drag the sheet
closed while the archive is in flight. Home stays intact with the chat
archived, and no refused-pop error is logged. Limitation: AXe taps don't
reach the native glass close button on the simulator, so the run
dismissed the sheet with the drag gesture, which takes the same route
pop.

buzz-review-completed

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:06:45 -08:00
Tom Brow
4a101752fb fix(mobile): never show emoji shortcodes in reaction pills (#9411)
## Context

A reaction slot should never show an emoji shortcode as text. Today it
does in two cases:

- An agent's reaction is a kind 7 event with content `:shortcode:` and
no NIP-30 `emoji` tag, so the pill printed `:approve:` in tiny text
instead of the community emoji.
- A custom emoji whose image fails to load fell back to the shortcode
text.

## Behavior

- A tagless `:shortcode:` reaction resolves against the community
custom-emoji palette and renders that image. An `emoji` tag on the event
still wins.
- A shortcode with no palette entry, or whose image fails to load, shows
a neutral placeholder glyph (the muted sparkles icon) instead of text.
The shortcode survives only as the semantics label.
- This applies to every reaction slot: the timeline pills, the combined
reaction tray, the Flutter reaction detail sheet, and the native iOS
reactions sheet (which is told which shortcodes have no image, so
`NativeMessageGlyph` draws the placeholder). System-message rows reuse
the same reaction row.
- Unicode emoji are unchanged.

The icon is the existing `BuzzIcons.sparkles`. Pareto note: the palette
lookup is the shared `reactionEmojiUrl` helper, so there is no new
resolver, and the pill only watches the palette when the reaction has no
tag.

### Validation

- `just mobile-check mobile-test`: format and analyze clean; full suite
passes (4773 passed, 74 skipped).
- New widget tests (journeys, in
`reaction_row_test/shortcode_tests.dart`): a tagless known shortcode
renders its image; an unknown shortcode and a failed image render the
placeholder and never the text; unicode is unchanged; the native sheet
payload marks image-less shortcodes. Reverting the fix makes both new
journeys fail.
- iOS: added a Swift unit test for the native glyph placeholder
(`NativeMessageImageLoaderTests`); not run locally, the app run below
exercises the same code.
- Automated app run on a cloned iOS simulator with a fixture entry point
(mocked media, synthetic palette): confirmed the pills before and after,
and opened the reaction sheet from a long-press to confirm the
placeholder renders there too. The clone was deleted afterwards.

## Before / after

Captures use synthetic shortcodes and a synthetic palette.

<img width="300" alt="reaction-pills-before"
src="https://raw.githubusercontent.com/block/buzz/75b22a00d92df2db389ef90d35d476b285b60374/pr-9411--reaction-pills-before.png">

<img width="300" alt="reaction-pills-after"
src="https://raw.githubusercontent.com/block/buzz/75b22a00d92df2db389ef90d35d476b285b60374/pr-9411--reaction-pills-after.png">

Reaction sheet after:

<img width="300" alt="reaction-sheet-after"
src="https://raw.githubusercontent.com/block/buzz/75b22a00d92df2db389ef90d35d476b285b60374/pr-9411--reaction-sheet-after.png">

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-12 13:38:37 -08:00
Michael Fransen
2f792c2f6b fix(mobile): isolate channel header scroll rebuilds (#9400)
## Summary

Improve scrolling performance in the Messages channel list by avoiding
unnecessary inventory rebuilds as the header moves. Keep scroll-driven
header state in a notifier and retain the inventory while the header
animates. Provider and parent updates still rebuild the inventory with
current channel data.

This complements the lazy-row optimization in #9401. In manual iPhone
runs with 500 channels, adding lazy rows on top of header isolation
reduced maximum observed Flutter UI work from **65.5 ms to 4.2 ms**.
That measurement reflects the added lazy-row change; no standalone
performance gain was established for header isolation.

This is an independent production-only change. Test fixtures and
diagnostic instrumentation are excluded; regression checks were run
locally and are not included in this PR.

### Related issue

Related: #5911 addresses scrolling behavior inside conversations. This
change addresses header-triggered rebuilds in the Messages channel
inventory. No matching open PR or issue was identified in the focused
duplicate search.

### Testing

Exercised Messages on a physical iPhone with 500 channels against an
isolated local relay. Header collapse and channel updates worked. This
change alone did not remove the large scroll stalls; lazy section rows
are a separate change. The device run preceded the refresh onto current
main.

Local-only regression checks passed 10 tests on this independent branch.
They verify stable inventory identity during header movement and visible
channel updates. These checks are excluded from the commit.

Remaining visible jumps are under investigation; this PR does not claim
to resolve them.

Generated with Codex

Signed-off-by: Michael Fransen <mfransen@squareup.com>
Co-authored-by: Karl <9e8471f7b792e46c9c100840959dc71c660786c79c2a3165dbcaf58f52c4266e@buzz.block.builderlab.xyz>
2026-11-12 13:11:49 -08:00
Michael Fransen
2636e986a0 fix(mobile): build channel section rows lazily (#9401)
## Summary

Improve scrolling performance in the Messages channel list by building
Solo and Team rows only as needed. Sections currently mount all their
rows as one scroll item, which causes long UI stalls with large channel
lists.

In manual iPhone runs with 500 channels, maximum observed Flutter UI
work fell from **65.5 ms to 4.2 ms** after adding lazy rows to a build
with header isolation (#9400). The tester reported much smoother
scrolling. This was an exploratory comparison with different gestures,
not a controlled benchmark of this independent branch.

Use stable channel keys and retain section controls, sorting, and
collapse animations. Clip the sliver extent during collapse so the
animation does not mount the entire section. The shared transition
supports downward vertical lists.

This is an independent production-only change. Test fixtures and
diagnostic instrumentation are excluded; regression checks were run
locally and are not included in this PR.

### Related issue

Related: #5911 addresses scrolling behavior inside conversations. This
change addresses eager row mounting in the Messages channel inventory.
No matching open PR or issue was identified in the focused duplicate
search.

### Testing

On a physical iPhone with 500 channels against an isolated local relay,
maximum Flutter UI work fell from 65.5 ms to 4.2 ms after adding lazy
rows to a build that already isolated header rebuilds. The tester
reported much smoother scrolling. Gestures differed between runs, so
this is not a controlled benchmark or an isolated measurement of this
branch on its own. The device run preceded the refresh onto current
main.

Local-only regression journeys passed 12 tests on this independent
branch. They cover page laziness and updates, variable-height rows,
large text, the last row, collapse reversal, reduced motion, and
semantics. These checks are excluded from the commit.

Smaller visible jumps remain under investigation; this PR does not claim
to resolve them.

Generated with Codex

---------

Signed-off-by: Michael Fransen <mfransen@squareup.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Karl <9e8471f7b792e46c9c100840959dc71c660786c79c2a3165dbcaf58f52c4266e@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-12 12:56:43 -08:00
klopez4212
cb69ad9e4f Adapt iPhone Duo layouts, rail navigation, and native sheets (#8568)
Duo keeps conversations and Settings details open across closed, book
and flat postures. Book mode splits at the fold; flattening restores the
sidebar. Native rail controls, full-width navigation backdrops and
sheet-local safe areas keep content aligned. Ordinary iPhones remain
single-pane in portrait and landscape; tablet and Duo split layouts
remain enabled.

Includes the recovered preview's matching pane widths, Buzz empty-pane
mark, stable Settings chevrons, Bestie pane routing and Duo-only upward
New menu attachment. Current main's Activity redesign, Search content
fade and unread-navigation button are retained. Menu selection checks
sit beside their labels.

Shared mobile changes remain in scope: the native iOS status editor,
Appearance preview layout, avatar crop preservation, onboarding footer
layout, profile/invite sheet geometry and nested conversation
navigation. This PR is not exclusively Duo-gated. Nested navigator
observers preserve recording cancellation and navigation callbacks; crop
resizing preserves the selected image region. iOS 27.1 APIs remain
compile-time and runtime gated.

Validation on the reconciled source: Flutter analysis, Activity/Home
journeys, the full mobile test suite, file-size checks and Swift package
tests. The iPhone single-pane fix was also exercised on an iPhone 18 Pro
simulator before reconciliation. Fresh hosted CI and physical-device
confirmation of the reconciled build are separate and remain pending.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-12 19:00:58 +00:00
klopez4212
5f81803cb1 End last-human agent Huddles and preserve mobile transcript access (#9375)
## Summary

Leaving an agent DM Huddle previously skipped client lifecycle cleanup,
allowing Join to remain visible while the relay waited for the agent.
Apply the existing last-human rule to DMs: release audio first, then
publish the ending and archive when the human count is at most one.
Preserve the existing additional-device and same-Huddle rejoin guards.
Retain DM membership when other humans remain so hanging up does not
revoke transcript access.

Offer **View** only when cached backing-room membership confirms
transcript access, opening the original Huddle transcript and reply
threads without joining audio. Non-members retain disabled Ended.
Preserve Open for an active local session even when an ended event
arrives.

For admitted or just-left Huddles, switching/removing a community
retires pending remote finalization and waits for local audio teardown.
Generation guards prevent retired count/end results from launching
follow-up writes or interfering with a later call. Existing in-flight
Huddle-start rollback behavior is unchanged.

Client only; remote relay finalization is separate in #9376. Human
counts use backing-channel membership; known duplicate owner admissions
prevent client cleanup. Concurrent device arrivals are not made atomic
by this client-only change, and human-to-human DMs with retained
memberships still rely on relay finalization.

### Related issue

Split from the combined Huddle repair at the author's request. Searched
open Huddle issues/PRs; no exact duplicate found for this mobile
behavior.

### Testing

Follow-up fixes are in `7f28dc486`; merged current main in `7a592f19d`.
Required push checks pass on the merged head.

- Mobile formatting, analysis, and full suite passed (4,705 tests, 71
skipped; supplementary suites: 4 and 27).
- DM hangup journey covers sole-human ending, preservation of another
owner device, and preservation of membership when another human remains.
Existing rejoin/lifecycle regressions remain in the full suite.
- View journey reads the original transcript and opens a server-only
reply-thread summary without joining audio.
- Mutation checks: restoring the DM cleanup exemption fails the
last-human journey; removing thread summaries fails View navigation.
Restored production code passes.
- Independent review completed; follow-up review of the three blocking
fixes found no remaining blockers.
- Follow-up regressions cover live-call Open after an ended event,
reactive history membership revocation, stalled count/end requests
during community transition, and background teardown of a later call
while retired cleanup is unresolved.

Phone/human validation remains pending. Start an agent DM Huddle and
leave from the last human device: its card should stop offering Join.
Tap View to read the transcript and replies. Repeat with another device
still in the Huddle and verify it stays open. Not deployed.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-12 10:45:10 -08:00
Tom Brow
473d592602 fix(mobile): keep a thread tail behind the keyboard unread (#9295)
Follow-up to [#9243 read tall
mentions](https://github.com/block/buzz/pull/9243).

**Problem.** Since #9243, the newest reply in a thread is read once its
end shows at the live bottom, even when it is taller than the screen.
The thread view decides "at the tail" from scroll geometry that ignores
the keyboard. On Android, with the keyboard open and tail-follow
detached, the last reply can sit at the scroll end but entirely behind
the keyboard, and it gets marked read. The mark stays after the keyboard
closes, so a mention there can be cleared without ever being seen.

**Fix.** The thread's live bottom now also requires the tail row's end
to be inside the reading area, above the keyboard and composer. This
matches how the channel timeline already checks its bottom row.

### Validation

- Added test: a thread whose last reply sits behind the Android keyboard
leaves it unread, including after the keyboard closes. It fails without
the guard.
- Full mobile suite and `flutter analyze` pass.

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 06:28:36 -08:00
Tom Brow
c0e30110dd fix(mobile): restore header cues and per-channel identity check for #9369 (#9370)
Follow-up to #9369 (conversation header avatars). Fixes two regressions
found in its review. The intended behavior of #9369 stays the same.

1. **Message rows no longer each scan the roster.**
`showMessageAuthorName` ran at the top of every message and thread row,
in every channel. Each run watched a whole `Channel` object (which has
no value equality) and built sets from the full roster, plus two more
sets for the stale-DM check in DMs. A new
`confirmedConversationPairProvider` works out the two-person pair once
per channel, including the rule that a DM keeps attribution while its
metadata disagrees with the roster. It returns a record that compares by
value, so rows rebuild only when the pair itself changes. It reads
`watchLatestChannelMembers`, so a revisit uses the cached roster and
rows no longer re-wrap 48 dp wider once the roster fetch returns. The
visible rule is the same as before.
2. **Android private channels show the lock again.** Every Android
conversation header now uses the compact title pill, which had no lock.
The pill now shows the existing lock icon (and its "Private channel"
label) before the name.

### Validation

- Added tests, all extending existing journeys:
- The author-visibility journey checks that replacing the channel object
(as live activity does) doesn't notify rows when the pair is unchanged.
Its existing `stale-dm` case covers the metadata rule now inside the
provider.
  - The private-lock header test expects the lock again.
- Each new or restored Dart assertion fails with its fix reverted, and
so does the `stale-dm` case with the provider's metadata rule removed.
- Full mobile suite (`just mobile-test`) and `flutter analyze` pass.
- Not run: an automated full-app session on a simulator or device.

🤖 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-12 06:21:39 -08:00
Tom Brow
27f0fe7527 feat(mobile): add iOS Home Screen shortcuts for New chat, New DM and the Bestie (#9360)
Long-pressing the Buzz icon on iOS now offers three quick actions:

- **New chat** opens a new solo chat (the same draft as New › New chat).
- **New DM** opens the New DM picker.
- **Message <Bestie>** opens the DM with the current community's Bestie,
using the agent's display name (for example "Message astra"). It's
hidden when the community has no Bestie, and it updates when the Bestie,
its name or the community changes.

| Before | After |
| --- | --- |
| <img alt="before"
src="https://github.com/user-attachments/assets/393c3fb6-fe64-4505-a7a4-12714d8bf1df"
width="300"> | <img alt="after"
src="https://github.com/user-attachments/assets/1c57df92-6fed-4fee-9ce8-e9ea0ec70294"
width="300"> |

### How it works

Home publishes the items through a small native bridge
(`buzz/home_screen_shortcuts`), which sets
`UIApplication.shortcutItems`. A tap goes through the scene delegate.
The bridge keeps the latest one until Dart has handled it, the same
pattern push-notification taps use, so cold launches work too. Home runs
it only once the app is active and the destination is ready. When a tap
arrives, Home pops back to the first route once, so a shortcut never
opens beneath a Flutter sheet or a conversation that was already open. A
screen that refuses to close (for example a New chat whose first message
is still sending) stays, and the tap is dropped. The one exception is
the native iOS New channel form, which isn't a Flutter route: a shortcut
tapped with it open runs underneath it. If a screen is opened while a
tap is still waiting for its destination, the tap is dropped. A New DM
tap while the New DM picker is open replaces the picker. Opening the
Bestie DM now goes through one shared function, so the Home launcher
button and the shortcut run identical code. A second open while the DM
is still being looked up does nothing. Signing out clears the items. The
shortcut wiring lives in its own leaf widget, so Home doesn't rebuild
for it.

Behavior change for the existing Home Bestie launcher: if you open
another screen while it's still looking up the DM, the DM no longer
opens over that screen.

Behavior change for the native member picker (New DM, and Add members in
channels): a picker reopened while the previous one is still closing now
opens once the dismissal finishes, instead of failing with "Cannot open
the member picker".

### Validation

- Added tests: a Home journey covers the published titles (including the
Bestie's name), a cold tap that waits for the app to resume and for New
chat to be available, a Bestie tap made with another route open, a New
chat tap while a draft is open, a New DM tap replacing an open picker, a
waiting tap dropped once another screen opens, no Home rebuilds on
lifecycle changes, and clearing the items when Home goes away. A
launcher test covers a slow Bestie lookup, and a New chat test covers a
shortcut tapped while the first message is still sending. I also broke
the code that runs the shortcut and confirmed the journey fails.
- Full mobile suite and `flutter analyze` pass. CI doesn't compile Swift
on drafts, so `NativeAddMembersSheet.swift` was compiled with a local
`flutter build ios --simulator` build.
- iPhone 17 Pro simulator (iOS 27), signed in to a Builderlab community:
from a cold launch, New chat opened the new-chat draft. Then, with the
app warm, New DM opened the picker and Message <Bestie> replaced it with
the Bestie DM. The recording stays in Buzz because it shows real account
data.

buzz-review-completed

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 04:20:36 +00:00
Tom Brow
85c7156085 perf(mobile): stop downloading whole videos for posterless stills (#9367)
Follow-up to [#9356 gallery video
selection](https://github.com/block/buzz/pull/9356), merged as
[ef57fec4d](ef57fec4d2).
It makes two changes that came out of review.

### 1. Remove automatic stills for videos without poster metadata

#9356 generated a still for every rendered video bubble or stack card
that had no NIP-71 poster. To do that it downloaded the **whole video**
(up to the 100 MB limit), grabbed a frame and threw the file away.
Desktop (buzz-app) never writes `image`/`thumb` on video attachments, so
this covered every desktop-sent video, not only old mobile messages.
Before #9356 those bubbles were a static placeholder that used no
network.

The cost on a real timeline:
- A four-card stack could pull up to about 400 MB just for stills,
before anyone pressed play.
- When the user did open a video, playback started its own separate
download of the same file, and the poster download kept competing for
bandwidth.
- A failed, cancelled or stalled download saved nothing, so every
remount (scroll back, swipe back in a stack) started the full GET again.
Cached stills from non-relay URLs were also dropped and fetched again
after the cache's seven-day expiry.

This PR deletes that path: `video_poster.dart` and its test, plus the
watchers and `generatedPoster` branches in `video_preview.dart` and
`media_stack.dart`. Posterless videos are back to base behavior: "Video
attachment" in a bubble, the plain surface on a stack card, and the
source snapshot in the native viewer. The rest of #9356 stays: queued
local stills (`prepareVideoPoster` on the local file, no network), the
remote-poster preview in the native viewer, the picker changes and swipe
dismissal.

`NativeVideoFiles._cancelTimeouts` was added for poster disposal. No
remaining test depends on it, so it goes back to base too.

If stills for desktop-sent videos are still wanted, a bounded follow-up
is to generate and cache the still from the file that playback already
downloaded, after the user opens it. That adds no network.


### 2. Route `.3gpp` and `.3g2` picks as videos

The Video row is gone from the attachment menu, so `_isPickedVideo` is
now the only thing that classifies path-only picker results. Its
extension list missed `3gpp` and `3g2`. The recent-media grid returns
the original library file, and PHPicker exports 3GPP2 as `.3g2`, so
those videos were queued as images and then rejected by `uploadImage`.
Before #9356, the explicit Video action uploaded them through
`uploadVideo`, which transcodes to MP4.

### Pareto

The change only removes work: no extra network or decoding for
posterless videos, and no change for videos that carry a poster. The one
thing we give up is the still on posterless videos that #9356 added and
base never had.

### Validation

- Added test rows: `clip.3gpp` and `clip.3g2` in the existing
mixed-gallery composer journey. Both now queue as video.
- Full mobile `flutter test` passes on
[518af3a0d](518af3a0d2):
4,688 passed, 71 skipped. `flutter analyze` is clean.
- I didn't run an app journey for this fix. It brings the posterless
paths back to base code, and #9356's own validation covers the rest.

Review report:
`buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=bcae52d59c255add1a927e0135441a1c58115b6aa6cda8d9ff7e58d47a627a87`

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:18:29 +00:00
klopez4212
96e56c5b33 Add participant avatars to mobile conversation headers (#9369)
## Summary

Add participant portraits to mobile conversation headers, with up to
four portraits in a compact cluster. DM and Solo headers show
counterparts; channel headers use the member roster. Names stay on one
line, and tapping either the portrait or title opens the existing
settings.

- iOS: float portraits above the glass title capsule; lift standalone
animated artwork and tuck the title underneath.
- Android: place the cluster inside a left-aligned title pill, 16 dp
after Back, with smaller agent portraits and a 48 dp tap target.
- Remove header presence/member-count subtitles. In confirmed two-member
conversations (DM, Solo, or channel), hide redundant incoming author
avatars and give text the freed 48 dp while retaining the previous total
width. Apply this to thread replies and align their footers; messages
with avatars and outgoing messages retain their production width caps.

Keep sender attribution visible while DM metadata and current membership
disagree. Forum loading, error, and post-list states reserve the full
conversation header height. The floating title follows the app-selected
appearance, including when it differs from iOS. Conversation headers
remain name-only, including temporary conversations, as requested;
retention accessibility text is preserved.

## Validation

- Formatting/static analysis and full mobile suite: 4,695 passed, 71
skipped; auxiliary push and crypto suites passed.
- Full native iOS suite passed, including title positioning/reset and
settings activation.
- Installed previews on physical iPhone Air and Pixel; Android
avatar/title settings taps exercised.
- Final diff reviewed for correctness, accessibility, scope, and
public-source boundaries; no blocking findings.

The width follow-up is covered by rendered conversation/thread tests.
The width follow-up is installed and launched on iPhone Air; the Pixel
preview remains on the preceding header build. The review fixes have not
been installed on physical devices.

## Snapshots

Current Pixel preview, cropped to the header to omit conversation
history. These captures show a single agent and a four-portrait cluster.
The current iOS preview is installed, but a fresh physical-device
screenshot was blocked by device authentication; no outdated iOS capture
is included.

### Android — single agent

![Android single-agent
header](https://github.com/user-attachments/assets/9ecb45b7-a2e0-4699-8889-ab7934fd1759)

### Android — grouped agents

![Android grouped-agent
header](https://github.com/user-attachments/assets/f4435720-0d10-4b4e-98c2-5494dc9a83c4)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-11 15:28:39 -08:00
Logan Johnson
8f80b172ea fix(mobile): stop asking for an API token when the channel list is refused (#9327)
## Summary
- When the relay refused the channel-list request (HTTP 401), the mobile
app said "Not authorized. Check your API token." The app has no API
token, so the advice could not be followed.
- The message now reads "This community couldn't authenticate the
request. Try again." Retry stays: for org and hosted communities the
refused token is dropped and Retry gets a fresh one, and a self-hosted
relay that refuses the key has no other recovery on this screen.
- One exception: when the organization sign-in has ended, the app sends
reads unsigned and Retry can never succeed, while the Home banner
already offers a working Sign in. In that state the channel list says
"Use the sign-in prompt below to reconnect." and hides Retry.

## Details
- `_ErrorView`
(`mobile/lib/features/channels/channels_page/badges.dart`) only appears
on a cold load with no saved channel list. It replaces the list, so
Retry is the only control on that screen.
- It reuses the shared `organizationSignInPromptVisible` predicate, the
same one the Home banner and the community switcher use, so the error
view and the banner agree on who owns the action.
- The 403 "Access denied." message is unchanged.
- Widget tests cover the new 401 copy with Retry, and the signed-out
organization state with no Retry.

## Screenshots
Android emulator, debug build, against a local test relay that refuses
the channel-list read with HTTP 401 (no saved channel list, so the error
view shows):

<img
src="https://github.com/user-attachments/assets/feebc324-a4cf-49ca-876a-1ae026bda753"
alt="Channel list error: This community couldn't authenticate the
request. Try again. With a Retry button" width="360">


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

---------

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:58:14 -08:00
klopez4212
ef57fec4d2 Fix gallery video selection, thumbnails, and swipe dismissal (#9356)
## Summary

Photos currently filters out videos, video messages without poster
metadata stay grey until playback, and the native gallery rejects
downward dismissal on video pages.

- Include photos and videos in the native inline/popover pickers, system
picker, and recent-media grid. Mixed selections retain their order and
videos use the video upload path. Remove the redundant Video menu row on
iOS and Android, whose Photos picker accepts both media types; reduce
their menu height to four rows. Native pickers request the current asset
representation to avoid compatibility transcoding and export up to three
files concurrently, preserving order and cleaning up cancelled/failed
batches.
- Show local stills for queued videos. For older messages without
posters, serialize thumbnail generation for the four rendered stack
cards, bound/cancel downloads, remove temporary videos, and save stills
in the existing account/community cache. Existing poster metadata is
used directly. The native viewer uses the poster while loading instead
of a play-button snapshot.
- Allow downward dismissal on native video pages while preserving
horizontal paging/scrubbing, zoomed-photo panning, and the accessible
Close button. Fire selection-click haptics as a swipe begins rather than
after the page settles, with no duplicate on completion or cancellation.
Page-indicator changes retain immediate feedback. Replace visible
video-loading text with the existing white arc-spinner treatment,
implemented natively with reduced-motion and lifecycle handling.
Completed swipes release the previous video player even after UIKit
removes it from the active children.

Legacy videos need one initial download (up to the existing 100 MB
limit) to generate their cached preview. This does not start playback.

### Related issue

Follow-up to merged #9259 and #9314. Searched open and closed
gallery/video issues and PRs; no duplicate fix found.

### Testing

- Full `just mobile-check` and `just mobile-test` passed at
`12e6ed6ae3`: 4,688 Flutter tests (71 skipped), 4 unconfigured-push
tests, and 27 crypto-package tests. File-size checks passed. Regressions
cover mixed image/video upload routing, queued still previews, the
rendered-card poster window, authenticated/cancelled downloads,
caching/cleanup, and native poster loading.
- Native gallery simulator regression fixture passed: photo/video
dismissal guards, real MP4 decoding, paging, selected-only playback
loading, and teardown.
- Swift type-check of the native picker and its dependencies passed,
with existing deprecation/capture warnings.
- `just ci` passed its repository-wide lint/type checks. The unrelated
Rust test rebuild was stopped after consuming about 13 GB to preserve
remaining disk space; only that run's generated caches were removed.

Release build at `fb09f9cb8` installed in place and launched on the
physical iPhone Air as **Buzz Photo Stack**, with
`BUZZ_NATIVE_PHOTO_ZOOM=true`. Existing app updated in place with the
same bundle and Keychain identity; no uninstall or reset. Owner tested
the physical-device preview and approved readiness for review. No
before/after capture was produced. The simulator evidence above is an
automated native fixture, not a full Buzz device journey.

Native preparation follow-up:
`scripts/test-mobile-picker-preparation.sh` passed on an iPhone Air
simulator, covering bounded overlap, out-of-order completion,
cancellation, and failure cleanup. The updated physical Air preview
launched successfully with unchanged preferences metadata. Cloud-only
assets may still require preparation.

Loader/haptics follow-up native fixture passed: real video readiness
hides the loader, error/retry and detach stop/restart it correctly,
swipe start triggers one haptic before selection changes, and
completion/cancellation/duplicate-start callbacks add none. Updated
release installed and launched on the physical Air; owner approved the
final preview for review.

Review: focused code review and native regression checks completed;
physical Air preview tested by the owner, who approved readiness.


P2 follow-up: video presentation uses an already decoded poster or the
source snapshot immediately, then forwards a pending poster
asynchronously. Late poster updates are limited to the selected native
page and do not restart playback. Added pending-provider presentation
coverage and native late/stale-poster checks. This follow-up has not
been installed on the physical preview yet.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-11 13:22:25 -08:00
Tom Brow
1adde0e6bf feat(mobile): prefill the agents you last tagged in a conversation (#9248)
Desktop prefills an empty composer with the agents your latest message
in that conversation notified. This brings the same behavior to mobile
for channels and threads.

### Behavior

- An empty channel or thread composer starts with `@Agent ` for each
agent that the viewer's latest loaded message in that conversation
notified (its `p` tags). It reads what the view displays: the main
timeline in a channel (top-level messages and broadcast replies), and
the head plus its direct replies in a thread. Deleted messages don't
count, and same-second messages follow the display order.
- People are never carried over, and neither are agents that are no
longer channel members (agent here means a member with the bot role or
an owned agent, the same classification the mention picker uses).
- The prefill comes from messages already loaded, with no extra relay
reads, so it follows sends from other devices.
- It isn't a draft: nothing is saved (no Drafts entry) until the viewer
edits it, and it sends no typing indicator.
- Removing it lasts until the composer is shown again (leave and reopen)
or the viewer sends another message there. Sending without the agent
ends the chain.
- An untouched prefill is taken back once it's out of date: when the
viewer's latest message (even one sent from another device) tags no
agent, or its agents have all left the channel. Text the viewer wrote is
never cleared.
- DMs and Solo chats are unchanged. There's no settings toggle.

Also moves the composer's keyboard-metrics observer effect into a
`helpers.dart` hook, unchanged, to keep `compose_bar_widget.dart` under
the 1200-line limit.

### Validation

Added tests: a compose bar widget journey covering prefill from the
latest own message (ignoring people and others' messages), no saved
draft until edited, send then re-prefill, removal sticking through a
member/name refresh and returning on remount, and no prefill for an
agent that left. A second test covers taking back an untouched prefill
after a newer agent-less message or the agent leaving, while keeping
text the viewer wrote. A unit test checks same-second display order.
Breaking the draft skip, the removal guard or the take-back fails them.

Full mobile suite: all pass except 4 `swipe_reply_tests` "right drag …
replies" cases, which fail identically on the base commit (stale after
the swipe-left-to-reply change).

Simulator (iPhone 17 Pro, debug build, test community, run on the first
commit; the take-back follow-up is covered by the widget tests): after
mentioning an agent in a channel, the composer refilled with it; sending
again refilled it; deleting it kept the composer empty until leaving and
reopening the channel, which brought it back; a thread with no
agent-tagged reply had no prefill, and after replying with an agent
mention the thread composer prefilled it. Demo video is shared
internally rather than here, since it shows a real account.

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 04:12:28 -08:00
Tom Brow
0ac71eaf95 feat(mobile): start a Solo chat from a message or inbox row (#9251)
Adds **Start Solo chat** to the message long-press sheet and the inbox
row menu, analogous to buzz-app desktop's action.

## Behavior

- Opens an unsent New chat draft (no channel is created until the first
send), with the composer expanded and focused.
- **Open channel messages** (public stream or forum) are seeded with the
message's `buzz://` link, as desktop does, so the agent can open it.
- **DMs, private channels, Solo chats and unknown channels** are seeded
with the message excerpted as a Markdown block quote, because the agent
usually can't read them. A long quote is cut at 6 KB so the first
message stays under the 8 KB limit.
- Starting again from the same message returns to the same draft (keyed
`new-solo:<messageId>`).
- Unlike desktop, it's available on your own messages too.
- In the sheet it's a list row under **Copy text**; in the inbox menu
it's under **Open conversation**, for message items with content.
- The draft title skips a leading block quote and uses the prompt after
it (or the quote text when there's no prompt).

## Notes

- A seeded draft left unsent stays in the inbox Drafts list, as an
unsent New chat draft already does.
- Conflicts with #9142 (inbox row menu follow and remind actions), which
reindents `_showRowActions`. Whichever lands second needs a small
rebase.

## Demo

Public channel message (linked), private channel message (quoted), then
a public channel inbox item (linked) and a DM inbox item (quoted). Test
data only.


https://github.com/user-attachments/assets/91d2de7f-d35d-4907-bcf6-ec904327f06c

## Before / after

| | Before | After |
|---|---|---|
| Message long-press sheet | <img
src="https://github.com/user-attachments/assets/da79ae08-68a0-4396-9a63-f01af9ceb3a3"
width="260"> | <img
src="https://github.com/user-attachments/assets/88ee6ff1-66d6-42fe-8b78-ab7f4e6cbcfa"
width="260"> |
| Inbox row menu | <img
src="https://github.com/user-attachments/assets/5c6f551c-63f5-40ab-b0a3-08778472d964"
width="260"> | <img
src="https://github.com/user-attachments/assets/25f9fa30-ac52-4b78-85fb-5679ca336495"
width="260"> |

Where it lands (new, unsent New chat draft):

| Public message | Private message | Public inbox item | DM inbox item |
|---|---|---|---|
| <img
src="https://github.com/user-attachments/assets/245204d3-0a56-4029-a2a6-e9d054ee6e0e"
width="190"> | <img
src="https://github.com/user-attachments/assets/3d5a100b-5ae5-470e-b945-8c9b24ac1db0"
width="190"> | <img
src="https://github.com/user-attachments/assets/8deea67e-07f4-4fc8-93d8-981fbe848c1d"
width="190"> | <img
src="https://github.com/user-attachments/assets/0f4b62c9-81ba-4d08-a77c-8298f3b46718"
width="190"> |

## Validation

- Automated simulator run (iOS 27 sim, Remote Agents Pilot): sheet on
own message in a public channel seeds the link chip; sheet on a private
channel message seeds a quote; inbox public channel item seeds the link;
inbox DM item seeds a quote. Recorded as the demo above.
- New `solo_chat_seed_test.dart` table test (link, thread link, quote
trimming, multi-line quote) and two new title cases in
`me_chat_creation_test.dart`.
- `flutter test`: all pass except the 4 `right drag starting on/beside a
link replies` cases in `channel_detail_page_test.dart`, which fail
identically on clean `main`.

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 04:12:00 -08:00
Logan Johnson
b483bbe765 fix(mobile): tell same-name agents apart in Solo (#9321)
## Summary
In Solo, two agents with the same name looked identical: the agent
picker, the new-chat draft ("Message Atlas"), the chat header and its
agent switcher, and the "working" label all showed the raw name. Now
they use the same disambiguated labels as the rest of the app, so
same-name agents read differently everywhere in Solo, and one agent
reads the same in every place.

### Related issue
None found.

### Testing
Widget tests open the picker and header with two same-name agents,
switch between them, and archive one (the remaining agent goes back to
its plain name). Further tests cover a saved agent switch and a resumed
new chat that still point to an archived agent with a live namesake, and
Solo rows with no working agent building no names. A focused test covers
which name Solo shows. Each fails without its change.

Android emulator, local relay, fictional names. Two live agents are both
named Helper; Atlas and Scout each have an archived namesake, which Solo
already left out.

**New Solo chat › Choose an agent: two agents named Helper**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/ff43e3cd-d8f3-4555-bc6b-6109b57993c0"
width="320"> | <img
src="https://github.com/user-attachments/assets/b1a73f63-fe00-49f8-b6ff-0c6a6cfc2d82"
width="320"> |

**New-chat draft with one Helper picked**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/4f375e0c-ce82-4787-b187-137ca25449ce"
width="320"> | <img
src="https://github.com/user-attachments/assets/d8626e98-e1db-437d-9824-cf83af26d752"
width="320"> |

**Chat settings › Agent row of an existing Solo chat**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/e7b0d3a0-10d2-4140-b5c0-b4a3857085ae"
width="320"> | <img
src="https://github.com/user-attachments/assets/e6a736ec-24af-4142-ba3f-1c68f64d80f7"
width="320"> |

**Agent switcher opened from that row**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/8eb1a66d-ff6d-4dc2-8df7-6c71732f186d"
width="320"> | <img
src="https://github.com/user-attachments/assets/9669231f-d842-4d32-bb13-ecd6a2b01e8f"
width="320"> |

## Details
- Names are compared only across the agents Solo offers. Archived agents
are already left out of that list, so an archived namesake adds no
qualifier.
- A saved choice can still point to an archived agent: a pending agent
switch (its notice and the Resume/Discard dialog) or a new chat waiting
to be resumed. That agent is labeled against the live agents, so it does
not read exactly like a live namesake.
- A Solo row reads names only while an agent is working in it, and
working rows share one name context.
- The chat header reads Solo names only in Solo chats, so channel and DM
pages no longer rebuild on every profile load (from
https://github.com/block/buzz/pull/9324 by Tom Brow).
- Solo keeps showing the owner's own name for an agent (from their agent
list) ahead of the agent's self-published profile name. A verified name
still wins over both.
- An agent with no name now shows the short npub, like every other
picker, instead of a truncated hex key.

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

---------

Signed-off-by: Logan Johnson <loganj@squareup.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: corey <2dafccf60ea6d431a568f6d67fc600160d92a51e415e09dc8b213b8e360663d5@localhost>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-10 16:20:32 -08:00
Tom Brow
0aca7588e3 fix(mobile): join an open channel from the chat footer (#9253) 2026-11-10 15:32:45 -08:00
Logan Johnson
dd2d3cf4ea fix(mobile): hide archived people and agents from choices; give them their own members section (#9320)
## Summary
Mobile kept offering archived people and agents as choices: Add members
(including adding an agent to a Solo chat), New DM, the `@` mention
chooser, Search › People and the Agents page. An archived agent that
shares a live agent's name also forced a qualifier onto the live one,
because names were told apart across both. The members sheet listed
archived members among live ones with nothing to mark them.

Now, matching desktop:
- Archived people and agents are left out of those choices. History
(messages, activity, profiles) still shows them.
- The members sheet moves archived members out of People and Agents into
their own "Archived · N" section after both: archived people, then
archived agents. Each row reads "Archived · Member" (or Agent) in place
of the role, status or "Working…" line. A screen reader reads it with
the name. The members preview on the channel info page (the first five
members above "See all") follows the same order and label.
- Nothing is hidden or marked while the community's archive list is
unknown or cannot be read, and you are never hidden from yourself.

### Related issue
None found. The desktop members dialog gets the same Archived section in
https://github.com/block/buzz-app/pull/3203.

### Testing
Widget and provider tests cover each surface, the unknown-archive case,
the viewer rule and a community switch. Each test fails without its
change.

Android emulator, local relay, fictional names. Each archived person or
agent has a live namesake. History rows still show archived identities,
as intended.

**`@` mention chooser, typing "@Sc" (Scout `qsfn` is archived)**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/6693729c-66c1-4433-8a7b-4f0e948057ee"
width="320"> | <img
src="https://github.com/user-attachments/assets/eb4f80be-780e-4dbe-8b2b-e6a5b6c3ca97"
width="320"> |

**`@` mention chooser, typing "@Ca" (Casey Lee `9mhy` is archived)**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/b6d409cd-7af1-4da7-b5b9-deece5e21de5"
width="320"> | <img
src="https://github.com/user-attachments/assets/60e21387-791b-4233-b8e6-1a29f94e6810"
width="320"> |

**Add members, searching "Morgan" (Morgan Reyes `ssc2` is archived)**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/1222a923-5e43-4263-843d-57564bdc7af3"
width="320"> | <img
src="https://github.com/user-attachments/assets/dbe58278-788d-4a89-83bf-f0b4bc119c5e"
width="320"> |

**Add members, searching "Atlas" (Atlas `85gl` is archived)**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/55c67a21-4cf5-47c5-b6ac-1ba80d68a3ec"
width="320"> | <img
src="https://github.com/user-attachments/assets/54b19ab3-fa2f-4933-8b67-1056d6e3b3a4"
width="320"> |

**New DM, no query yet**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/6a26fd49-4a06-47bd-ba37-37e5898ab344"
width="320"> | <img
src="https://github.com/user-attachments/assets/3f33eb2b-f27a-4528-91c0-ac76d3fdf44b"
width="320"> |

**New DM, searching "Morgan"**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/22d2d617-3074-4910-8c39-e0778e47a879"
width="320"> | <img
src="https://github.com/user-attachments/assets/fa00b160-e350-49af-94d0-beb15c357bef"
width="320"> |

**Search › People, "Morgan"**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/83a28f2b-9b22-4d0c-8728-8a2dfb10e634"
width="320"> | <img
src="https://github.com/user-attachments/assets/573aed3f-75ab-478f-8c11-bedab5c6ce4f"
width="320"> |

**Agents page**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/d7980f95-825c-4d1a-ad67-95f906a52e9a"
width="320"> | <img
src="https://github.com/user-attachments/assets/6252c38a-b2ec-48dc-ab4e-824ea29bbd85"
width="320"> |

**Channel info, members preview**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/8744cdfd-c073-4ade-bd53-9d5e137cee60"
width="320"> | <img
src="https://github.com/user-attachments/assets/5240b1be-13d5-4f22-85a9-8375f1d8ac18"
width="320"> |

**Members sheet, top**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/c9241478-99b1-452e-ad41-8c38fe080182"
width="320"> | <img
src="https://github.com/user-attachments/assets/3c6f9247-60c6-47df-94b0-9175f25805bb"
width="320"> |

**Members sheet, scrolled to the end**

| Before | After |
| --- | --- |
| <img
src="https://github.com/user-attachments/assets/7da7fcc8-28ea-4c7a-904e-91ca5a068d23"
width="320"> | <img
src="https://github.com/user-attachments/assets/024f676e-8150-457d-b7d0-67fa1a680f8d"
width="320"> |

## Details
- The archive reader (the community's NIP-IA archive list, signed by the
relay's NIP-11 `self` key) moves from `shared/me` to
`shared/identity_archives`, since it is no longer Solo-only.
`hiddenArchivedIdentitiesProvider` is the single rule the surfaces read.
- Pulling to refresh on the Agents page also rereads the archive list.
Other views reuse the last list, as on desktop; it is also reread on
reconnect and when the agent inventory changes.
- A refresh keeps the last known list. After a community or account
switch, the previous community's list does not apply: nobody is hidden
until the new list arrives.
- The shared chooser drops archived identities before names are
compared, which covers Add members, New DM and mentions.
- Search › People asks the relay for 24 people and shows the first 8
that are not archived, so archived matches do not push live people out.
- The channel info preview shows the label on one line, so with a long
name the role after "Archived" can be cut off. A screen reader still
reads it in full.
- Not changed: typing a full `@Name` by hand (without the chooser) still
resolves against archived channel members too, so an archived namesake
can still make a typed name ambiguous. Picking from the chooser is
unaffected. Possible follow-up.

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

---------

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 11:10:49 -08:00
klopez4212
b40f22114b Add video stacks and native iOS zoom playback (#9316)
## Summary

Videos previously rendered outside photo stacks and opened only the
Flutter video viewer. Message bubbles now group trailing videos and
photos in their original order, with poster thumbnails or a visible play
placeholder. On iOS 18+, the native zoom gallery (enabled by default)
opens both standalone videos and mixed stacks with AVKit playback
controls, and closing restores the selected stack item.

Flutter downloads only the selected video using fresh media
authentication, streams it to a bounded temporary file, and
cancels/deletes it when selection changes or the viewer closes. UIKit
releases the old player before that file is removed. Failed downloads
and playback expose Retry. Video URLs never enter the image decoder, and
photo-only actions are hidden on video pages.

The existing Flutter viewers remain the fallback. Native zoom defaults
on; `--dart-define=BUZZ_NATIVE_PHOTO_ZOOM=false` remains an explicit
build-time opt-out. Unsupported platforms/formats, unavailable native
presentation, and bridge failures use the Flutter fallback. Native video
pages use Close or accessibility escape to return with zoom; the
photo-specific downward drag recognizer is disabled there to avoid
competing with AVKit controls.

### Related issue

Stacked on #9314 (PNG/HEIC photo formats); merge that first. No matching
open video-stack/zoom PR found.

### Testing

- Default-on follow-up: presentation tests also cover unavailable, null,
and throwing bridge responses.

- `just mobile-check mobile-test`: analysis clean, 4,601 mobile tests
passed, plus push-configuration and secp256k1 package tests.
- Full native-enabled mobile suite: 4,626 passed, 68 skipped; rerun
passed at `dc752dccaa664cb56a19cbe517a266d1407a1100`.
- Mixed-stack widget journey covers order, video opening, returning to
selection, and the photo-only fallback gallery.
- Native bridge tests cover video snapshot presentation, selected-only
dispatch, stale sessions and keeping video URLs out of image decoding.
- Real HTTP download journey covers authenticated requests, Retry, byte
limits, cancellation and temporary-file cleanup.
- Native simulator fixture decodes a real MP4 and verifies selected-only
loading, player release on paging and teardown. Removing playback
cleanup makes the regression fail; restoring it passes.
- No physical-device installation or end-to-end zoom recording captured.

### Widget previews

Actual Flutter renders with sample video URLs and no poster metadata;
these show the stack layout, not device playback.

| Received, light | Sent, dark |
| --- | --- |
| ![Received video stack without poster
images](https://github.com/user-attachments/assets/af6d06a7-10e3-43c4-87de-52324be5b19c)
| ![Sent video stack without poster
images](https://github.com/user-attachments/assets/5b79b5b1-e3d4-4482-bbf6-574849d5dfdc)
|

### Human verification pending

On a normal build on iOS 18+ (no extra flag required), open a message
containing photos and videos, page between them, play a video, and
close. Verify playback controls work, only the selected video plays, and
closing returns to the selected stack item.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-10 10:03:56 -08:00
klopez4212
e2dc54e22f Support PNG and HEIC photos in the native iOS zoom gallery (#9314)
## Summary

The opt-in iOS zoom gallery rejected PNG and HEIC/HEIF photos, so photo
stacks containing those files opened the Flutter fallback. Accept these
formats by MIME type or file extension, including uppercase extensions
and URLs with query strings.

Preserve animated PNG playback by forwarding continuing decoded frames
to the selected native page. Keep the existing five-photo load window,
coalesce frames while the bridge is busy, skip offscreen frame encoding,
and release listeners on eviction or dismissal. Native updates reject
stale sessions, offscreen pages, malformed frames, and closed viewers.

`BUZZ_NATIVE_PHOTO_ZOOM` remains opt-in. iOS below 18 and unsupported
formats retain the existing gallery.

### Related issue

Follow-up to #9259. No matching open issue or PR found; #7666 concerns
desktop HEIC upload tiling, a separate path.

### Testing

- `just mobile-install mobile-check mobile-test` passed.
- Full mobile suite with `BUZZ_NATIVE_PHOTO_ZOOM=true`: 4,623 passed, 68
skipped. Standard configuration: 4,599 passed, 92 skipped; push
configuration and secp256k1 package tests also passed.
- Real PNG and HEIC decoding through the production presentation bridge;
real two-frame APNG decoding with continuing-frame and listener-cleanup
assertions.
- `scripts/test-mobile-photo-zoom.sh` on an iOS 27 simulator exercises
the production native controller, including frame updates, stale-page
rejection, malformed input and teardown.

No physical-device or end-to-end zoom recording captured. This extends
accepted image formats and playback without changing the gallery layout.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-10 07:34:40 -08:00
Tom Brow
13a6aa19f4 fix(mobile): list known people in recipient pickers before a name is typed (#9311)
## Problem

Add members (and New DM, which shares the picker) showed an empty list
until the first character was typed. An empty query runs no directory
search, so the only candidates were the viewer's own agents and agents
shared with them. Once those are members, or while the owned-agent list
is still loading, nothing is left.

`@` completion shows the channel's members before a name is typed. A
recipient picker has no channel to draw from, so this lists the people
the viewer already knows instead.

## Change

- With an empty query, `recipientCandidatesProvider` adds people from
the viewer's open channels and DMs (from the member lists the channel
list already loaded). Add members skips the target channel's own members
before choosing. The 50 people (`mentionSuggestionLimit`) are gathered
from DMs first, then channels, and shown in the usual label order.
- Empty-query rows list agents ahead of known people, so people never
push an agent off the 50-row list. When an agent the opening hasn't
offered yet arrives after rows were shown (the viewer's own agents
loading late, a picker opened mid-reload, or a reconnect that brings a
new agent), the people rows start over so it takes its place ahead of
them; agent rows already shown keep their places, including one whose
list is still reloading. A reload that brings no new agent moves
nothing, and typed rows never restart. Known people don't wait for the
agent lists, which never load offline.
- Member lists carry no profiles, so the unnamed people among the 50 are
loaded through the user cache's batched preload, each person once per
picker opening regardless of rebuilds.
- The roster scan stops at 50 people or 2,000 roster entries, whichever
comes first, and doesn't copy rosters.
- Typed queries and `@` completion are unchanged: same ranking,
directory search only, no known-people rows mixed in.

## Why nothing gets worse

- Network: at most 50 profile reads per opening, batched, only for
uncached people, and never repeated on rebuilds (new messages, presence,
profile updates).
- CPU: at most 2,000 roster entries per rebuild, only while a picker
shows an empty query.
- Agents: every agent the picker listed before still lists, ahead of the
new rows.
- Ranking, selection, typed search, the viewer and unshared-agent
filters, and "Add members hides existing members" are unchanged.

## Validation

- Added tests: `recipient_known_people_test.dart` (empty query lists
people from open channels and DMs, excludes archived and non-member
channels, loads a missing name; agents stay ahead of people and people
don't wait for an unloaded agent list; the real user cache reads each
unnamed person once across rebuilds; Add members skips the channel's own
members; at most 50 people are gathered; typed query adds nothing) and
`recipient_late_agents_test.dart` (Add members sheet with a controllable
own-agent list and 60 known people: agents arriving on first load, in a
picker opened mid-reload, and on a reconnect that adds a new agent all
take rows ahead of the people; reload, land, reload, land moves nothing;
typed rows keep their places; 55 agents fill the list and stay put
across reloads and a rename that changes their order; both agent lists
reloading after a reconnect and landing in either order, with a new
agent in the first, keep every earlier agent's row). Confirmed the
late-agent tests fail without the restart. Confirmed the ordering and
read-once tests fail without their fixes. Confirmed the first test fails
without the fix.
- Focused existing validation: `flutter test test/features/channels`
(2,308 passed), `flutter analyze` on the changed directory.
- Automated app run (on an earlier head; iOS 27 simulator, iPhone 17
Pro, a Builderlab test account): opened a private channel, Channel
details, Add members. Before: only the account's own agents. After:
agents, then people from its channels and DMs with names and avatars;
typing `ar` still narrows to directory matches. Captures show real
community members, so they were shared internally rather than embedded
here. Native iOS sheet only; Android and New DM share the provider but
were not run in the app.

🤖 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@localhost>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 15:18:36 +00:00
Logan Johnson
6384c6cdfa feat(mobile): mark edited messages after the body (#8863)
## Summary

Mobile showed "(edited)" only in the author header. A grouped follow-up
message has no header, so an edited follow-up had no marker at all. This
ports the placement from desktop
https://github.com/block/buzz-app/pull/2020 to the channel and thread
message bodies:

- **After prose:** the marker joins the last line, for example `Hi how
are ya. (edited)`. This includes a final list item or quote, as on
desktop. It is drawn in the timestamp style, with the metadata colour on
received messages and the bubble ink on your own messages.
- **After a block that text cannot join:** the marker goes on its own
line inside the same text bubble. This applies to code, tables, rules,
display math, indented code, a heading, a last line that ends in a link,
and a bare list, quote or checkbox marker. A link renders as a widget
span, so a joined marker would be read before the link by screen
readers. Any body that contains ```` ``` ```` always uses its own line.
gpt_markdown's fence rules differ from CommonMark, so putting the marker
inside the Markdown could change how the code renders.
- **After trailing images:** the marker goes below the gallery, outside
the bubble.
- The marker is injected only at render time: a private-use slot
character that the renderer removes from authored content first. Copy
text, previews and notifications still use the original message content.

**Out of scope:** the mobile forum models (`ForumPost`, `ThreadReply`)
have no edited state and don't fold edits, so forum posts still show no
marker. Search and inbox previews also show no marker, which matches the
preview rules.

### Related issue

Desktop parity for https://github.com/block/buzz-app/pull/2020. I found
no existing mobile issue or PR for this.

### Testing

At `5276d968`:

- `just mobile-check`, `just file-size-check` and `just mobile-test` all
exit 0.
- `edited_marker_test.dart`: a table test of which endings join inline
and which take their own line, including `` ```npm install``` ``, `~~~`,
indented code, tables, rules, math and bare block markers.
- `message_content_bubble_cases.dart`: rendered widget checks. For each
risky ending, the edited render is the unedited render plus one
`(edited)` line inside the same text bubble. The tests also cover
colours, trailing media, an open `<u>` and authored slot characters.
With the guards removed, this test fails.
- `channel_detail_page_test.dart`, edit journey: an edited message and
an edited grouped follow-up are marked and an unedited message isn't.
Copy text copies `Edited text` without the marker. Opening the thread
marks the edited head and the edited reply. With the thread wiring
removed, this test fails.
- Contrast (from review): received 5.34:1 light and 8.61:1 dark;
own-bubble accents at least 4.60:1.
- Android emulator run (screenshots below): every edited case shows the
marker where the rules above say, in light and dark. Not done: iOS
simulator and VoiceOver.
- Found during the emulator run, not caused by this PR: an edit made to
a thread reply before the thread is opened is not loaded, so the reply
shows its original text and no marker. The thread query asks only for
content kinds, and the channel history did not supply the earlier edit.
An edit that arrives while the thread is open shows correctly
(screenshot).

**Android emulator** (debug build of `5276d968` on a local relay, seeded
with edited messages):

| Prose, grouped follow-up, own bubbles, list | Code block, table,
fenced inline text, trailing image |
| - | - |
|
![emu-1-prose](https://raw.githubusercontent.com/block/buzz/673534d3aab0a87148655e19142965dbfdb6e3ef/pr-8863--emu-1-prose.png)
|
![emu-2-blocks](https://raw.githubusercontent.com/block/buzz/673534d3aab0a87148655e19142965dbfdb6e3ef/pr-8863--emu-2-blocks.png)
|

| Dark | Dark, trailing image | Thread (edit arrived while open) |
| - | - | - |
|
![emu-3-dark](https://raw.githubusercontent.com/block/buzz/673534d3aab0a87148655e19142965dbfdb6e3ef/pr-8863--emu-3-dark.png)
|
![emu-5-dark-media](https://raw.githubusercontent.com/block/buzz/673534d3aab0a87148655e19142965dbfdb6e3ef/pr-8863--emu-5-dark-media.png)
|
![emu-4-thread](https://raw.githubusercontent.com/block/buzz/673534d3aab0a87148655e19142965dbfdb6e3ef/pr-8863--emu-4-thread.png)
|

**Widget renders** (throwaway test, not committed):

| Light | Dark |
| - | - |
|
![edited-light](https://raw.githubusercontent.com/block/buzz/6a790edaaaa80acff4ed4a358be92e5ca8f86e25/pr-8863--edited-light.png)
|
![edited-dark](https://raw.githubusercontent.com/block/buzz/6a790edaaaa80acff4ed4a358be92e5ca8f86e25/pr-8863--edited-dark.png)
|

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

---------

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 07:02:54 -08:00
klopez4212
44b3c4823f Add swipeable photo stacks and native iOS gallery preview (#9259)
## Summary

Replace bubble photo carousels with swipeable, overlapping photo stacks,
with distinct sent/received layouts and a stationary photo count.
Opening and closing the gallery preserves the selected photo. Photo
frames follow the active theme.

Add an opt-in iOS 18+ native zoom gallery
(`BUZZ_NATIVE_PHOTO_ZOOM=true`) with paging, continuous dot scrubbing,
preview-backed loading, Reply/More actions, and Liquid Glass controls on
iOS 26+. The existing gallery remains the fallback. UIKit’s late corner
settling and brief return-transition input lockout remain known preview
limitations.

### Related issue

None found.

### Testing

Validation: full mobile pre-push checks/tests passed on `2b5bac3075`;
light/dark sent/received widget renders verified. Earlier native
simulator checks covered paging, scrubbing, downward close, and Reply.

Snapshots below are actual Flutter widget renders with sample photos
(not device screenshots).

| Before: carousel | After: sent | After: received |
| --- | --- | --- |
| ![Original photo
carousel](https://github.com/user-attachments/assets/9fb13b0a-d2b9-4429-9bb1-396deeb126da)
| ![Sent photo
stack](https://github.com/user-attachments/assets/ab6a3094-5460-45fb-8020-68c454d6474f)
| ![Received photo
stack](https://github.com/user-attachments/assets/0ec2e803-a5b5-4812-8159-2e0585eea199)
|



| Dark mode: sent | Dark mode: received |
| --- | --- |
| ![Dark sent photo
stack](https://github.com/user-attachments/assets/3d4f993a-4e59-4da8-a30b-c6a0c19ad7eb)
| ![Dark received photo
stack](https://github.com/user-attachments/assets/e552070a-e516-434c-ae76-0f8811184d2e)
|

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-09 16:52:02 -08:00
klopez4212
49511f02b6 fix(mobile): show observed thread replies in Activity (#9286)
## Summary

A reply in a thread you started, participated in, or followed can light
a mobile channel's attention dot without appearing in Activity. Activity
now includes eligible replies already observed by the channel unread
pipeline in **All** and **Threads**. Tapping a row uses the existing
oldest-unread reply and thread navigation.

Retain the reply payload alongside its bounded unread evidence, then
merge by event ID with the addressed feed. Mentions retain their
category and do not duplicate. Deletion, eviction, and account/community
resets share the same registry. This adds no relay queries or
subscriptions.

Coverage follows the existing channel unread catch-up and live
subscriptions. This does not introduce complete historical thread
discovery: replies outside that retained window, and replies not
eligible for the channel attention dot, are not newly fetched.

### Related issue

Related to #9271 (clearing channel rows) and closed #9186 (broader
Activity feed expansion). #9213 supplied the existing Activity filters.
This PR connects existing observed replies to those filters.

### Testing

- Full mobile suite, push-unconfigured tests, analysis, formatting and
file-size checks.
- Production-provider regression: cold catch-up, live reply, mention
deduplication, excluded unrelated/quiet replies, thread read markers,
deletion/replay and identity reset.
- Real Activity widget journey with fake relay/storage boundaries: show
the unmentioned reply, select Threads, tap the row, and verify the reply
ID and thread ID passed to the conversation page.
- Mutation check: removing reply-payload retention makes the widget
journey fail because the reply is absent.
- Independent agent source review: no blockers.

### Preview

Actual Flutter widgets at phone width with synthetic data and the new
reply wiring disabled/enabled. These are widget-test captures, not
installed-device or live-relay evidence.

| Before | After |
| --- | --- |
| ![Activity omits the unmentioned
reply](https://github.com/user-attachments/assets/a6fc8193-b1ef-4022-a5f1-a1cbbcdf5fb2)
| ![Activity shows the unmentioned thread
reply](https://github.com/user-attachments/assets/b2a6ba13-384a-4d0f-bda3-88d83307d31e)
|

### Human validation pending

Draft per the repository readiness checklist. On a device, receive an
unmentioned reply in a thread you started, replied in, or followed.
Check Activity → All and Threads, tap the row to reach the reply, then
read it and confirm Unread clears without reading unrelated channel
messages. Native/live-relay testing and human confirmation remain
pending.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:48:08 -08:00
klopez4212
2bbaa061d0 Enable mobile huddles with Codex agents (#9269)
Show the Huddle action in owned Codex agent DMs and invite the agent
before connecting audio. Revalidate eligibility on starts/recovery, ask
before inviting into an existing call, and distinguish pending
invitations from connected audio peers with actionable timeout feedback.
DM hangup leaves shared room cleanup to the relay so another owner
device stays connected.

Pairs with https://github.com/block/buzz-app/pull/3048. Desktop and the
Codex agent must remain running.

Validated: 4,559 mobile tests, analysis, formatting, push hooks, and
independent source review. Live phone-to-desktop audio and human trial
remain pending.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 19:19:43 +00:00
Blake McAnally
c1ce2ca800 fix(mobile): read mentions taller than the screen (#9243)
## Problem

Bug report (mobile 0.28.0 (46)): opening a mention from the Inbox in an
archived Solo chat leaves the Inbox row unread.

The video shows the cause. Each unread row is a long agent answer. On a
phone, the answer is taller than the screen, or it lands partly cut off
after the deep-link jump. Mobile automatic reading writes a `msg:` mark
only for a row that is fully visible for the 300 ms dwell. A mention row
is high priority, so `activity:<channel>` does not read it. The mention
can stay unread until the reader marks it read by hand.

The archived state is not the cause. A widget test shows that an
archived Solo chat writes read marks for short messages. Archived chats
make the problem easy to see, because there is no composer and the
reader only reads.

## Fix

A message counts as read only when it actually showed, for the 300 ms
dwell. A row counts when any of these holds:

- **It fits:** the whole row is inside the reading area (unchanged).
- **It fills the screen:** the row is taller than the reading area and
covers all of it. This applies to the channel timeline and the thread
view.
- **A link opened it:** the message a deep link or Inbox tap opened
counts once any part of it shows, because the jump places it at 35% and
a long one lands cut off.
- **It is the newest message at the live bottom:** its end is showing,
in a channel, a Solo chat (replies inline) or a thread. This covers a
long final answer that only ever shows its end.

Reaching the bottom does **not** read mentions or broadcasts above the
newest message that never came on screen. Desktop does that sweep
(block/buzz-app#1679). Mobile deliberately does not. Ordinary
`activity:` / `thread-activity:` catch-up is unchanged, and messages the
reader marked unread stay unread.

## Tests

- `reading_marks_test.dart`: the bottom does not read mentions above it;
the newest message is read at the live bottom (and respects manual
unread); a flat Solo timeline reads only its newest inline reply; a tall
thread tail reply is read at its end; DM catch-up does not mark
mentions; `isReadableRow` cases, including linked rows.
- `channel_detail_page_test.dart`: an archived Solo chat and a Solo
inline reply each read a tall newest mention at the bottom; a tall row
away from the bottom is read once it fills the screen; tall linked
messages (channel and thread) are read when the jump leaves them cut
off; in a thread, the tall last reply is read at the end and an earlier
tall reply is read once it fills the screen. These fail on `main`.
- `just mobile-check` and the full mobile suite pass.

## Human test steps

1. Get a long agent reply that mentions you in a Solo chat, then archive
the chat.
2. Open the row from the Inbox and hold still for about one second.
3. Go back. The row should now show as read, with no dot.

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

---------

Signed-off-by: Blake McAnally <bmcanally@squareup.com>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: BlakeBot <85bbd70443139fd5c5762e34c2e214240939eb243c37f98380f69fed3b3bb4a6@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morgmart <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Morgarita <6e967af659416160ab4f2fd56d74c8c6f273791ee7bfc9468a1be37c387947be@buzz.block.builderlab.xyz>
2026-11-09 11:13:55 -08:00
Matthew Boston
c502e53e63 feat(mobile): tag the reacted-to message author on reactions (#9141)
## Why

NIP-25 says a reaction should carry a `p` tag naming the author of the
reacted-to event. buzz-app's Activity → Reactions tab
(block/buzz-app#2638, merged) finds reactions to your messages with a
`#p` read. Reactions sent from mobile have no `p` tag, so they never
appear there. block/buzz#9121 makes the same change for `buzz reactions
add`.

## What

- Every reaction sent from mobile now carries `["p", <message author>]`.
This covers the reaction pill, the quick-reaction row, the emoji picker,
and reactions on system rows.
- Removing a reaction is unchanged.
- Agent status reactions (buzz-acp) and the desktop app are unchanged by
decision. Agent status reactions stay out of Activity.

## Testing

- New unit test: `ChannelActions.addReaction` publishes exactly `["e",
target]` and `["p", author]`. It fails without the change (actual tags:
`[['e', 'target-event']]`).
- The message-actions widget test now checks that a quick reaction
passes the message's author.
- `just mobile-check`: format and `flutter analyze` are clean (no
issues).
- `just mobile-test`: 4,507 passed, plus the push-unconfigured and
secp256k1 suites. All pass.
- No screenshots: the change is one tag on the published event, and
nothing on screen changes.
- Not yet: a run on a device, and the human test.

## How a human can test

1. On mobile, as user B, react 👍 to a message from user A.
2. As user A, open Activity → Reactions in a current buzz-app build.
3. It works if a "B reacted 👍" row appears. Before this change, no row
appears.

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

Signed-off-by: Matthew Boston <mboston@squareup.com>
Co-authored-by: mboston Implementer <932d3b6ebea6cc83e091551ae46d1c7e7f8f7d0fa8e9cef5e6facc8544af413b@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:16:29 -07:00
Tom Brow
5f59940544 fix(mobile): steady New DM picker rows and animate picks (#9249)
On iOS, the New DM (and Add Members) picker is a native UIKit sheet that
Flutter drives by pushing the picker's whole state on every rebuild.
Each push called `reloadData`, which rebuilt every visible row in a
fresh, unreused cell showing the initials fallback, then fetched each
avatar again over the platform channel. So whenever anything refreshed
(several refreshes land right after foregrounding), every avatar blinked
to its initial for a frame or two. Picks also jumped instantly from the
results to the chosen section.

Now the picker:

- ignores a pushed state identical to the one it shows;
- applies the rest as a diffable snapshot, so unchanged rows keep their
cells and changed rows are redrawn in place, in reused cells;
- keeps loaded avatars by avatar key for the life of the sheet, so a
redrawn row shows its avatar at once;
- animates a member's row moving between the chosen and result sections
when it's picked or removed (no animation with Reduce Motion).

Flutter's toggle handlers in both pickers now read the current selection
rather than the one captured at build time. A fast second tap could
otherwise add the same person twice, which the diffed table would
reject.

### Validation

- Native member picker test (`scripts/test-mobile-member-picker.sh`),
extended: after an avatar loads, a changed row is redrawn with that
avatar and requests nothing more. The avatar check fails on `main` and
passes here; the existing identity and accessibility checks still pass
with the diffable table.
- Added a New DM test: two toggles before Flutter rebuilds never list a
person twice. It fails without the toggle fix.
- Full mobile Flutter suite and analyzer pass in CI on the current head,
which includes `main`'s fix for the right-drag link tests.
- Simulator runs of the app (iPhone 17 Pro, iOS 27, signed in to a test
community): opened New DM, backgrounded and foregrounded the app,
searched, picked from the list and from a search, and removed a pick.
Without this change, every avatar flashed to its initial after a
foreground. With it, no avatar flashed at any point, and picks and
removals animate between sections. Recordings show real community
members, so they're shared in Buzz rather than here.

#### Full-app comparison, `main` vs this PR

The same scripted New DM sequence on a clone of the same signed-in
simulator (iPhone 17 Pro, iOS 27), first on `main` (65e864301d) and then
on this PR (330805cfc4): pick george, then glm; search "ju", pick judge,
clear the search; remove george; background and reopen the app. The list
shows only agents, no people.

Both builds end in the same state: each pick moves into the selected
section with its check mark, search narrows to one result and clearing
it restores the full list, the removed pick returns to the list, and
every avatar keeps rendering after the app reopens. Sampled at 6 frames
per second around the reopen, neither build fell back to initials in
this run. The visible difference is motion: on `main` a picked row jumps
into the selected section, and here it animates there.

Before (`main`):


https://github.com/user-attachments/assets/12d88f47-0c10-4e78-a12c-18235e068f88

After (this PR):


https://github.com/user-attachments/assets/b3d8edb1-94ad-44dd-b6b3-3db22d8311b0

### Before merge

- [x] Update onto `main` once main's link swipe tests are fixed (they
were fixed by [#9255 Solo chat
settings](https://github.com/block/buzz/pull/9255)), so Mobile Checks
can pass.

buzz-review-completed

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-09 07:34:02 -08:00
Tom Brow
52cb6818fa perf(mobile): keep remote images on disk and show small ones as thumbnails (#9158)
## Summary

The mobile app now saves remote images on disk. After a relaunch,
avatars, custom emoji, message attachments and agent artwork show
immediately. The app does not download them again.

Small images on a relay now load only the relay's thumbnail. The app
never downloads the full-size upload to show a small image.

## Why

Before this change, the app kept remote images only in memory. Each cold
launch downloaded every image again. On a slow connection, attachments
showed a "Loading image" placeholder for a long time.

Also, when a relay had no thumbnail for an image, the app downloaded the
full-size upload. That upload can be up to 20 MiB, for an avatar that is
a few dozen points wide.

## What changes

### Images on disk

- `MediaImageProvider` reads and writes a `MediaDiskCache`. Each account
in each community has its own cache, at `<root>/communities/<community
id>/media/<signer pubkey>`. The cache is built on
`flutter_cache_manager`, with a JSON index.
- On iOS, the root is the app group's `Library/Caches` (from a new
`buzz/app_group` method channel). App extensions can then read the same
cache. On other platforms, the root is the app cache directory.
- Each cache holds a maximum of 250 MB. When it is full, the least
recently used images go first. `MediaCacheIndex` measures each file when
it writes it, because `flutter_cache_manager` limits only the number of
files. Every disk read marks the file used, and every write schedules
eviction, including a refresh that replaces bytes the package already
holds in memory (by default the package does neither for those).
- The cache does not save an image that is larger than 5 MiB. The app
still shows that image from memory. Thus, one large image cannot push
out all the others.
- Relay media URLs contain a content hash, so their bytes never change.
The cache keeps them until it evicts them. For other URLs, the cache
shows the saved image, and then gets a new copy in the background after
one week. A maximum of two of these refreshes run at the same time. The
app decodes a refreshed image before it replaces the saved copy.
- When you remove a community, the app deletes its cache. When a
community gets a new signing key, the app deletes the media of the old
account. At launch, the app also deletes caches of communities and
accounts that are no longer present.
- Startup does not wait for the cache. The cache directory resolves in
the background. Image reads wait for it for a maximum of 3 seconds.

### Thumbnails for small images

- A small relay image loads the relay's WebP thumbnail. If the relay has
no WebP thumbnail, the image loads the JPEG thumbnail. If the relay has
neither, the widget shows its placeholder (initials for an avatar, an
empty tile for artwork).
- Native avatars drawn by UIKit (the navigation bar, the community icon
on the create button, and the New DM and Add Members pickers) use the
same choice, through a new `smallMediaImageProviders`. They try the same
thumbnails, fall back the same way, and show initials when neither
thumbnail exists. Before, they downloaded the full-size upload and only
decoded it small.
- Larger layouts and the full-screen viewer load the full-size upload,
as before.

### Agent artwork

- Preset agent artwork (the tray, flight, video placeholder, avatar hero
and the avatar editor's blurred backdrop) now loads through
`MediaImage`, so it uses the disk cache too.
- The create-agent and empty-bestie pages warm the same
`MediaImageProvider` that their widgets read, through a new
`mediaImageProviderFor(ref, url)`.
- No code in `mobile/lib` uses `Image.network` or `NetworkImage` now.

## Demo

A cold relaunch (the app is stopped, then started) into a synthetic "QA
demo" Solo chat that holds a few generated images. Shown at half speed.

Before: the attachment shows a "Loading image" placeholder while it
downloads.


https://github.com/user-attachments/assets/107f43a3-63d0-40c3-bd80-4ea9d7897a97

After: the attachment shows with the chat, from disk.


https://github.com/user-attachments/assets/d3985bb2-838c-4efa-93cb-44cef51f677d

## Tests

- `test/shared/relay/media_disk_cache_test.dart` follows one journey
through the real provider and a real cache in a temporary directory. The
first launch downloads and saves. An offline relaunch shows the
full-size image, its thumbnail and an external image from disk, and the
oversized image goes back to the network. Eight days later, only the
external image refreshes. Removing the community deletes its directory.
- A second test checks the order of eviction when the cache is full,
that a file read from disk is evicted after files that were not, and
that replacing a file's bytes after eviction last ran evicts again when
the cache goes over budget.
- `community_provider_test` checks that launch deletes orphan media
directories, that a new signing key deletes only the old account's
media, and that removing a community deletes its media.
- `avatar_image_test` checks that a missing WebP thumbnail falls back to
the JPEG thumbnail, and that an avatar with no thumbnail shows its
initials.
- `native_avatar_image_test` checks the same for native avatars: a WebP
404 paints the JPEG thumbnail, the full-size upload is never requested,
a relay with no thumbnail paints initials and is not asked again, and
any other failure stops at the initials.
- `flutter analyze` and the full mobile test suite pass.
- Automated app runs on an iPhone 17 Pro simulator (iOS 27): the channel
list, a DM, Home, the Agents grid and an agent details sheet show their
images. After a relaunch, the images came from disk and the app wrote no
new files. In the "QA demo" chat, a new image from the app showed
immediately.
- Automated run of the native-thumbnail fix on an iPhone 17 Pro
simulator (iOS 27): the native New DM picker shows photo avatars, and
the cache gained only relay `.thumb.webp` entries for them, no full-size
uploads. After a cold relaunch, the picker showed the same avatars
within about 1.5 seconds, and the cache directory gained no files. The
avatar editor backdrop was not exercised in the app. The test community
has no remote agents, and the backdrop tests cover only emoji and
picked-image selections.

## Before merge

- [x] Automated simulator run of this head: avatars and agent artwork
show their thumbnails, and a cold relaunch shows images from disk.

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
2026-11-09 07:21:21 -08:00
Tom Brow
e1e1cd50ab fix(mobile): keep Home's header clean under sheets (#9152)
On iOS, opening a sheet over Home (for example a channel's long-press
actions) left a hard horizontal edge and a light glow band under the
filter chips. Home's header keeps a native UIKit soft-edge view behind
its Flutter controls, and the sheet's dim barrier doesn't composite
cleanly over it.

While another route covers Home, the header now switches to its Flutter
backdrop through the existing `FrostedAppBar.nativeViewSuppressed` hook,
the same mechanism other headers use while a backdrop covers them. Home
already hides its native bottom controls under the same condition.

| Before | After |
| --- | --- |
| <img alt="before"
src="https://github.com/user-attachments/assets/a5bf01da-4f88-4055-809d-e347b35408a9"
width="300"> | <img alt="after"
src="https://github.com/user-attachments/assets/6813bb27-9f76-45d5-81c3-b46d8e0df647"
width="300"> |

### Validation

- iPhone 17 Pro simulator (iOS 27), Builderlab test community:
reproduced the artifact on `main` with Home scrolled and the channel
actions sheet open, then confirmed it is gone with this change. Also
opened and dismissed the sheet repeatedly and checked the header before,
during and after.
- Transition timing, frame-stepped from simulator recordings of `main`
(top row of each strip) and this PR (bottom row) on the same Home state:
- The header and the bottom navigation controls switch on the same
frame. A modal sheet doesn't drive Home's secondary animation
(`MaterialPageRoute.canTransitionTo` is false for a sheet route), so the
bottom controls' `secondaryAnimation == 0` check reduces to the same
`isCurrent` gate the header uses.
- Known limitation: while the native header view is swapped out, the
header blanks for about 2 display frames as the sheet opens and about 3
as it closes (about 30 to 50 ms, seen as the missing chips below).
`main` has no blank frames but shows the hard edge.

  Opening:

<img alt="sheet open, main above PR"
src="https://github.com/user-attachments/assets/df8f04f2-da72-4889-b9c8-5c47596fe7e3"
width="900">

  Closing:

<img alt="sheet close, main above PR"
src="https://github.com/user-attachments/assets/aa234a82-773d-4c9f-bba4-469afd158de8"
width="900">
- Extended the iOS Home widget journey: the native header view is
removed while the channel actions sheet is open and restored after it is
dismissed. Without the fix, the journey fails.
- Full mobile Flutter suite passes.

buzz-review-completed

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 06:59:08 -08:00
Tom Brow
ac2c5831f3 fix(mobile): show already-loaded custom emoji in the iOS reactions sheet (#9150)
On iOS, the reactions sheet (long-press a reaction pill) could show a
custom emoji as truncated `:shortcode:` text, for example `:eye…`, even
though the same emoji rendered as an image on the message pill a moment
before.

The sheet is a native UIKit view that downloaded each custom emoji again
with its own `URLSession` request and showed the shortcode label until
that download finished, and for good when it failed. A shortcode is
illegible in a chip that size.

Now:

- Flutter keeps the encoded bytes of custom emoji it has downloaded (a
bounded LRU: 512 KiB per emoji, 8 MiB total, rebuilt when the media auth
scope changes so accounts never share bytes) and hands them to the
sheet, which decodes them without a fetch. Emoji the timeline never
loaded still download natively as before.
- A custom emoji in the sheet never shows its shortcode: it stays blank
while loading and shows the sparkles icon, matching the native emoji
picker, if the image cannot load. Reaction pills in Flutter get the same
sparkles fallback. Inline emoji in message text keep the shortcode
fallback, where it reads as text. Avatars in the sheet keep their
initial.

### Before / after

Reactions sheet header and chips right after opening, on a message with
two custom-emoji reactions (synthetic test channel, captured from a 30
fps screen recording).

| Before (main) | After (this branch) |
| --- | --- |
| <img width="300" alt="Before: custom emoji chips show truncated
:qa-... shortcodes"
src="https://github.com/user-attachments/assets/593e555b-9c82-4eec-9049-3d909f987c76">
| <img width="300" alt="After: custom emoji chips show images"
src="https://github.com/user-attachments/assets/a6739997-b39f-4062-9e5c-d22a8a38b368">
|

### Validation

- Added tests: the native sheet's payload carries the bytes the pill
already downloaded; the combined reaction tray shows sparkles, not the
shortcode, when a custom emoji fails to load (the existing alignment
test previously asserted the shortcode).
- Full mobile suite and `just mobile-check` pass; the iOS simulator
build compiles.
- Automated simulator run (iPhone 17 Pro, iOS 27, main vs this branch,
signed in to a test community): channel list, opening a channel, the
message action sheet, the emoji picker, and the reactions sheet on a
message carrying two custom emoji I added plus a thumbs-up. On main the
sheet's custom-emoji chips show truncated `:qa-...` shortcodes for a few
frames before the images arrive; on this branch they render as images
from the first frame (see Before / after). Limitations: the emoji images
load fine over the network in this setup, so the failed-download
sparkles fallback was covered by tests only, not seen in the app; a long
press on the combined reaction tray opened the message menu in the
simulator, a tap opened the sheet.

🤖 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-09 06:59:03 -08:00
Tom Brow
ad5699d05a fix(mobile): start no threads in Solo chats (#9123)
Agents in a Solo chat always answer at the chat's top level. On mobile
you can still start a thread in Solo (Reply action, swipe-to-reply,
media reply) or reply inside an existing one, so the agent's answer
lands outside the thread you wrote in. Desktop already avoids this: Solo
shows existing threads but starts none and has no thread composer.

This matches desktop on mobile:

- No Reply quick action, swipe-to-reply or media reply in Solo chats.
- Existing Solo threads still open from their reply summary, read-only
(no composer).
- Every other channel is unchanged.

### Demo

Synthetic Solo chat "QA demo", iPhone 17 Pro simulator. Each clip: right
swipe on an agent message, then long-press for the actions.

Before (main): the swipe shows the reply circle and opens a thread with
a composer; Reply is in the actions.


https://github.com/user-attachments/assets/cc5025a3-b7ba-4ab2-bebb-06c7b54e7906

After (this branch): the swipe does nothing; the actions have no Reply.


https://github.com/user-attachments/assets/b31f9983-8c52-45c2-ae88-1661aa71210e

### Validation

Added tests: a Solo chat's message neither swipes to reply nor offers
Reply in its actions, and a Solo thread opens without a composer.
Existing swipe-reply and Solo channel tests pass, along with the full
mobile suite and analyzer.

Simulator run on an iPhone 17 Pro, signed in to a real community: in an
existing Solo chat, a right swipe on an agent message no longer moves or
opens a thread, and the long-press actions show no Reply (Copy link,
Remind me and the rest are unchanged). Team-channel Reply is covered by
the existing swipe-reply tests, not this run.

A second simulator run on an iPhone 17 Pro, in a synthetic Solo chat,
compared main and this branch: on main the swipe opens a thread with a
composer and the actions list Reply; on this branch neither does (see
Demo). The Demo's "Follow thread" action still appears in a Solo chat's
actions on both builds; this PR does not change it.

🤖 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: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 06:58:53 -08:00
Tom Brow
439d7bcc12 fix(mobile): keep a sent thread reply above the composer (#9026)
Fixes two thread symptoms that come from the same state: after sending a
reply, the composer clears but the new reply sits hidden under the
composer (or out of view entirely) until you leave and return, and the
**Latest** button stays visible even though the list looks like it is at
the bottom.

### Cause

1. A sent reply grows into place over its 500 ms entrance transition
(`LocalSendRow`). The thread's one-shot tail correction can finish while
the row is still growing. Once it has finished, nothing moves the list
as the reply keeps growing, so the list stops short of the real end
(about 40 pt on an iPhone 17 Pro simulator) and the reply ends up behind
the composer. Because the list isn't actually at its end, **Latest**
shows. It is visible even with the composer focused when an earlier drag
detached tail-follow.
2. A thread opened at a specific reply (from Inbox, a push notification
or a message link) skipped the new-reply follow logic for its whole
lifetime, not just for the replies it opened with. If the reader
scrolled at all before replying, their own sent reply was never brought
into view: it landed below the viewport, and a quick swipe couldn't
reach it before the next layout.

### Fix

- While the thread follows its tail, a `ScrollMetricsNotification`
listener keeps a position that was at its previous end on the new end
whenever the extent grows. It only acts when the last reply is laid out,
the reader isn't dragging or opted out, and no navigation to the tail is
in progress, so programmatic jumps away from the tail are left alone.
This also covers other growth at the tail, such as media or typing rows.
- A targeted entry now absorbs the replies it hydrates with until its
target jump has revealed the list. Hydration can come in two steps (the
route's snapshot of the target, then the relay's full thread). Absorbing
only the first let the second, when it held the reader's own earlier
replies, schedule a tail correction that cancelled the one-shot target
jump and left the list hidden behind its loading placeholder. Later
arrivals use the ordinary rules: the reader's own reply comes into view,
and other people's replies still don't move a reader who is away from
the tail.

### Before and after

Same flow on an iPhone 17 Pro simulator, in a synthetic QA channel
thread: scroll the list away from the bottom, focus the composer, send a
long reply that wraps onto many lines. Before (main) the sent reply ends
with its bottom edge under the composer; after (this branch) it ends
clear above it.

Before (main):


https://github.com/user-attachments/assets/5101b63d-e2df-46d1-bfd1-49038330ddf5

After (this branch):


https://github.com/user-attachments/assets/1df81ad5-bb6b-4df6-b4e3-5c37fd8aab67

### Validation

- Test `a sent reply stays above the composer as it grows in` now runs
for a plain entry, a targeted entry (`initialMessageId`), and a targeted
entry whose relay hydration is delayed and includes the reader's own
replies. The targeted row opens at an older reply, checks it is visible,
drags a little, focuses the composer with the keyboard up, sends a
multi-line reply, and checks that the reply ends above the composer and
**Latest** is hidden. Each row fails without its fix (growth: reply
bottom at 504, composer top at 402; targeted: the reply is never
followed; delayed hydration: the target never becomes hit-testable
because the list stays hidden).
- Full `flutter analyze` and mobile test suite pass.
- Before/after capture on an iPhone 17 Pro simulator (iOS 27, debug
builds of this branch head and of current main), in a synthetic QA
channel thread with enough replies to scroll. Flow: scroll away from the
bottom, focus the composer, send a long wrapping reply. Over 7 runs on
main, the reply's bottom ended 3 to 25 pt under the composer in 5; over
6 runs on this branch, it ended 17 pt above the composer every time.
Limitation: debug simulator builds only, and the shortfall on main
varies run to run.
- Automated full-app run on an iPhone 17 Pro simulator (iOS 27) against
the Remote Agents Pilot community. In a test DM thread, I sent short and
wrapping replies with no prior scroll, after dragging up and returning,
and after the follow-up narrowing. Each reply ended fully above the
composer, and **Latest** stayed hidden at the bottom. I also dragged up
with the keyboard dismissed and confirmed the list stays at the tail
with no stray **Latest**. For the targeted entry, I opened a thread from
a message link, scrolled, and sent replies: without the targeted-entry
fix they stayed out of view under the keyboard; with it hot-reloaded
they were followed (the combined build is covered by the widget test
rows above). I then reopened that link right after an app restart, which
hydrates in two steps: before the hydration fix the thread showed only
its root with the replies hidden, and with it the list revealed at the
target and a sent reply came into view. Human testing is waived per the
owner's standing exception. Limitation: this run did not cover physical
devices or media replies.

The simulator recording was taken in an internal community, so it is
shared internally rather than embedded here.

🤖 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@localhost>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-09 06:58:43 -08:00