Support per-instance pinning across multiple Pinned Item widgets#87
Merged
Conversation
Previously PinnedItemStore held a single global pin, so any number of Pinned Item widgets placed on the same home screen always showed the identical item — there was no way to give each one something different (e.g. one per household member). - PinnedItemStore gains per-appWidgetId overrides (pinnedItemFor, setPinnedFor, togglePinnedFor) that fall back to the existing default pin when unset, so the default/single-widget behavior is unchanged. - PinnedItemWidget resolves its own GlanceId to an appWidgetId and reads that instance's pin instead of the shared default. - The in-app pin toggle (ChoreListViewModel/TaskListViewModel) checks how many Pinned Item widgets are currently placed: 0-1 behaves exactly as before (writes the default pin), 2+ shows a new PinWidgetChooserDialog to pick which widget to target, since widgets have no user-given label yet (no config screen exists to set one). - Known limitation, called out for follow-up: the in-app pin icon/highlight still reflects only the default pin, not "pinned to any instance", once a household is using 2+ widgets.
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.
Summary
This is the last item from the original widget UX investigation:
PinnedItemStorewas a single global pin, so placing 2+ "Pinned Item" widgets on one home screen always showed the identical item — no way to give each one something different (e.g. one per household member).PinnedItemStoregains per-appWidgetIdoverrides (pinnedItemFor,setPinnedFor,togglePinnedFor) that fall back to the existing default pin when unset. The existingpinnedItem/setPinned/togglePinnedAPI is untouched, so behavior with 0-1 widgets placed is unchanged.PinnedItemWidgetresolves its ownGlanceIdto anappWidgetId(GlanceAppWidgetManager(context).getAppWidgetId(id)) and reads that specific instance's pin instead of the shared default.ChoreListViewModel/TaskListViewModel) checks how many Pinned Item widgets are currently placed (AppWidgetManager.getAppWidgetIds): 0-1 behaves exactly as before; 2+ shows a newPinWidgetChooserDialog("Pin to which widget?") to pick which instance to target, since widgets have no user-given label yet (there's no config screen to set one).changelog/unreleased/fragment (minor bump).Known limitation (documented in code, flagged for follow-up rather than silently shipped): the in-app pin icon/highlight on task and chore cards still reflects only the default pin, not "pinned to any widget instance" — once a household is using 2+ widgets via the chooser, the star icon may not track a pin made to a specific non-default instance. A proper fix wants a real widget config screen with user-given labels, which is a larger follow-up (this PR intentionally stays scoped to the data model + minimal numbered chooser rather than building that now).
Test plan
Generated by Claude Code