Skip to content

Commit

Permalink
fix: iOS warning of missing method channel callback setReplayConfig (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind authored Dec 11, 2024
1 parent ab99a31 commit 20a5bce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 7 additions & 0 deletions flutter/lib/src/native/cocoa/sentry_native_cocoa.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'dart:async';
import 'dart:ffi';
import 'dart:typed_data';
import 'dart:ui';

import 'package:meta/meta.dart';

import '../../../sentry_flutter.dart';
import '../../replay/replay_config.dart';
import '../../screenshot/recorder.dart';
import '../../screenshot/recorder_config.dart';
import '../sentry_native_channel.dart';
Expand Down Expand Up @@ -68,6 +70,11 @@ class SentryNativeCocoa extends SentryNativeChannel {
return super.init(hub);
}

@override
FutureOr<void> setReplayConfig(ReplayConfig config) {
// Note: unused on iOS.
}

@override
int? startProfiler(SentryId traceId) => tryCatchSync('startProfiler', () {
final cSentryId = cocoa.SentryId1.alloc(_lib)
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/native/sentry_native_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class SentryNativeChannel
bool get supportsReplay => false;

@override
Future<void> setReplayConfig(ReplayConfig config) =>
FutureOr<void> setReplayConfig(ReplayConfig config) =>
channel.invokeMethod('setReplayConfig', {
'width': config.width,
'height': config.height,
Expand Down
16 changes: 10 additions & 6 deletions flutter/test/sentry_native_channel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,16 @@ void main() {
ReplayConfig(width: 1.1, height: 2.2, frameRate: 3, bitRate: 4);
await sut.setReplayConfig(config);

verify(channel.invokeMethod('setReplayConfig', {
'width': config.width,
'height': config.height,
'frameRate': config.frameRate,
'bitRate': config.bitRate,
}));
if (mockPlatform.isAndroid) {
verify(channel.invokeMethod('setReplayConfig', {
'width': config.width,
'height': config.height,
'frameRate': config.frameRate,
'bitRate': config.bitRate,
}));
} else {
verifyNever(channel.invokeMethod('setReplayConfig', any));
}
});

test('captureReplay', () async {
Expand Down

0 comments on commit 20a5bce

Please sign in to comment.