Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
"loadContexts" -> loadContexts(result)
"displayRefreshRate" -> displayRefreshRate(result)
"addReplayScreenshot" -> addReplayScreenshot(call.argument("path"), call.argument("timestamp"), result)
"sendReplayForEvent" -> sendReplayForEvent(call.argument("eventId"), call.argument("isCrash"), result)
"captureReplay" -> captureReplay(call.argument("isCrash"), result)
else -> result.notImplemented()
}
}
Expand Down Expand Up @@ -555,16 +555,15 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
result.success("")
}

private fun sendReplayForEvent(
eventId: String?,
private fun captureReplay(
isCrash: Boolean?,
result: Result,
) {
if (eventId == null || isCrash == null) {
if (isCrash == null) {
result.error("5", "Arguments are null", null)
return
}
replay.sendReplay(isCrash, eventId, null)
replay.captureReplay(isCrash)
result.success(replay.getReplayId().toString())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ReplayEventProcessor implements EventProcessor {
event.exceptions?.isNotEmpty == true) {
final isCrash =
event.exceptions!.any((e) => e.mechanism?.handled == false);
await _binding.sendReplayForEvent(event.eventId, isCrash);
await _binding.captureReplay(isCrash);
}
return event;
}
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/native/sentry_native_binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ abstract class SentryNativeBinding {

Future<void> resumeAppHangTracking();

Future<SentryId> sendReplayForEvent(SentryId eventId, bool isCrash);
Future<SentryId> captureReplay(bool isCrash);
}
5 changes: 2 additions & 3 deletions flutter/lib/src/native/sentry_native_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ class SentryNativeChannel
channel.invokeMethod('resumeAppHangTracking');

@override
Future<SentryId> sendReplayForEvent(SentryId eventId, bool isCrash) =>
channel.invokeMethod('sendReplayForEvent', {
'eventId': eventId.toString(),
Future<SentryId> captureReplay(bool isCrash) =>
channel.invokeMethod('captureReplay', {
'isCrash': isCrash,
}).then((value) => SentryId.fromId(value as String));
}
20 changes: 5 additions & 15 deletions flutter/test/mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1364,26 +1364,16 @@ class MockSentryNativeBinding extends _i1.Mock
) as _i7.Future<void>);

@override
_i7.Future<_i2.SentryId> sendReplayForEvent(
_i2.SentryId? eventId,
bool? isCrash,
) =>
(super.noSuchMethod(
_i7.Future<_i2.SentryId> captureReplay(bool? isCrash) => (super.noSuchMethod(
Invocation.method(
#sendReplayForEvent,
[
eventId,
isCrash,
],
#captureReplay,
[isCrash],
),
returnValue: _i7.Future<_i2.SentryId>.value(_FakeSentryId_5(
this,
Invocation.method(
#sendReplayForEvent,
[
eventId,
isCrash,
],
#captureReplay,
[isCrash],
),
)),
) as _i7.Future<_i2.SentryId>);
Expand Down