mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
feat: add IsAutoUpdateComplete to DPI
This commit is contained in:
parent
839519b2bb
commit
ca8a05b672
2 changed files with 18 additions and 4 deletions
|
|
@ -110,7 +110,7 @@ public class ChatHandlers : IServiceType
|
||||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
private bool hasSeenLoadingMsg;
|
private bool hasSeenLoadingMsg;
|
||||||
private bool hasAutoUpdatedPlugins;
|
private bool startedAutoUpdatingPlugins;
|
||||||
|
|
||||||
[ServiceManager.ServiceConstructor]
|
[ServiceManager.ServiceConstructor]
|
||||||
private ChatHandlers(ChatGui chatGui)
|
private ChatHandlers(ChatGui chatGui)
|
||||||
|
|
@ -129,6 +129,11 @@ public class ChatHandlers : IServiceType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? LastLink { get; private set; }
|
public string? LastLink { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether or not auto-updates have already completed this session.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAutoUpdateComplete { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a TextPayload to SeString and wrap in italics payloads.
|
/// Convert a TextPayload to SeString and wrap in italics payloads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -185,7 +190,7 @@ public class ChatHandlers : IServiceType
|
||||||
if (clientState.LocalPlayer != null && clientState.TerritoryType == 0 && !this.hasSeenLoadingMsg)
|
if (clientState.LocalPlayer != null && clientState.TerritoryType == 0 && !this.hasSeenLoadingMsg)
|
||||||
this.PrintWelcomeMessage();
|
this.PrintWelcomeMessage();
|
||||||
|
|
||||||
if (!this.hasAutoUpdatedPlugins)
|
if (!this.startedAutoUpdatingPlugins)
|
||||||
this.AutoUpdatePlugins();
|
this.AutoUpdatePlugins();
|
||||||
|
|
||||||
#if !DEBUG && false
|
#if !DEBUG && false
|
||||||
|
|
@ -289,13 +294,16 @@ public class ChatHandlers : IServiceType
|
||||||
if (!pluginManager.ReposReady || pluginManager.InstalledPlugins.Count == 0 || pluginManager.AvailablePlugins.Count == 0)
|
if (!pluginManager.ReposReady || pluginManager.InstalledPlugins.Count == 0 || pluginManager.AvailablePlugins.Count == 0)
|
||||||
{
|
{
|
||||||
// Plugins aren't ready yet.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasAutoUpdatedPlugins = true;
|
this.startedAutoUpdatingPlugins = true;
|
||||||
|
|
||||||
Task.Run(() => pluginManager.UpdatePluginsAsync(true, !this.configuration.AutoUpdatePlugins, true)).ContinueWith(task =>
|
Task.Run(() => pluginManager.UpdatePluginsAsync(true, !this.configuration.AutoUpdatePlugins, true)).ContinueWith(task =>
|
||||||
{
|
{
|
||||||
|
this.IsAutoUpdateComplete = true;
|
||||||
|
|
||||||
if (task.IsFaulted)
|
if (task.IsFaulted)
|
||||||
{
|
{
|
||||||
Log.Error(task.Exception, Loc.Localize("DalamudPluginUpdateCheckFail", "Could not check for plugin updates."));
|
Log.Error(task.Exception, Loc.Localize("DalamudPluginUpdateCheckFail", "Could not check for plugin updates."));
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Reflection;
|
||||||
using Dalamud.Configuration;
|
using Dalamud.Configuration;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Game.Text.Sanitizer;
|
using Dalamud.Game.Text.Sanitizer;
|
||||||
|
|
@ -110,6 +111,11 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PluginLoadReason Reason { get; }
|
public PluginLoadReason Reason { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether or not auto-updates have already completed this session.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAutoUpdateComplete => Service<ChatHandlers>.Get().IsAutoUpdateComplete;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the repository from which this plugin was installed.
|
/// Gets the repository from which this plugin was installed.
|
||||||
///
|
///
|
||||||
|
|
@ -123,7 +129,7 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
/// Gets the current internal plugin name.
|
/// Gets the current internal plugin name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string InternalName => this.pluginName;
|
public string InternalName => this.pluginName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this is a dev plugin.
|
/// Gets a value indicating whether this is a dev plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue