File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 55### Features
66
77- Breadcrumbs for database operations ([ #1656 ] ( https://github.com/getsentry/sentry-dart/pull/1656 ) )
8+ - Add ` attachScreenshotOnlyWhenResumed ` to options ([ #1700 ] ( https://github.com/getsentry/sentry-dart/pull/1700 ) )
89
910### Dependencies
1011
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import '../screenshot/sentry_screenshot_widget.dart';
88import '../sentry_flutter_options.dart' ;
99import 'package:flutter/rendering.dart' ;
1010import '../renderer/renderer.dart' ;
11+ import 'package:flutter/widgets.dart' as widget;
1112
1213class ScreenshotEventProcessor implements EventProcessor {
1314 final SentryFlutterOptions _options;
@@ -38,6 +39,14 @@ class ScreenshotEventProcessor implements EventProcessor {
3839 return event;
3940 }
4041
42+ if (_options.attachScreenshotOnlyWhenResumed &&
43+ widget.WidgetsBinding .instance.lifecycleState !=
44+ AppLifecycleState .resumed) {
45+ _options.logger (SentryLevel .debug,
46+ 'Only attaching screenshots when application state is resumed.' );
47+ return event;
48+ }
49+
4150 final bytes = await _createScreenshot ();
4251 if (bytes != null ) {
4352 hint? .screenshot = SentryAttachment .fromScreenshotData (bytes);
Original file line number Diff line number Diff line change @@ -167,6 +167,9 @@ class SentryFlutterOptions extends SentryOptions {
167167 /// The quality of the attached screenshot
168168 SentryScreenshotQuality screenshotQuality = SentryScreenshotQuality .high;
169169
170+ /// Only attach a screenshot when the app is resumed.
171+ bool attachScreenshotOnlyWhenResumed = false ;
172+
170173 /// Enable or disable automatic breadcrumbs for User interactions Using [Listener]
171174 ///
172175 /// Requires adding the [SentryUserInteractionWidget] to the widget tree.
You can’t perform that action at this time.
0 commit comments