Composer: fix /gif and /emoji appearing in typeahead (#529)
* Composer: add WebPanelCommands (/gif, /emoji) to typeahead The typeahead for slash commands was missing /gif and /emoji, which are defined in WebPanelCommands. They should always show up like other client-handled commands. Now the typeahead includes WebPanelCommands alongside botCommands and native-handled commands. * Typeahead: deduplicate commands to prevent duplicates Commands are now deduplicated by name before filtering, so the same command won't appear twice in the typeahead even if it exists in multiple sources (botCommands, WebPanelCommands, appCommands).
1 file changed,
+10
−1
ios/LChatCore/Sources/LChatCore/ComposerTypeahead.swift+10 −1
diff --git a/ios/LChatCore/Sources/LChatCore/ComposerTypeahead.swift b/ios/LChatCore/Sources/LChatCore/ComposerTypeahead.swift| index cff839d..680ad05 100644 |
| --- a/ios/LChatCore/Sources/LChatCore/ComposerTypeahead.swift |
| +++ b/ios/LChatCore/Sources/LChatCore/ComposerTypeahead.swift |
| @@ -96,9 +96,18 @@ public func typeaheadItems(_ token: ComposerToken, roster: [RosterEntry], |
| // theming and /me (SlashCommands.swift) while /help falls through to a |
| // bot — the web's mirror image — so each side ungates exactly what it |
| // can answer itself. |
| - let floor = botCommands.filter { hasBot || clientAnswered.contains($0.name) } + [meCommand] |
| + let floor = botCommands.filter { hasBot || clientAnswered.contains($0.name) } |
| + + WebPanelCommands.catalog + [meCommand] |
| + // Deduplicate by name (case-insensitive) to avoid showing the same command twice |
| + var seen = Set<String>() |
| return (appCommands + floor) |
| .filter { $0.name.dropFirst().lowercased().hasPrefix(q) } |
| + .filter { cmd in |
| + let key = cmd.name.lowercased() |
| + guard !seen.contains(key) else { return false } |
| + seen.insert(key) |
| + return true |
| + } |
| .prefix(8) |
| .map { .command(name: $0.name, desc: $0.desc) } |
| case .emoji: |