Skip to content

Commit b18a997

Browse files
committed
Bug bot reviews
1 parent e8ce749 commit b18a997

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

packages/flutter/example/integration_test/replay_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ void main() {
168168
expect(frameCount, equals(afterStopCount));
169169
}, skip: !Platform.isAndroid);
170170

171-
testWidgets('setReplayConfig applies without error on iOS', (tester) async {
172-
if (!Platform.isAndroid) return;
171+
testWidgets('setReplayConfig applies without error on Android',
172+
(tester) async {
173173
await setupSentryAndApp(tester);
174174
const config = ReplayConfig(
175175
windowWidth: 1080,
@@ -188,7 +188,7 @@ void main() {
188188
await setupSentryAndApp(tester);
189189
final native = SentryFlutter.native as SentryNativeCocoa?;
190190
expect(native, isNotNull);
191-
final json = await native!.testRecorder.captureScreenshot();
191+
final json = await native!.testRecorder?.captureScreenshot();
192192
expect(json, isNotNull);
193193
expect(json!['length'], isNotNull);
194194
expect(json['address'], isNotNull);
@@ -198,7 +198,7 @@ void main() {
198198
expect((json['height'] as int) > 0, isTrue);
199199

200200
// Capture again to ensure subsequent captures still succeed
201-
final json2 = await native.testRecorder.captureScreenshot();
201+
final json2 = await native.testRecorder?.captureScreenshot();
202202
expect(json2, isNotNull);
203203
}, skip: !Platform.isIOS);
204204
});

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,8 @@ class SentryNativeCocoa extends SentryNativeChannel {
2727
@override
2828
SentryId? get replayId => _replayId;
2929

30-
// Test-only: expose recorder without MethodChannel.
3130
@visibleForTesting
32-
CocoaReplayRecorder get testRecorder {
33-
return _replayRecorder ??= CocoaReplayRecorder(options);
34-
}
35-
36-
@visibleForTesting
37-
Future<void> testSetReplayId(String? id,
38-
{bool replayIsBuffering = false}) async {
39-
final newId = id == null ? null : SentryId.fromId(id);
40-
if (_replayId != newId) {
41-
_replayId = newId;
42-
await Sentry.configureScope((s) async {
43-
// ignore: invalid_use_of_internal_member
44-
s.replayId = !replayIsBuffering ? _replayId : null;
45-
});
46-
}
47-
}
31+
CocoaReplayRecorder? get testRecorder => _replayRecorder;
4832

4933
@override
5034
Future<void> init(Hub hub) async {

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,22 @@ class SentryNativeJava extends SentryNativeChannel {
367367
.privateSentryGetReplayIntegration();
368368
// The passed parameter is `isTerminating`
369369
_nativeReplay?.captureReplay(false.toJBoolean()..releasedBy(arena));
370-
final jString = _nativeReplay?.getReplayId().toString$1()
371-
?..releasedBy(arena);
372370

373-
if (jString == null) {
374-
return SentryId.empty();
375-
} else {
376-
return SentryId.fromId(jString.toDartString());
371+
final nativeReplayId = _nativeReplay?.getReplayId();
372+
nativeReplayId?.releasedBy(arena);
373+
374+
JString? jString;
375+
if (nativeReplayId != null) {
376+
jString = nativeReplayId.toString$1();
377+
jString?.releasedBy(arena);
377378
}
379+
380+
final result = jString == null
381+
? SentryId.empty()
382+
: SentryId.fromId(jString.toDartString());
383+
384+
_replayId = result;
385+
return result;
378386
});
379387
});
380388

0 commit comments

Comments
 (0)