Skip to content

Commit

Permalink
chore(deps): update Java SDK to v7.15.0 (#284)
Browse files Browse the repository at this point in the history
* chore: update scripts/update-java.sh to 7.15.0

* update android  to  and mask to redact

* update

* update tests

* rename import to AndroidSentryReplayOptions

---------

Co-authored-by: GitHub <[email protected]>
Co-authored-by: GIancarlo Buenaflor <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2024
1 parent 1bf5cc1 commit a8cebc1
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) :
Expand Down Expand Up @@ -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) {
Expand All @@ -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<String>,
unmaskViewClasses: Collection<String>,
viewClassName: String
) {
if (kmpMaskAll) {
assertContains(maskViewClasses, viewClassName)
assertFalse(unmaskViewClasses.contains(viewClassName))
} else {
assertFalse(maskViewClasses.contains(viewClassName))
assertContains(unmaskViewClasses, viewClassName)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
}

Expand All @@ -183,4 +183,4 @@ class SentryOptionsTest : BaseSentryTest() {
}
}

expect fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions)
expect fun PlatformOptions.assertPlatformSpecificOptions(kmpOptions: SentryOptions)
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a8cebc1

Please sign in to comment.