Skip to content

Commit

Permalink
Don’t attach feedback event screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Oct 22, 2024
1 parent 8f95e33 commit be5c603
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class ScreenshotEventProcessor implements EventProcessor {
_hasSentryScreenshotWidget) {
return event;
}

if (event.type == 'feedback') {
return event; // No need to attach screenshot of feedback form.
}

final beforeScreenshot = _options.beforeScreenshot;
if (beforeScreenshot != null) {
try {
Expand Down
30 changes: 30 additions & 0 deletions flutter/test/event_processor/screenshot_event_processor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,36 @@ void main() {
added: true, isWeb: false, expectedMaxWidthOrHeight: widthOrHeight);
});

testWidgets('does not add screenshot for feedback events', (tester) async {
await tester.runAsync(() async {
final sut = fixture.getSut(null, false);

await tester.pumpWidget(
SentryScreenshotWidget(
child: Text('Catching Pokémon is a snap!',
textDirection: TextDirection.ltr),
),
);

final feedback = SentryFeedback(
message: 'message',
contactEmail: '[email protected]',
name: 'Joe Dirt',
associatedEventId: null,
);
final feedbackEvent = SentryEvent(
type: 'feedback',
contexts: Contexts(feedback: feedback),
level: SentryLevel.info,
);

final hint = Hint();
await sut.apply(feedbackEvent, hint);

expect(hint.screenshot, isNull);
});
});

group('beforeScreenshot', () {
testWidgets('does add screenshot if beforeScreenshot returns true',
(tester) async {
Expand Down

0 comments on commit be5c603

Please sign in to comment.