Skip to content

Commit 313aef8

Browse files
committed
Merge branch 'v9' into refactor/cleanup-platform-mocking
# Conflicts: # flutter/test/replay/replay_native_test.dart
2 parents d70dc31 + 63f825f commit 313aef8

21 files changed

+53
-70
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased 9.0.0
4+
5+
- Move replay and privacy from experimental to options ([#2755](https://github.com/getsentry/sentry-dart/pull/2755))
6+
- Remove renderer from `flutter_context` ([#2751](https://github.com/getsentry/sentry-dart/pull/2751))
7+
38
## 9.0.0-alpha.1
49

510
### Breaking changes
@@ -27,6 +32,8 @@
2732
- The `PlatformChecker` was renamed to `RuntimeChecker`
2833
- Moved `PlatfomrChecker.platform` to `options.platform`
2934

35+
36+
3037
### Enhancements
3138

3239
- Replay: improve Android native interop performance by using JNI ([#2670](https://github.com/getsentry/sentry-dart/pull/2670))

flutter/example/integration_test/replay_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void main() {
1111
options.automatedTestMode = true;
1212
options.dsn = 'https://[email protected]/1234567';
1313
options.debug = true;
14-
options.experimental.replay.sessionSampleRate = 1.0;
14+
options.replay.sessionSampleRate = 1.0;
1515
});
1616
});
1717

flutter/example/lib/main.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ Future<void> setupSentry(
8686
options.maxRequestBodySize = MaxRequestBodySize.always;
8787
options.navigatorKey = navigatorKey;
8888

89-
options.experimental.replay.sessionSampleRate = 1.0;
90-
options.experimental.replay.onErrorSampleRate = 1.0;
91-
92-
// This has a side-effect of creating the default privacy configuration,
93-
// thus enabling Screenshot masking. No need to actually change it.
94-
options.experimental.privacy;
89+
options.replay.sessionSampleRate = 1.0;
90+
options.replay.onErrorSampleRate = 1.0;
9591

9692
_isIntegrationTest = isIntegrationTest;
9793
if (_isIntegrationTest) {

flutter/lib/src/event_processor/flutter_enricher_event_processor.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ class FlutterEnricherEventProcessor implements EventProcessor {
138138
// ignore: deprecated_member_use
139139
final hasRenderView = _widgetsBinding?.renderViewElement != null;
140140

141-
final renderer = _options.rendererWrapper.getRenderer()?.name;
142-
143141
return <String, String>{
144142
'has_render_view': hasRenderView.toString(),
145143
if (tempDebugBrightnessOverride != null)
@@ -156,7 +154,6 @@ class FlutterEnricherEventProcessor implements EventProcessor {
156154
// Also always fails in tests.
157155
// See https://github.com/flutter/flutter/issues/83919
158156
// 'window_is_visible': _window.viewConfiguration.visible,
159-
if (renderer != null) 'renderer': renderer,
160157
if (appFlavor != null) 'appFlavor': appFlavor!,
161158
};
162159
}

flutter/lib/src/native/cocoa/cocoa_replay_recorder.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class CocoaReplayRecorder {
1616
CocoaReplayRecorder(this._options)
1717
: _recorder = ReplayScreenshotRecorder(
1818
ScreenshotRecorderConfig(
19-
pixelRatio:
20-
_options.experimental.replay.quality.resolutionScalingFactor,
19+
pixelRatio: _options.replay.quality.resolutionScalingFactor,
2120
),
2221
_options,
2322
);

flutter/lib/src/native/cocoa/sentry_native_cocoa.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SentryNativeCocoa extends SentryNativeChannel {
2424
Future<void> init(Hub hub) async {
2525
// We only need these when replay is enabled (session or error capture)
2626
// so let's set it up conditionally. This allows Dart to trim the code.
27-
if (options.experimental.replay.isEnabled) {
27+
if (options.replay.isEnabled) {
2828
channel.setMethodCallHandler((call) async {
2929
switch (call.method) {
3030
case 'captureReplayScreenshot':

flutter/lib/src/native/java/sentry_native_java.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SentryNativeJava extends SentryNativeChannel {
1717
Future<void> init(Hub hub) async {
1818
// We only need these when replay is enabled (session or error capture)
1919
// so let's set it up conditionally. This allows Dart to trim the code.
20-
if (options.experimental.replay.isEnabled) {
20+
if (options.replay.isEnabled) {
2121
channel.setMethodCallHandler((call) async {
2222
switch (call.method) {
2323
case 'ReplayRecorder.start':

flutter/lib/src/native/sentry_native_channel.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ class SentryNativeChannel
6767
options.appHangTimeoutInterval.inMilliseconds,
6868
if (options.proxy != null) 'proxy': options.proxy?.toJson(),
6969
'replay': <String, dynamic>{
70-
'quality': options.experimental.replay.quality.name,
71-
'sessionSampleRate': options.experimental.replay.sessionSampleRate,
72-
'onErrorSampleRate': options.experimental.replay.onErrorSampleRate,
70+
'quality': options.replay.quality.name,
71+
'sessionSampleRate': options.replay.sessionSampleRate,
72+
'onErrorSampleRate': options.replay.onErrorSampleRate,
7373
'tags': <String, dynamic>{
74-
'maskAllText': options.experimental.privacy.maskAllText,
75-
'maskAllImages': options.experimental.privacy.maskAllImages,
76-
'maskAssetImages': options.experimental.privacy.maskAssetImages,
77-
if (options.experimental.privacy.userMaskingRules.isNotEmpty)
78-
'maskingRules': options.experimental.privacy.userMaskingRules
74+
'maskAllText': options.privacy.maskAllText,
75+
'maskAllImages': options.privacy.maskAllImages,
76+
'maskAssetImages': options.privacy.maskAssetImages,
77+
if (options.privacy.userMaskingRules.isNotEmpty)
78+
'maskingRules': options.privacy.userMaskingRules
7979
.map((rule) => '${rule.name}: ${rule.description}')
8080
.toList(growable: false),
8181
},

flutter/lib/src/replay/integration.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ReplayIntegration extends Integration<SentryFlutterOptions> {
1818

1919
@override
2020
FutureOr<void> call(Hub hub, SentryFlutterOptions options) {
21-
final replayOptions = options.experimental.replay;
21+
final replayOptions = options.replay;
2222
if (_native.supportsReplay && replayOptions.isEnabled) {
2323
options.sdk.addIntegration(replayIntegrationName);
2424

flutter/lib/src/replay/replay_recorder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var _instanceCounter = 0;
1111
class ReplayScreenshotRecorder extends ScreenshotRecorder {
1212
ReplayScreenshotRecorder(super.config, super.options)
1313
: super(
14-
privacyOptions: options.experimental.privacy,
14+
privacyOptions: options.privacy,
1515
logName: 'ReplayRecorder #${++_instanceCounter}');
1616

1717
@override

flutter/lib/src/screenshot/recorder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ScreenshotRecorder {
3232
SentryPrivacyOptions? privacyOptions,
3333
this.logName = 'ScreenshotRecorder',
3434
}) {
35-
privacyOptions ??= options.experimental.privacy;
35+
privacyOptions ??= options.privacy;
3636

3737
final maskingConfig =
3838
privacyOptions.buildMaskingConfig(_log, options.runtimeChecker);

flutter/lib/src/sentry_flutter_options.dart

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,13 @@ class SentryFlutterOptions extends SentryOptions {
284284
/// you must use `SentryWidgetsFlutterBinding.ensureInitialized()` instead.
285285
bool enableFramesTracking = true;
286286

287+
/// Replay recording configuration.
288+
final replay = SentryReplayOptions();
289+
290+
/// Privacy configuration for masking sensitive data in screenshots and Session Replay.
291+
/// Screen content masking is enabled by default.
292+
final privacy = SentryPrivacyOptions();
293+
287294
/// By using this, you are disabling native [Breadcrumb] tracking and instead
288295
/// you are just tracking [Breadcrumb]s which result from events available
289296
/// in the current Flutter environment.
@@ -368,21 +375,6 @@ class SentryFlutterOptions extends SentryOptions {
368375
@override
369376
// ignore: invalid_use_of_internal_member
370377
set automatedTestMode(bool value) => super.automatedTestMode = value;
371-
372-
/// Configuration of experimental features that may change or be removed
373-
/// without prior notice. Additionally, these features may not be ready for
374-
/// production use yet.
375-
@meta.experimental
376-
final experimental = _SentryFlutterExperimentalOptions();
377-
}
378-
379-
class _SentryFlutterExperimentalOptions {
380-
/// Replay recording configuration.
381-
final replay = SentryReplayOptions();
382-
383-
/// Privacy configuration for masking sensitive data in screenshots and Session Replay.
384-
/// Screen content masking is enabled by default.
385-
final privacy = SentryPrivacyOptions();
386378
}
387379

388380
/// A callback which can be used to suppress capturing of screenshots.

flutter/lib/src/sentry_privacy_options.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ class SentryPrivacyOptions {
1111
/// Mask all text content. Draws a rectangle of text bounds with text color
1212
/// on top. Currently, only [Text] and [EditableText] Widgets are masked.
1313
/// Default is enabled.
14-
@experimental
1514
var maskAllText = true;
1615

1716
/// Mask content of all images. Draws a rectangle of image bounds with image's
1817
/// dominant color on top. Currently, only [Image] widgets are masked.
1918
/// Default is enabled (except for asset images, see [maskAssetImages]).
20-
@experimental
2119
var maskAllImages = true;
2220

2321
/// Redact asset images coming from the root asset bundle.
24-
@experimental
2522
var maskAssetImages = false;
2623

2724
final _userMaskingRules = <SentryMaskingRule>[];
@@ -80,11 +77,6 @@ class SentryPrivacyOptions {
8077
final regexp = RegExp('video|webview|password|pinput|camera|chart',
8178
caseSensitive: false);
8279

83-
// Note: the following line just makes sure if the option is renamed,
84-
// someone will notice that there is a string that needs updating too.
85-
SentryFlutterOptions().experimental.privacy;
86-
final optionsName = 'options.experimental.privacy';
87-
8880
rules.add(SentryMaskingCustomRule<Widget>(
8981
callback: (Element element, Widget widget) {
9082
final type = widget.runtimeType.toString();
@@ -96,9 +88,9 @@ class SentryPrivacyOptions {
9688
'widget comes from a third-party plugin or your code, Sentry '
9789
"doesn't recognize it and can't reliably mask it in release "
9890
'builds (due to obfuscation). '
99-
'Please mask it explicitly using $optionsName.mask<$type>(). '
91+
'Please mask it explicitly using options.privacy.mask<$type>(). '
10092
'If you want to silence this warning and keep the widget '
101-
'visible in captures, you can use $optionsName.unmask<$type>(). '
93+
'visible in captures, you can use options.privacy.unmask<$type>(). '
10294
'Note: the RegExp matched is: $regexp (case insensitive).');
10395
}
10496
return SentryMaskingDecision.continueProcessing;

flutter/lib/src/sentry_replay_options.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import 'package:meta/meta.dart';
22

33
import 'replay/replay_quality.dart';
44

5-
/// Configuration of the experimental replay feature.
6-
@experimental
5+
/// Configuration of the replay feature.
76
class SentryReplayOptions {
87
double? _sessionSampleRate;
98

flutter/lib/src/view_hierarchy/view_hierarchy_integration.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import '../../sentry_flutter.dart';
22
import 'view_hierarchy_event_processor.dart';
33

4-
/// A [Integration] that renders an ASCII represention of the entire view
4+
/// A [Integration] that renders an ASCII representation of the entire view
55
/// hierarchy of the application when an error happens and includes it as an
66
/// attachment to the [Hint].
77
class SentryViewHierarchyIntegration

flutter/test/event_processor/flutter_enricher_event_processor_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ void main() {
7474
final flutterContext = event?.contexts['flutter_context'];
7575
expect(flutterContext, isNotNull);
7676
expect(flutterContext, isA<Map<String, String>>());
77-
expect(flutterContext['renderer'], isNotNull);
7877
});
7978

8079
testWidgets('accessibility context', (WidgetTester tester) async {

flutter/test/event_processor/screenshot_event_processor_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void main() {
6565

6666
testWidgets('adds screenshot attachment with masking enabled dart:io',
6767
(tester) async {
68-
fixture.options.experimental.privacy.maskAllText = true;
68+
fixture.options.privacy.maskAllText = true;
6969
await _addScreenshotAttachment(tester, null, added: true, isWeb: false);
7070
});
7171

flutter/test/integrations/init_native_sdk_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ void main() {
129129
user: 'admin',
130130
pass: '0000',
131131
)
132-
..experimental.replay.quality = SentryReplayQuality.high
133-
..experimental.replay.sessionSampleRate = 0.1
134-
..experimental.replay.onErrorSampleRate = 0.2
135-
..experimental.privacy.mask<Image>()
132+
..replay.quality = SentryReplayQuality.high
133+
..replay.sessionSampleRate = 0.1
134+
..replay.onErrorSampleRate = 0.2
135+
..privacy.mask<Image>()
136136
..spotlight =
137137
Spotlight(enabled: true, url: 'http://localhost:8969/stream');
138138

flutter/test/replay/replay_integration_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void main() {
3737
'$ReplayIntegration in options.sdk.integrations when supportsReplay=$supportsReplay',
3838
() {
3939
when(native.supportsReplay).thenReturn(supportsReplay);
40-
options.experimental.replay.sessionSampleRate = 1.0;
40+
options.replay.sessionSampleRate = 1.0;
4141
sut.call(hub, options);
4242
var matcher = contains(replayIntegrationName);
4343
matcher = supportsReplay ? matcher : isNot(matcher);
@@ -49,7 +49,7 @@ void main() {
4949
test(
5050
'$ReplayIntegration in options.sdk.integrations when sessionSampleRate=$sampleRate',
5151
() {
52-
options.experimental.replay.sessionSampleRate = sampleRate;
52+
options.replay.sessionSampleRate = sampleRate;
5353
sut.call(hub, options);
5454
var matcher = contains(replayIntegrationName);
5555
matcher = sampleRate > 0 ? matcher : isNot(matcher);
@@ -61,7 +61,7 @@ void main() {
6161
test(
6262
'$ReplayEventProcessor in options.EventProcessors when onErrorSampleRate=$sampleRate',
6363
() async {
64-
options.experimental.replay.onErrorSampleRate = sampleRate;
64+
options.replay.onErrorSampleRate = sampleRate;
6565
await sut.call(hub, options);
6666

6767
if (sampleRate > 0) {
@@ -74,7 +74,7 @@ void main() {
7474
}
7575

7676
testWidgets('Configures replay when displayed', (tester) async {
77-
options.experimental.replay.sessionSampleRate = 1.0;
77+
options.replay.sessionSampleRate = 1.0;
7878
when(native.setReplayConfig(any)).thenReturn(null);
7979
sut.call(hub, options);
8080

@@ -90,8 +90,8 @@ void main() {
9090
});
9191

9292
testWidgets('Adjusts resolution based on quality', (tester) async {
93-
options.experimental.replay.sessionSampleRate = 1.0;
94-
options.experimental.replay.quality = SentryReplayQuality.low;
93+
options.replay.sessionSampleRate = 1.0;
94+
options.replay.quality = SentryReplayQuality.low;
9595
when(native.setReplayConfig(any)).thenReturn(null);
9696
sut.call(hub, options);
9797

flutter/test/replay/replay_native_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ void main() {
4242
setUp(() {
4343
hub = MockHub();
4444
native = NativeChannelFixture();
45+
4546
options = defaultTestOptions()
4647
..platform = mockPlatform
4748
..methodChannel = native.channel
48-
..experimental.replay.quality = SentryReplayQuality.low;
49+
..replay.quality = SentryReplayQuality.low;
50+
4951
sut = createBinding(options);
5052

5153
if (mockPlatform.isIOS) {
@@ -72,8 +74,8 @@ void main() {
7274

7375
group('replay recorder', () {
7476
setUp(() async {
75-
options.experimental.replay.sessionSampleRate = 0.1;
76-
options.experimental.replay.onErrorSampleRate = 0.1;
77+
options.replay.sessionSampleRate = 0.1;
78+
options.replay.onErrorSampleRate = 0.1;
7779
await sut.init(hub);
7880
});
7981

flutter/test/screenshot/recorder_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void main() async {
9292
final fixture = await _Fixture.create(tester);
9393
fixture.options
9494
..automatedTestMode = true
95-
..experimental.privacy.maskCallback<widgets.Stack>((el, widget) {
95+
..privacy.maskCallback<widgets.Stack>((el, widget) {
9696
throw Exception('testing masking error');
9797
});
9898

@@ -106,7 +106,7 @@ void main() async {
106106
final fixture = await _Fixture.create(tester);
107107
fixture.options
108108
..automatedTestMode = false
109-
..experimental.privacy.maskCallback<widgets.Stack>((el, widget) {
109+
..privacy.maskCallback<widgets.Stack>((el, widget) {
110110
throw Exception('testing masking error');
111111
});
112112

0 commit comments

Comments
 (0)