📜 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
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
useShakeGestureis enabled inSentryUserFeedbackConfiguration, shaking the device opens the feedback form.The implementation swizzles
UIWindow.motionEnded:withEvent:usingclass_addMethod+method_setImplementationto safely intercept shake events without modifyingUIResponder'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
useShakeGestureproperty already existed inSentryUserFeedbackConfigurationbut 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?
SentryShakeDetector📝 Checklist
sendDefaultPIIis enabled.