Skip to content

Commit e41f7a1

Browse files
committed
window facelift #2
1 parent cddcbc4 commit e41f7a1

File tree

8 files changed

+204
-222
lines changed

8 files changed

+204
-222
lines changed

src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs

Lines changed: 84 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -6,140 +6,110 @@ namespace Sentry.Unity.Editor.ConfigurationWindow;
66

77
internal 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.\nDefault: 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.\nDefault: 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();

src/Sentry.Unity.Editor/ConfigurationWindow/CoreTab.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ internal static class CoreTab
99
internal static void Display(ScriptableSentryUnityOptions options)
1010
{
1111
{
12-
GUILayout.Label("Base Options", EditorStyles.boldLabel);
13-
1412
options.Dsn = EditorGUILayout.TextField(
1513
new GUIContent("DSN", "The URL to your Sentry project. " +
1614
"Get yours on sentry.io -> Project Settings."),
@@ -21,6 +19,15 @@ internal static void Display(ScriptableSentryUnityOptions options)
2119
EditorGUILayout.HelpBox("The SDK requires a DSN.", MessageType.Error);
2220
}
2321

22+
var sampleRate = EditorGUILayout.FloatField(
23+
new GUIContent("Event Sample Rate", "Indicates the percentage of events that are " +
24+
"captured. Setting this to 0.1 captures 10% of events. " +
25+
"Setting this to 1.0 captures all events." +
26+
"\nThis affects only errors and logs, not performance " +
27+
"(transactions) data. See TraceSampleRate for that."),
28+
options.SampleRate);
29+
options.SampleRate = Mathf.Clamp01(sampleRate);
30+
2431
options.CaptureInEditor = EditorGUILayout.Toggle(
2532
new GUIContent("Capture In Editor", "Capture errors while running in the Editor."),
2633
options.CaptureInEditor);
@@ -36,6 +43,7 @@ internal static void Display(ScriptableSentryUnityOptions options)
3643
"diagnostic logs to the console."),
3744
options.Debug);
3845

46+
EditorGUI.indentLevel++;
3947
options.DebugOnlyInEditor = EditorGUILayout.Toggle(
4048
new GUIContent("Only In Editor", "Only print logs when in the editor. Development " +
4149
"builds of the player will not include Sentry's SDK diagnostics."),
@@ -46,6 +54,7 @@ internal static void Display(ScriptableSentryUnityOptions options)
4654
"Log messages with a level below this level are dropped."),
4755
options.DiagnosticLevel);
4856

57+
EditorGUI.indentLevel--;
4958
EditorGUILayout.EndToggleGroup();
5059
}
5160

@@ -55,6 +64,7 @@ internal static void Display(ScriptableSentryUnityOptions options)
5564

5665
{
5766
GUILayout.Label("Tracing - Performance Monitoring", EditorStyles.boldLabel);
67+
EditorGUI.indentLevel++;
5868

5969
var sampleRate = EditorGUILayout.FloatField(
6070
new GUIContent("Traces Sample Rate", "Indicates the percentage of transactions that are " +
@@ -65,7 +75,6 @@ internal static void Display(ScriptableSentryUnityOptions options)
6575

6676
EditorGUI.BeginDisabledGroup(options.TracesSampleRate <= 0);
6777

68-
EditorGUILayout.Space();
6978
GUILayout.Label("Auto Instrumentation", EditorStyles.boldLabel);
7079

7180
options.AutoStartupTraces = EditorGUILayout.Toggle(
@@ -91,6 +100,7 @@ internal static void Display(ScriptableSentryUnityOptions options)
91100
"of Awake as Spans."),
92101
options.AutoAwakeTraces);
93102

103+
EditorGUI.indentLevel--;
94104
EditorGUI.EndDisabledGroup();
95105
}
96106
}

src/Sentry.Unity.Editor/ConfigurationWindow/DebugSymbolsTab.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ internal static void Display(SentryCliOptions cliOptions)
1111
new GUIContent("Upload Symbols", "Whether debug symbols should be uploaded automatically " +
1212
"on release builds."),
1313
cliOptions.UploadSymbols);
14+
EditorGUI.indentLevel++;
1415

1516
cliOptions.UploadDevelopmentSymbols = EditorGUILayout.Toggle(
1617
new GUIContent("Upload Dev Symbols", "Whether debug symbols should be uploaded automatically " +
@@ -52,10 +53,12 @@ internal static void Display(SentryCliOptions cliOptions)
5253

5354
cliOptions.CliOptionsConfiguration = OptionsConfigurationItem.Display(
5455
cliOptions.CliOptionsConfiguration,
55-
"Sentry CLI Config Script",
56+
"CLI Config Script",
5657
"SentryCliConfiguration",
5758
"A scriptable object that inherits from 'SentryCliOptionsConfiguration'." +
5859
"It allows you to programmatically modify the options used during debug symbols upload."
5960
);
61+
62+
EditorGUI.indentLevel--;
6063
}
6164
}

0 commit comments

Comments
 (0)