From cf27a6729657fdccb54f71b14cf6b67081191dca Mon Sep 17 00:00:00 2001 From: choco Date: Tue, 14 Oct 2025 15:07:46 +0200 Subject: [PATCH] optional action button toggle for pair request (default on) --- .../Configurations/LightlessConfig.cs | 1 + LightlessSync/Services/NotificationService.cs | 11 +++++++++-- LightlessSync/UI/SettingsUi.cs | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs index 9102d90..bdf8542 100644 --- a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs @@ -125,6 +125,7 @@ public class LightlessConfig : ILightlessConfiguration public bool DisablePairRequestSound { get; set; } = true; public bool DisablePerformanceSound { get; set; } = true; public bool ShowPerformanceNotificationActions { get; set; } = true; + public bool ShowPairRequestNotificationActions { get; set; } = true; public bool UseFocusTarget { get; set; } = false; public bool overrideFriendColor { get; set; } = false; public bool overridePartyColor { get; set; } = false; diff --git a/LightlessSync/Services/NotificationService.cs b/LightlessSync/Services/NotificationService.cs index c2f5ab6..755e756 100644 --- a/LightlessSync/Services/NotificationService.cs +++ b/LightlessSync/Services/NotificationService.cs @@ -118,8 +118,10 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ ShowChat(new NotificationMessage("Pair Request Received", $"{senderName} wants to directly pair with you.", NotificationType.PairRequest)); } - // Show Lightless notification if configured - if (location == NotificationLocation.LightlessUi || location == NotificationLocation.ChatAndLightlessUi) + // Show Lightless notification if configured and action buttons are enabled + if ((location == NotificationLocation.LightlessUi || location == NotificationLocation.ChatAndLightlessUi) + && _configService.Current.UseLightlessNotifications + && _configService.Current.ShowPairRequestNotificationActions) { var notification = new LightlessNotification { @@ -139,6 +141,11 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ Mediator.Publish(new LightlessNotificationMessage(notification)); } + else if (location != NotificationLocation.Nowhere && location != NotificationLocation.Chat) + { + // Fall back to regular notification without action buttons + HandleNotificationMessage(new NotificationMessage("Pair Request Received", $"{senderName} wants to directly pair with you.", NotificationType.PairRequest)); + } } private uint? GetPairRequestSoundId() => diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index d5520e0..dd7ee84 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -4085,6 +4085,22 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.TreePop(); } + if (_uiShared.MediumTreeNode("Pair Request Notifications", UIColors.Get("PairBlue"))) + { + var showPairRequestActions = _configService.Current.ShowPairRequestNotificationActions; + if (ImGui.Checkbox("Show action buttons on pair requests", ref showPairRequestActions)) + { + _configService.Current.ShowPairRequestNotificationActions = showPairRequestActions; + _configService.Save(); + } + + _uiShared.DrawHelpText( + "When you receive a pair request, show Accept/Decline buttons in the notification."); + + _uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f); + ImGui.TreePop(); + } + if (_uiShared.MediumTreeNode("Performance Notifications", UIColors.Get("LightlessOrange"))) { var showPerformanceActions = _configService.Current.ShowPerformanceNotificationActions;