Skip to content

Commit

Permalink
Fix Android breadcrumbs on web (#1378)
Browse files Browse the repository at this point in the history
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
Co-authored-by: Manoel Aranda Neto <marandaneto@gmail.com>
  • Loading branch information
3 people committed Apr 11, 2023
1 parent 22ed6cb commit 3334ac1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Fix breadcrumbs not being sent on Android web ([#1378](https://github.com/getsentry/sentry-dart/pull/1378))

## 7.4.1

### Fixes
Expand Down
4 changes: 4 additions & 0 deletions dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ class SentryClient {
/// this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read
/// the envelope.
bool _shouldRemoveBreadcrumbs(SentryEvent event) {
if (_options.platformChecker.isWeb) {
return false;
}

final isAndroid = _options.platformChecker.platform.isAndroid;
final enableScopeSync = _options.enableScopeSync;

Expand Down
28 changes: 28 additions & 0 deletions dart/test/sentry_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,34 @@ void main() {

expect((capturedEvent.breadcrumbs ?? []).isNotEmpty, true);
});

test('web breadcrumbs exist on web Android devices', () async {
fixture.options.enableScopeSync = true;
fixture.options.platformChecker = MockPlatformChecker(
platform: MockPlatform.android(),
isWebValue: true,
);

final client = fixture.getSut();
final event = SentryEvent(exceptions: [
SentryException(
type: "type",
value: "value",
mechanism: Mechanism(
type: 'type',
handled: true,
),
),
], breadcrumbs: [
Breadcrumb(),
]);
await client.captureEvent(event);

final capturedEnvelope = (fixture.transport).envelopes.first;
final capturedEvent = await eventFromEnvelope(capturedEnvelope);

expect((capturedEvent.breadcrumbs ?? []).isNotEmpty, true);
});
});

group('ClientReportRecorder', () {
Expand Down

0 comments on commit 3334ac1

Please sign in to comment.