Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: iOS warning of missing method channel callback setReplayConfig #2478

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading