Skip to content

fix: Unpin button in Sleep Image Picker now actually unpins#24

Open
HenriqueMorato wants to merge 1 commit into
trilwu:mainfrom
HenriqueMorato:fix/sleep-image-unpin
Open

fix: Unpin button in Sleep Image Picker now actually unpins#24
HenriqueMorato wants to merge 1 commit into
trilwu:mainfrom
HenriqueMorato:fix/sleep-image-unpin

Conversation

@HenriqueMorato

Copy link
Copy Markdown

Summary

Fix the Unpin button in the Sleep Image Picker — pressing Left on a pinned image was moving thecursor up and pinning the row above, instead of clearing the pin.

  • What changes are included?
    • src/activities/tools/SleepImagePickerActivity.cpp — in list mode, bind Up/Down explicitly via onPressAndContinuous({Up}) /({Down}) instead of onNext/onPrevious, so Left/Right are no longer consumed by ButtonNavigator's "previous/next" actions.

Additional Context

Root cause is a button-down vs button-up race:

  • buttonNavigator.onPrevious(...) binds the callback to {Up, Left} on button-down (ButtonNavigator::getPreviousButtons()), and on Left it moves selectorIndex up.
  • The explicit wasReleased(Left) handler then reads selectorIndex on button-up to decide Pin vs Unpin via
    isCurrentImageSelection(selectorIndex).

So pressing Left on a pinned row first moved the selector to the row above, then the release handler saw it was no longer on the pinned row and took the else branch — pinning that new row. The original pin was never cleared.

Slideshow mode is untouched (Left = previous image is the right semantic there).

Tested on-device — pin/unpin now works correctly, Up/Down navigation still works, slideshow Left/Right still navigates images.


AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? YES

- List mode binds Up/Down explicitly via onPressAndContinuous so Left
  is no longer consumed by ButtonNavigator's "previous" action
- Was a button-down vs button-up race: onPrevious (Up+Left, button-down)
  moved the cursor before wasReleased(Left) read selectorIndex, so
  Unpin pinned the row above instead of clearing the pin
- Slideshow mode untouched — Left = previous image remains correct
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.

1 participant