Skip to content

Commit 7ae9e39

Browse files
committed
Add sendDefaultPii
1 parent 6739707 commit 7ae9e39

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

sentry-kotlin-multiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.android.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class SentryAndroidOptionsWrapper(private val androidOptions: SentryAndroidOptio
7373
override val sessionReplay: AndroidSentryReplayOptions
7474
get() = androidOptions.sessionReplay
7575

76+
override val sendDefaultPii: Boolean
77+
get() = androidOptions.isSendDefaultPii
78+
7679
override fun applyFromOptions(options: SentryOptions) {
7780
options.toAndroidSentryOptionsCallback().invoke(androidOptions)
7881
}

sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ open class SentryAppleOptionsWrapper(private val cocoaOptions: CocoaSentryOption
5454
override val diagnosticLevel: SentryLevel
5555
get() = cocoaOptions.diagnosticLevel.toKmpSentryLevel()!!
5656

57+
override val sendDefaultPii: Boolean
58+
get() = cocoaOptions.sendDefaultPii
59+
5760
override fun applyFromOptions(options: SentryOptions) {
5861
options.toCocoaOptionsConfiguration().invoke(cocoaOptions)
5962
}

sentry-kotlin-multiplatform/src/commonMain/kotlin/io/sentry/kotlin/multiplatform/SentryOptions.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ public open class SentryOptions {
191191
*/
192192
public var sessionReplay: SentryReplayOptions = SentryReplayOptions()
193193

194+
/**
195+
* Set this option to true to send default PII data to Sentry.
196+
* Among other things, enabling this will enable automatic IP address collection on events.
197+
*
198+
* For further details, refer to the documentation in the respective native SDKs:
199+
* - [Cocoa](https://docs.sentry.io/platforms/apple/data-management/data-collected/)
200+
* - [Android](https://docs.sentry.io/platforms/android/data-management/data-collected/)
201+
*/
202+
public var sendDefaultPii: Boolean = false
203+
194204
/**
195205
* Experimental options for new features, these options are going to be promoted to SentryOptions
196206
* before GA.

sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface CommonPlatformOptions {
1414
val maxAttachmentSize: Long
1515
val sampleRate: Double?
1616
val tracesSampleRate: Double?
17+
val sendDefaultPii: Boolean
1718

1819
fun applyFromOptions(options: SentryOptions)
1920
}

sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/SentryOptionsTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class SentryOptionsTest : BaseSentryTest() {
133133
assertTrue(options.sessionReplay.maskAllImages)
134134
assertEquals(SentryReplayOptions.Quality.MEDIUM, options.sessionReplay.quality)
135135
assertTrue(options.enableWatchdogTerminationTracking)
136+
assertFalse(options.sendDefaultPii)
136137
}
137138

138139
@Test
@@ -163,6 +164,7 @@ class SentryOptionsTest : BaseSentryTest() {
163164
sessionReplay.maskAllText = false
164165
sessionReplay.maskAllImages = false
165166
sessionReplay.quality = SentryReplayOptions.Quality.LOW
167+
sendDefaultPii = true
166168
}
167169

168170
val platformOptions = createPlatformOptions()

0 commit comments

Comments
 (0)