Skip to content

Support per-instance pinning across multiple Pinned Item widgets#87

Merged
mapgie merged 1 commit into
mainfrom
claude/widget-per-instance-pinning
Jul 12, 2026
Merged

Support per-instance pinning across multiple Pinned Item widgets#87
mapgie merged 1 commit into
mainfrom
claude/widget-per-instance-pinning

Conversation

@mapgie

@mapgie mapgie commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

This is the last item from the original widget UX investigation: PinnedItemStore was 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).

  • PinnedItemStore gains per-appWidgetId overrides (pinnedItemFor, setPinnedFor, togglePinnedFor) that fall back to the existing default pin when unset. The existing pinnedItem/setPinned/togglePinned API is untouched, so behavior with 0-1 widgets placed is unchanged.
  • PinnedItemWidget resolves its own GlanceId to an appWidgetId (GlanceAppWidgetManager(context).getAppWidgetId(id)) and reads that specific instance's pin instead of the shared default.
  • The in-app pin toggle (ChoreListViewModel/TaskListViewModel) checks how many Pinned Item widgets are currently placed (AppWidgetManager.getAppWidgetIds): 0-1 behaves exactly as before; 2+ shows a new PinWidgetChooserDialog ("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).
  • When exactly one widget is placed, any stale per-instance override left over from a previous 2+-widget state is cleared so that widget reliably tracks the default again.
  • Adds a 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

  • With 0 or 1 Pinned Item widgets placed, confirm pinning behaves exactly as before (no chooser, no visible change).
  • Place 2 Pinned Item widgets, pin a task via the chooser to "Pinned Widget 1" and a different chore to "Pinned Widget 2"; confirm each widget shows its own item.
  • Remove one of the two widgets so only one remains; pin something new and confirm the remaining widget updates (doesn't get stuck on a stale override).
  • CI build/lint/changelog checks pass.

Generated by Claude Code

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.
@mapgie mapgie marked this pull request as ready for review July 12, 2026 10:04
@mapgie mapgie merged commit d958d71 into main Jul 12, 2026
4 checks passed
@mapgie mapgie deleted the claude/widget-per-instance-pinning branch July 12, 2026 10:05
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.

2 participants