diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index cc4bd4d82..4827c0d4f 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -110,7 +110,7 @@ public class ChatHandlers : IServiceType private readonly DalamudConfiguration configuration = Service.Get(); private bool hasSeenLoadingMsg; - private bool hasAutoUpdatedPlugins; + private bool startedAutoUpdatingPlugins; [ServiceManager.ServiceConstructor] private ChatHandlers(ChatGui chatGui) @@ -129,6 +129,11 @@ public class ChatHandlers : IServiceType /// public string? LastLink { get; private set; } + /// + /// Gets a value indicating whether or not auto-updates have already completed this session. + /// + public bool IsAutoUpdateComplete { get; private set; } + /// /// Convert a TextPayload to SeString and wrap in italics payloads. /// @@ -185,7 +190,7 @@ public class ChatHandlers : IServiceType if (clientState.LocalPlayer != null && clientState.TerritoryType == 0 && !this.hasSeenLoadingMsg) this.PrintWelcomeMessage(); - if (!this.hasAutoUpdatedPlugins) + if (!this.startedAutoUpdatingPlugins) this.AutoUpdatePlugins(); #if !DEBUG && false @@ -289,13 +294,16 @@ public class ChatHandlers : IServiceType if (!pluginManager.ReposReady || pluginManager.InstalledPlugins.Count == 0 || pluginManager.AvailablePlugins.Count == 0) { // Plugins aren't ready yet. + // TODO: We should retry. This sucks, because it means we won't ever get here again until another notice. return; } - this.hasAutoUpdatedPlugins = true; + this.startedAutoUpdatingPlugins = true; Task.Run(() => pluginManager.UpdatePluginsAsync(true, !this.configuration.AutoUpdatePlugins, true)).ContinueWith(task => { + this.IsAutoUpdateComplete = true; + if (task.IsFaulted) { Log.Error(task.Exception, Loc.Localize("DalamudPluginUpdateCheckFail", "Could not check for plugin updates.")); diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 7e3f0eacd..2912eaf97 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -10,6 +10,7 @@ using System.Reflection; using Dalamud.Configuration; using Dalamud.Configuration.Internal; using Dalamud.Data; +using Dalamud.Game; using Dalamud.Game.Gui; using Dalamud.Game.Text; using Dalamud.Game.Text.Sanitizer; @@ -110,6 +111,11 @@ public sealed class DalamudPluginInterface : IDisposable /// public PluginLoadReason Reason { get; } + /// + /// Gets a value indicating whether or not auto-updates have already completed this session. + /// + public bool IsAutoUpdateComplete => Service.Get().IsAutoUpdateComplete; + /// /// Gets the repository from which this plugin was installed. /// @@ -123,7 +129,7 @@ public sealed class DalamudPluginInterface : IDisposable /// Gets the current internal plugin name. /// public string InternalName => this.pluginName; - + /// /// Gets a value indicating whether this is a dev plugin. ///