diff --git a/LightlessSync/Services/NotificationService.cs b/LightlessSync/Services/NotificationService.cs index 72f4a16..8709710 100644 --- a/LightlessSync/Services/NotificationService.cs +++ b/LightlessSync/Services/NotificationService.cs @@ -342,12 +342,6 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ _ => download.Status }; - private bool AreAllDownloadsCompleted(List<(string PlayerName, float Progress, string Status)> userDownloads) => - userDownloads.Any() && userDownloads.All(x => x.Progress >= 1.0f); - - public void DismissPairDownloadNotification() => - Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress")); - private TimeSpan GetDefaultDurationForType(NotificationType type) => type switch { NotificationType.Info => TimeSpan.FromSeconds(_configService.Current.InfoNotificationDurationSeconds), @@ -607,11 +601,6 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ }; Mediator.Publish(new LightlessNotificationMessage(notification)); - - if (userDownloads.Count == 0 || AreAllDownloadsCompleted(userDownloads)) - { - Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress")); - } } private void HandlePerformanceNotification(PerformanceNotificationMessage msg) diff --git a/LightlessSync/UI/DownloadUi.cs b/LightlessSync/UI/DownloadUi.cs index a592e43..2761b59 100644 --- a/LightlessSync/UI/DownloadUi.cs +++ b/LightlessSync/UI/DownloadUi.cs @@ -58,14 +58,14 @@ public class DownloadUi : WindowMediatorSubscriberBase IsOpen = true; - Mediator.Subscribe(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus); + Mediator.Subscribe(this, (msg) => + { + _currentDownloads[msg.DownloadId] = msg.DownloadStatus; + _notificationDismissed = false; + }); Mediator.Subscribe(this, (msg) => { _currentDownloads.TryRemove(msg.DownloadId, out _); - if (!_currentDownloads.Any()) - { - Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress")); - } }); Mediator.Subscribe(this, (_) => IsOpen = false); Mediator.Subscribe(this, (_) => IsOpen = true); diff --git a/LightlessSync/UI/LightlessNotificationUI.cs b/LightlessSync/UI/LightlessNotificationUI.cs index 3d2d748..2d412f2 100644 --- a/LightlessSync/UI/LightlessNotificationUI.cs +++ b/LightlessSync/UI/LightlessNotificationUI.cs @@ -86,6 +86,12 @@ public class LightlessNotificationUi : WindowMediatorSubscriberBase existing.Progress = updated.Progress; existing.ShowProgress = updated.ShowProgress; existing.Title = updated.Title; + + if (updated.Type == NotificationType.Download && updated.Progress < 1.0f) + { + existing.CreatedAt = DateTime.UtcNow; + } + _logger.LogDebug("Updated existing notification: {Title}", updated.Title); } diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index febc142..4054853 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -3851,9 +3851,9 @@ public class SettingsUi : WindowMediatorSubscriberBase _uiShared.DrawHelpText("Choose which corner of the screen notifications appear in."); int offsetY = _configService.Current.NotificationOffsetY; - if (ImGui.SliderInt("Vertical Offset", ref offsetY, 0, 1000)) + if (ImGui.SliderInt("Vertical Offset", ref offsetY, 0, 5000)) { - _configService.Current.NotificationOffsetY = Math.Clamp(offsetY, 0, 1000); + _configService.Current.NotificationOffsetY = Math.Clamp(offsetY, 0, 5000); _configService.Save(); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -3866,9 +3866,9 @@ public class SettingsUi : WindowMediatorSubscriberBase _uiShared.DrawHelpText("Distance from the top edge of the screen."); int offsetX = _configService.Current.NotificationOffsetX; - if (ImGui.SliderInt("Horizontal Offset", ref offsetX, 0, 500)) + if (ImGui.SliderInt("Horizontal Offset", ref offsetX, 0, 2500)) { - _configService.Current.NotificationOffsetX = Math.Clamp(offsetX, 0, 500); + _configService.Current.NotificationOffsetX = Math.Clamp(offsetX, 0, 2500); _configService.Save(); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -3985,9 +3985,9 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.SetTooltip("Right click to reset to default (20)."); int pairRequestDuration = _configService.Current.PairRequestDurationSeconds; - if (ImGui.SliderInt("Pair Request Duration (seconds)", ref pairRequestDuration, 30, 600)) + if (ImGui.SliderInt("Pair Request Duration (seconds)", ref pairRequestDuration, 30, 1800)) { - _configService.Current.PairRequestDurationSeconds = Math.Clamp(pairRequestDuration, 30, 600); + _configService.Current.PairRequestDurationSeconds = Math.Clamp(pairRequestDuration, 30, 1800); _configService.Save(); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -3999,23 +3999,23 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.SetTooltip("Right click to reset to default (180)."); int downloadDuration = _configService.Current.DownloadNotificationDurationSeconds; - if (ImGui.SliderInt("Download Duration (seconds)", ref downloadDuration, 60, 600)) + if (ImGui.SliderInt("Download Duration (seconds)", ref downloadDuration, 60, 120)) { - _configService.Current.DownloadNotificationDurationSeconds = Math.Clamp(downloadDuration, 60, 600); + _configService.Current.DownloadNotificationDurationSeconds = Math.Clamp(downloadDuration, 60, 120); _configService.Save(); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) { - _configService.Current.DownloadNotificationDurationSeconds = 300; + _configService.Current.DownloadNotificationDurationSeconds = 30; _configService.Save(); } if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Right click to reset to default (300)."); + ImGui.SetTooltip("Right click to reset to default (30)."); int performanceDuration = _configService.Current.PerformanceNotificationDurationSeconds; - if (ImGui.SliderInt("Performance Duration (seconds)", ref performanceDuration, 5, 60)) + if (ImGui.SliderInt("Performance Duration (seconds)", ref performanceDuration, 5, 120)) { - _configService.Current.PerformanceNotificationDurationSeconds = Math.Clamp(performanceDuration, 5, 60); + _configService.Current.PerformanceNotificationDurationSeconds = Math.Clamp(performanceDuration, 5, 120); _configService.Save(); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right))