feat(feedback): Add runtime toggle for shake-to-report#5232
Draft
feat(feedback): Add runtime toggle for shake-to-report#5232
Conversation
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Sentry Build Distribution
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| abfcc92 | 304.04 ms | 370.33 ms | 66.29 ms |
| 3699cd5 | 423.60 ms | 495.52 ms | 71.92 ms |
| b3d8889 | 371.33 ms | 426.24 ms | 54.92 ms |
| 55aaf9b | 336.43 ms | 364.14 ms | 27.71 ms |
| 6727e14 | 337.22 ms | 373.94 ms | 36.71 ms |
| f634d01 | 359.58 ms | 433.88 ms | 74.30 ms |
| ee747ae | 374.71 ms | 455.18 ms | 80.47 ms |
| bbc35bb | 324.88 ms | 425.73 ms | 100.85 ms |
| f064536 | 327.04 ms | 405.35 ms | 78.31 ms |
| ee747ae | 400.46 ms | 423.61 ms | 23.15 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| abfcc92 | 1.58 MiB | 2.13 MiB | 557.31 KiB |
| 3699cd5 | 1.58 MiB | 2.10 MiB | 533.45 KiB |
| b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
| 55aaf9b | 0 B | 0 B | 0 B |
| 6727e14 | 1.58 MiB | 2.28 MiB | 718.64 KiB |
| f634d01 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| f064536 | 1.58 MiB | 2.20 MiB | 633.90 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
Add Sentry.enableFeedbackOnShake() and Sentry.disableFeedbackOnShake() for runtime control of shake gesture detection, matching the React Native API. The integration now always registers lifecycle callbacks and checks the useShakeGesture flag dynamically on each activity transition. When disabled, there is zero overhead — no sensor or thread allocation. Sensor/thread initialization is deferred to first use. The shake callback also checks the flag before showing the dialog, so disabling takes effect immediately for new shakes even before the next activity transition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a34dd38 to
1e00dfe
Compare
Contributor
Author
|
@sentry review |
Contributor
Author
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Add
Sentry.enableFeedbackOnShake()andSentry.disableFeedbackOnShake()static methods for runtime control of shake gesture detection, matching the React Native API.The integration now always registers lifecycle callbacks and checks the
useShakeGestureflag dynamically on each activity transition. When disabled, there is zero overhead — no sensor registration, no thread allocation.Changes:
FeedbackShakeIntegration: always registers lifecycle callbacks, checksisUseShakeGesture()dynamically inonActivityResumedand in the shake callbackSentryShakeDetector.init(): deferred to firststartShakeDetection()call (lazy initialization)Sentry.java: addedenableFeedbackOnShake()/disableFeedbackOnShake()convenience methods💡 Motivation and Context
Users want to enable/disable shake-to-report at runtime (e.g., only in certain screens or for specific user roles) without restarting the app. This mirrors the existing React Native API.
Stacked on #5150.
💚 How did you test it?
FeedbackShakeIntegrationTest,SentryShakeDetectorTest,SentryAndroidTest,ManifestMetadataReaderTest)📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
enableFeedbackOnShake()/disableFeedbackOnShake()API