feat(ios): @-mention picker in the composer (web parity)#274
Merged
Conversation
The iOS app rendered incoming mentions but could never send one: SendMessageRequest.mention_ids was never populated and the composer had no "@" typeahead, so a message typed on iOS never triggered a bot. - ComposerView: "@" opens a picker over the channel's members plus the group tokens (@all/@bots/@humans/@here), ranked bots -> groups -> people; tapping a row inserts "@Label " (caret assumed at end of draft - SwiftUI TextField exposes no caret position). - ChatModel: builds the mention pool from channel members, tracks picked mentions, and on send keeps only tokens still present in the text, splitting them into mention_ids (members) and mention_names (group tokens), same contract as the web MessageComposer. - DTOs: SendMessageRequest gains mention_names. Verified live against the kind stack: @codex persisted the mention and dispatched the bot; @Bots expanded server-side to the channel's bot. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
haowei2000
added a commit
that referenced
this pull request
Jul 20, 2026
Conflict in apps/ios/Sources/State/ChatModel.swift: #274 (iOS @-mention picker) built its `mentionPool` inside the members-fetch block of loadInitial, which this branch had extracted into refreshMembers(). Resolved by keeping this branch's loadInitial (offline-first seed + contiguity check) and moving #274's mentionPool construction into refreshMembers(). Strictly better than either side: refreshMembers() also runs on warm re-entry, so a member who joined while the user was away now appears in the mention picker without a cold reload — #274's version only built the pool on a cold load. DTOs.swift, ChatView.swift and ComposerView.swift auto-merged. xcodebuild (Debug, iOS Simulator) succeeds; SwiftData harness and frontend vitest (83/83) still pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The iOS app could render incoming mentions (bubble highlighting) but could never send one:
SendMessageRequest.mention_idswas never populated and the composer had no "@" typeahead. A message typed on iOS therefore never triggered a bot.Changes
@opens a picker over the channel's members plus the group tokens (@all/@bots/@humans/@here), ranked bots → groups → people, filtered by label/username; tapping a row inserts@label. The trigger token is detected assuming the caret sits at the end of the draft — SwiftUI'sTextFieldexposes no caret position, and appending is where mobile typing overwhelmingly happens.@labelstill survives in the text, splitting them intomention_ids(real members) andmention_names(group tokens) — the same contract as the web MessageComposer.SendMessageRequestgainsmention_names.Verification (live, kind stack)
Installed the build on an iPhone 17 simulator against
localhost:30080:@opens the picker with correct ranking;@bofilters down tobots.@Codex reply with exactly: iOS mention test ok→ API shows the persisted message withmentions: [Codex], and the gateway dispatched the bot (it answered[bot offline]— the Codex connector wasn't running, but the dispatch path fired, which never happened before this fix).@bots→ server expanded the group token to the channel's bot and dispatched.xcodebuild(Debug, iOS Simulator) passes.🤖 Generated with Claude Code