Skip to content

Commit e964e2b

Browse files
authored
Use recordHttpBreadcrumbs to set iOS enableNetworkBreadcrumbs (#1884)
1 parent f754e86 commit e964e2b

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

CHANGELOG.md

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

3+
## Unreleased
4+
5+
### Features
6+
7+
- Use `recordHttpBreadcrumbs` to set iOS `enableNetworkBreadcrumbs` ([#1884](https://github.com/getsentry/sentry-dart/pull/1884))
8+
39
## 7.16.1
410

511
### Fixes

dart/lib/src/sentry_options.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,13 @@ class SentryOptions {
248248
/// - In an browser environment this can be requests which fail because of CORS.
249249
/// - In an mobile or desktop application this can be requests which failed
250250
/// because the connection was interrupted.
251-
/// Use with [SentryHttpClient] or `sentry_dio` integration for this to work
251+
/// Use with [SentryHttpClient] or `sentry_dio` integration for this to work,
252+
/// or iOS native where it sets the value to `enableCaptureFailedRequests`.
252253
bool captureFailedRequests = true;
253254

254255
/// Whether to records requests as breadcrumbs. This is on by default.
255-
/// It only has an effect when the SentryHttpClient or dio integration is in use
256+
/// It only has an effect when the SentryHttpClient or dio integration is in
257+
/// use, or iOS native where it sets the value to `enableNetworkBreadcrumbs`.
256258
bool recordHttpBreadcrumbs = true;
257259

258260
/// Whether [SentryEvent] deduplication is enabled.

flutter/example/ios/RunnerTests/SentryFlutterTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ final class SentryFlutterTests: XCTestCase {
4141
"enableWatchdogTerminationTracking": false,
4242
"sendClientReports": false,
4343
"maxAttachmentSize": NSNumber(value: 9004),
44+
"recordHttpBreadcrumbs": false,
4445
"captureFailedRequests": false,
4546
"enableAppHangTracking": false,
4647
"appHangTimeoutIntervalMillis": NSNumber(value: 10000)
@@ -65,6 +66,7 @@ final class SentryFlutterTests: XCTestCase {
6566
XCTAssertEqual(false, fixture.options.enableWatchdogTerminationTracking)
6667
XCTAssertEqual(false, fixture.options.sendClientReports)
6768
XCTAssertEqual(9004, fixture.options.maxAttachmentSize)
69+
XCTAssertEqual(false, fixture.options.enableNetworkBreadcrumbs)
6870
XCTAssertEqual(false, fixture.options.enableCaptureFailedRequests)
6971
XCTAssertEqual(false, fixture.options.enableAppHangTracking)
7072
XCTAssertEqual(10, fixture.options.appHangTimeoutInterval)

flutter/ios/Classes/SentryFlutter.swift

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public final class SentryFlutter {
5858
if let maxAttachmentSize = data["maxAttachmentSize"] as? NSNumber {
5959
options.maxAttachmentSize = maxAttachmentSize.uintValue
6060
}
61+
if let recordHttpBreadcrumbs = data["recordHttpBreadcrumbs"] as? Bool {
62+
options.enableNetworkBreadcrumbs = recordHttpBreadcrumbs
63+
}
6164
if let captureFailedRequests = data["captureFailedRequests"] as? Bool {
6265
options.enableCaptureFailedRequests = captureFailedRequests
6366
}

flutter/lib/src/integrations/native_sdk_integration.dart

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class NativeSdkIntegration implements Integration<SentryFlutterOptions> {
4747
'sendClientReports': options.sendClientReports,
4848
'proguardUuid': options.proguardUuid,
4949
'maxAttachmentSize': options.maxAttachmentSize,
50+
'recordHttpBreadcrumbs': options.recordHttpBreadcrumbs,
5051
'captureFailedRequests': options.captureFailedRequests,
5152
'enableAppHangTracking': options.enableAppHangTracking,
5253
'connectionTimeoutMillis': options.connectionTimeout.inMilliseconds,

flutter/test/integrations/init_native_sdk_integration_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void main() {
5858
'sendClientReports': true,
5959
'proguardUuid': null,
6060
'maxAttachmentSize': 20 * 1024 * 1024,
61+
'recordHttpBreadcrumbs': true,
6162
'captureFailedRequests': true,
6263
'enableAppHangTracking': true,
6364
'connectionTimeoutMillis': 5000,
@@ -98,6 +99,7 @@ void main() {
9899
..enableNdkScopeSync = true
99100
..proguardUuid = fakeProguardUuid
100101
..maxAttachmentSize = 10
102+
..recordHttpBreadcrumbs = false
101103
..captureFailedRequests = false
102104
..enableAppHangTracking = false
103105
..connectionTimeout = Duration(milliseconds: 9001)
@@ -141,6 +143,7 @@ void main() {
141143
'sendClientReports': false,
142144
'proguardUuid': fakeProguardUuid,
143145
'maxAttachmentSize': 10,
146+
'recordHttpBreadcrumbs': false,
144147
'captureFailedRequests': false,
145148
'enableAppHangTracking': false,
146149
'connectionTimeoutMillis': 9001,

0 commit comments

Comments
 (0)