remove unncessary sha1 dictionary, use new notification management

This commit is contained in:
rootdarkarchon
2024-03-19 13:06:12 +01:00
parent 86cdcdb5cf
commit 342c6dab38
11 changed files with 30 additions and 37 deletions

View File

@@ -48,7 +48,7 @@ public record TransientResourceChangedMessage(IntPtr Address) : MessageBase;
public record HaltScanMessage(string Source) : MessageBase;
public record ResumeScanMessage(string Source) : MessageBase;
public record NotificationMessage
(string Title, string Message, NotificationType Type, uint TimeShownOnScreen = 3000) : MessageBase;
(string Title, string Message, NotificationType Type, TimeSpan? TimeShownOnScreen = null) : MessageBase;
public record CreateCacheForObjectMessage(GameObjectHandler ObjectToCreateFor) : MessageBase;
public record ClearCacheForObjectMessage(GameObjectHandler ObjectToCreateFor) : MessageBase;
public record CharacterDataCreatedMessage(CharacterData CharacterData) : SameThreadMessage;

View File

@@ -11,13 +11,13 @@ namespace MareSynchronos.Services;
public class NotificationService : DisposableMediatorSubscriberBase
{
private readonly INotificationManager _notificationManager;
private readonly IChatGui _chatGui;
private readonly MareConfigService _configurationService;
private readonly UiBuilder _uiBuilder;
public NotificationService(ILogger<NotificationService> logger, MareMediator mediator, UiBuilder uiBuilder, IChatGui chatGui, MareConfigService configurationService) : base(logger, mediator)
public NotificationService(ILogger<NotificationService> logger, MareMediator mediator, INotificationManager notificationManager, IChatGui chatGui, MareConfigService configurationService) : base(logger, mediator)
{
_uiBuilder = uiBuilder;
_notificationManager = notificationManager;
_chatGui = chatGui;
_configurationService = configurationService;
@@ -108,6 +108,13 @@ public class NotificationService : DisposableMediatorSubscriberBase
private void ShowToast(NotificationMessage msg)
{
_uiBuilder.AddNotification(msg.Message ?? string.Empty, "[Mare Synchronos] " + msg.Title, msg.Type, msg.TimeShownOnScreen);
_notificationManager.AddNotification(new Dalamud.Interface.ImGuiNotification.Notification()
{
Content = msg.Message ?? string.Empty,
Title = msg.Title,
Type = msg.Type,
Minimized = false,
InitialDuration = msg.TimeShownOnScreen ?? TimeSpan.FromSeconds(3)
});
}
}

View File

@@ -63,7 +63,7 @@ public class PluginWarningNotificationService
{
_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));
NotificationType.Warning, TimeSpan.FromSeconds(10)));
}
}
}