download notification stuck fix, more x and y offset positions

This commit is contained in:
choco
2025-11-10 10:59:42 +01:00
parent b5bdededae
commit 8692e877cf
4 changed files with 23 additions and 28 deletions

View File

@@ -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)

View File

@@ -58,14 +58,14 @@ public class DownloadUi : WindowMediatorSubscriberBase
IsOpen = true;
Mediator.Subscribe<DownloadStartedMessage>(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus);
Mediator.Subscribe<DownloadStartedMessage>(this, (msg) =>
{
_currentDownloads[msg.DownloadId] = msg.DownloadStatus;
_notificationDismissed = false;
});
Mediator.Subscribe<DownloadFinishedMessage>(this, (msg) =>
{
_currentDownloads.TryRemove(msg.DownloadId, out _);
if (!_currentDownloads.Any())
{
Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress"));
}
});
Mediator.Subscribe<GposeStartMessage>(this, (_) => IsOpen = false);
Mediator.Subscribe<GposeEndMessage>(this, (_) => IsOpen = true);

View File

@@ -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);
}

View File

@@ -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))