diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce454d18..d98b36fc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- `CaptureFeedback` now returns a `SentryId` and exposes a `CaptureFeedbackResult` out parameter to indicate whether feedback was captured successfully ([#2589](https://github.com/getsentry/sentry-unity/pull/2579)) - When exporting a NSP ROM File for Switch the SKD now correctly uploads the debug symbols ([#2580](https://github.com/getsentry/sentry-unity/pull/2580)) - The SDK now also uses `.sentry-native` as a subdirectory for native support on desktop platforms. It now also falls back to `Application.persistentDataPath` instead of the current working directory. Note: `crashedLastRun` may report `false` for the first time after upgrading. ([#2547](https://github.com/getsentry/sentry-unity/pull/2547)) - The currently experimental Metrics are now opt-in by default ([#2546](https://github.com/getsentry/sentry-unity/pull/2546)) diff --git a/src/Sentry.Unity/SentrySdk.Dotnet.cs b/src/Sentry.Unity/SentrySdk.Dotnet.cs index 1d82975d9..2539aa3b2 100644 --- a/src/Sentry.Unity/SentrySdk.Dotnet.cs +++ b/src/Sentry.Unity/SentrySdk.Dotnet.cs @@ -315,21 +315,37 @@ public static SentryId CaptureMessage(string message, Action configureSco /// Captures feedback from the user. /// [DebuggerStepThrough] - public static void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null) + public static SentryId CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null) => Sentry.SentrySdk.CaptureFeedback(feedback, configureScope, hint); /// /// Captures feedback from the user. /// [DebuggerStepThrough] - public static void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null) + public static SentryId CaptureFeedback(SentryFeedback feedback, out CaptureFeedbackResult result, + Action configureScope, SentryHint? hint = null) + => Sentry.SentrySdk.CaptureFeedback(feedback, out result, configureScope, hint); + + /// + /// Captures feedback from the user. + /// + [DebuggerStepThrough] + public static SentryId CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null) => Sentry.SentrySdk.CaptureFeedback(feedback, scope, hint); /// /// Captures feedback from the user. /// [DebuggerStepThrough] - public static void CaptureFeedback(string message, string? contactEmail = null, string? name = null, + public static SentryId CaptureFeedback(SentryFeedback feedback, out CaptureFeedbackResult result, + Scope? scope = null, SentryHint? hint = null) + => Sentry.SentrySdk.CaptureFeedback(feedback, out result, scope, hint); + + /// + /// Captures feedback from the user. + /// + [DebuggerStepThrough] + public static SentryId CaptureFeedback(string message, string? contactEmail = null, string? name = null, string? replayId = null, string? url = null, SentryId? associatedEventId = null, Scope? scope = null, SentryHint? hint = null) => Sentry.SentrySdk.CaptureFeedback(new SentryFeedback(message, contactEmail, name, replayId, url, associatedEventId), diff --git a/src/Sentry.Unity/SentrySdk.cs b/src/Sentry.Unity/SentrySdk.cs index 55cb951bb..38f3b066d 100644 --- a/src/Sentry.Unity/SentrySdk.cs +++ b/src/Sentry.Unity/SentrySdk.cs @@ -106,6 +106,6 @@ public static CrashedLastRun GetLastRunState() /// /// Captures a User Feedback /// - public static void CaptureFeedback(string message, string? email, string? name, bool addScreenshot) => - UnitySdk?.CaptureFeedback(message, email, name, addScreenshot); + public static SentryId CaptureFeedback(string message, string? email, string? name, bool addScreenshot) => + UnitySdk?.CaptureFeedback(message, email, name, addScreenshot) ?? SentryId.Empty; } diff --git a/src/Sentry.Unity/SentryUnitySdk.cs b/src/Sentry.Unity/SentryUnitySdk.cs index 5e957cdec..a00899bac 100644 --- a/src/Sentry.Unity/SentryUnitySdk.cs +++ b/src/Sentry.Unity/SentryUnitySdk.cs @@ -113,12 +113,12 @@ public SentrySdk.CrashedLastRun CrashedLastRun() : SentrySdk.CrashedLastRun.DidNotCrash; } - public void CaptureFeedback(string message, string? email, string? name, bool addScreenshot) + public SentryId CaptureFeedback(string message, string? email, string? name, bool addScreenshot) { if (string.IsNullOrWhiteSpace(message)) { _options.LogError("To submit a feedback, you must provide a message."); - return; + return SentryId.Empty; } SentryHint? hint = null; @@ -150,7 +150,7 @@ public void CaptureFeedback(string message, string? email, string? name, bool ad } } - Sentry.SentrySdk.CurrentHub.CaptureFeedback(message, email, name, hint: hint); + return Sentry.SentrySdk.CurrentHub.CaptureFeedback(message, email, name, hint: hint); } internal static void SetUpWindowsPlayerCaching(SentryUnitySdk unitySdk, SentryUnityOptions options) diff --git a/test/Sentry.Unity.Tests/Stubs/TestHub.cs b/test/Sentry.Unity.Tests/Stubs/TestHub.cs index accbe8d3c..9c8af21dc 100644 --- a/test/Sentry.Unity.Tests/Stubs/TestHub.cs +++ b/test/Sentry.Unity.Tests/Stubs/TestHub.cs @@ -36,7 +36,7 @@ public SentryId CaptureFeedback(SentryFeedback feedback, out CaptureFeedbackResu throw new NotImplementedException(); } - public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null) + public SentryId CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null) { throw new NotImplementedException(); } @@ -202,7 +202,7 @@ public SentryId CaptureFeedback(SentryFeedback feedback, out CaptureFeedbackResu throw new NotImplementedException(); } - public void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null) + public SentryId CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null) { throw new NotImplementedException(); }