@@ -25,16 +25,22 @@ public final class SentryUserFeedbackDialog extends AlertDialog {
2525
2626 private boolean isCancelable = false ;
2727 private @ Nullable SentryId currentReplayId ;
28+ private final @ Nullable SentryId associatedEventId ;
2829 private @ Nullable OnDismissListener delegate ;
2930
3031 private final @ Nullable OptionsConfiguration configuration ;
32+ private final @ Nullable SentryFeedbackOptions .OptionsConfigurator configurator ;
3133
3234 SentryUserFeedbackDialog (
3335 final @ NotNull Context context ,
3436 final int themeResId ,
35- final @ Nullable OptionsConfiguration configuration ) {
37+ final @ Nullable SentryId associatedEventId ,
38+ final @ Nullable OptionsConfiguration configuration ,
39+ final @ Nullable SentryFeedbackOptions .OptionsConfigurator configurator ) {
3640 super (context , themeResId );
41+ this .associatedEventId = associatedEventId ;
3742 this .configuration = configuration ;
43+ this .configurator = configurator ;
3844 SentryIntegrationPackageStorage .getInstance ().addIntegration ("UserFeedbackWidget" );
3945 }
4046
@@ -56,6 +62,9 @@ protected void onCreate(Bundle savedInstanceState) {
5662 if (configuration != null ) {
5763 configuration .configure (getContext (), feedbackOptions );
5864 }
65+ if (configurator != null ) {
66+ configurator .configure (feedbackOptions );
67+ }
5968 final @ NotNull TextView lblTitle = findViewById (R .id .sentry_dialog_user_feedback_title );
6069 final @ NotNull ImageView imgLogo = findViewById (R .id .sentry_dialog_user_feedback_logo );
6170 final @ NotNull TextView lblName = findViewById (R .id .sentry_dialog_user_feedback_txt_name );
@@ -145,6 +154,9 @@ protected void onCreate(Bundle savedInstanceState) {
145154 final @ NotNull Feedback feedback = new Feedback (message );
146155 feedback .setName (name );
147156 feedback .setContactEmail (email );
157+ if (associatedEventId != null ) {
158+ feedback .setAssociatedEventId (associatedEventId );
159+ }
148160 if (currentReplayId != null ) {
149161 feedback .setReplayId (currentReplayId );
150162 }
@@ -226,6 +238,8 @@ public void show() {
226238 public static class Builder {
227239
228240 @ Nullable OptionsConfiguration configuration ;
241+ @ Nullable SentryFeedbackOptions .OptionsConfigurator configurator ;
242+ @ Nullable SentryId associatedEventId ;
229243 final @ NotNull Context context ;
230244 final int themeResId ;
231245
@@ -317,14 +331,38 @@ public Builder(
317331 this .configuration = configuration ;
318332 }
319333
334+ /**
335+ * Sets the configuration for the feedback options.
336+ *
337+ * @param configurator the configuration for the feedback options, can be {@code null} to use
338+ * the global feedback options.
339+ */
340+ public Builder configurator (
341+ final @ Nullable SentryFeedbackOptions .OptionsConfigurator configurator ) {
342+ this .configurator = configurator ;
343+ return this ;
344+ }
345+
346+ /**
347+ * Sets the associated event ID for the feedback.
348+ *
349+ * @param associatedEventId the associated event ID for the feedback, can be {@code null} to
350+ * avoid associating the feedback to an event.
351+ */
352+ public Builder associatedEventId (final @ Nullable SentryId associatedEventId ) {
353+ this .associatedEventId = associatedEventId ;
354+ return this ;
355+ }
356+
320357 /**
321358 * Builds a new {@link SentryUserFeedbackDialog} with the specified context, theme, and
322359 * configuration.
323360 *
324361 * @return a new instance of {@link SentryUserFeedbackDialog}
325362 */
326363 public SentryUserFeedbackDialog create () {
327- return new SentryUserFeedbackDialog (context , themeResId , configuration );
364+ return new SentryUserFeedbackDialog (
365+ context , themeResId , associatedEventId , configuration , configurator );
328366 }
329367 }
330368
0 commit comments