diff --git a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs index b102cf0..80193d4 100644 --- a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs @@ -77,9 +77,11 @@ public class LightlessConfig : ILightlessConfiguration public bool EnableNotificationSounds { get; set; } = true; public int DefaultNotificationDurationSeconds { get; set; } = 10; public bool ShowNotificationProgress { get; set; } = true; - public NotificationLocation LightlessInfoNotification { get; set; } = NotificationLocation.LightlessUI; - public NotificationLocation LightlessWarningNotification { get; set; } = NotificationLocation.LightlessUI; - public NotificationLocation LightlessErrorNotification { get; set; } = NotificationLocation.ChatAndLightlessUI; + public NotificationLocation LightlessInfoNotification { get; set; } = NotificationLocation.LightlessUi; + public NotificationLocation LightlessWarningNotification { get; set; } = NotificationLocation.LightlessUi; + public NotificationLocation LightlessErrorNotification { get; set; } = NotificationLocation.ChatAndLightlessUi; + public NotificationLocation LightlessPairRequestNotification { get; set; } = NotificationLocation.LightlessUi; + public NotificationLocation LightlessDownloadNotification { get; set; } = NotificationLocation.TextOverlay; public float NotificationOpacity { get; set; } = 0.95f; public bool EnableNotificationAnimations { get; set; } = true; @@ -93,7 +95,6 @@ public class LightlessConfig : ILightlessConfiguration public uint CustomWarningSoundId { get; set; } = 15; // Se15 public uint CustomErrorSoundId { get; set; } = 16; // Se16 public bool UseCustomSounds { get; set; } = false; - public float NotificationSoundVolume { get; set; } = 1.0f; // till here c: public bool UseFocusTarget { get; set; } = false; public bool overrideFriendColor { get; set; } = false; diff --git a/LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs b/LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs index 657715f..2815986 100644 --- a/LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs +++ b/LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs @@ -6,13 +6,16 @@ public enum NotificationLocation Chat, Toast, Both, - LightlessUI, - ChatAndLightlessUI, + LightlessUi, + ChatAndLightlessUi, + TextOverlay, } public enum NotificationType { Info, Warning, - Error + Error, + PairRequest, + Download } \ No newline at end of file diff --git a/LightlessSync/Services/NotificationService.cs b/LightlessSync/Services/NotificationService.cs index c15fd3f..bfec6e6 100644 --- a/LightlessSync/Services/NotificationService.cs +++ b/LightlessSync/Services/NotificationService.cs @@ -92,8 +92,8 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ { Title = "Pair Request Received", Message = $"{senderName} wants to pair with you.", - Type = NotificationType.Info, - Duration = TimeSpan.FromSeconds(60), + Type = NotificationType.PairRequest, + Duration = TimeSpan.FromSeconds(180), SoundEffectId = NotificationSounds.PairRequest, Actions = new List { @@ -271,7 +271,7 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ Id = "pair_download_progress", Title = "Downloading Pair Data", Message = message, - Type = NotificationType.Info, + Type = NotificationType.Download, Duration = TimeSpan.FromMinutes(5), ShowProgress = true, Progress = totalProgress @@ -336,20 +336,24 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ if (!_dalamudUtilService.IsLoggedIn) return; - // Get notification location based on type and system pref + // Get notification location based on type and system preference var location = _configService.Current.UseLightlessNotifications ? msg.Type switch { NotificationType.Info => _configService.Current.LightlessInfoNotification, NotificationType.Warning => _configService.Current.LightlessWarningNotification, NotificationType.Error => _configService.Current.LightlessErrorNotification, - _ => NotificationLocation.LightlessUI + NotificationType.PairRequest => _configService.Current.LightlessPairRequestNotification, + NotificationType.Download => _configService.Current.LightlessDownloadNotification, + _ => NotificationLocation.LightlessUi } : msg.Type switch { NotificationType.Info => _configService.Current.InfoNotification, NotificationType.Warning => _configService.Current.WarningNotification, NotificationType.Error => _configService.Current.ErrorNotification, + NotificationType.PairRequest => NotificationLocation.Toast, + NotificationType.Download => NotificationLocation.Toast, _ => NotificationLocation.Nowhere }; @@ -373,11 +377,11 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ ShowChat(msg); break; - case NotificationLocation.LightlessUI: + case NotificationLocation.LightlessUi: ShowLightlessNotification(msg); break; - case NotificationLocation.ChatAndLightlessUI: + case NotificationLocation.ChatAndLightlessUi: ShowChat(msg); ShowLightlessNotification(msg); break; @@ -419,7 +423,6 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ { NotificationType.Error => Dalamud.Interface.ImGuiNotification.NotificationType.Error, NotificationType.Warning => Dalamud.Interface.ImGuiNotification.NotificationType.Warning, - NotificationType.Info => Dalamud.Interface.ImGuiNotification.NotificationType.Info, _ => Dalamud.Interface.ImGuiNotification.NotificationType.Info }; diff --git a/LightlessSync/UI/DownloadUi.cs b/LightlessSync/UI/DownloadUi.cs index 45fce1a..301f177 100644 --- a/LightlessSync/UI/DownloadUi.cs +++ b/LightlessSync/UI/DownloadUi.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface.Colors; using LightlessSync.LightlessConfiguration; +using LightlessSync.LightlessConfiguration.Models; using LightlessSync.PlayerData.Handlers; using LightlessSync.Services; using LightlessSync.Services.Mediator; @@ -120,9 +121,14 @@ public class DownloadUi : WindowMediatorSubscriberBase try { - if (_configService.Current.UseNotificationsForDownloads) + // Check if download notifications are enabled (not set to TextOverlay) + var useNotifications = _configService.Current.UseLightlessNotifications + ? _configService.Current.LightlessDownloadNotification != NotificationLocation.TextOverlay + : _configService.Current.UseNotificationsForDownloads; + + if (useNotifications) { - // Use new notification stuff + // Use notification system if (_currentDownloads.Any()) { UpdateDownloadNotification(limiterSnapshot); @@ -132,7 +138,8 @@ public class DownloadUi : WindowMediatorSubscriberBase { _notificationService.DismissPairDownloadNotification(); _notificationDismissed = true; - } } + } + } else { if (limiterSnapshot.IsEnabled) diff --git a/LightlessSync/UI/LightlessNotificationUI.cs b/LightlessSync/UI/LightlessNotificationUI.cs index c74c5b1..8a34a84 100644 --- a/LightlessSync/UI/LightlessNotificationUI.cs +++ b/LightlessSync/UI/LightlessNotificationUI.cs @@ -527,6 +527,8 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase NotificationType.Info => UIColors.Get("LightlessPurple"), NotificationType.Warning => UIColors.Get("LightlessYellow"), NotificationType.Error => UIColors.Get("DimRed"), + NotificationType.PairRequest => UIColors.Get("LightlessBlue"), + NotificationType.Download => UIColors.Get("LightlessGreen"), _ => UIColors.Get("LightlessPurple") }; } diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 074eb60..45876ba 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -2675,6 +2675,30 @@ public class SettingsUi : WindowMediatorSubscriberBase _configService.Save(); }, _configService.Current.LightlessErrorNotification); + ImGuiHelpers.ScaledDummy(3); + _uiShared.DrawHelpText("Special notification types:"); + + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted("Pair Request Notifications:"); + ImGui.SameLine(); + ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); + _uiShared.DrawCombo("###enhanced_pairrequest", lightlessLocations, GetNotificationLocationLabel, (location) => + { + _configService.Current.LightlessPairRequestNotification = location; + _configService.Save(); + }, _configService.Current.LightlessPairRequestNotification); + + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted("Download Progress Notifications:"); + ImGui.SameLine(); + ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); + var downloadLocations = GetDownloadNotificationLocations(); + _uiShared.DrawCombo("###enhanced_download", downloadLocations, GetNotificationLocationLabel, (location) => + { + _configService.Current.LightlessDownloadNotification = location; + _configService.Save(); + }, _configService.Current.LightlessDownloadNotification); + ImGui.Unindent(); } @@ -2932,21 +2956,6 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.TreePop(); } - // Download Progress Notifications Section - if (_uiShared.MediumTreeNode("Download Progress Notifications", UIColors.Get("LightlessPurple"))) - { - var useNotificationsForDownloads = _configService.Current.UseNotificationsForDownloads; - if (ImGui.Checkbox("Show download progress as notifications", ref useNotificationsForDownloads)) - { - _configService.Current.UseNotificationsForDownloads = useNotificationsForDownloads; - _configService.Save(); - } - _uiShared.DrawHelpText("Show download progress as clean notifications instead of overlay text. Notifications update in real-time and use the Info notification location settings above."); - - _uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f); - ImGui.TreePop(); - } - // System Notifications Section if (_uiShared.MediumTreeNode("System Notifications", UIColors.Get("LightlessYellow"))) { @@ -2972,8 +2981,19 @@ public class SettingsUi : WindowMediatorSubscriberBase { return new[] { - NotificationLocation.LightlessUI, - NotificationLocation.ChatAndLightlessUI, + NotificationLocation.LightlessUi, + NotificationLocation.ChatAndLightlessUi, + NotificationLocation.Nowhere + }; + } + + private NotificationLocation[] GetDownloadNotificationLocations() + { + return new[] + { + NotificationLocation.LightlessUi, + NotificationLocation.ChatAndLightlessUi, + NotificationLocation.TextOverlay, NotificationLocation.Nowhere }; } @@ -2997,8 +3017,9 @@ public class SettingsUi : WindowMediatorSubscriberBase NotificationLocation.Chat => "Chat", NotificationLocation.Toast => "Toast", NotificationLocation.Both => "Toast + Chat", - NotificationLocation.LightlessUI => "Lightless Notifications", - NotificationLocation.ChatAndLightlessUI => "Chat + Lightless Notifications", + NotificationLocation.LightlessUi => "Lightless Notifications", + NotificationLocation.ChatAndLightlessUi => "Chat + Lightless Notifications", + NotificationLocation.TextOverlay => "Text Overlay", _ => location.ToString() }; }