Skip to content

Commit

Permalink
feat: wizard notes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Jun 14, 2022
1 parent 4917350 commit 55253e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal static void SaveWizardResult(WizardConfiguration config)
var options = SentryScriptableObject.CreateOrLoad<ScriptableSentryUnityOptions>(OptionsPath);
var cliOptions = SentryScriptableObject.CreateOrLoad<SentryCliOptions>(CliOptionsPath);
options.Dsn = config.Dsn;
cliOptions.UploadSymbols = config.UploadSymbols;
cliOptions.UploadSymbols = !string.IsNullOrWhiteSpace(config.Token);
cliOptions.Auth = config.Token;
cliOptions.Organization = config.OrgSlug;
cliOptions.Project = config.ProjectSlug;
Expand Down
30 changes: 20 additions & 10 deletions src/Sentry.Unity.Editor/ConfigurationWindow/Wizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ internal class Wizard : EditorWindow
{
private int _projectSelected = 0;
private int _orgSelected = 0;
private bool _uploadSymbols = false;

private static Wizard? Instance;
internal WizardStep2Response? Response { get; set; }
Expand All @@ -42,7 +41,13 @@ public static void Start(IDiagnosticLogger logger)
private void StartLoder()
{
_task = new WizardLoader(this, _logger);
Task.Run(async () => Response = await _task.Load());
Task.Run(async () => Response = await _task.Load()).ContinueWith(t =>
{
if (t.Exception is not null)
{
_logger.Log(SentryLevel.Warning, "Wizard loader failed", t.Exception);
}
});
}

public static bool InProgress => Instance is not null;
Expand Down Expand Up @@ -110,12 +115,6 @@ private void OnGUI()
.Prepend(firstEntry).ToArray());
}

if (_projectSelected != 0)
{
_uploadSymbols = EditorGUILayout.Toggle(new GUIContent("Upload debug symbols",
"Should we upload debug symbols to sentry.io to improve stack traces on errors"), _uploadSymbols);
}

if (_projectSelected != 0)
{
var proj = orgsAndProjects[_orgSelected - 1].ToArray()[_projectSelected - 1];
Expand All @@ -125,7 +124,6 @@ private void OnGUI()
Dsn = proj.Keys.First().Dsn!.Public,
OrgSlug = proj.Organization!.Slug,
ProjectSlug = proj.Slug,
UploadSymbols = _uploadSymbols
};
}
}
Expand All @@ -134,6 +132,19 @@ private void OnGUI()
{
GUILayout.FlexibleSpace();

EditorGUILayout.LabelField("We have updated the default options with your selection.");

EditorGUILayout.HelpBox(
"Sentry options persist in two assets in your project directory:\n" +
" Resources/Sentry/SentryOptions.asset contains the main configuration,\n" +
" Plugins/Sentry/SentryCliOptions.asset contains the settings for debug symbol upload.",
MessageType.Info);
EditorGUILayout.HelpBox(
"Make sure to keep the SentryCliOptions.asset private because it contains an API authentication token linked to your account.",
MessageType.Warning);

GUILayout.FlexibleSpace();

EditorGUILayout.LabelField("Would you like to inspect the settings or leave at defaults for now? ");
EditorGUILayout.LabelField("You can always make changes later in the Tools/Sentry menu.");
EditorGUILayout.Space();
Expand Down Expand Up @@ -257,7 +268,6 @@ internal class WizardConfiguration
public string? Dsn { get; set; }
public string? OrgSlug { get; set; }
public string? ProjectSlug { get; set; }
public bool UploadSymbols { get; set; } = false;
}

internal class WizardCancelled : Exception
Expand Down

0 comments on commit 55253e5

Please sign in to comment.