Skip to content

Commit 7659fe5

Browse files
romtsnclaude
andauthored
ref(feedback): Rename Dialog to Form across feedback APIs (#5349)
* ref(feedback): Rename Dialog to Form across feedback APIs Rename SentryUserFeedbackDialog to SentryUserFeedbackForm as the primary class. Keep SentryUserFeedbackDialog as a deprecated subclass for backward compatibility. Also rename internal APIs to use Form naming consistently: - IDialogHandler -> IFormHandler - showDialog -> showForm - setDialogHandler/getDialogHandler -> setFormHandler/getFormHandler - AndroidUserFeedbackIDialogHandler -> AndroidUserFeedbackFormHandler Add deprecated Sentry.showUserFeedbackDialog() overloads that delegate to the new Sentry.showUserFeedbackForm() methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(feedback): Preserve binary compatibility for deprecated Builder constructors Use SentryUserFeedbackDialog.OptionsConfiguration as the parameter type in the deprecated Builder constructors so old compiled code looking for the original descriptor still resolves correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Make internal ctor package-private * Add missing deprecated annotaiton * Fix api * docs(changelog): Add deprecation entry for feedback Dialog to Form rename Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs(changelog): Note removal in next major version Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(feedback): Add Sentry.feedback() API Introduce IFeedbackApi with showForm() and capture() methods, accessible via Sentry.feedback(). This consolidates all feedback operations under a single API entry point. Deprecate Sentry.showUserFeedbackForm(), Sentry.showUserFeedbackDialog(), Sentry.captureFeedback(), and Sentry.captureUserFeedback() in favor of the new Sentry.feedback() API. All deprecated methods will be removed in the next major version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs(changelog): Update section to Features and remove unpublished API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ref(feedback): Move FeedbackApi to IScopes Add feedback() method to IScopes, matching the pattern used by logger() and metrics(). FeedbackApi takes an IScopes reference instead of using Sentry.getCurrentScopes() statically. Implemented in Scopes, NoOpScopes, NoOpHub, HubAdapter, HubScopesWrapper, and ScopesAdapter. Sentry.feedback() now delegates to getCurrentScopes().feedback(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ref: Rename showForm() to show() on IFeedbackApi Since the method is already namespaced under feedback(), the extra "Form" suffix is redundant. This aligns with the convention used by logger() and metrics(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: Deprecate UserFeedback and captureUserFeedback, delete showUserFeedbackForm Deprecate the old `UserFeedback` class and `captureUserFeedback()` across IScopes, ISentryClient, and all implementations in favor of `Sentry.feedback().capture()` with the new `Feedback` type. Delete `Sentry.showUserFeedbackForm()` (3 overloads) as it was never published. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: Deprecate SentryEnvelopeItem.fromUserFeedback() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: Deprecate SentryClient.buildEnvelope(UserFeedback) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ref: Remove unnecessary SuppressWarnings("deprecation") Deprecated methods don't need to suppress deprecation warnings for referencing other deprecated types — the deprecation annotation itself is sufficient. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix test * remove redudndant deprecated annotations * fix test --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 61659b6 commit 7659fe5

38 files changed

Lines changed: 786 additions & 409 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Add `Sentry.feedback()` API for `show()` and `capture()` ([#5349](https://github.com/getsentry/sentry-java/pull/5349))
8+
- `Sentry.showUserFeedbackDialog()` is deprecated in favor of `Sentry.feedback().show()`
9+
- `Sentry.captureFeedback()` is deprecated in favor of `Sentry.feedback().capture()`
10+
- `Sentry.captureUserFeedback()` and `UserFeedback` are deprecated in favor of `Sentry.feedback().capture()` with the new `Feedback` type
11+
- `SentryUserFeedbackDialog` is deprecated in favor of `SentryUserFeedbackForm`
12+
- All deprecated APIs will be removed in the next major version
13+
514
### Dependencies
615

716
- Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334))

sentry-android-core/api/sentry-android-core.api

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,23 +502,44 @@ public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Bu
502502
public fun setOnClickListener (Landroid/view/View$OnClickListener;)V
503503
}
504504

505-
public final class io/sentry/android/core/SentryUserFeedbackDialog : android/app/AlertDialog {
506-
public fun setCancelable (Z)V
507-
public fun setOnDismissListener (Landroid/content/DialogInterface$OnDismissListener;)V
508-
public fun show ()V
505+
public final class io/sentry/android/core/SentryUserFeedbackDialog : io/sentry/android/core/SentryUserFeedbackForm {
509506
}
510507

511-
public class io/sentry/android/core/SentryUserFeedbackDialog$Builder {
508+
public class io/sentry/android/core/SentryUserFeedbackDialog$Builder : io/sentry/android/core/SentryUserFeedbackForm$Builder {
512509
public fun <init> (Landroid/content/Context;)V
513510
public fun <init> (Landroid/content/Context;I)V
514511
public fun <init> (Landroid/content/Context;ILio/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration;)V
515512
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration;)V
516513
public fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackDialog$Builder;
514+
public synthetic fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder;
517515
public fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackDialog$Builder;
516+
public synthetic fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder;
518517
public fun create ()Lio/sentry/android/core/SentryUserFeedbackDialog;
518+
public synthetic fun create ()Lio/sentry/android/core/SentryUserFeedbackForm;
519+
}
520+
521+
public abstract interface class io/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration : io/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration {
522+
}
523+
524+
public class io/sentry/android/core/SentryUserFeedbackForm : android/app/AlertDialog {
525+
protected fun onCreate (Landroid/os/Bundle;)V
526+
protected fun onStart ()V
527+
public fun setCancelable (Z)V
528+
public fun setOnDismissListener (Landroid/content/DialogInterface$OnDismissListener;)V
529+
public fun show ()V
530+
}
531+
532+
public class io/sentry/android/core/SentryUserFeedbackForm$Builder {
533+
public fun <init> (Landroid/content/Context;)V
534+
public fun <init> (Landroid/content/Context;I)V
535+
public fun <init> (Landroid/content/Context;ILio/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration;)V
536+
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration;)V
537+
public fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder;
538+
public fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder;
539+
public fun create ()Lio/sentry/android/core/SentryUserFeedbackForm;
519540
}
520541

521-
public abstract interface class io/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration {
542+
public abstract interface class io/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration {
522543
public abstract fun configure (Landroid/content/Context;Lio/sentry/SentryFeedbackOptions;)V
523544
}
524545

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static void installDefaultIntegrations(
441441
}
442442
options
443443
.getFeedbackOptions()
444-
.setDialogHandler(new SentryAndroidOptions.AndroidUserFeedbackIDialogHandler());
444+
.setFormHandler(new SentryAndroidOptions.AndroidUserFeedbackFormHandler());
445445
}
446446

447447
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private void startShakeDetection(final @NotNull Activity activity) {
178178
}
179179
previousOnFormClose = null;
180180
});
181-
new SentryUserFeedbackDialog.Builder(active).create().show();
181+
new SentryUserFeedbackForm.Builder(active).create().show();
182182
} catch (Throwable e) {
183183
isDialogShowing = false;
184184
options.getFeedbackOptions().setOnFormClose(previousOnFormClose);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,9 @@ public void setEnableAnrFingerprinting(final boolean enableAnrFingerprinting) {
741741
this.enableAnrFingerprinting = enableAnrFingerprinting;
742742
}
743743

744-
static class AndroidUserFeedbackIDialogHandler implements SentryFeedbackOptions.IDialogHandler {
744+
static class AndroidUserFeedbackFormHandler implements SentryFeedbackOptions.IFormHandler {
745745
@Override
746-
public void showDialog(
746+
public void showForm(
747747
final @Nullable SentryId associatedEventId,
748748
final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) {
749749
final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity();
@@ -758,7 +758,7 @@ public void showDialog(
758758
return;
759759
}
760760

761-
new SentryUserFeedbackDialog.Builder(activity)
761+
new SentryUserFeedbackForm.Builder(activity)
762762
.associatedEventId(associatedEventId)
763763
.configurator(configurator)
764764
.create()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void init(
104104
}
105105
}
106106

107-
// Set the default ClickListener to open the SentryUserFeedbackDialog
107+
// Set the default ClickListener to open the SentryUserFeedbackForm
108108
setOnClickListener(delegate);
109109
}
110110

@@ -113,7 +113,7 @@ public void setOnClickListener(final @Nullable OnClickListener listener) {
113113
delegate = listener;
114114
super.setOnClickListener(
115115
v -> {
116-
new SentryUserFeedbackDialog.Builder(getContext()).create().show();
116+
new SentryUserFeedbackForm.Builder(getContext()).create().show();
117117
if (delegate != null) {
118118
delegate.onClick(v);
119119
}

0 commit comments

Comments
 (0)