add NotificationService, cleanup

This commit is contained in:
Stanley Dimant
2023-01-31 14:43:22 +01:00
parent 12f0789e9c
commit 576d005b32
17 changed files with 243 additions and 84 deletions

View File

@@ -285,8 +285,6 @@ public class CharacterDataFactory
Thread.Sleep(50);
}
_dalamudUtil.WaitWhileCharacterIsDrawing(objectKind.ToString(), charaPointer, objectKind == ObjectKind.MinionOrMount ? 1000 : 15000);
var human = (Human*)((Character*)charaPointer)->GameObject.GetDrawObject();
for (var mdlIdx = 0; mdlIdx < human->CharacterBase.SlotCount; ++mdlIdx)
{

View File

@@ -1,4 +1,5 @@
using Dalamud.Logging;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Logging;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Enum;
@@ -143,11 +144,12 @@ public class CachedPlayer : IDisposable
}
}
List<string> missingPluginsForData = new();
if (characterData.HeelsOffset != default)
{
if (!warning.ShownHeelsWarning && !_ipcManager.CheckHeelsApi())
{
_dalamudUtil.PrintWarnChat("Received Heels data for player " + PlayerName + ", but Heels is not installed. Install Heels to experience their character fully.");
missingPluginsForData.Add("Heels");
warning.ShownHeelsWarning = true;
}
}
@@ -155,7 +157,7 @@ public class CachedPlayer : IDisposable
{
if (!warning.ShownCustomizePlusWarning && !_ipcManager.CheckCustomizePlusApi())
{
_dalamudUtil.PrintWarnChat("Received Customize+ data for player " + PlayerName + ", but Customize+ is not installed. Install Customize+ to experience their character fully.");
missingPluginsForData.Add("Customize+");
warning.ShownCustomizePlusWarning = true;
}
}
@@ -164,11 +166,18 @@ public class CachedPlayer : IDisposable
{
if (!warning.ShownPalettePlusWarning && !_ipcManager.CheckPalettePlusApi())
{
_dalamudUtil.PrintWarnChat("Received Palette+ data for player " + PlayerName + ", but Palette+ is not installed. Install Palette+ to experience their character fully.");
missingPluginsForData.Add("Palette+");
warning.ShownPalettePlusWarning = true;
}
}
if (missingPluginsForData.Any())
{
_mediator.Publish(new NotificationMessage("Missing plugins for " + PlayerName,
$"Received data for {PlayerName} that contained information for plugins you have not installed. Install {string.Join(", ", missingPluginsForData)} to experience their character fully.",
NotificationType.Warning, 10000));
}
_cachedData = characterData;
DownloadAndApplyCharacter(charaDataToUpdate, updateModdedPaths);

View File

@@ -177,7 +177,7 @@ public class IpcManager : IDisposable
}
}
public bool Initialized => CheckPenumbraApi();
public bool Initialized => CheckPenumbraApi() && CheckGlamourerApi();
public bool CheckGlamourerApi()
{
try

View File

@@ -0,0 +1,103 @@
using Dalamud.Game.Gui;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Mediator;
using MareSynchronos.Utils;
namespace MareSynchronos.Managers;
public class NotificationService
{
private readonly UiBuilder _uiBuilder;
private readonly ChatGui _chatGui;
private readonly ConfigurationService _configurationService;
public NotificationService(MareMediator mediator, UiBuilder uiBuilder, ChatGui chatGui, ConfigurationService configurationService)
{
_uiBuilder = uiBuilder;
_chatGui = chatGui;
_configurationService = configurationService;
mediator.Subscribe<NotificationMessage>(this, (msg) => ShowNotification((NotificationMessage)msg));
}
private void ShowNotification(NotificationMessage msg)
{
Logger.Info(msg.ToString());
switch (msg.Type)
{
case NotificationType.Info:
case NotificationType.Success:
case NotificationType.None:
ShowNotificationLocationBased(msg, _configurationService.Current.InfoNotification);
break;
case NotificationType.Warning:
ShowNotificationLocationBased(msg, _configurationService.Current.WarningNotification);
break;
case NotificationType.Error:
ShowNotificationLocationBased(msg, _configurationService.Current.ErrorNotification);
break;
}
}
private void ShowNotificationLocationBased(NotificationMessage msg, NotificationLocation location)
{
switch (location)
{
case NotificationLocation.Toast:
ShowToast(msg);
break;
case NotificationLocation.Chat:
ShowChat(msg);
break;
case NotificationLocation.Both:
ShowToast(msg);
ShowChat(msg);
break;
case NotificationLocation.Nowhere:
break;
}
}
private void ShowToast(NotificationMessage msg)
{
_uiBuilder.AddNotification(msg.Message ?? string.Empty, "[Mare Synchronos] " + msg.Title, msg.Type, msg.TimeShownOnScreen);
}
private void ShowChat(NotificationMessage msg)
{
switch (msg.Type)
{
case NotificationType.Info:
case NotificationType.Success:
case NotificationType.None:
PrintInfoChat(msg.Message);
break;
case NotificationType.Warning:
PrintWarnChat(msg.Message);
break;
case NotificationType.Error:
PrintErrorChat(msg.Message);
break;
}
}
private void PrintInfoChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] Info: ").AddItalics(message ?? string.Empty);
_chatGui.Print(se.BuiltString);
}
private void PrintWarnChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] ").AddUiForeground("Warning: " + (message ?? string.Empty), 31).AddUiForegroundOff();
_chatGui.Print(se.BuiltString);
}
private void PrintErrorChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] ").AddUiForeground("Error: ", 534).AddItalicsOn().AddUiForeground(message ?? string.Empty, 534).AddUiForegroundOff().AddItalicsOff();
_chatGui.Print(se.BuiltString);
}
}

View File

@@ -1,5 +1,6 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Utility;
using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Comparer;
@@ -21,16 +22,14 @@ public class PairManager : IDisposable
private readonly ConcurrentDictionary<UserData, Pair> _allClientPairs = new(UserDataComparer.Instance);
private readonly ConcurrentDictionary<GroupData, GroupFullInfoDto> _allGroups = new(GroupDataComparer.Instance);
private readonly CachedPlayerFactory _cachedPlayerFactory;
private readonly DalamudUtil _dalamudUtil;
private readonly PairFactory _pairFactory;
private readonly UiBuilder _uiBuilder;
private readonly ConfigurationService _configurationService;
private readonly MareMediator _mediator;
public PairManager(CachedPlayerFactory cachedPlayerFactory, DalamudUtil dalamudUtil, PairFactory pairFactory, UiBuilder uiBuilder, ConfigurationService configurationService, MareMediator mediator)
public PairManager(CachedPlayerFactory cachedPlayerFactory, PairFactory pairFactory, UiBuilder uiBuilder, ConfigurationService configurationService, MareMediator mediator)
{
_cachedPlayerFactory = cachedPlayerFactory;
_dalamudUtil = dalamudUtil;
_pairFactory = pairFactory;
_uiBuilder = uiBuilder;
_configurationService = configurationService;
@@ -172,20 +171,24 @@ public class PairManager : IDisposable
public void MarkPairOnline(OnlineUserIdentDto dto, ApiController controller)
{
if (!_allClientPairs.ContainsKey(dto.User)) throw new InvalidOperationException("No user found for " + dto);
var pair = _allClientPairs[dto.User];
if (pair.CachedPlayer != null) return;
if (_allClientPairs[dto.User].CachedPlayer != null) return;
if (_configurationService.Current.ShowOnlineNotifications)
if (_configurationService.Current.ShowOnlineNotifications
&& ((_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs && pair.UserPair != null)
|| !_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs)
&& (_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs && !string.IsNullOrEmpty(pair.GetNote())
|| !_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs))
{
var pair = _allClientPairs[dto.User];
if (_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs && pair.UserPair != null || !_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs)
{
_uiBuilder.AddNotification(string.Empty, "[Mare Synchronos] " + (pair.GetNote() ?? pair.UserData.AliasOrUID) + " is now online", Dalamud.Interface.Internal.Notifications.NotificationType.Info, 5000);
}
string note = pair.GetNote();
var msg = string.IsNullOrEmpty(note)
? $"{note} ({pair.UserData.AliasOrUID}) is now online"
: $"{pair.UserData.AliasOrUID} is now online";
_mediator.Publish(new NotificationMessage("User online", msg, NotificationType.Info, 5000));
}
_allClientPairs[dto.User].CachedPlayer?.Dispose();
_allClientPairs[dto.User].CachedPlayer = _cachedPlayerFactory.Create(dto, controller);
pair.CachedPlayer?.Dispose();
pair.CachedPlayer = _cachedPlayerFactory.Create(dto, controller);
RecreateLazy();
}

View File

@@ -3,7 +3,6 @@ using MareSynchronos.Utils;
using MareSynchronos.WebAPI;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using MareSynchronos.Models;
using MareSynchronos.UI;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.Mediator;
#if DEBUG
@@ -55,10 +54,10 @@ public class PlayerManager : MediatorSubscriberBase, IDisposable
_playerRelatedObjects = new List<PlayerRelatedObject>()
{
new PlayerRelatedObject(ObjectKind.Player, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.PlayerPointer),
new PlayerRelatedObject(ObjectKind.MinionOrMount, IntPtr.Zero, IntPtr.Zero, () => (IntPtr)((Character*)_dalamudUtil.PlayerPointer)->CompanionObject),
new PlayerRelatedObject(ObjectKind.Pet, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.GetPet()),
new PlayerRelatedObject(ObjectKind.Companion, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.GetCompanion()),
new(ObjectKind.Player, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.PlayerPointer),
new(ObjectKind.MinionOrMount, IntPtr.Zero, IntPtr.Zero, () => (IntPtr)((Character*)_dalamudUtil.PlayerPointer)->CompanionObject),
new(ObjectKind.Pet, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.GetPet()),
new(ObjectKind.Companion, IntPtr.Zero, IntPtr.Zero, () => _dalamudUtil.GetCompanion()),
};
}

View File

@@ -19,7 +19,6 @@ public class MareConfig : IPluginConfiguration
public int TimeSpanBetweenScansInSeconds { get; set; } = 30;
public bool FileScanPaused { get; set; } = false;
public bool InitialScanComplete { get; set; } = false;
public bool HideInfoMessages { get; set; } = false;
public bool DisableOptionalPluginWarnings { get; set; } = false;
public bool OpenGposeImportOnGposeStart { get; set; } = false;
public bool ShowTransferWindow { get; set; } = true;
@@ -27,5 +26,9 @@ public class MareConfig : IPluginConfiguration
public string CurrentServer { get; set; } = string.Empty;
public bool ShowOnlineNotifications { get; set; } = false;
public bool ShowOnlineNotificationsOnlyForIndividualPairs { get; set; } = true;
public bool ShowOnlineNotificationsOnlyForNamedPairs { get; set; } = false;
public bool ShowCharacterNameInsteadOfNotesForVisible { get; set; } = false;
public NotificationLocation InfoNotification { get; set; } = NotificationLocation.Toast;
public NotificationLocation WarningNotification { get; set; } = NotificationLocation.Both;
public NotificationLocation ErrorNotification { get; set;} = NotificationLocation.Both;
}

View File

@@ -0,0 +1,9 @@
namespace MareSynchronos.MareConfiguration;
public enum NotificationLocation
{
Nowhere,
Chat,
Toast,
Both
}

View File

@@ -1,6 +1,4 @@
using MareSynchronos.Mediator;
namespace MareSynchronos.Utils;
namespace MareSynchronos.Mediator;
public abstract class MediatorSubscriberBase : IDisposable
{
@@ -9,7 +7,7 @@ public abstract class MediatorSubscriberBase : IDisposable
Mediator = mediator;
}
protected MareMediator Mediator;
protected readonly MareMediator Mediator;
public virtual void Dispose()
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dalamud.Interface.Internal.Notifications;
namespace MareSynchronos.Mediator;
@@ -37,4 +33,6 @@ public record PlayerRelatedObjectPointerUpdateMessage(IntPtr[] RelatedObjects) :
public record HaltScanMessage(string Source) : IMessage;
public record ResumeScanMessage(string Source) : IMessage;
public record NotificationMessage
(string Title, string Message, NotificationType Type, uint TimeShownOnScreen = 3000) : IMessage;
#pragma warning restore MA0048 // File name must match type name

View File

@@ -62,6 +62,7 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<PeriodicFileScanner>();
collection.AddSingleton<FileReplacementFactory>();
collection.AddSingleton<MareCharaFileManager>();
collection.AddSingleton<NotificationService>();
collection.AddSingleton<UiShared>();
collection.AddSingleton<SettingsUi>();
@@ -90,6 +91,7 @@ public sealed class Plugin : IDalamudPlugin
_serviceProvider.GetRequiredService<GposeUi>();
_serviceProvider.GetRequiredService<IntroUi>();
_serviceProvider.GetRequiredService<DownloadUi>();
_serviceProvider.GetRequiredService<NotificationService>();
}
public string Name => "Mare Synchronos";

View File

@@ -14,6 +14,8 @@ using MareSynchronos.Managers;
using MareSynchronos.API.Data.Comparer;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Mediator;
using Lumina.Excel.GeneratedSheets;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace MareSynchronos.UI;
@@ -453,10 +455,6 @@ public class SettingsUi : Window, IDisposable
}
var openPopupOnAddition = _configService.Current.OpenPopupOnAdd;
var hideInfoMessages = _configService.Current.HideInfoMessages;
var disableOptionalPluginWarnings = _configService.Current.DisableOptionalPluginWarnings;
var onlineNotifs = _configService.Current.ShowOnlineNotifications;
var onlineNotifsPairsOnly = _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs;
if (ImGui.Checkbox("Open Notes Popup on user addition", ref openPopupOnAddition))
{
@@ -485,25 +483,85 @@ public class SettingsUi : Window, IDisposable
ImGui.Separator();
UiShared.FontText("Server Messages", _uiShared.UidFont);
if (ImGui.Checkbox("Hide Server Info Messages", ref hideInfoMessages))
var disableOptionalPluginWarnings = _configService.Current.DisableOptionalPluginWarnings;
var onlineNotifs = _configService.Current.ShowOnlineNotifications;
var onlineNotifsPairsOnly = _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs;
var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs;
var infoNotifLocation = _configService.Current.InfoNotification;
var warnNotifLocation = _configService.Current.WarningNotification;
var errorNotifLocation = _configService.Current.ErrorNotification;
UiShared.FontText("Notifications", _uiShared.UidFont);
if (ImGui.BeginCombo("Info Notification Display", infoNotifLocation.ToString()))
{
_configService.Current.HideInfoMessages = hideInfoMessages;
_configService.Save();
foreach (var item in (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)))
{
bool isSelected = item == infoNotifLocation;
if (ImGui.Selectable(item.ToString(), isSelected))
{
_configService.Current.InfoNotification = item;
_configService.Save();
}
}
ImGui.EndCombo();
}
UiShared.DrawHelpText("Enabling this will not print any \"Info\" labeled messages into the game chat.");
UiShared.DrawHelpText("The location where \"Info\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Info notifications"
+ Environment.NewLine + "'Chat' will print Info notifications in chat"
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
+ Environment.NewLine + "'Both' will show chat as well as the toast notification");
if (ImGui.BeginCombo("Warning Notification Display", warnNotifLocation.ToString()))
{
foreach (var item in (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)))
{
bool isSelected = item == warnNotifLocation;
if (ImGui.Selectable(item.ToString(), isSelected))
{
_configService.Current.WarningNotification = item;
_configService.Save();
}
}
ImGui.EndCombo();
}
UiShared.DrawHelpText("The location where \"Warning\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Warning notifications"
+ Environment.NewLine + "'Chat' will print Warning notifications in chat"
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
+ Environment.NewLine + "'Both' will show chat as well as the toast notification");
if (ImGui.BeginCombo("Error Notification Display", warnNotifLocation.ToString()))
{
foreach (var item in (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)))
{
bool isSelected = item == errorNotifLocation;
if (ImGui.Selectable(item.ToString(), isSelected))
{
_configService.Current.ErrorNotification = item;
_configService.Save();
}
}
ImGui.EndCombo();
}
UiShared.DrawHelpText("The location where \"Error\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Error notifications"
+ Environment.NewLine + "'Chat' will print Error notifications in chat"
+ Environment.NewLine + "'Toast' will show Error toast notifications in the bottom right corner"
+ Environment.NewLine + "'Both' will show chat as well as the toast notification");
if (ImGui.Checkbox("Disable optional plugin warnings", ref disableOptionalPluginWarnings))
{
_configService.Current.DisableOptionalPluginWarnings = disableOptionalPluginWarnings;
_configService.Save();
}
UiShared.DrawHelpText("Enabling this will not print any \"Warning\" labeled messages for missing optional plugins Heels or Customize+ in the game chat.");
UiShared.DrawHelpText("Enabling this will not show any \"Warning\" labeled messages for missing optional plugins.");
if (ImGui.Checkbox("Enable online notifications", ref onlineNotifs))
{
_configService.Current.ShowOnlineNotifications = onlineNotifs;
_configService.Save();
}
UiShared.DrawHelpText("Enabling this will show a small notification in the bottom right corner when pairs go online.");
UiShared.DrawHelpText("Enabling this will show a small notification (type: Info) in the bottom right corner when pairs go online.");
if (!onlineNotifs) ImGui.BeginDisabled();
if (ImGui.Checkbox("Notify only for individual pairs", ref onlineNotifsPairsOnly))
@@ -511,7 +569,13 @@ public class SettingsUi : Window, IDisposable
_configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs = onlineNotifsPairsOnly;
_configService.Save();
}
UiShared.DrawHelpText("Enabling this will only show online notifications for individual pairs.");
UiShared.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs.");
if (ImGui.Checkbox("Notify only for named pairs", ref onlineNotifsNamedOnly))
{
_configService.Current.ShowOnlineNotificationsOnlyForNamedPairs = onlineNotifsNamedOnly;
_configService.Save();
}
UiShared.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note.");
if (!onlineNotifs) ImGui.EndDisabled();
}

View File

@@ -13,7 +13,6 @@ using MareSynchronos.FileCache;
using MareSynchronos.Localization;
using MareSynchronos.Managers;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Mediator;
using MareSynchronos.Models;
using MareSynchronos.Utils;
using MareSynchronos.WebAPI;

View File

@@ -19,8 +19,6 @@ public class DalamudUtil : IDisposable
private readonly ObjectTable _objectTable;
private readonly Framework _framework;
private readonly Dalamud.Game.ClientState.Conditions.Condition _condition;
private readonly ChatGui _chatGui;
private readonly Dalamud.Data.DataManager _gameData;
private readonly MareMediator _mediator;
private uint? _classJobId = 0;
@@ -42,15 +40,13 @@ public class DalamudUtil : IDisposable
}
public DalamudUtil(ClientState clientState, ObjectTable objectTable, Framework framework,
Dalamud.Game.ClientState.Conditions.Condition condition, ChatGui chatGui,
Dalamud.Game.ClientState.Conditions.Condition condition,
Dalamud.Data.DataManager gameData, MareMediator mediator)
{
_clientState = clientState;
_objectTable = objectTable;
_framework = framework;
_condition = condition;
_chatGui = chatGui;
_gameData = gameData;
_mediator = mediator;
_framework.Update += FrameworkOnUpdate;
if (IsLoggedIn)
@@ -67,24 +63,6 @@ public class DalamudUtil : IDisposable
public Lazy<Dictionary<ushort, string>> WorldData { get; private set; }
public void PrintInfoChat(string message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] Info: ").AddItalics(message);
_chatGui.Print(se.BuiltString);
}
public void PrintWarnChat(string message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] ").AddUiForeground("Warning: " + message, 31).AddUiForegroundOff();
_chatGui.Print(se.BuiltString);
}
public void PrintErrorChat(string message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] ").AddUiForeground("Error: ", 534).AddItalicsOn().AddUiForeground(message, 534).AddUiForegroundOff().AddItalicsOff();
_chatGui.Print(se.BuiltString);
}
private unsafe void FrameworkOnUpdate(Framework framework)
{
if (GposeTarget != null && !IsInGpose)

View File

@@ -1,7 +1,5 @@
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace MareSynchronos.Utils;

View File

@@ -1,7 +1,9 @@
using MareSynchronos.API.Data.Enum;
using Dalamud.Interface.Internal.Notifications;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.API.Dto;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.API.Dto.User;
using MareSynchronos.Mediator;
using MareSynchronos.Utils;
using Microsoft.AspNetCore.SignalR.Client;
@@ -253,19 +255,13 @@ public partial class ApiController
switch (severity)
{
case MessageSeverity.Error:
Logger.Error(message);
_dalamudUtil.PrintErrorChat(message);
_mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Error, 7500));
break;
case MessageSeverity.Warning:
Logger.Warn(message);
_dalamudUtil.PrintWarnChat(message);
_mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Warning, 7500));
break;
case MessageSeverity.Information:
Logger.Info(message);
if (!_configService.Current.HideInfoMessages)
{
_dalamudUtil.PrintInfoChat(message);
}
_mediator.Publish(new NotificationMessage("Info from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Info, 5000));
break;
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using Dalamud.Interface.Internal.Notifications;
using System.Collections.Concurrent;
using MareSynchronos.API.Routes;
using MareSynchronos.FileCache;
using MareSynchronos.Utils;
@@ -352,6 +353,7 @@ public partial class ApiController : IDisposable, IMareHubClient
_connectionDto = null;
_healthCheckTokenSource?.Cancel();
ServerState = ServerState.Reconnecting;
_mediator.Publish(new NotificationMessage("Connection lost", "Connection lost to " + _serverManager.CurrentServer!.ServerName, NotificationType.Error, 5000));
Logger.Warn("Connection closed... Reconnecting");
Logger.Warn(arg?.Message ?? string.Empty);
Logger.Warn(arg?.StackTrace ?? string.Empty);