@@ -6,140 +6,110 @@ namespace Sentry.Unity.Editor.ConfigurationWindow;
66
77internal static class AdvancedTab
88{
9- private static bool UnfoldFailedStatusCodeRanges ;
9+ private static bool UnfoldAutomaticOptions ;
10+ private static bool UnfoldNativeOptions ;
1011
1112 internal static void Display ( ScriptableSentryUnityOptions options , SentryCliOptions ? cliOptions )
1213 {
14+ UnfoldAutomaticOptions = EditorGUILayout . BeginFoldoutHeaderGroup ( UnfoldAutomaticOptions , "Automatic Behaviour" ) ;
15+ EditorGUI . indentLevel ++ ;
16+ if ( UnfoldAutomaticOptions )
1317 {
14- options . AutoSessionTracking = EditorGUILayout . BeginToggleGroup (
15- new GUIContent ( "Auto Session Tracking" , "Whether the SDK should start and end sessions " +
16- "automatically. If the timeout is reached the old session will" +
17- "be ended and a new one started." ) ,
18- options . AutoSessionTracking ) ;
19-
20- options . AutoSessionTrackingInterval = EditorGUILayout . IntField (
21- new GUIContent ( "Session Timeout [ms]" , "The duration of time a session can stay paused " +
22- "(i.e. the application has been put in the background) before " +
23- "it is considered ended." ) ,
24- options . AutoSessionTrackingInterval ) ;
25- options . AutoSessionTrackingInterval = Mathf . Max ( 0 , options . AutoSessionTrackingInterval ) ;
26- EditorGUILayout . EndToggleGroup ( ) ;
27- }
28-
29- EditorGUILayout . Space ( ) ;
30- EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
31- EditorGUILayout . Space ( ) ;
32-
33- {
34- options . AnrDetectionEnabled = EditorGUILayout . BeginToggleGroup (
35- new GUIContent ( "ANR Detection" , "Whether the SDK should report 'Application Not " +
36- "Responding' events." ) ,
37- options . AnrDetectionEnabled ) ;
38-
39- options . AnrTimeout = EditorGUILayout . IntField (
40- new GUIContent ( "ANR Timeout [ms]" , "The duration in [ms] for how long the game has to be unresponsive " +
41- "before an ANR event is reported.\n Default: 5000ms" ) ,
42- options . AnrTimeout ) ;
43- options . AnrTimeout = Math . Max ( 0 , options . AnrTimeout ) ;
44-
45- EditorGUILayout . EndToggleGroup ( ) ;
46- }
47-
48- EditorGUILayout . Space ( ) ;
49- EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
50- EditorGUILayout . Space ( ) ;
51-
52- {
53- options . CaptureFailedRequests = EditorGUILayout . BeginToggleGroup (
54- new GUIContent ( "Capture Failed HTTP Requests" ,
55- "Whether the SDK should capture failed HTTP requests. This works out of the box for iOS only" +
56- "For the C# layer you need to add the 'SentryHttpMessageHandler' to your HTTP Client." ) ,
57- options . CaptureFailedRequests ) ;
58-
59- UnfoldFailedStatusCodeRanges = EditorGUILayout . BeginFoldoutHeaderGroup ( UnfoldFailedStatusCodeRanges , "Failed Status Codes Ranges" ) ;
60- if ( UnfoldFailedStatusCodeRanges )
6118 {
62- var rangeCount = options . FailedRequestStatusCodes . Count / 2 ;
63- rangeCount = EditorGUILayout . IntField (
64- new GUIContent ( "Status Codes Range Count" , "The amount of ranges of HTTP status codes to capture." ) ,
65- rangeCount ) ;
66-
67- // Because it's a range, we need to double the count
68- rangeCount *= 2 ;
69-
70- if ( rangeCount <= 0 )
71- {
72- options . FailedRequestStatusCodes . Clear ( ) ;
73- }
74-
75- if ( rangeCount < options . FailedRequestStatusCodes . Count )
76- {
77- options . FailedRequestStatusCodes . RemoveRange ( rangeCount , options . FailedRequestStatusCodes . Count - rangeCount ) ;
78- }
19+ options . AutoSessionTracking = EditorGUILayout . BeginToggleGroup (
20+ new GUIContent ( "Auto Session Tracking" , "Whether the SDK should start and end sessions " +
21+ "automatically. If the timeout is reached the old session will" +
22+ "be ended and a new one started." ) ,
23+ options . AutoSessionTracking ) ;
24+
25+ EditorGUI . indentLevel ++ ;
26+ options . AutoSessionTrackingInterval = EditorGUILayout . IntField (
27+ new GUIContent ( "Timeout [ms]" , "The duration of time a session can stay paused " +
28+ "(i.e. the application has been put in the background) before " +
29+ "it is considered ended." ) ,
30+ options . AutoSessionTrackingInterval ) ;
31+ options . AutoSessionTrackingInterval = Mathf . Max ( 0 , options . AutoSessionTrackingInterval ) ;
32+ EditorGUI . indentLevel -- ;
33+ EditorGUILayout . EndToggleGroup ( ) ;
34+ }
7935
80- if ( rangeCount > options . FailedRequestStatusCodes . Count )
81- {
82- var rangedToAdd = rangeCount - options . FailedRequestStatusCodes . Count ;
83- for ( var i = 0 ; i < rangedToAdd ; i += 2 )
84- {
85- options . FailedRequestStatusCodes . Add ( 500 ) ;
86- options . FailedRequestStatusCodes . Add ( 599 ) ;
87- }
88- }
36+ EditorGUILayout . Space ( ) ;
37+ EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
38+ EditorGUILayout . Space ( ) ;
8939
90- for ( var i = 0 ; i < options . FailedRequestStatusCodes . Count ; i += 2 )
91- {
92- GUILayout . BeginHorizontal ( ) ;
40+ {
41+ options . AnrDetectionEnabled = EditorGUILayout . BeginToggleGroup (
42+ new GUIContent ( "ANR Detection" , "Whether the SDK should report 'Application Not " +
43+ "Responding' events." ) ,
44+ options . AnrDetectionEnabled ) ;
45+ EditorGUI . indentLevel ++ ;
46+
47+ options . AnrTimeout = EditorGUILayout . IntField (
48+ new GUIContent ( "Timeout [ms]" ,
49+ "The duration in [ms] for how long the game has to be unresponsive " +
50+ "before an ANR event is reported.\n Default: 5000ms" ) ,
51+ options . AnrTimeout ) ;
52+ options . AnrTimeout = Math . Max ( 0 , options . AnrTimeout ) ;
53+
54+ EditorGUI . indentLevel -- ;
55+ EditorGUILayout . EndToggleGroup ( ) ;
56+ }
9357
94- options . FailedRequestStatusCodes [ i ] = EditorGUILayout . IntField ( "Start" , options . FailedRequestStatusCodes [ i ] ) ;
95- options . FailedRequestStatusCodes [ i + 1 ] = EditorGUILayout . IntField ( "End" , options . FailedRequestStatusCodes [ i + 1 ] ) ;
58+ EditorGUILayout . Space ( ) ;
59+ EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
60+ EditorGUILayout . Space ( ) ;
9661
97- GUILayout . EndHorizontal ( ) ;
98- }
62+ {
63+ GUILayout . Label ( "Automatic Exception Filter" , EditorStyles . boldLabel ) ;
64+
65+ options . FilterBadGatewayExceptions = EditorGUILayout . Toggle (
66+ new GUIContent ( "BadGatewayException" , "Whether the SDK automatically filters Bad Gateway " +
67+ "exceptions before they are being sent to Sentry." ) ,
68+ options . FilterBadGatewayExceptions ) ;
69+
70+ options . FilterWebExceptions = EditorGUILayout . Toggle (
71+ new GUIContent ( "WebException" , "Whether the SDK automatically filters " +
72+ "System.Net.WebException before they are being sent to Sentry." ) ,
73+ options . FilterWebExceptions ) ;
74+
75+ options . FilterSocketExceptions = EditorGUILayout . Toggle (
76+ new GUIContent ( "SocketException" , "Whether the SDK automatically filters " +
77+ "System.Net.Sockets.SocketException with error code '10049' from " +
78+ "being sent to Sentry." ) ,
79+ options . FilterSocketExceptions ) ;
9980 }
10081
101- EditorGUILayout . EndFoldoutHeaderGroup ( ) ;
102- EditorGUILayout . EndToggleGroup ( ) ;
82+ EditorGUILayout . Space ( ) ;
83+ EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
84+ EditorGUILayout . Space ( ) ;
10385 }
10486
105- EditorGUILayout . Space ( ) ;
106- EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
107- EditorGUILayout . Space ( ) ;
87+ EditorGUI . indentLevel -- ;
88+ EditorGUILayout . EndFoldoutHeaderGroup ( ) ;
10889
90+ UnfoldNativeOptions = EditorGUILayout . BeginFoldoutHeaderGroup ( UnfoldNativeOptions , "Native Support" ) ;
91+ EditorGUI . indentLevel ++ ;
92+ if ( UnfoldNativeOptions )
10993 {
110- GUILayout . Label ( "Automatic Exception Filter" , EditorStyles . boldLabel ) ;
111-
112- options . FilterBadGatewayExceptions = EditorGUILayout . Toggle (
113- new GUIContent ( "BadGatewayException" , "Whether the SDK automatically filters Bad Gateway " +
114- "exceptions before they are being sent to Sentry." ) ,
115- options . FilterBadGatewayExceptions ) ;
116-
117- options . FilterWebExceptions = EditorGUILayout . Toggle (
118- new GUIContent ( "WebException" , "Whether the SDK automatically filters " +
119- "System.Net.WebException before they are being sent to Sentry." ) ,
120- options . FilterWebExceptions ) ;
121-
122- options . FilterSocketExceptions = EditorGUILayout . Toggle (
123- new GUIContent ( "SocketException" , "Whether the SDK automatically filters " +
124- "System.Net.Sockets.SocketException with error code '10049' from " +
125- "being sent to Sentry." ) ,
126- options . FilterSocketExceptions ) ;
127- }
94+ options . WindowsNativeSupportEnabled = EditorGUILayout . Toggle (
95+ new GUIContent ( "Windows" , "Whether to enable native crashes support on Windows." ) ,
96+ options . WindowsNativeSupportEnabled ) ;
12897
129- EditorGUILayout . Space ( ) ;
130- EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
131- EditorGUILayout . Space ( ) ;
98+ options . MacosNativeSupportEnabled = EditorGUILayout . Toggle (
99+ new GUIContent ( "macOS" , "Whether to enable native crashes support on macOS." ) ,
100+ options . MacosNativeSupportEnabled ) ;
132101
133- GUILayout . Label ( "Native Support" , EditorStyles . boldLabel ) ;
102+ options . LinuxNativeSupportEnabled = EditorGUILayout . Toggle (
103+ new GUIContent ( "Linux" , "Whether to enable native crashes support on Linux." ) ,
104+ options . LinuxNativeSupportEnabled ) ;
134105
135- {
136106 options . IosNativeSupportEnabled = EditorGUILayout . Toggle (
137- new GUIContent ( "iOS Native Support " , "Whether to enable Native iOS support to capture" +
107+ new GUIContent ( "iOS" , "Whether to enable Native iOS support to capture" +
138108 "errors written in languages such as Objective-C, Swift, C and C++." ) ,
139109 options . IosNativeSupportEnabled ) ;
140110
141111 options . AndroidNativeSupportEnabled = EditorGUILayout . Toggle (
142- new GUIContent ( "Android Native Support " , "Whether to enable Native Android support to " +
112+ new GUIContent ( "Android" , "Whether to enable Native Android support to " +
143113 "capture errors written in languages such as Java, Kotlin, C and C++." ) ,
144114 options . AndroidNativeSupportEnabled ) ;
145115#pragma warning disable CS0618
@@ -162,26 +132,12 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti
162132 options . NdkScopeSyncEnabled ) ;
163133 EditorGUI . EndDisabledGroup ( ) ;
164134 EditorGUI . EndDisabledGroup ( ) ;
165- options . PostGenerateGradleProjectCallbackOrder = EditorGUILayout . IntField (
166- new GUIContent ( "Android Callback Order" , "Override the default callback order of " +
167- "Sentry Gradle modification script that adds Sentry dependencies " +
168- "to the gradle project files." ) ,
169- options . PostGenerateGradleProjectCallbackOrder ) ;
170135 EditorGUI . indentLevel -- ;
171-
172- options . WindowsNativeSupportEnabled = EditorGUILayout . Toggle (
173- new GUIContent ( "Windows Native Support" , "Whether to enable native crashes support on Windows." ) ,
174- options . WindowsNativeSupportEnabled ) ;
175-
176- options . MacosNativeSupportEnabled = EditorGUILayout . Toggle (
177- new GUIContent ( "macOS Native Support" , "Whether to enable native crashes support on macOS." ) ,
178- options . MacosNativeSupportEnabled ) ;
179-
180- options . LinuxNativeSupportEnabled = EditorGUILayout . Toggle (
181- new GUIContent ( "Linux Native Support" , "Whether to enable native crashes support on Linux." ) ,
182- options . LinuxNativeSupportEnabled ) ;
183136 }
184137
138+ EditorGUI . indentLevel -- ;
139+ EditorGUILayout . EndFoldoutHeaderGroup ( ) ;
140+
185141 EditorGUILayout . Space ( ) ;
186142 EditorGUI . DrawRect ( EditorGUILayout . GetControlRect ( false , 1 ) , Color . gray ) ;
187143 EditorGUILayout . Space ( ) ;
0 commit comments