fix: EdgegapPlugin progress bar getting stuck when returning early without clearing it

This commit is contained in:
mischa 2023-11-07 20:18:53 +01:00
parent ee76c6aa25
commit 0a3368afe3

View File

@ -343,6 +343,7 @@ async void BuildAndPushServer()
if (!await EdgegapBuildUtils.DockerSetupAndInstallationCheck())
{
onError("Docker installation not found. Docker can be downloaded from:\n\nhttps://www.docker.com/");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
@ -352,6 +353,7 @@ async void BuildAndPushServer()
if (!BuildPipeline.IsBuildTargetSupported(BuildTargetGroup.Standalone, BuildTarget.StandaloneLinux64))
{
onError($"Linux Build Support is missing.\n\nPlease open Unity Hub -> Installs -> Unity {Application.unityVersion} -> Add Modules -> Linux Build Support (IL2CPP & Mono & Dedicated Server) -> Install\n\nAfterwards restart Unity!");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
// END MIRROR CHANGE
@ -361,10 +363,10 @@ async void BuildAndPushServer()
if (buildResult.summary.result != BuildResult.Succeeded)
{
onError("Edgegap build failed, please check the Unity console logs.");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
string registry = _containerRegistry;
string imageName = _containerImageRepo;
string tag = _containerImageTag;
@ -388,12 +390,14 @@ async void BuildAndPushServer()
if (error.Contains("Cannot connect to the Docker daemon"))
{
onError($"{error}\nTo solve this, you can install and run Docker Desktop from:\n\nhttps://www.docker.com/products/docker-desktop");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
if (error.Contains("unauthorized to access repository"))
{
onError($"Docker authorization failed:\n\n{error}\nTo solve this, you can open a terminal and enter 'docker login {registry}', then enter your credentials.");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
@ -401,11 +405,13 @@ async void BuildAndPushServer()
if (Regex.IsMatch(error, @".*project .* not found.*", RegexOptions.IgnoreCase))
{
onError($"{error}\nTo solve this, make sure that Image Repository is 'project/game' where 'project' is from the Container Registry page on the Edgegap website.");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}
// otherwise show generic error message
onError($"Unable to push docker image to registry. Please make sure you're logged in to {registry} and check the following error:\n\n{error}");
EditorUtility.ClearProgressBar(); // MIRROR CHANGE: always clear before returning otherwise it gets stuck there forever!
return;
}