From dd4714753871edfc07fd1c4b30cd027c43dd9449 Mon Sep 17 00:00:00 2001 From: goaaats Date: Thu, 27 Feb 2025 21:38:06 +0100 Subject: [PATCH] Installer: if main-repo cross update is available, adjust warning message --- .../PluginInstaller/PluginInstallerWindow.cs | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 3abb1bb39..d01063156 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -223,10 +223,11 @@ private enum PluginHeaderFlags IsThirdParty = 1 << 0, HasTrouble = 1 << 1, UpdateAvailable = 1 << 2, - IsNew = 1 << 3, - IsInstallableOutdated = 1 << 4, - IsOrphan = 1 << 5, - IsTesting = 1 << 6, + MainRepoCrossUpdate = 1 << 3, + IsNew = 1 << 4, + IsInstallableOutdated = 1 << 5, + IsOrphan = 1 << 6, + IsTesting = 1 << 7, } private enum InstalledPluginListFilter @@ -2217,7 +2218,12 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk else if (plugin is { IsDecommissioned: true, IsThirdParty: true }) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_NoServiceThird); + + ImGui.TextWrapped( + flags.HasFlag(PluginHeaderFlags.MainRepoCrossUpdate) + ? Locs.PluginBody_NoServiceThirdCrossUpdate + : Locs.PluginBody_NoServiceThird); + ImGui.PopStyleColor(); } else if (plugin != null && !plugin.CheckPolicy()) @@ -2602,7 +2608,10 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani availablePluginUpdate = null; // Update available - if (availablePluginUpdate != default) + var isMainRepoCrossUpdate = availablePluginUpdate != null && + availablePluginUpdate.UpdateManifest.RepoUrl != plugin.Manifest.RepoUrl && + availablePluginUpdate.UpdateManifest.RepoUrl == PluginRepository.MainRepoUrl; + if (availablePluginUpdate != null) { label += Locs.PluginTitleMod_HasUpdate; } @@ -2612,7 +2621,7 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani if (this.updatedPlugins != null && !plugin.IsDev) { var update = this.updatedPlugins.FirstOrDefault(update => update.InternalName == plugin.Manifest.InternalName); - if (update != default) + if (update != null) { if (update.Status == PluginUpdateStatus.StatusKind.Success) { @@ -2640,8 +2649,8 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani trouble = true; } - // Orphaned - if (plugin.IsOrphaned) + // Orphaned, if we don't have a cross-repo update + if (plugin.IsOrphaned && !isMainRepoCrossUpdate) { label += Locs.PluginTitleMod_OrphanedError; trouble = true; @@ -2670,7 +2679,7 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani string? availableChangelog = null; var didDrawAvailableChangelogInsideCollapsible = false; - if (availablePluginUpdate != default) + if (availablePluginUpdate != null) { availablePluginUpdateVersion = availablePluginUpdate.UseTesting ? @@ -2688,8 +2697,10 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani flags |= PluginHeaderFlags.IsThirdParty; if (trouble) flags |= PluginHeaderFlags.HasTrouble; - if (availablePluginUpdate != default) + if (availablePluginUpdate != null) flags |= PluginHeaderFlags.UpdateAvailable; + if (isMainRepoCrossUpdate) + flags |= PluginHeaderFlags.MainRepoCrossUpdate; if (plugin.IsOrphaned) flags |= PluginHeaderFlags.IsOrphan; if (plugin.IsTesting) @@ -4056,6 +4067,8 @@ internal static class Locs public static string PluginBody_NoServiceThird => Loc.Localize("InstallerNoServiceThirdPluginBody", "This plugin is no longer being serviced by its source repo. You may have to look for an updated version in another repo."); + public static string PluginBody_NoServiceThirdCrossUpdate => Loc.Localize("InstallerNoServiceThirdCrossUpdatePluginBody", "This plugin is no longer being serviced by its source repo. An update is available and will update it to a version from the official repository."); + public static string PluginBody_LoadFailed => Loc.Localize("InstallerLoadFailedPluginBody ", "This plugin failed to load. Please contact the author for more information."); public static string PluginBody_Banned => Loc.Localize("InstallerBannedPluginBody ", "This plugin was automatically disabled due to incompatibilities and is not available.");