diff --git a/Directory.Build.targets b/Directory.Build.targets index fda6ee560..4150d6a5c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -187,15 +187,19 @@ Expected to exist: - + + - - + + + + + diff --git a/package-dev/Plugins/Android/proguard-sentry-unity.pro b/package-dev/Plugins/Android/proguard-sentry-unity.pro index db90a2504..c15ce052b 100644 --- a/package-dev/Plugins/Android/proguard-sentry-unity.pro +++ b/package-dev/Plugins/Android/proguard-sentry-unity.pro @@ -7,3 +7,6 @@ -keep class io.sentry.Scope { *; } -keep class io.sentry.ScopeCallback { *; } -keep class io.sentry.protocol.** { *; } + +# TODO Copy proguard rules from sentry-android-* in msbuild +-keep class io.sentry.** { *; } diff --git a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs index abbc91e6c..a83a78c3e 100644 --- a/src/Sentry.Unity.Editor.iOS/NativeOptions.cs +++ b/src/Sentry.Unity.Editor.iOS/NativeOptions.cs @@ -37,7 +37,14 @@ internal static string Generate(SentryUnityOptions options) @""attachScreenshot"" : @{ToObjCString(options.AttachScreenshot)}, @""release"" : @""{options.Release}"", @""environment"" : @""{options.Environment}"", - @""enableNetworkBreadcrumbs"" : @NO + @""enableNetworkBreadcrumbs"" : @NO, + // TODO temp code, implement this properly + @""experimental"" : @{{ + @""sessionReplay"" : @{{ + @""sessionSampleRate"" : @1.0, + @""errorSampleRate"" : @1.0 + }} + }} }}; NSError *error = nil; diff --git a/src/Sentry.Unity.Editor/Android/AndroidManifestConfiguration.cs b/src/Sentry.Unity.Editor/Android/AndroidManifestConfiguration.cs index 72e8891bf..bd8640c41 100644 --- a/src/Sentry.Unity.Editor/Android/AndroidManifestConfiguration.cs +++ b/src/Sentry.Unity.Editor/Android/AndroidManifestConfiguration.cs @@ -179,6 +179,7 @@ internal void ModifyManifest(string basePath) androidManifest.SetAutoAppLifecycleBreadcrumbs(false); androidManifest.SetAnr(false); androidManifest.SetPersistentScopeObserver(false); + androidManifest.SetReplay(1.0, 1.0); // TODO: All SentryOptions and create specific Android options @@ -444,6 +445,21 @@ internal void SetNdkScopeSync(bool enableNdkScopeSync) internal void SetDebug(bool debug) => SetMetaData($"{SentryPrefix}.debug", debug ? "true" : "false"); + internal void SetReplay(double? sessionSampleRate, double? errorSampleRate) + { + if (sessionSampleRate != null) + { + // https://github.com/getsentry/sentry-java/issues/3603 + // SetMetaData($"{SentryPrefix}.session-replay.session-sample-rate", sessionSampleRate.ToString()); + SetMetaData($"{SentryPrefix}.session-replay.session-sample-rate", "1.0"); + } + if (errorSampleRate != null) + { + // SetMetaData($"{SentryPrefix}.session-replay.error-sample-rate", errorSampleRate.ToString()); + SetMetaData($"{SentryPrefix}.session-replay.error-sample-rate", "1.0"); + } + } + // https://github.com/getsentry/sentry-java/blob/db4dfc92f202b1cefc48d019fdabe24d487db923/sentry/src/main/java/io/sentry/SentryLevel.java#L4-L9 internal void SetLevel(SentryLevel level) => SetMetaData($"{SentryPrefix}.debug.level", level switch diff --git a/src/Sentry.Unity.Editor/Android/GradleSetup.cs b/src/Sentry.Unity.Editor/Android/GradleSetup.cs index cfee30120..d3f2109c0 100644 --- a/src/Sentry.Unity.Editor/Android/GradleSetup.cs +++ b/src/Sentry.Unity.Editor/Android/GradleSetup.cs @@ -13,7 +13,8 @@ internal class GradleSetup public const string SdkDependencies = @"dependencies { implementation(name: 'sentry-android-ndk-release', ext:'aar') - implementation(name: 'sentry-android-core-release', ext:'aar')"; + implementation(name: 'sentry-android-core-release', ext:'aar') + implementation(name: 'sentry-android-replay-release', ext:'aar')"; public const string DependenciesAddedMessage = "The Sentry Gradle dependencies have already been added."; private readonly string _unityLibraryGradle; diff --git a/test/Scripts.Tests/package-release.zip.snapshot b/test/Scripts.Tests/package-release.zip.snapshot index 4a2595134..f853366d3 100644 --- a/test/Scripts.Tests/package-release.zip.snapshot +++ b/test/Scripts.Tests/package-release.zip.snapshot @@ -220,6 +220,7 @@ Plugins/Android/proguard-sentry-unity.pro Plugins/Android/proguard-sentry-unity.pro.meta Plugins/Android/Sentry~/sentry-android-core-release.aar Plugins/Android/Sentry~/sentry-android-ndk-release.aar +Plugins/Android/Sentry~/sentry-android-replay-release.aar Plugins/Android/Sentry~/sentry.jar Plugins/Windows/Sentry.meta Plugins/Windows/Sentry/crashpad_handler.exe