Skip to content

Ensure TouchBehavior.LongPressCompleted event fires when LongPressCommand is null#2239

Merged
TheCodeTraveler merged 8 commits into
mainfrom
Ensure-LongPressCompleted-Fires-When-LongPressCommand-is-null
Oct 4, 2024
Merged

Ensure TouchBehavior.LongPressCompleted event fires when LongPressCommand is null#2239
TheCodeTraveler merged 8 commits into
mainfrom
Ensure-LongPressCompleted-Fires-When-LongPressCommand-is-null

Conversation

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

Description of Change

This PR normalizes the behavior between TouchBehavior.TouchGestureCompleted and TouchBehavior.LongPressCompleted.

Currently, the TouchBehavior.TouchGestureCompleted event fires regardless of whether its Command is set, using TouchBehavior.IsEnabled to determine whether or not to proceed with handling the touch:

This PR updates GestureManager.HandleLongPress use similar logic, verifying TouchBehavior.IsEnabled to determine whether or not to proceed with handling the long press.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard

Additional information

I've also added Unit Tests for GestureManager to cover the bug fixed in this PR

@TheCodeTraveler TheCodeTraveler marked this pull request as ready for review September 28, 2024 19:14
@TheCodeTraveler TheCodeTraveler changed the title Ensure TouchBehavior.LongPressCompleted event fires when LongPressCommand is null Ensure TouchBehavior.LongPressCompleted event fires when LongPressCommand is null Sep 30, 2024
@TheCodeTraveler TheCodeTraveler added the needs discussion Discuss it on the next Monthly standup label Sep 30, 2024
@TheCodeTraveler TheCodeTraveler removed the needs discussion Discuss it on the next Monthly standup label Oct 3, 2024
Copy link
Copy Markdown
Contributor

@bijington bijington left a comment

Choose a reason for hiding this comment

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

It took me a while to work out what exactly CanExecute meant but once I understood that then the changes look good. Thanks @brminnick

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator Author

Ha! I know exactly what you mean. I spent a lot of time trying to figure that out too when working on this PR.

Thanks man!!

@TheCodeTraveler TheCodeTraveler merged commit 1319fb9 into main Oct 4, 2024
@TheCodeTraveler TheCodeTraveler deleted the Ensure-LongPressCompleted-Fires-When-LongPressCommand-is-null branch October 4, 2024 06:10
KeithBoynton added a commit to KeithBoynton/CommunityToolkitMaui that referenced this pull request Oct 31, 2024
* main:
  Update dependabot.yml
  Tell Dependabot to ignore required libraries from auto-updating
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2295)
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2292)
  Fix animation behavior hot reload (CommunityToolkit#2288)
  Update resourceManagement.yml
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2285)
  [Housekeeping] Update NuGet Packages (CommunityToolkit#2254)
  Implement the ability to Close a popup (CommunityToolkit#1688)
  Add `[Obsolete]` tag
  Fix FileSaver Progress (CommunityToolkit#2277)
  Ensure `TouchBehavior.LongPressCompleted` event fires when `LongPressCommand is null` (CommunityToolkit#2239)
  Add Popup Support for MediaElement on iOS + MacCatalyst (CommunityToolkit#2251)
  [Sample app] Add MediaElementMultipleWindowsPage (CommunityToolkit#2250)
  [Sample App] Add Second CarouselView to `MediaElementCarouselViewPage.xaml` (CommunityToolkit#2248)
  Fix Windows Autoplay bug (CommunityToolkit#2238)
  Fix Crash on iOS when using MediaElement inside a CarouselView (again) (CommunityToolkit#2245)
  Refactor URLs and improve logging consistency (CommunityToolkit#2228)
  Bump xunit from 2.9.1 to 2.9.2 in /samples (CommunityToolkit#2234)
  Increase `CommunityToolkitSampleApp_Xcode_Version` to `16`
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] LongPressCompleted event won't fire unless LongPressCommand is bound

2 participants