Skip to content

Wire per-row Pin/Unpin in chat history overflow menu#8604

Merged
GerardPaligot merged 4 commits into
developfrom
feature/gerard/chat-history-pin
May 20, 2026
Merged

Wire per-row Pin/Unpin in chat history overflow menu#8604
GerardPaligot merged 4 commits into
developfrom
feature/gerard/chat-history-pin

Conversation

@GerardPaligot
Copy link
Copy Markdown
Contributor

@GerardPaligot GerardPaligot commented May 18, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1214820120386824?focus=true

Description

Wires the Pin / Unpin action on the Duck.ai chat history screen so a chat actually moves between the Pinned and Recent sections. The toggle fires immediately with no confirmation; a snackbar with Undo appears so a mistap is recoverable. State is persisted via the native chat store so the same Pinned/Recent split shows on next open and on Duck.ai itself.

Steps to test this PR

Note

Prerequisites:

  • Install Internal Debug.
  • In Settings → Developer Settings → Feature Flags, confirm duckAiChatHistory (self, historyScreen) is ON and duckChat → useNativeStorageChatData is ON.
  • Create at least 2 chats in Duck.ai so there's something to pin.

Happy path

  • Open the Chats screen → tap the 3-dot on a Recent row → tap Pin → confirm the row moves to a Pinned section above Recent and a "Chat pinned" snackbar appears with an Undo action.
  • Tap the 3-dot on a Pinned row → tap Unpin → confirm the row moves back to Recent and a "Chat unpinned" snackbar appears with Undo.
  • Trigger a pin → tap Undo before the snackbar auto-dismisses → confirm the row returns to its original section.
  • Trigger an unpin → tap Undo → confirm the row returns to the Pinned section.

Persistence

  • Pin a chat, close and reopen the Chats screen → confirm the chat is still in the Pinned section.
  • Pin a chat on Android, then open the same chat on Duck.ai web → confirm it shows as pinned there too (and vice versa).

UI changes

Before After
image image
image image
N/A image

Note

Medium Risk
Adds a new persisted pin/unpin write path into the native chat store and surfaces it via immediate UI actions with undo, which could affect chat metadata consistency across sessions. Changes are localized but touch storage JSON updates and user-facing state transitions.

Overview
Enables the per-row Pin/Unpin action in chat history to immediately move chats between Pinned and Recent, and shows a snackbar with Undo after toggling.

Adds a new ChatHistoryRepository.setPinned flow backed by native storage (DuckAiChatStore.pinChat/unpinChat) that updates the stored chat JSON’s pinned field, plus ViewModel/fragment wiring (messageEvents) and new tests validating state changes and persistence behavior.

Reviewed by Cursor Bugbot for commit 83e7fe3. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor Author

GerardPaligot commented May 18, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-rename branch from b7d6e93 to f6907a1 Compare May 19, 2026 09:21
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch 2 times, most recently from 7814890 to 8ccddb3 Compare May 19, 2026 09:38
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-rename branch from 8207298 to cd1d1b5 Compare May 19, 2026 12:38
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from 750e7cc to 0bdc467 Compare May 19, 2026 12:38
@malmstein malmstein self-assigned this May 19, 2026
Copy link
Copy Markdown
Contributor

@malmstein malmstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, left a few comments but nothing blocker

@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-rename branch from cd1d1b5 to f7b5cd6 Compare May 19, 2026 21:51
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from 0bdc467 to f77064b Compare May 19, 2026 21:51
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-rename branch from f7b5cd6 to 65337eb Compare May 20, 2026 08:25
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from f77064b to 6530893 Compare May 20, 2026 08:25
@GerardPaligot GerardPaligot changed the base branch from feature/gerard/chat-history-rename to graphite-base/8604 May 20, 2026 09:31
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from 6530893 to a720619 Compare May 20, 2026 09:31
@GerardPaligot GerardPaligot changed the base branch from graphite-base/8604 to develop May 20, 2026 09:31
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from a720619 to 008e473 Compare May 20, 2026 14:28
Surfaces a snackbar after the per-row Pin/Unpin overflow action so the
user can recover from a mistap. The toggle still fires immediately; the
snackbar is purely informational + an Undo affordance that re-issues
setPinned with the previous value.

Also fixes a pre-existing build break in RecordingRenameRepository,
which was missing the setPinned override added in b3157b9.
Intent-named methods read more naturally at call sites that already
know which direction they're going, and dropping the Boolean return
keeps the public contract free of JSON-validity concerns — not-found
and malformed JSON are silent no-ops. The shared mutation logic stays
as a private setPinned helper inside RealDuckAiChatStore.

The repository keeps its boolean-toggle setPinned signature because
its caller (ChatHistoryViewModel) computes the next state as a
boolean; the impl dispatches to pinChat / unpinChat.
@GerardPaligot GerardPaligot force-pushed the feature/gerard/chat-history-pin branch from 008e473 to 06c472f Compare May 20, 2026 14:57
The rebase dropped the one-line override on this private test fake,
breaking compileDebugUnitTestKotlin because RecordingRenameRepository
implements ChatHistoryRepository which declares setPinned.
@GerardPaligot GerardPaligot merged commit 90d8ca9 into develop May 20, 2026
13 checks passed
@GerardPaligot GerardPaligot deleted the feature/gerard/chat-history-pin branch May 20, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants