Skip to content

Commit

Permalink
Merge branch 'main' into fix/screenshot-masking-during-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind authored Jan 8, 2025
2 parents 9d4a3f9 + 3a4de05 commit 4439231
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 20 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

### Dependencies

- Bump Android SDK from v7.19.0 to v7.19.1 ([#2536](https://github.com/getsentry/sentry-dart/pull/2536))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7191)
- [diff](https://github.com/getsentry/sentry-java/compare/7.19.0...7.19.1)
- Bump Cocoa SDK from v8.42.0 to v8.43.0-beta.1 ([#2542](https://github.com/getsentry/sentry-dart/pull/2542))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8430-beta1)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.42.0...8.43.0-beta.1)
- Bump Cocoa SDK from v8.42.0 to v8.43.0 ([#2542](https://github.com/getsentry/sentry-dart/pull/2542), [#2548](https://github.com/getsentry/sentry-dart/pull/2548))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8430)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.42.0...8.43.0)
- Bump Android SDK from v7.19.0 to v7.20.0 ([#2536](https://github.com/getsentry/sentry-dart/pull/2536), [#2549](https://github.com/getsentry/sentry-dart/pull/2549))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7200)
- [diff](https://github.com/getsentry/sentry-java/compare/7.19.0...7.20.0)

## 8.12.0

Expand Down
2 changes: 1 addition & 1 deletion flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ android {
}

dependencies {
api 'io.sentry:sentry-android:7.19.1'
api 'io.sentry:sentry-android:7.20.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// Required -- JUnit 4 framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class SentryFlutter(
}

data.getIfNotNull<Map<String, Any>>("replay") {
updateReplayOptions(options.experimental.sessionReplay, it)
updateReplayOptions(options.sessionReplay, it)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import io.sentry.protocol.DebugImage
import io.sentry.protocol.SdkVersion
import io.sentry.protocol.SentryId
import io.sentry.protocol.User
import io.sentry.rrweb.RRWebOptionsEvent
import io.sentry.transport.CurrentDateProvider
import java.io.File
import java.lang.ref.WeakReference
Expand Down Expand Up @@ -169,7 +170,7 @@ class SentryFlutterPlugin :
// Replace the default ReplayIntegration with a Flutter-specific recorder.
options.integrations.removeAll { it is ReplayIntegration }
val cacheDirPath = options.cacheDirPath
val replayOptions = options.experimental.sessionReplay
val replayOptions = options.sessionReplay
val isReplayEnabled = replayOptions.isSessionReplayEnabled || replayOptions.isSessionReplayForErrorsEnabled
if (cacheDirPath != null && isReplayEnabled) {
replay =
Expand All @@ -194,6 +195,20 @@ class SentryFlutterPlugin :
replay.breadcrumbConverter = SentryFlutterReplayBreadcrumbConverter()
options.addIntegration(replay)
options.setReplayController(replay)

options.beforeSendReplay =
SentryOptions.BeforeSendReplayCallback { event, hint ->
hint.replayRecording?.payload?.firstOrNull { it is RRWebOptionsEvent }?.let { optionsEvent ->
val payload = (optionsEvent as RRWebOptionsEvent).optionsPayload

// Remove defaults set by the native SDK.
payload.filterKeys { it.contains("mask") }.forEach { (k, _) -> payload.remove(k) }

// Now, set the Flutter-specific values.
// TODO do this in a followup PR
}
event
}
} else {
options.setReplayController(null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ class SentryFlutterTest {
assertEquals("admin", fixture.options.proxy?.user)
assertEquals("0000", fixture.options.proxy?.pass)

assertEquals(0.5, fixture.options.experimental.sessionReplay.sessionSampleRate)
assertEquals(0.6, fixture.options.experimental.sessionReplay.onErrorSampleRate)
assertEquals(0.5, fixture.options.sessionReplay.sessionSampleRate)
assertEquals(0.6, fixture.options.sessionReplay.onErrorSampleRate)

// Note: these are currently read-only in SentryReplayOptions so we're only asserting the default values here to
// know when there's a change in the native SDK, as it may require a manual change in the Flutter implementation.
assertEquals(1, fixture.options.experimental.sessionReplay.frameRate)
assertEquals(30_000L, fixture.options.experimental.sessionReplay.errorReplayDuration)
assertEquals(5000L, fixture.options.experimental.sessionReplay.sessionSegmentDuration)
assertEquals(60 * 60 * 1000L, fixture.options.experimental.sessionReplay.sessionDuration)
assertEquals(1, fixture.options.sessionReplay.frameRate)
assertEquals(30_000L, fixture.options.sessionReplay.errorReplayDuration)
assertEquals(5000L, fixture.options.sessionReplay.sessionSegmentDuration)
assertEquals(60 * 60 * 1000L, fixture.options.sessionReplay.sessionDuration)
}

@Test
Expand Down
8 changes: 4 additions & 4 deletions flutter/ios/Classes/SentryFlutter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ public final class SentryFlutter {
}
#if canImport(UIKit) && !SENTRY_NO_UIKIT && (os(iOS) || os(tvOS))
if let replayOptions = data["replay"] as? [String: Any] {
options.experimental.sessionReplay.sessionSampleRate =
options.sessionReplay.sessionSampleRate =
(replayOptions["sessionSampleRate"] as? NSNumber)?.floatValue ?? 0
options.experimental.sessionReplay.onErrorSampleRate =
options.sessionReplay.onErrorSampleRate =
(replayOptions["onErrorSampleRate"] as? NSNumber)?.floatValue ?? 0

// TMP: this doesn't actually mask, just ensures we show the correct
// value in tags. https://github.com/getsentry/sentry-cocoa/issues/4666
options.experimental.sessionReplay.maskAllText =
options.sessionReplay.maskAllText =
(replayOptions["maskAllText"] as? Bool) ?? false
options.experimental.sessionReplay.maskAllImages =
options.sessionReplay.maskAllImages =
(replayOptions["maskAllImages"] as? Bool) ?? false
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion flutter/ios/sentry_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Sentry SDK for Flutter with support to native through sentry-cocoa.
:tag => s.version.to_s }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Sentry/HybridSDK', '8.43.0-beta.1'
s.dependency 'Sentry/HybridSDK', '8.43.0'
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '12.0'
Expand Down
12 changes: 12 additions & 0 deletions flutter/lib/src/native/cocoa/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29906,6 +29906,8 @@ class SentryCocoa {
late final _sel_setSdkName_1 = _registerName1("setSdkName:");
late final _sel_getSdkName1 = _registerName1("getSdkName");
late final _sel_getSdkVersionString1 = _registerName1("getSdkVersionString");
late final _sel_addSdkPackage_version_1 =
_registerName1("addSdkPackage:version:");
late final _sel_getExtraContext1 = _registerName1("getExtraContext");
late final _class_SentryId2 = _getClass1("Sentry.SentryId");
late final _sel_startProfilerForTrace_1 =
Expand Down Expand Up @@ -70745,6 +70747,16 @@ class PrivateSentrySDKOnly extends NSObject {
return NSString._(_ret, _lib, retain: true, release: true);
}

/// Add a package to the SDK packages
static void addSdkPackage_version_(
SentryCocoa _lib, NSString? name, NSString? version) {
_lib._objc_msgSend_515(
_lib._class_PrivateSentrySDKOnly1,
_lib._sel_addSdkPackage_version_1,
name?._id ?? ffi.nullptr,
version?._id ?? ffi.nullptr);
}

/// Retrieves extra context
static NSDictionary getExtraContext(SentryCocoa _lib) {
final _ret = _lib._objc_msgSend_170(
Expand Down

0 comments on commit 4439231

Please sign in to comment.