-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose
enableWatchdogTerminationTracking
in common options (#281)
* update * update * format * update * Update CHANGELOG.md * update
- Loading branch information
Showing
9 changed files
with
132 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...ultiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.apple.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package io.sentry.kotlin.multiplatform | ||
|
||
import io.sentry.kotlin.multiplatform.extensions.toCocoaOptionsConfiguration | ||
import io.sentry.kotlin.multiplatform.utils.fakeDsn | ||
import kotlinx.cinterop.convert | ||
import kotlin.test.assertEquals | ||
|
||
actual interface PlatformOptions : CommonPlatformOptions { | ||
val enableWatchdogTerminationTracking: Boolean | ||
} | ||
|
||
open class SentryAppleOptionsWrapper(private val cocoaOptions: CocoaSentryOptions) : | ||
PlatformOptions { | ||
override val dsn: String? | ||
get() = cocoaOptions.dsn | ||
|
||
override val attachStackTrace: Boolean | ||
get() = cocoaOptions.attachStacktrace | ||
|
||
override val release: String? | ||
get() = cocoaOptions.releaseName | ||
|
||
override val debug: Boolean | ||
get() = cocoaOptions.debug | ||
|
||
override val environment: String | ||
get() = cocoaOptions.environment | ||
|
||
override val dist: String? | ||
get() = cocoaOptions.dist | ||
|
||
override val enableAutoSessionTracking: Boolean | ||
get() = cocoaOptions.enableAutoSessionTracking | ||
|
||
override val sessionTrackingIntervalMillis: Long | ||
get() = cocoaOptions.sessionTrackingIntervalMillis.convert() | ||
|
||
override val maxBreadcrumbs: Int | ||
get() = cocoaOptions.maxBreadcrumbs.convert() | ||
|
||
override val maxAttachmentSize: Long | ||
get() = cocoaOptions.maxAttachmentSize.convert() | ||
|
||
override val sampleRate: Double? | ||
get() = cocoaOptions.sampleRate?.doubleValue | ||
|
||
override val tracesSampleRate: Double? | ||
get() = cocoaOptions.tracesSampleRate?.doubleValue | ||
|
||
override val enableWatchdogTerminationTracking: Boolean | ||
get() = cocoaOptions.enableWatchdogTerminationTracking | ||
|
||
override fun applyFromOptions(options: SentryOptions) { | ||
options.toCocoaOptionsConfiguration().invoke(cocoaOptions) | ||
} | ||
} | ||
|
||
expect interface ApplePlatformOptions : PlatformOptions | ||
|
||
actual fun createPlatformOptions(): PlatformOptions = createApplePlatformOptions() | ||
|
||
expect fun createApplePlatformOptions(): PlatformOptions | ||
|
||
expect fun ApplePlatformOptions.assertApplePlatformSpecificOptions(options: SentryOptions) | ||
|
||
actual fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) { | ||
(this as ApplePlatformOptions).assertApplePlatformSpecificOptions(options) | ||
|
||
val appleOptions = this | ||
assertEquals(appleOptions.enableWatchdogTerminationTracking, options.enableWatchdogTerminationTracking) | ||
} | ||
|
||
actual fun createSentryPlatformOptionsConfiguration(): PlatformOptionsConfiguration = { | ||
val cocoaOptions = it as CocoaSentryOptions | ||
cocoaOptions.dsn = fakeDsn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 4 additions & 53 deletions
57
...monTvWatchMacOsTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.tvwatchmacos.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,12 @@ | ||
package io.sentry.kotlin.multiplatform | ||
|
||
import io.sentry.kotlin.multiplatform.extensions.toCocoaOptionsConfiguration | ||
import io.sentry.kotlin.multiplatform.utils.fakeDsn | ||
import kotlinx.cinterop.convert | ||
actual interface ApplePlatformOptions : PlatformOptions | ||
|
||
actual interface PlatformOptions : CommonPlatformOptions | ||
class SentryTvWatchMacOsOptionsWrapper(cocoaOptions: CocoaSentryOptions) : SentryAppleOptionsWrapper(cocoaOptions) | ||
|
||
class SentryTvWatchMacOsOptionsWrapper(private val cocoaOptions: CocoaSentryOptions) : | ||
PlatformOptions { | ||
override val dsn: String? | ||
get() = cocoaOptions.dsn | ||
|
||
override val attachStackTrace: Boolean | ||
get() = cocoaOptions.attachStacktrace | ||
|
||
override val release: String? | ||
get() = cocoaOptions.releaseName | ||
|
||
override val debug: Boolean | ||
get() = cocoaOptions.debug | ||
|
||
override val environment: String | ||
get() = cocoaOptions.environment | ||
|
||
override val dist: String? | ||
get() = cocoaOptions.dist | ||
|
||
override val enableAutoSessionTracking: Boolean | ||
get() = cocoaOptions.enableAutoSessionTracking | ||
|
||
override val sessionTrackingIntervalMillis: Long | ||
get() = cocoaOptions.sessionTrackingIntervalMillis.convert() | ||
|
||
override val maxBreadcrumbs: Int | ||
get() = cocoaOptions.maxBreadcrumbs.convert() | ||
|
||
override val maxAttachmentSize: Long | ||
get() = cocoaOptions.maxAttachmentSize.convert() | ||
|
||
override val sampleRate: Double? | ||
get() = cocoaOptions.sampleRate?.doubleValue | ||
|
||
override val tracesSampleRate: Double? | ||
get() = cocoaOptions.tracesSampleRate?.doubleValue | ||
|
||
override fun applyFromOptions(options: SentryOptions) { | ||
options.toCocoaOptionsConfiguration().invoke(cocoaOptions) | ||
} | ||
} | ||
|
||
actual fun createPlatformOptions(): PlatformOptions = | ||
actual fun createApplePlatformOptions(): PlatformOptions = | ||
SentryTvWatchMacOsOptionsWrapper(CocoaSentryOptions()) | ||
|
||
actual fun PlatformOptions.assertPlatformSpecificOptions(options: SentryOptions) { | ||
actual fun ApplePlatformOptions.assertApplePlatformSpecificOptions(options: SentryOptions) { | ||
// no-op | ||
} | ||
|
||
actual fun createSentryPlatformOptionsConfiguration(): PlatformOptionsConfiguration = { | ||
it.dsn = fakeDsn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters