Skip to content

feat(feedback): implement shake gesture detectionΒ #7597

@github-actions

Description

@github-actions

Note

The pull request "feat(feedback): implement shake gesture detection" was created by @antonis but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

πŸ“œ Description

Implements shake gesture detection for the user feedback form. When useShakeGesture is enabled in SentryUserFeedbackConfiguration, shaking the device opens the feedback form.

The implementation swizzles UIWindow.motionEnded:withEvent: using class_addMethod + method_setImplementation to safely intercept shake events without modifying UIResponder's inherited implementation. A cooldown of 1 second prevents duplicate triggers.

Note: this is exposed to be used on React Native too getsentry/sentry-react-native#5754

πŸ’‘ Motivation and Context

The useShakeGesture property already existed in SentryUserFeedbackConfiguration but was never wired up. This PR implements the feature. The implementation is placed here (sentry-cocoa) rather than in each SDK separately so it can be reused by all SDKs that embed the feedback UI (React Native, Flutter, .NET MAUI, Unity).

πŸ’š How did you test it?

  • Tested in a sample iOS app (release build) β€” shaking the device opens the feedback form
  • Debug builds: shake triggers the React Native dev menu (expected; RCTDevMenu also swizzles the same method)
  • Unit tests added for SentryShakeDetector

πŸ“ Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions