fix: don't unload plugin until update is downloaded, show proper errors

This commit is contained in:
goat 2023-11-02 19:42:32 +01:00
parent 403e94f9d0
commit 7f87d2a9d2
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
3 changed files with 235 additions and 156 deletions

View file

@ -728,10 +728,10 @@ internal class PluginInstallerWindow : Window, IDisposable
}
else
{
this.updatedPlugins = task.Result.Where(res => res.WasUpdated).ToList();
this.updatedPlugins = task.Result.Where(res => res.Status == PluginUpdateStatus.StatusKind.Success).ToList();
this.updatePluginCount = this.updatedPlugins.Count;
var errorPlugins = task.Result.Where(res => !res.WasUpdated).ToList();
var errorPlugins = task.Result.Where(res => res.Status != PluginUpdateStatus.StatusKind.Success).ToList();
var errorPluginCount = errorPlugins.Count;
if (errorPluginCount > 0)
@ -739,9 +739,9 @@ internal class PluginInstallerWindow : Window, IDisposable
var errorMessage = this.updatePluginCount > 0
? Locs.ErrorModal_UpdaterFailPartial(this.updatePluginCount, errorPluginCount)
: Locs.ErrorModal_UpdaterFail(errorPluginCount);
var hintInsert = errorPlugins
.Aggregate(string.Empty, (current, pluginUpdateStatus) => $"{current}* {pluginUpdateStatus.InternalName}\n")
.Aggregate(string.Empty, (current, pluginUpdateStatus) => $"{current}* {pluginUpdateStatus.InternalName} ({PluginUpdateStatus.LocalizeUpdateStatusKind(pluginUpdateStatus.Status)})\n")
.TrimEnd();
errorMessage += Locs.ErrorModal_HintBlame(hintInsert);
@ -2250,7 +2250,7 @@ internal class PluginInstallerWindow : Window, IDisposable
var update = this.updatedPlugins.FirstOrDefault(update => update.InternalName == plugin.Manifest.InternalName);
if (update != default)
{
if (update.WasUpdated)
if (update.Status == PluginUpdateStatus.StatusKind.Success)
{
thisWasUpdated = true;
label += Locs.PluginTitleMod_Updated;