File tree 3 files changed +13
-0
lines changed 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 5
5
### Features
6
6
7
7
- 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 ) )
8
9
9
10
### Dependencies
10
11
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import '../screenshot/sentry_screenshot_widget.dart';
8
8
import '../sentry_flutter_options.dart' ;
9
9
import 'package:flutter/rendering.dart' ;
10
10
import '../renderer/renderer.dart' ;
11
+ import 'package:flutter/widgets.dart' as widget;
11
12
12
13
class ScreenshotEventProcessor implements EventProcessor {
13
14
final SentryFlutterOptions _options;
@@ -38,6 +39,14 @@ class ScreenshotEventProcessor implements EventProcessor {
38
39
return event;
39
40
}
40
41
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
+
41
50
final bytes = await _createScreenshot ();
42
51
if (bytes != null ) {
43
52
hint? .screenshot = SentryAttachment .fromScreenshotData (bytes);
Original file line number Diff line number Diff line change @@ -167,6 +167,9 @@ class SentryFlutterOptions extends SentryOptions {
167
167
/// The quality of the attached screenshot
168
168
SentryScreenshotQuality screenshotQuality = SentryScreenshotQuality .high;
169
169
170
+ /// Only attach a screenshot when the app is resumed.
171
+ bool attachScreenshotOnlyWhenResumed = false ;
172
+
170
173
/// Enable or disable automatic breadcrumbs for User interactions Using [Listener]
171
174
///
172
175
/// Requires adding the [SentryUserInteractionWidget] to the widget tree.
You can’t perform that action at this time.
0 commit comments