Replace update message with link to changelog

...instead of pointing to Discord
This commit is contained in:
goaaats 2025-04-15 21:43:08 +02:00
parent af1eb275cf
commit cb8d9cc397
4 changed files with 36 additions and 9 deletions

View file

@ -8,6 +8,8 @@ using Dalamud.Configuration.Internal;
using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Logging.Internal;
using Dalamud.Plugin.Internal;
@ -100,8 +102,6 @@ internal partial class ChatHandlers : IServiceType
if (chatGui == null || pluginManager == null || dalamudInterface == null)
return;
var assemblyVersion = Assembly.GetAssembly(typeof(ChatHandlers)).GetName().Version.ToString();
if (this.configuration.PrintDalamudWelcomeMsg)
{
chatGui.Print(string.Format(Loc.Localize("DalamudWelcome", "Dalamud {0} loaded."), Util.GetScmVersion())
@ -116,15 +116,30 @@ internal partial class ChatHandlers : IServiceType
}
}
if (string.IsNullOrEmpty(this.configuration.LastVersion) || !assemblyVersion.StartsWith(this.configuration.LastVersion))
if (string.IsNullOrEmpty(this.configuration.LastVersion) || !Util.AssemblyVersion.StartsWith(this.configuration.LastVersion))
{
var linkPayload = chatGui.AddChatLinkHandler(
"dalamud",
8459324,
(_, _) => dalamudInterface.OpenPluginInstallerTo(PluginInstallerOpenKind.Changelogs));
var updateMessage = new SeStringBuilder()
.AddText(Loc.Localize("DalamudUpdated", "Dalamud has been updated successfully!"))
.AddUiForeground(500)
.AddText(" [")
.Add(linkPayload)
.AddText(Loc.Localize("DalamudClickToViewChangelogs", " Click here to view the changelog."))
.Add(RawPayload.LinkTerminator)
.AddText("]")
.AddUiForegroundOff();
chatGui.Print(new XivChatEntry
{
Message = Loc.Localize("DalamudUpdated", "Dalamud has been updated successfully! Please check the discord for a full changelog."),
Message = updateMessage.Build(),
Type = XivChatType.Notice,
});
this.configuration.LastVersion = assemblyVersion;
this.configuration.LastVersion = Util.AssemblyVersion;
this.configuration.QueueSave();
}

View file

@ -220,6 +220,7 @@ internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui
/// <param name="commandId">The ID of the command to run.</param>
/// <param name="commandAction">The command action itself.</param>
/// <returns>A payload for handling.</returns>
[Api13ToDo("Plugins should not specify their own command IDs here. We should assign them ourselves.")]
internal DalamudLinkPayload AddChatLinkHandler(string pluginName, uint commandId, Action<uint, SeString> commandAction)
{
var payload = new DalamudLinkPayload { Plugin = pluginName, CommandId = commandId };

View file

@ -14,16 +14,21 @@ public enum PluginInstallerOpenKind
/// Open to the "Installed Plugins" page.
/// </summary>
InstalledPlugins,
/// <summary>
/// Open to the "Can be updated" page.
/// </summary>
UpdateablePlugins,
/// <summary>
/// Open to the "Changelogs" page.
/// Open to the "Plugin Changelogs" page.
/// </summary>
Changelogs,
/// <summary>
/// Open to the "Dalamud Changelogs" page.
/// </summary>
DalamudChangelogs,
}
/// <summary>
@ -35,12 +40,12 @@ public enum SettingsOpenKind
/// Open to the "General" page.
/// </summary>
General,
/// <summary>
/// Open to the "Look &#038; Feel" page.
/// </summary>
LookAndFeel,
/// <summary>
/// Open to the "Auto Updates" page.
/// </summary>

View file

@ -501,6 +501,12 @@ internal class PluginInstallerWindow : Window, IDisposable
// Plugins category
this.categoryManager.CurrentCategoryKind = PluginCategoryManager.CategoryKind.All;
break;
case PluginInstallerOpenKind.DalamudChangelogs:
// Changelog group
this.categoryManager.CurrentGroupKind = PluginCategoryManager.GroupKind.Changelog;
// Dalamud category
this.categoryManager.CurrentCategoryKind = PluginCategoryManager.CategoryKind.DalamudChangelogs;
break;
default:
throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
}