From cd544dca928b4e4446a2b1600b5f14ed0970afc9 Mon Sep 17 00:00:00 2001 From: melekr Date: Fri, 30 Aug 2024 12:31:10 -0400 Subject: [PATCH] Update macos native client --- Editor/BacktraceClientConfigurationEditor.cs | 2 +- Editor/BacktraceConfigurationEditor.cs | 2 +- Runtime/BacktraceClient.cs | 6 +++--- Runtime/Model/Attributes/MachineAttributeProvider.cs | 4 ++++ Runtime/Model/BacktraceConfiguration.cs | 8 ++++---- Tests/Runtime/Native/BreadcrumbsAnrTests.cs | 2 +- Tests/Runtime/Native/Mocks/TestableNativeClient.cs | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Editor/BacktraceClientConfigurationEditor.cs b/Editor/BacktraceClientConfigurationEditor.cs index 7581fbb8..b45b0332 100644 --- a/Editor/BacktraceClientConfigurationEditor.cs +++ b/Editor/BacktraceClientConfigurationEditor.cs @@ -26,7 +26,7 @@ public override void OnInspectorGUI() #else settings.IgnoreSslValidation = false; #endif -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX settings.HandleANR = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_ANR, settings.HandleANR); settings.OomReports = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_OOM, settings.OomReports); #endif diff --git a/Editor/BacktraceConfigurationEditor.cs b/Editor/BacktraceConfigurationEditor.cs index 534393f3..8d0deb55 100644 --- a/Editor/BacktraceConfigurationEditor.cs +++ b/Editor/BacktraceConfigurationEditor.cs @@ -153,7 +153,7 @@ public override void OnInspectorGUI() serializedObject.FindProperty("HandleANR"), new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_ANR)); #endif -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX EditorGUILayout.PropertyField( serializedObject.FindProperty("OomReports"), new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_OOM)); diff --git a/Runtime/BacktraceClient.cs b/Runtime/BacktraceClient.cs index 3bf1e4f7..230fe80b 100644 --- a/Runtime/BacktraceClient.cs +++ b/Runtime/BacktraceClient.cs @@ -712,7 +712,7 @@ private void OnDestroy() _instance = null; Application.logMessageReceived -= HandleUnityMessage; Application.logMessageReceivedThreaded -= HandleUnityBackgroundException; -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX Application.lowMemory -= HandleLowMemory; #endif if (_nativeClient != null) @@ -1040,7 +1040,7 @@ private void CaptureUnityMessages() { Application.logMessageReceived += HandleUnityMessage; Application.logMessageReceivedThreaded += HandleUnityBackgroundException; -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX Application.lowMemory += HandleLowMemory; #endif } @@ -1069,7 +1069,7 @@ internal void HandleUnityBackgroundException(string message, string stackTrace, HandleUnityMessage(message, stackTrace, type); } -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX internal void HandleLowMemory() { if (!Enabled) diff --git a/Runtime/Model/Attributes/MachineAttributeProvider.cs b/Runtime/Model/Attributes/MachineAttributeProvider.cs index 89b13ddd..5020b462 100644 --- a/Runtime/Model/Attributes/MachineAttributeProvider.cs +++ b/Runtime/Model/Attributes/MachineAttributeProvider.cs @@ -90,6 +90,10 @@ private void IncludeOsInformation(IDictionary attributes) attributes["uname.version"] = UnityEngine.iOS.Device.systemVersion; attributes["uname.fullname"] = Environment.OSVersion.Version.ToString(); #endif + +#if UNITY_STANDALONE_OSX && !UNITY_EDITOR + attributes["uname.fullname"] = Environment.OSVersion.Version.ToString(); +#endif } private void IncludeGraphicCardInformation(IDictionary attributes) diff --git a/Runtime/Model/BacktraceConfiguration.cs b/Runtime/Model/BacktraceConfiguration.cs index 5db954ee..1dc4b294 100644 --- a/Runtime/Model/BacktraceConfiguration.cs +++ b/Runtime/Model/BacktraceConfiguration.cs @@ -146,7 +146,7 @@ public class BacktraceConfiguration : ScriptableObject /// /// Handle ANR events - Application not responding /// -#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN [Tooltip("Capture ANR events - Application not responding")] #else [Obsolete("Not supported")] @@ -157,7 +157,7 @@ public class BacktraceConfiguration : ScriptableObject /// /// Anr watchdog timeout in ms. Time needed to detect an ANR event /// -#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN [Tooltip("ANR watchdog timeout")] #else [Obsolete("Not supported")] @@ -167,7 +167,7 @@ public class BacktraceConfiguration : ScriptableObject /// /// Send Out of memory exceptions to Backtrace. /// -#if UNITY_ANDROID || UNITY_IOS +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX [Tooltip("Send Out of Memory exceptions to Backtrace")] #else [Obsolete("Not supported")] @@ -177,7 +177,7 @@ public class BacktraceConfiguration : ScriptableObject /// /// Enable client side unwinding. /// -#if UNITY_2019_2_OR_NEWER && (UNITY_ANDROID || UNITY_IOS) +#if UNITY_2019_2_OR_NEWER && (UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX) [Tooltip("Enable client-side unwinding.")] #else [Obsolete("Not supported")] diff --git a/Tests/Runtime/Native/BreadcrumbsAnrTests.cs b/Tests/Runtime/Native/BreadcrumbsAnrTests.cs index 59372ce1..4c21f75a 100644 --- a/Tests/Runtime/Native/BreadcrumbsAnrTests.cs +++ b/Tests/Runtime/Native/BreadcrumbsAnrTests.cs @@ -1,4 +1,4 @@ -#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN using Backtrace.Unity.Model; using Backtrace.Unity.Model.Breadcrumbs; using Backtrace.Unity.Model.Breadcrumbs.InMemory; diff --git a/Tests/Runtime/Native/Mocks/TestableNativeClient.cs b/Tests/Runtime/Native/Mocks/TestableNativeClient.cs index a8f1fd93..1c170135 100644 --- a/Tests/Runtime/Native/Mocks/TestableNativeClient.cs +++ b/Tests/Runtime/Native/Mocks/TestableNativeClient.cs @@ -1,4 +1,4 @@ -#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN +#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN using Backtrace.Unity.Model; using Backtrace.Unity.Model.Breadcrumbs; using Backtrace.Unity.Runtime.Native;