diff --git a/CHANGELOG.md b/CHANGELOG.md index 06622ead..6351acf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ Sentry.init { options -> - Bump Cocoa SDK from v8.36.0 to v8.37.0 ([#279](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/279)) - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8370) - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.36.0...8.37.0) +- Bump Java SDK from v7.14.0 to v7.15.0 ([#284](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/284)) + - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7150) + - [diff](https://github.com/getsentry/sentry-java/compare/7.14.0...7.15.0) ## 0.9.0 diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 9776e67b..e9302819 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -32,7 +32,7 @@ object Config { object Libs { val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib" - val sentryJavaVersion = "7.14.0" + val sentryJavaVersion = "7.15.0" val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion" val sentryJava = "io.sentry:sentry:$sentryJavaVersion" diff --git a/sentry-kotlin-multiplatform/api/android/sentry-kotlin-multiplatform.api b/sentry-kotlin-multiplatform/api/android/sentry-kotlin-multiplatform.api index 7faedcaf..8f91313e 100644 --- a/sentry-kotlin-multiplatform/api/android/sentry-kotlin-multiplatform.api +++ b/sentry-kotlin-multiplatform/api/android/sentry-kotlin-multiplatform.api @@ -233,16 +233,16 @@ public final class io/sentry/kotlin/multiplatform/SentryReplayOptions { public final fun copy (Ljava/lang/Double;Ljava/lang/Double;ZZLio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;)Lio/sentry/kotlin/multiplatform/SentryReplayOptions; public static synthetic fun copy$default (Lio/sentry/kotlin/multiplatform/SentryReplayOptions;Ljava/lang/Double;Ljava/lang/Double;ZZLio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;ILjava/lang/Object;)Lio/sentry/kotlin/multiplatform/SentryReplayOptions; public fun equals (Ljava/lang/Object;)Z + public final fun getMaskAllImages ()Z + public final fun getMaskAllText ()Z public final fun getOnErrorSampleRate ()Ljava/lang/Double; public final fun getQuality ()Lio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality; - public final fun getRedactAllImages ()Z - public final fun getRedactAllText ()Z public final fun getSessionSampleRate ()Ljava/lang/Double; public fun hashCode ()I + public final fun setMaskAllImages (Z)V + public final fun setMaskAllText (Z)V public final fun setOnErrorSampleRate (Ljava/lang/Double;)V public final fun setQuality (Lio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;)V - public final fun setRedactAllImages (Z)V - public final fun setRedactAllText (Z)V public final fun setSessionSampleRate (Ljava/lang/Double;)V public fun toString ()Ljava/lang/String; } diff --git a/sentry-kotlin-multiplatform/api/jvm/sentry-kotlin-multiplatform.api b/sentry-kotlin-multiplatform/api/jvm/sentry-kotlin-multiplatform.api index 97ad6f0b..34b8653d 100644 --- a/sentry-kotlin-multiplatform/api/jvm/sentry-kotlin-multiplatform.api +++ b/sentry-kotlin-multiplatform/api/jvm/sentry-kotlin-multiplatform.api @@ -230,16 +230,16 @@ public final class io/sentry/kotlin/multiplatform/SentryReplayOptions { public final fun copy (Ljava/lang/Double;Ljava/lang/Double;ZZLio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;)Lio/sentry/kotlin/multiplatform/SentryReplayOptions; public static synthetic fun copy$default (Lio/sentry/kotlin/multiplatform/SentryReplayOptions;Ljava/lang/Double;Ljava/lang/Double;ZZLio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;ILjava/lang/Object;)Lio/sentry/kotlin/multiplatform/SentryReplayOptions; public fun equals (Ljava/lang/Object;)Z + public final fun getMaskAllImages ()Z + public final fun getMaskAllText ()Z public final fun getOnErrorSampleRate ()Ljava/lang/Double; public final fun getQuality ()Lio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality; - public final fun getRedactAllImages ()Z - public final fun getRedactAllText ()Z public final fun getSessionSampleRate ()Ljava/lang/Double; public fun hashCode ()I + public final fun setMaskAllImages (Z)V + public final fun setMaskAllText (Z)V public final fun setOnErrorSampleRate (Ljava/lang/Double;)V public final fun setQuality (Lio/sentry/kotlin/multiplatform/SentryReplayOptions$Quality;)V - public final fun setRedactAllImages (Z)V - public final fun setRedactAllText (Z)V public final fun setSessionSampleRate (Ljava/lang/Double;)V public fun toString ()Ljava/lang/String; } diff --git a/sentry-kotlin-multiplatform/src/androidMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.android.kt b/sentry-kotlin-multiplatform/src/androidMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.android.kt index 7a0f46a0..b1f73cd0 100644 --- a/sentry-kotlin-multiplatform/src/androidMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.android.kt +++ b/sentry-kotlin-multiplatform/src/androidMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.android.kt @@ -1,6 +1,8 @@ package io.sentry.kotlin.multiplatform.extensions import io.sentry.android.core.SentryAndroidOptions +import io.sentry.android.replay.maskAllImages +import io.sentry.android.replay.maskAllText import io.sentry.kotlin.multiplatform.JvmSentryReplayQuality import io.sentry.kotlin.multiplatform.SentryOptions import io.sentry.kotlin.multiplatform.SentryReplayOptions @@ -19,13 +21,13 @@ internal fun SentryOptions.toAndroidSentryOptionsCallback(): (SentryAndroidOptio androidOptions.anrTimeoutIntervalMillis = kmpOptions.anrTimeoutIntervalMillis // Replay options - androidOptions.experimental.sessionReplay.redactAllText = - kmpOptions.experimental.sessionReplay.redactAllText - androidOptions.experimental.sessionReplay.redactAllImages = - kmpOptions.experimental.sessionReplay.redactAllImages + androidOptions.experimental.sessionReplay.maskAllText = + kmpOptions.experimental.sessionReplay.maskAllText + androidOptions.experimental.sessionReplay.maskAllImages = + kmpOptions.experimental.sessionReplay.maskAllImages androidOptions.experimental.sessionReplay.sessionSampleRate = kmpOptions.experimental.sessionReplay.sessionSampleRate - androidOptions.experimental.sessionReplay.errorSampleRate = + androidOptions.experimental.sessionReplay.onErrorSampleRate = kmpOptions.experimental.sessionReplay.onErrorSampleRate androidOptions.experimental.sessionReplay.quality = kmpOptions.experimental.sessionReplay.quality.toAndroidSentryQuality() diff --git a/sentry-kotlin-multiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.android.kt b/sentry-kotlin-multiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.android.kt index 0601682e..9afd3bc1 100644 --- a/sentry-kotlin-multiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.android.kt +++ b/sentry-kotlin-multiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.android.kt @@ -3,15 +3,17 @@ package io.sentry.kotlin.multiplatform import io.sentry.android.core.SentryAndroidOptions import io.sentry.kotlin.multiplatform.extensions.toAndroidSentryOptionsCallback import io.sentry.kotlin.multiplatform.utils.fakeDsn +import kotlin.test.assertContains import kotlin.test.assertEquals -import io.sentry.SentryReplayOptions as NativeSentryReplayOptions +import kotlin.test.assertFalse +import io.sentry.SentryReplayOptions as AndroidSentryReplayOptions actual interface PlatformOptions : CommonPlatformOptions { val isAnrEnabled: Boolean val anrTimeoutIntervalMillis: Long val attachScreenshot: Boolean val attachViewHierarchy: Boolean - val sessionReplay: NativeSentryReplayOptions + val sessionReplay: AndroidSentryReplayOptions } class SentryAndroidOptionsWrapper(private val androidOptions: SentryAndroidOptions) : @@ -64,7 +66,7 @@ class SentryAndroidOptionsWrapper(private val androidOptions: SentryAndroidOptio override val attachViewHierarchy: Boolean get() = androidOptions.isAttachViewHierarchy - override val sessionReplay: NativeSentryReplayOptions + override val sessionReplay: AndroidSentryReplayOptions get() = androidOptions.experimental.sessionReplay override fun applyFromOptions(options: SentryOptions) { @@ -75,18 +77,52 @@ class SentryAndroidOptionsWrapper(private val androidOptions: SentryAndroidOptio actual fun createPlatformOptions(): PlatformOptions = SentryAndroidOptionsWrapper(SentryAndroidOptions()) -actual fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) { - assertEquals(attachScreenshot, options.attachScreenshot) - assertEquals(attachViewHierarchy, options.attachViewHierarchy) - assertEquals(isAnrEnabled, options.isAnrEnabled) - assertEquals(anrTimeoutIntervalMillis, options.anrTimeoutIntervalMillis) - assertEquals(sessionReplay.redactAllText, options.experimental.sessionReplay.redactAllText) - assertEquals(sessionReplay.redactAllImages, options.experimental.sessionReplay.redactAllImages) - assertEquals(sessionReplay.errorSampleRate, options.experimental.sessionReplay.onErrorSampleRate) - assertEquals(sessionReplay.sessionSampleRate, options.experimental.sessionReplay.sessionSampleRate) - assertEquals(sessionReplay.quality.name, options.experimental.sessionReplay.quality.name) +actual fun PlatformOptions.assertPlatformSpecificOptions(kmpOptions: SentryOptions) { + val androidOptions = this + assertEquals(androidOptions.attachScreenshot, kmpOptions.attachScreenshot) + assertEquals(androidOptions.attachViewHierarchy, kmpOptions.attachViewHierarchy) + assertEquals(androidOptions.isAnrEnabled, kmpOptions.isAnrEnabled) + assertEquals(androidOptions.anrTimeoutIntervalMillis, kmpOptions.anrTimeoutIntervalMillis) + + val kmpReplayOptions = kmpOptions.experimental.sessionReplay + assertViewClassMasking( + kmpReplayOptions.maskAllText, + androidOptions.sessionReplay.maskViewClasses, + androidOptions.sessionReplay.unmaskViewClasses, + AndroidSentryReplayOptions.TEXT_VIEW_CLASS_NAME + ) + assertViewClassMasking( + kmpReplayOptions.maskAllImages, + androidOptions.sessionReplay.maskViewClasses, + androidOptions.sessionReplay.unmaskViewClasses, + AndroidSentryReplayOptions.IMAGE_VIEW_CLASS_NAME + ) + assertEquals( + androidOptions.sessionReplay.onErrorSampleRate, + kmpReplayOptions.onErrorSampleRate + ) + assertEquals( + androidOptions.sessionReplay.sessionSampleRate, + kmpReplayOptions.sessionSampleRate + ) + assertEquals(androidOptions.sessionReplay.quality.name, kmpReplayOptions.quality.name) } actual fun createSentryPlatformOptionsConfiguration(): PlatformOptionsConfiguration = { it.dsn = fakeDsn } + +private fun assertViewClassMasking( + kmpMaskAll: Boolean, + maskViewClasses: Collection, + unmaskViewClasses: Collection, + viewClassName: String +) { + if (kmpMaskAll) { + assertContains(maskViewClasses, viewClassName) + assertFalse(unmaskViewClasses.contains(viewClassName)) + } else { + assertFalse(maskViewClasses.contains(viewClassName)) + assertContains(unmaskViewClasses, viewClassName) + } +} diff --git a/sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt b/sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt index 015fe560..8ed826c6 100644 --- a/sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt +++ b/sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt @@ -63,11 +63,11 @@ expect fun createApplePlatformOptions(): PlatformOptions expect fun ApplePlatformOptions.assertApplePlatformSpecificOptions(options: SentryOptions) -actual fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) { - (this as ApplePlatformOptions).assertApplePlatformSpecificOptions(options) +actual fun PlatformOptions.assertPlatformSpecificOptions(kmpOptions: SentryOptions) { + (this as ApplePlatformOptions).assertApplePlatformSpecificOptions(kmpOptions) val appleOptions = this - assertEquals(appleOptions.enableWatchdogTerminationTracking, options.enableWatchdogTerminationTracking) + assertEquals(appleOptions.enableWatchdogTerminationTracking, kmpOptions.enableWatchdogTerminationTracking) } actual fun createSentryPlatformOptionsConfiguration(): PlatformOptionsConfiguration = { diff --git a/sentry-kotlin-multiplatform/src/commonMain/kotlin/io/sentry/kotlin/multiplatform/SentryReplayOptions.kt b/sentry-kotlin-multiplatform/src/commonMain/kotlin/io/sentry/kotlin/multiplatform/SentryReplayOptions.kt index 3e1c8dc8..28648518 100644 --- a/sentry-kotlin-multiplatform/src/commonMain/kotlin/io/sentry/kotlin/multiplatform/SentryReplayOptions.kt +++ b/sentry-kotlin-multiplatform/src/commonMain/kotlin/io/sentry/kotlin/multiplatform/SentryReplayOptions.kt @@ -21,18 +21,18 @@ public data class SentryReplayOptions( public var onErrorSampleRate: Double? = null, /** - * Redact all text content. Draws a rectangle of text bounds with text color on top. + * Makss all text content. Draws a rectangle of text bounds with text color on top. * * The default is true. */ - public var redactAllText: Boolean = true, + public var maskAllText: Boolean = true, /** - * Redact all image content. Draws a rectangle of image bounds with image's dominant color on top. + * Masks all image content. Draws a rectangle of image bounds with image's dominant color on top. * * The default is true. */ - public var redactAllImages: Boolean = true, + public var maskAllImages: Boolean = true, /** * Defines the quality of the session replay. The higher the quality, the more accurate the replay diff --git a/sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/SentryOptionsTest.kt b/sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/SentryOptionsTest.kt index d3379b90..044d97e1 100644 --- a/sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/SentryOptionsTest.kt +++ b/sentry-kotlin-multiplatform/src/commonTest/kotlin/io/sentry/kotlin/multiplatform/SentryOptionsTest.kt @@ -128,8 +128,8 @@ class SentryOptionsTest : BaseSentryTest() { assertEquals(5000L, options.anrTimeoutIntervalMillis) assertNull(options.experimental.sessionReplay.onErrorSampleRate) assertNull(options.experimental.sessionReplay.sessionSampleRate) - assertTrue(options.experimental.sessionReplay.redactAllText) - assertTrue(options.experimental.sessionReplay.redactAllImages) + assertTrue(options.experimental.sessionReplay.maskAllText) + assertTrue(options.experimental.sessionReplay.maskAllImages) assertEquals(SentryReplayOptions.Quality.MEDIUM, options.experimental.sessionReplay.quality) assertTrue(options.enableWatchdogTerminationTracking) } @@ -158,8 +158,8 @@ class SentryOptionsTest : BaseSentryTest() { enableWatchdogTerminationTracking = false experimental.sessionReplay.onErrorSampleRate = 0.5 experimental.sessionReplay.sessionSampleRate = 0.5 - experimental.sessionReplay.redactAllText = false - experimental.sessionReplay.redactAllImages = false + experimental.sessionReplay.maskAllText = false + experimental.sessionReplay.maskAllImages = false experimental.sessionReplay.quality = SentryReplayOptions.Quality.LOW } @@ -183,4 +183,4 @@ class SentryOptionsTest : BaseSentryTest() { } } -expect fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) +expect fun PlatformOptions.assertPlatformSpecificOptions(kmpOptions: SentryOptions) diff --git a/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt b/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt index ed8426d7..c523db66 100644 --- a/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt +++ b/sentry-kotlin-multiplatform/src/iosMain/kotlin/io/sentry/kotlin/multiplatform/extensions/SentryOptionsExtensions.ios.kt @@ -23,8 +23,8 @@ internal fun SentryOptions.toIosOptionsConfiguration(): (CocoaSentryOptions?) -> "errorSampleRate" to kmpOptions.experimental.sessionReplay.onErrorSampleRate?.toFloat() ) ).apply { - setRedactAllText(kmpOptions.experimental.sessionReplay.redactAllText) - setRedactAllImages(kmpOptions.experimental.sessionReplay.redactAllImages) + setRedactAllText(kmpOptions.experimental.sessionReplay.maskAllText) + setRedactAllImages(kmpOptions.experimental.sessionReplay.maskAllImages) kmpOptions.experimental.sessionReplay.sessionSampleRate?.let { setSessionSampleRate(it.toFloat()) } setQuality(kmpOptions.experimental.sessionReplay.quality.ordinal.toLong()) } diff --git a/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt b/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt index a9a7b021..3fac591f 100644 --- a/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt +++ b/sentry-kotlin-multiplatform/src/iosTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.ios.kt @@ -40,8 +40,8 @@ actual fun ApplePlatformOptions.assertApplePlatformSpecificOptions(options: Sent assertEquals(attachViewHierarchy, options.attachViewHierarchy) assertEquals(enableAppHangTracking, options.enableAppHangTracking) assertEquals(appHangTimeoutIntervalMillis, options.appHangTimeoutIntervalMillis) - assertEquals(sessionReplay.redactAllText(), options.experimental.sessionReplay.redactAllText) - assertEquals(sessionReplay.redactAllImages(), options.experimental.sessionReplay.redactAllImages) + assertEquals(sessionReplay.redactAllText(), options.experimental.sessionReplay.maskAllText) + assertEquals(sessionReplay.redactAllImages(), options.experimental.sessionReplay.maskAllImages) assertEquals(sessionReplay.onErrorSampleRate().toDouble(), options.experimental.sessionReplay.onErrorSampleRate) assertEquals(sessionReplay.sessionSampleRate().toDouble(), options.experimental.sessionReplay.sessionSampleRate) assertEquals(sessionReplay.quality(), options.experimental.sessionReplay.quality.ordinal.toLong()) diff --git a/sentry-kotlin-multiplatform/src/jvmTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.jvm.kt b/sentry-kotlin-multiplatform/src/jvmTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.jvm.kt index 40d7841e..965b3fa5 100644 --- a/sentry-kotlin-multiplatform/src/jvmTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.jvm.kt +++ b/sentry-kotlin-multiplatform/src/jvmTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.jvm.kt @@ -49,7 +49,7 @@ class SentryJvmOptionsWrapper(private val jvmOptions: JvmSentryOptions) : Platfo actual fun createPlatformOptions(): PlatformOptions = SentryJvmOptionsWrapper(JvmSentryOptions()) -actual fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) { +actual fun PlatformOptions.assertPlatformSpecificOptions(kmpOptions: SentryOptions) { // no-op }