Experimental: no longer run in dev/staging dalamud when not Debug/ReleaseValidate

This commit is contained in:
RisaDev
2024-11-18 01:08:25 +03:00
parent 9c0b8b7ab0
commit 344dc52614
11 changed files with 124 additions and 18 deletions

View File

@@ -2,7 +2,9 @@
using CustomizePlus.Core.Helpers;
using CustomizePlus.Core.Services.Dalamud;
using CustomizePlus.Game.Services;
using CustomizePlus.UI.Windows;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.UI;
namespace CustomizePlus.Core.Services;
@@ -11,17 +13,20 @@ public class UserNotifierService : IDisposable
private readonly IClientState _clientState;
private readonly ChatService _chatService;
private readonly DalamudBranchService _dalamudBranchService;
private readonly PopupSystem _popupSystem;
public UserNotifierService(
IClientState clientState,
ChatService chatService,
DalamudBranchService dalamudBranchService)
DalamudBranchService dalamudBranchService,
PopupSystem popupSystem)
{
_clientState = clientState;
_chatService = chatService;
_dalamudBranchService = dalamudBranchService;
_popupSystem = popupSystem;
OnLogin();
NotifyUser(true);
_clientState.Login += OnLogin;
}
@@ -32,13 +37,26 @@ public class UserNotifierService : IDisposable
}
private void OnLogin()
{
NotifyUser(true);
}
private void NotifyUser(bool displayOptionalMessages = false)
{
if (VersionHelper.IsTesting)
_chatService.PrintInChat($"You are running testing version of Customize+! Some features like integration with other plugins might not function correctly.",
ChatService.ChatMessageColor.Warning);
if (_dalamudBranchService.CurrentBranch != DalamudBranchService.DalamudBranch.Release)
_chatService.PrintInChat($"You are running development or testing version of Dalamud. This is not supported and might be actively prevented in the future.",
if (!_dalamudBranchService.AllowPluginToRun)
{
_chatService.PrintInChat(DalamudBranchService.PluginDisabledMessage,
ChatService.ChatMessageColor.Error);
if (displayOptionalMessages)
{
UIGlobals.PlayChatSoundEffect(11);
_popupSystem.ShowPopup(PopupSystem.Messages.PluginDisabledNonReleaseDalamud);
}
}
}
}