Skip to content

Commit

Permalink
Installer: if main-repo cross update is available, adjust warning mes…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
goaaats committed Feb 27, 2025
1 parent defa498 commit dd47147
Showing 1 changed file with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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;
}
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ?
Expand All @@ -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)
Expand Down Expand Up @@ -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.");
Expand Down

0 comments on commit dd47147

Please sign in to comment.