notifications improvement, working pairs incoming request feature and working user logging in notif
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Colors;
|
||||
using LightlessSync.LightlessConfiguration;
|
||||
using LightlessSync.PlayerData.Handlers;
|
||||
@@ -88,19 +87,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
if (_configService.Current.ShowTransferWindow)
|
||||
{
|
||||
var limiterSnapshot = _pairProcessingLimiter.GetSnapshot();
|
||||
if (limiterSnapshot.IsEnabled)
|
||||
{
|
||||
var queueColor = limiterSnapshot.Waiting > 0 ? ImGuiColors.DalamudYellow : ImGuiColors.DalamudGrey;
|
||||
var queueText = $"Pair queue {limiterSnapshot.InFlight}/{limiterSnapshot.Limit}";
|
||||
queueText += limiterSnapshot.Waiting > 0 ? $" ({limiterSnapshot.Waiting} waiting, {limiterSnapshot.Remaining} free)" : $" ({limiterSnapshot.Remaining} free)";
|
||||
UiSharedService.DrawOutlinedFont(queueText, queueColor, new Vector4(0, 0, 0, 255), 1);
|
||||
ImGui.NewLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.DrawOutlinedFont("Pair apply limiter disabled", ImGuiColors.DalamudGrey, new Vector4(0, 0, 0, 255), 1);
|
||||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (_fileTransferManager.IsUploading)
|
||||
@@ -138,18 +125,30 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
// Use new notification stuff
|
||||
if (_currentDownloads.Any())
|
||||
{
|
||||
UpdateDownloadNotification();
|
||||
UpdateDownloadNotification(limiterSnapshot);
|
||||
_notificationDismissed = false;
|
||||
}
|
||||
else if (!_notificationDismissed)
|
||||
{
|
||||
_notificationService.DismissPairDownloadNotification();
|
||||
_notificationDismissed = true;
|
||||
}
|
||||
}
|
||||
} }
|
||||
else
|
||||
{
|
||||
// text overlay
|
||||
if (limiterSnapshot.IsEnabled)
|
||||
{
|
||||
var queueColor = limiterSnapshot.Waiting > 0 ? ImGuiColors.DalamudYellow : ImGuiColors.DalamudGrey;
|
||||
var queueText = $"Pair queue {limiterSnapshot.InFlight}/{limiterSnapshot.Limit}";
|
||||
queueText += limiterSnapshot.Waiting > 0 ? $" ({limiterSnapshot.Waiting} waiting, {limiterSnapshot.Remaining} free)" : $" ({limiterSnapshot.Remaining} free)";
|
||||
UiSharedService.DrawOutlinedFont(queueText, queueColor, new Vector4(0, 0, 0, 255), 1);
|
||||
ImGui.NewLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.DrawOutlinedFont("Pair apply limiter disabled", ImGuiColors.DalamudGrey, new Vector4(0, 0, 0, 255), 1);
|
||||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
foreach (var item in _currentDownloads.ToList())
|
||||
{
|
||||
var dlSlot = item.Value.Count(c => c.Value.DownloadStatus == DownloadStatus.WaitingForSlot);
|
||||
@@ -292,7 +291,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
};
|
||||
}
|
||||
|
||||
private void UpdateDownloadNotification()
|
||||
private void UpdateDownloadNotification(PairProcessingLimiterSnapshot limiterSnapshot)
|
||||
{
|
||||
var downloadStatus = new List<(string playerName, float progress, string status)>();
|
||||
|
||||
@@ -319,9 +318,12 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
downloadStatus.Add((item.Key.Name, progress, status));
|
||||
}
|
||||
|
||||
if (downloadStatus.Any())
|
||||
// Pass queue waiting count separately, show notification if there are downloads or queue items
|
||||
var queueWaiting = limiterSnapshot.IsEnabled ? limiterSnapshot.Waiting : 0;
|
||||
if (downloadStatus.Any() || queueWaiting > 0)
|
||||
{
|
||||
_notificationService.ShowPairDownloadNotification(downloadStatus);
|
||||
_notificationService.ShowPairDownloadNotification(downloadStatus, queueWaiting);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user