notifications improvement, working pairs incoming request feature and working user logging in notif

This commit is contained in:
choco
2025-10-06 20:25:47 +02:00
parent 090b81c989
commit 83e4555e4b
7 changed files with 176 additions and 49 deletions

View File

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

View File

@@ -1,4 +1,4 @@
using Dalamud.Interface;
using Dalamud.Interface;
using LightlessSync.LightlessConfiguration.Models;
using System.Numerics;
namespace LightlessSync.UI.Models;
@@ -21,6 +21,9 @@ public class LightlessNotification
public float AnimationProgress { get; set; } = 0f;
public bool IsAnimatingIn { get; set; } = true;
public bool IsAnimatingOut { get; set; } = false;
// Sound properties
public uint? SoundEffectId { get; set; } = null;
}
public class LightlessNotificationAction
{

View File

@@ -0,0 +1,50 @@
using LightlessSync.LightlessConfiguration.Models;
namespace LightlessSync.UI.Models;
/// <summary>
/// Common FFXIV sound effect IDs for notifications
/// </summary>
public static class NotificationSounds
{
/// <summary>
/// General notification sound (quest complete)
/// </summary>
public const uint Info = 37;
/// <summary>
/// Warning/alert sound (system error)
/// </summary>
public const uint Warning = 15;
/// <summary>
/// Error sound (action failed)
/// </summary>
public const uint Error = 16;
/// <summary>
/// Success sound (level up)
/// </summary>
public const uint Success = 25;
/// <summary>
/// Pair request sound (tell received)
/// </summary>
public const uint PairRequest = 13;
/// <summary>
/// Download complete sound (item obtained)
/// </summary>
public const uint DownloadComplete = 30;
/// <summary>
/// Get default sound for notification type
/// </summary>
public static uint GetDefaultSound(NotificationType type) => type switch
{
NotificationType.Info => Info,
NotificationType.Warning => Warning,
NotificationType.Error => Error,
_ => Info
};
}

View File

@@ -11,12 +11,8 @@ using LightlessSync.Services;
using LightlessSync.Services.Mediator;
using LightlessSync.Utils;
using LightlessSync.WebAPI;
using Serilog;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Reflection.Emit;
using System.Threading.Tasks;
namespace LightlessSync.UI;
@@ -269,7 +265,6 @@ public class TopTabMenu
_lightlessNotificationService.ShowPairDownloadNotification(downloadStatus);
}
ImGui.SameLine();
if (ImGui.Button("Dismiss Download"))
{