pi: show a warning if a non-release dalamud version is outdated

This commit is contained in:
goat 2024-07-08 20:57:47 +02:00
parent baa875f516
commit 10f9f0b37b
2 changed files with 110 additions and 5 deletions

View file

@ -135,6 +135,8 @@ internal class PluginInstallerWindow : Window, IDisposable
private LoadingIndicatorKind loadingIndicatorKind = LoadingIndicatorKind.Unknown;
private string verifiedCheckmarkHoveredPlugin = string.Empty;
private string? staleDalamudNewVersion = null;
/// <summary>
/// Initializes a new instance of the <see cref="PluginInstallerWindow"/> class.
@ -292,6 +294,20 @@ internal class PluginInstallerWindow : Window, IDisposable
}
this.profileManagerWidget.Reset();
// TODO: Actually check if we are on a tag-0 version here. We might be opted into a beta but have a wrong key.
if (this.staleDalamudNewVersion == null && !Service<DalamudConfiguration>.Get().DalamudBetaKind.IsNullOrEmpty())
{
Service<DalamudReleases>.Get().GetVersionForCurrentTrack().ContinueWith(t =>
{
if (!t.IsCompletedSuccessfully)
return;
var versionInfo = t.Result;
if (versionInfo.AssemblyVersion != Util.GetGitHash())
this.staleDalamudNewVersion = versionInfo.AssemblyVersion;
});
}
}
/// <inheritdoc/>
@ -1488,8 +1504,7 @@ internal class PluginInstallerWindow : Window, IDisposable
return;
}
var pm = Service<PluginManager>.Get();
if (pm.SafeMode)
void DrawWarningIcon()
{
ImGuiHelpers.ScaledDummy(10);
@ -1498,15 +1513,34 @@ internal class PluginInstallerWindow : Window, IDisposable
ImGuiHelpers.CenteredText(FontAwesomeIcon.ExclamationTriangle.ToIconString());
ImGui.PopFont();
ImGui.PopStyleColor();
var lines = Locs.SafeModeDisclaimer.Split('\n');
}
void DrawLinesCentered(string text)
{
var lines = text.Split('\n');
foreach (var line in lines)
{
ImGuiHelpers.CenteredText(line);
}
}
var pm = Service<PluginManager>.Get();
if (pm.SafeMode)
{
DrawWarningIcon();
DrawLinesCentered(Locs.SafeModeDisclaimer);
ImGuiHelpers.ScaledDummy(10);
}
if (this.staleDalamudNewVersion != null)
{
DrawWarningIcon();
DrawLinesCentered("A new version of Dalamud is available.\n" +
"Please restart the game to ensure compatibility with updated plugins.\n" +
$"old: {Util.GetGitHash()} new: {this.staleDalamudNewVersion}");
ImGuiHelpers.ScaledDummy(10);
ImGui.Separator();
}
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImGuiHelpers.ScaledVector2(1, 3));