Skip to content

Commit 3334ac1

Browse files
Fix Android breadcrumbs on web (#1378)
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Co-authored-by: Manoel Aranda Neto <marandaneto@gmail.com>
1 parent 22ed6cb commit 3334ac1

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Fix breadcrumbs not being sent on Android web ([#1378](https://github.com/getsentry/sentry-dart/pull/1378))
8+
39
## 7.4.1
410

511
### Fixes

dart/lib/src/sentry_client.dart

+4
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ class SentryClient {
468468
/// this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read
469469
/// the envelope.
470470
bool _shouldRemoveBreadcrumbs(SentryEvent event) {
471+
if (_options.platformChecker.isWeb) {
472+
return false;
473+
}
474+
471475
final isAndroid = _options.platformChecker.platform.isAndroid;
472476
final enableScopeSync = _options.enableScopeSync;
473477

dart/test/sentry_client_test.dart

+28
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,34 @@ void main() {
13121312

13131313
expect((capturedEvent.breadcrumbs ?? []).isNotEmpty, true);
13141314
});
1315+
1316+
test('web breadcrumbs exist on web Android devices', () async {
1317+
fixture.options.enableScopeSync = true;
1318+
fixture.options.platformChecker = MockPlatformChecker(
1319+
platform: MockPlatform.android(),
1320+
isWebValue: true,
1321+
);
1322+
1323+
final client = fixture.getSut();
1324+
final event = SentryEvent(exceptions: [
1325+
SentryException(
1326+
type: "type",
1327+
value: "value",
1328+
mechanism: Mechanism(
1329+
type: 'type',
1330+
handled: true,
1331+
),
1332+
),
1333+
], breadcrumbs: [
1334+
Breadcrumb(),
1335+
]);
1336+
await client.captureEvent(event);
1337+
1338+
final capturedEnvelope = (fixture.transport).envelopes.first;
1339+
final capturedEvent = await eventFromEnvelope(capturedEnvelope);
1340+
1341+
expect((capturedEvent.breadcrumbs ?? []).isNotEmpty, true);
1342+
});
13151343
});
13161344

13171345
group('ClientReportRecorder', () {

0 commit comments

Comments
 (0)