Skip to content

Commit

Permalink
renamed screenshot settings
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhaintz committed Nov 13, 2024
1 parent 23cd66c commit 673ef0b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ScreenshotEventProcessor implements EventProcessor {

ScreenshotEventProcessor(this._options) {
_recorder = ScreenshotRecorder(
ScreenshotRecorderConfig(quality: _options.screenshot.screenshotQuality),
ScreenshotRecorderConfig(quality: _options.screenshot.quality),
_options,
isReplayRecorder: false,
);
Expand All @@ -39,7 +39,7 @@ class ScreenshotEventProcessor implements EventProcessor {
return event; // No need to attach screenshot of feedback form.
}

final beforeScreenshot = _options.screenshot.beforeScreenshot;
final beforeScreenshot = _options.screenshot.beforeCapture;
if (beforeScreenshot != null) {
try {
final result = beforeScreenshot(event, hint: hint);
Expand All @@ -65,7 +65,7 @@ class ScreenshotEventProcessor implements EventProcessor {
}
}

if (_options.screenshot.attachScreenshotOnlyWhenResumed &&
if (_options.screenshot.attachOnlyWhenResumed &&
widget.WidgetsBinding.instance.lifecycleState !=
AppLifecycleState.resumed) {
_options.logger(SentryLevel.debug,
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/integrations/screenshot_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ScreenshotIntegration implements Integration<SentryFlutterOptions> {

@override
void call(Hub hub, SentryFlutterOptions options) {
if (options.screenshot.attachScreenshot) {
if (options.screenshot.attach) {
_options = options;
final screenshotEventProcessor = ScreenshotEventProcessor(options);
options.addEventProcessor(screenshotEventProcessor);
Expand Down
31 changes: 15 additions & 16 deletions flutter/lib/src/sentry_flutter_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,34 +182,33 @@ class SentryFlutterOptions extends SentryOptions {

/// Automatically attaches a screenshot when capturing an error or exception.
///
/// Requires adding the [SentryScreenshotWidget] to the widget tree.
/// Requires adding the [SentryWidget] to the widget tree.
/// Example:
/// runApp(SentryScreenshotWidget(child: App()));
/// The [SentryScreenshotWidget] has to be the root widget of the app.
@Deprecated('Use `screenshot.attachScreenshot` instead')
bool get attachScreenshot => screenshot.attachScreenshot;
set attachScreenshot(bool value) => screenshot.attachScreenshot = value;
/// runApp(SentryWidget(child: App()));
/// The [SentryWidget] has to be the root widget of the app.
@Deprecated('Use `screenshot.attach` instead')
bool get attachScreenshot => screenshot.attach;
set attachScreenshot(bool value) => screenshot.attach = value;

/// The quality of the attached screenshot
@Deprecated('Use `screenshot.screenshotQuality` instead')
SentryScreenshotQuality get screenshotQuality => screenshot.screenshotQuality;
@Deprecated('Use `screenshot.quality` instead')
SentryScreenshotQuality get screenshotQuality => screenshot.quality;
set screenshotQuality(SentryScreenshotQuality value) =>
screenshot.screenshotQuality = value;
screenshot.quality = value;

/// Only attach a screenshot when the app is resumed.
@Deprecated('Use `screenshot.attachScreenshotOnlyWhenResumed` instead')
bool get attachScreenshotOnlyWhenResumed =>
screenshot.attachScreenshotOnlyWhenResumed;
@Deprecated('Use `screenshot.attachOnlyWhenResumed` instead')
bool get attachScreenshotOnlyWhenResumed => screenshot.attachOnlyWhenResumed;
set attachScreenshotOnlyWhenResumed(bool value) =>
screenshot.attachScreenshotOnlyWhenResumed = value;
screenshot.attachOnlyWhenResumed = value;

/// Sets a callback which is executed before capturing screenshots. Only
/// relevant if `attachScreenshot` is set to true. When false is returned
/// from the function, no screenshot will be attached.
@Deprecated('Use `screenshot.beforeScreenshot` instead')
BeforeScreenshotCallback? get beforeScreenshot => screenshot.beforeScreenshot;
@Deprecated('Use `screenshot.beforeCapture` instead')
BeforeScreenshotCallback? get beforeScreenshot => screenshot.beforeCapture;
set beforeScreenshot(BeforeScreenshotCallback? value) =>
screenshot.beforeScreenshot = value;
screenshot.beforeCapture = value;

final screenshot = SentryScreenshotOptions();

Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/sentry_screenshot_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SentryScreenshotOptions {
bool attach = false;

/// Sets a callback which is executed before capturing screenshots. Only
/// relevant if `attachScreenshot` is set to true. When false is returned
/// relevant if `attach` is set to true. When false is returned
/// from the function, no screenshot will be attached.
BeforeScreenshotCallback? beforeCapture;

Expand Down

0 comments on commit 673ef0b

Please sign in to comment.