Skip to content

Commit 8b9bab2

Browse files
antonisclaude
andcommitted
fix(feedback): clean up dialog state when a different activity resumes
When a dialog is showing on Activity A and the user navigates to Activity B (e.g. via notification), onActivityResumed(B) overwrites currentActivity. Later onActivityDestroyed(A) can't match and cleanup never runs, leaving isDialogShowing permanently stuck. Now we detect this in onActivityResumed and clean up proactively. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a734533 commit 8b9bab2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public void close() throws IOException {
6464

6565
@Override
6666
public void onActivityResumed(final @NotNull Activity activity) {
67+
// If a dialog is showing on a different activity (e.g. user navigated via notification),
68+
// clean up since the dialog's host activity is going away and onActivityDestroyed
69+
// won't match currentActivity anymore.
70+
if (isDialogShowing && currentActivity != null && currentActivity != activity) {
71+
isDialogShowing = false;
72+
if (options != null) {
73+
options.getFeedbackOptions().setOnFormClose(previousOnFormClose);
74+
}
75+
previousOnFormClose = null;
76+
}
6777
currentActivity = activity;
6878
startShakeDetection(activity);
6979
}

0 commit comments

Comments
 (0)