Refine Duck.ai chat history screen and gate it via suspend flag#8531
Open
GerardPaligot wants to merge 7 commits into
Open
Refine Duck.ai chat history screen and gate it via suspend flag#8531GerardPaligot wants to merge 7 commits into
GerardPaligot wants to merge 7 commits into
Conversation
In full-screen mode every OPEN_DUCK_CHAT intent previously spawned a new browser tab regardless of whether a Duck.ai tab was already open, which made entry points like chat-history row taps pile up duplicate Duck.ai tabs. When the intent carries an active session flag we now look for an existing Duck.ai tab via isDuckChatUrl, switch to it, and submit the target URL; the pager-selection flow is awaited first so currentTab resolves to the right fragment before navigation. No Duck.ai tab or a cold session falls back to the original new-tab path.
The browser-menu entry and the screen toolbar previously read "Duck.ai Chats"; the shorter "Chats" label aligns with the Figma design and removes redundancy when the screen launches from inside the Duck.ai context. A new browserMenuChats string in browser-ui's donottranslate keeps the entry consistent across locales until translation lands, and the empty-state title becomes "No Chats yet" to match. The per-row 3-dot popup also gains a Delete entry (still mocked to the "Coming soon" snackbar) so Phase 3 can wire the real action against an already-final popup shape.
Fixes the DenyListedApi lint failure flagged by the in-house lint rule on Flow.first: the safer firstOrNull variant returns null if the flow ever completes without emitting, where first would throw. The behaviour is equivalent for selectedTabFlow (a hot StateFlow-derived stream that never completes in practice), and the downstream call already null-checks currentTab so a null tabId result is benign.
DuckChat no longer exposes openDuckChatHistory; the screen is launched through a new DuckChatHistoryNoParams entry in :duckchat-api annotated on ChatHistoryActivity with @ContributeToActivityStarter. This matches the pattern already used by DuckChatSettingsNoParams and decouples the caller from the concrete Activity class — :app can navigate to the screen without a facade method on the Duck.ai interface, and the impl no longer hard-references ChatHistoryActivity. BrowserTabViewModel keeps the available-vs-sidebar decision (and its two tests) by emitting a new LaunchDuckChatHistory command that BrowserTabFragment translates into the GlobalActivityStarter call.
Co-locating historyScreen and deleteFromAutocomplete with the rest of the aiChat flags lets RealDuckChat depend on a single feature interface and drops the redundant DuckAiChatHistoryFeature.self() gate from isChatHistoryAvailable(). DuckAiChatHistoryFeature stays for the input-screen suggestion settings consumed via getSettings().
The chat-history visibility decision now flows entirely through BrowserViewState, so the factory no longer needs to query DuckChat directly. Removing the field shrinks its Dagger graph and keeps the factory focused on translating view state into menu state.
f320a85 to
fff886e
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fff886e. Configure here.
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.


Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1214566301692451?focus=true
Description
Ships the native Duck.ai chat history screen, reachable from the browser menu on the New Tab Page and on website tabs (gated by the layered
duckAiChatHistoryfeature flags). The screen lists past Duck.ai conversations partitioned into Pinned and Recent sections, sorted most-recent-first; tapping a row opens Duck.ai with that conversation already loaded via the?chatID=<id>URL parameter.Steps to test this PR
Note
Prerequisites:
duckAiChatHistoryand confirmself,historyScreenare ON.useNativeStorageChatDatais ON underduckChatin the feature flags.Menu entry visibility
https://duckduckgo.com) → open the browser menu → confirm the "Chats" entry is visible.Empty state
Loaded list and row tap
UI changes
Screen_recording_20260512_152511.mp4
Note
Medium Risk
Adds a new Duck.ai chat history Activity/Fragment surface backed by reactive native storage flows and new navigation commands; while gated by feature flags, it touches browser menu/intent tab switching and DuckChat API/feature toggles.
Overview
Adds a new native Duck.ai chat history screen (
ChatHistoryActivity/ChatHistoryFragment) that lists stored chats (Pinned/Recent) and opens Duck.ai with a selected conversation via achatIDURL parameter.Wires a new browser menu entry (“Chats”) on NTP and regular tabs, controlled by a new
BrowserViewState/BrowserMenuViewStateflag and a newCommand.LaunchDuckChatHistory, with fallback to the existing sidebar action when history isn’t available.Extends
DuckChatwith suspend-gatedisChatHistoryAvailable()and adds reactive chat retrieval (DuckAiChatStore.getChatsFlow()+ Room DAO Flow), plus small Duck.ai intent handling tweaks to reuse an existing Duck.ai tab when resuming a session. Includes new resources, icons, manifest registration, and unit tests for gating/repository/viewmodel behavior.Reviewed by Cursor Bugbot for commit fff886e. Bugbot is set up for automated code reviews on this repo. Configure here.