pair/downloads notif changes + more settings options

This commit is contained in:
choco
2025-10-09 13:56:40 +02:00
parent 0dfa667ed3
commit d295f3e22d
6 changed files with 74 additions and 37 deletions

View File

@@ -77,9 +77,11 @@ public class LightlessConfig : ILightlessConfiguration
public bool EnableNotificationSounds { get; set; } = true; public bool EnableNotificationSounds { get; set; } = true;
public int DefaultNotificationDurationSeconds { get; set; } = 10; public int DefaultNotificationDurationSeconds { get; set; } = 10;
public bool ShowNotificationProgress { get; set; } = true; public bool ShowNotificationProgress { get; set; } = true;
public NotificationLocation LightlessInfoNotification { get; set; } = NotificationLocation.LightlessUI; public NotificationLocation LightlessInfoNotification { get; set; } = NotificationLocation.LightlessUi;
public NotificationLocation LightlessWarningNotification { get; set; } = NotificationLocation.LightlessUI; public NotificationLocation LightlessWarningNotification { get; set; } = NotificationLocation.LightlessUi;
public NotificationLocation LightlessErrorNotification { get; set; } = NotificationLocation.ChatAndLightlessUI; 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 float NotificationOpacity { get; set; } = 0.95f;
public bool EnableNotificationAnimations { get; set; } = true; public bool EnableNotificationAnimations { get; set; } = true;
@@ -93,7 +95,6 @@ public class LightlessConfig : ILightlessConfiguration
public uint CustomWarningSoundId { get; set; } = 15; // Se15 public uint CustomWarningSoundId { get; set; } = 15; // Se15
public uint CustomErrorSoundId { get; set; } = 16; // Se16 public uint CustomErrorSoundId { get; set; } = 16; // Se16
public bool UseCustomSounds { get; set; } = false; public bool UseCustomSounds { get; set; } = false;
public float NotificationSoundVolume { get; set; } = 1.0f;
// till here c: // till here c:
public bool UseFocusTarget { get; set; } = false; public bool UseFocusTarget { get; set; } = false;
public bool overrideFriendColor { get; set; } = false; public bool overrideFriendColor { get; set; } = false;

View File

@@ -6,13 +6,16 @@ public enum NotificationLocation
Chat, Chat,
Toast, Toast,
Both, Both,
LightlessUI, LightlessUi,
ChatAndLightlessUI, ChatAndLightlessUi,
TextOverlay,
} }
public enum NotificationType public enum NotificationType
{ {
Info, Info,
Warning, Warning,
Error Error,
PairRequest,
Download
} }

View File

@@ -92,8 +92,8 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
{ {
Title = "Pair Request Received", Title = "Pair Request Received",
Message = $"{senderName} wants to pair with you.", Message = $"{senderName} wants to pair with you.",
Type = NotificationType.Info, Type = NotificationType.PairRequest,
Duration = TimeSpan.FromSeconds(60), Duration = TimeSpan.FromSeconds(180),
SoundEffectId = NotificationSounds.PairRequest, SoundEffectId = NotificationSounds.PairRequest,
Actions = new List<LightlessNotificationAction> Actions = new List<LightlessNotificationAction>
{ {
@@ -271,7 +271,7 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
Id = "pair_download_progress", Id = "pair_download_progress",
Title = "Downloading Pair Data", Title = "Downloading Pair Data",
Message = message, Message = message,
Type = NotificationType.Info, Type = NotificationType.Download,
Duration = TimeSpan.FromMinutes(5), Duration = TimeSpan.FromMinutes(5),
ShowProgress = true, ShowProgress = true,
Progress = totalProgress Progress = totalProgress
@@ -336,20 +336,24 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
if (!_dalamudUtilService.IsLoggedIn) return; 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 var location = _configService.Current.UseLightlessNotifications
? msg.Type switch ? msg.Type switch
{ {
NotificationType.Info => _configService.Current.LightlessInfoNotification, NotificationType.Info => _configService.Current.LightlessInfoNotification,
NotificationType.Warning => _configService.Current.LightlessWarningNotification, NotificationType.Warning => _configService.Current.LightlessWarningNotification,
NotificationType.Error => _configService.Current.LightlessErrorNotification, NotificationType.Error => _configService.Current.LightlessErrorNotification,
_ => NotificationLocation.LightlessUI NotificationType.PairRequest => _configService.Current.LightlessPairRequestNotification,
NotificationType.Download => _configService.Current.LightlessDownloadNotification,
_ => NotificationLocation.LightlessUi
} }
: msg.Type switch : msg.Type switch
{ {
NotificationType.Info => _configService.Current.InfoNotification, NotificationType.Info => _configService.Current.InfoNotification,
NotificationType.Warning => _configService.Current.WarningNotification, NotificationType.Warning => _configService.Current.WarningNotification,
NotificationType.Error => _configService.Current.ErrorNotification, NotificationType.Error => _configService.Current.ErrorNotification,
NotificationType.PairRequest => NotificationLocation.Toast,
NotificationType.Download => NotificationLocation.Toast,
_ => NotificationLocation.Nowhere _ => NotificationLocation.Nowhere
}; };
@@ -373,11 +377,11 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
ShowChat(msg); ShowChat(msg);
break; break;
case NotificationLocation.LightlessUI: case NotificationLocation.LightlessUi:
ShowLightlessNotification(msg); ShowLightlessNotification(msg);
break; break;
case NotificationLocation.ChatAndLightlessUI: case NotificationLocation.ChatAndLightlessUi:
ShowChat(msg); ShowChat(msg);
ShowLightlessNotification(msg); ShowLightlessNotification(msg);
break; break;
@@ -419,7 +423,6 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
{ {
NotificationType.Error => Dalamud.Interface.ImGuiNotification.NotificationType.Error, NotificationType.Error => Dalamud.Interface.ImGuiNotification.NotificationType.Error,
NotificationType.Warning => Dalamud.Interface.ImGuiNotification.NotificationType.Warning, NotificationType.Warning => Dalamud.Interface.ImGuiNotification.NotificationType.Warning,
NotificationType.Info => Dalamud.Interface.ImGuiNotification.NotificationType.Info,
_ => Dalamud.Interface.ImGuiNotification.NotificationType.Info _ => Dalamud.Interface.ImGuiNotification.NotificationType.Info
}; };

View File

@@ -1,6 +1,7 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using LightlessSync.LightlessConfiguration; using LightlessSync.LightlessConfiguration;
using LightlessSync.LightlessConfiguration.Models;
using LightlessSync.PlayerData.Handlers; using LightlessSync.PlayerData.Handlers;
using LightlessSync.Services; using LightlessSync.Services;
using LightlessSync.Services.Mediator; using LightlessSync.Services.Mediator;
@@ -120,9 +121,14 @@ public class DownloadUi : WindowMediatorSubscriberBase
try 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()) if (_currentDownloads.Any())
{ {
UpdateDownloadNotification(limiterSnapshot); UpdateDownloadNotification(limiterSnapshot);
@@ -132,7 +138,8 @@ public class DownloadUi : WindowMediatorSubscriberBase
{ {
_notificationService.DismissPairDownloadNotification(); _notificationService.DismissPairDownloadNotification();
_notificationDismissed = true; _notificationDismissed = true;
} } }
}
else else
{ {
if (limiterSnapshot.IsEnabled) if (limiterSnapshot.IsEnabled)

View File

@@ -527,6 +527,8 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
NotificationType.Info => UIColors.Get("LightlessPurple"), NotificationType.Info => UIColors.Get("LightlessPurple"),
NotificationType.Warning => UIColors.Get("LightlessYellow"), NotificationType.Warning => UIColors.Get("LightlessYellow"),
NotificationType.Error => UIColors.Get("DimRed"), NotificationType.Error => UIColors.Get("DimRed"),
NotificationType.PairRequest => UIColors.Get("LightlessBlue"),
NotificationType.Download => UIColors.Get("LightlessGreen"),
_ => UIColors.Get("LightlessPurple") _ => UIColors.Get("LightlessPurple")
}; };
} }

View File

@@ -2675,6 +2675,30 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save(); _configService.Save();
}, _configService.Current.LightlessErrorNotification); }, _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(); ImGui.Unindent();
} }
@@ -2932,21 +2956,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.TreePop(); 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 // System Notifications Section
if (_uiShared.MediumTreeNode("System Notifications", UIColors.Get("LightlessYellow"))) if (_uiShared.MediumTreeNode("System Notifications", UIColors.Get("LightlessYellow")))
{ {
@@ -2972,8 +2981,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
{ {
return new[] return new[]
{ {
NotificationLocation.LightlessUI, NotificationLocation.LightlessUi,
NotificationLocation.ChatAndLightlessUI, NotificationLocation.ChatAndLightlessUi,
NotificationLocation.Nowhere
};
}
private NotificationLocation[] GetDownloadNotificationLocations()
{
return new[]
{
NotificationLocation.LightlessUi,
NotificationLocation.ChatAndLightlessUi,
NotificationLocation.TextOverlay,
NotificationLocation.Nowhere NotificationLocation.Nowhere
}; };
} }
@@ -2997,8 +3017,9 @@ public class SettingsUi : WindowMediatorSubscriberBase
NotificationLocation.Chat => "Chat", NotificationLocation.Chat => "Chat",
NotificationLocation.Toast => "Toast", NotificationLocation.Toast => "Toast",
NotificationLocation.Both => "Toast + Chat", NotificationLocation.Both => "Toast + Chat",
NotificationLocation.LightlessUI => "Lightless Notifications", NotificationLocation.LightlessUi => "Lightless Notifications",
NotificationLocation.ChatAndLightlessUI => "Chat + Lightless Notifications", NotificationLocation.ChatAndLightlessUi => "Chat + Lightless Notifications",
NotificationLocation.TextOverlay => "Text Overlay",
_ => location.ToString() _ => location.ToString()
}; };
} }