Skip to content

Add ShakeDelegate.shouldHandleShake() to gate shakes per event - #102

Merged
kkoser merged 4 commits into
linkedin:mainfrom
anniec-01:jimchang/should-handle-shake
Oct 22, 2026
Merged

kkoser merged 4 commits into
linkedin:mainfrom
anniec-01:jimchang/should-handle-shake

Conversation

@anniec-01

@anniec-01 anniec-01 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds ShakeDelegate.shouldHandleShake() (default true) and checks it at the top of Shaky.hearShake(), before the custom-handling check, onShakyStarted, screenshot capture and data collection. An ignored shake is logged.

Why: ShakeDelegate.isEnabled() is only evaluated when an activity resumes and the shake sensor is registered, so apps can't honor a setting that changes afterwards. This lets an app customize the behavior per shake. Apps that don't override it are unaffected.

  • Flows started from non shake entry points (startFeedbackFlow()) are unchanged.
  • Added a CHANGELOG entry under Unreleased.

Testing

  • ./gradlew clean check: passed
  • New tests in ShakyShould: default is true; a declined shake is ignored (no callback) with and without custom handling, and without checking custom handling; the flow starts when the delegate accepts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread shaky/src/main/java/com/linkedin/android/shaky/ShakeDelegate.java Outdated
Comment thread shaky/src/main/java/com/linkedin/android/shaky/Shaky.java Outdated
Comment thread shaky/src/main/java/com/linkedin/android/shaky/Shaky.java Outdated
@kkoser
kkoser merged commit 2c39f65 into linkedin:main Oct 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants