-
-
Notifications
You must be signed in to change notification settings - Fork 383
Description
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
sendDefaultPIIis 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.