Compare commits
14 Commits
1.12.2.6-D
...
1.12.2.7-D
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e129f6a1d | ||
|
|
1e97f27cb8 | ||
|
|
7aadbcec10 | ||
|
|
a32ac02c6d | ||
| f48698373b | |||
| ee20b6fa5f | |||
| f11741225b | |||
|
|
147baa4c1b | ||
|
|
4f5ef8ff4b | ||
|
|
fae6d31792 | ||
|
|
b4dd0ee0e1 | ||
| f5458c7f97 | |||
| 923f118a47 | |||
|
|
0cb71e5444 |
@@ -25,6 +25,7 @@ changelog:
|
|||||||
- "More customizable notification options."
|
- "More customizable notification options."
|
||||||
- "Perfomance limiter shows as notifications."
|
- "Perfomance limiter shows as notifications."
|
||||||
- "All notifications can be configured or disabled in Settings → Notifications."
|
- "All notifications can be configured or disabled in Settings → Notifications."
|
||||||
|
- "Cleaning up notifications implementation"
|
||||||
- number: "Bugfixes"
|
- number: "Bugfixes"
|
||||||
icon: ""
|
icon: ""
|
||||||
items:
|
items:
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ credits:
|
|||||||
role: "Height offset integration"
|
role: "Height offset integration"
|
||||||
- name: "Honorific Team"
|
- name: "Honorific Team"
|
||||||
role: "Title system integration"
|
role: "Title system integration"
|
||||||
- name: "Moodles Team"
|
- name: "Glyceri"
|
||||||
role: "Status effect integration"
|
role: "Moodles - Status effect integration"
|
||||||
- name: "PetNicknames Team"
|
- name: "Glyceri"
|
||||||
role: "Pet naming integration"
|
role: "PetNicknames - Pet naming integration"
|
||||||
- name: "Brio Team"
|
- name: "Minmoose"
|
||||||
role: "GPose enhancement integration"
|
role: "Brio - GPose enhancement integration"
|
||||||
|
|
||||||
- category: "Special Thanks"
|
- category: "Special Thanks"
|
||||||
items:
|
items:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>1.12.2.6</Version>
|
<Version>1.12.2.7</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddScoped<WindowMediatorSubscriberBase, BroadcastUI>((s) => new BroadcastUI(s.GetRequiredService<ILogger<BroadcastUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<LightlessConfigService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>()));
|
collection.AddScoped<WindowMediatorSubscriberBase, BroadcastUI>((s) => new BroadcastUI(s.GetRequiredService<ILogger<BroadcastUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<LightlessConfigService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>()));
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, SyncshellFinderUI>((s) => new SyncshellFinderUI(s.GetRequiredService<ILogger<SyncshellFinderUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<DalamudUtilService>()));
|
collection.AddScoped<WindowMediatorSubscriberBase, SyncshellFinderUI>((s) => new SyncshellFinderUI(s.GetRequiredService<ILogger<SyncshellFinderUI>>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<PerformanceCollectorService>(), s.GetRequiredService<BroadcastService>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<BroadcastScannerService>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<DalamudUtilService>()));
|
||||||
collection.AddScoped<IPopupHandler, BanUserPopupHandler>();
|
collection.AddScoped<IPopupHandler, BanUserPopupHandler>();
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, LightlessNotificationUI>((s) =>
|
collection.AddScoped<WindowMediatorSubscriberBase, LightlessNotificationUi>((s) =>
|
||||||
new LightlessNotificationUI(
|
new LightlessNotificationUi(
|
||||||
s.GetRequiredService<ILogger<LightlessNotificationUI>>(),
|
s.GetRequiredService<ILogger<LightlessNotificationUi>>(),
|
||||||
s.GetRequiredService<LightlessMediator>(),
|
s.GetRequiredService<LightlessMediator>(),
|
||||||
s.GetRequiredService<PerformanceCollectorService>(),
|
s.GetRequiredService<PerformanceCollectorService>(),
|
||||||
s.GetRequiredService<LightlessConfigService>()));
|
s.GetRequiredService<LightlessConfigService>()));
|
||||||
@@ -269,8 +269,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
s.GetRequiredService<WindowSystem>(), s.GetServices<WindowMediatorSubscriberBase>(),
|
s.GetRequiredService<WindowSystem>(), s.GetServices<WindowMediatorSubscriberBase>(),
|
||||||
s.GetRequiredService<UiFactory>(),
|
s.GetRequiredService<UiFactory>(),
|
||||||
s.GetRequiredService<FileDialogManager>(),
|
s.GetRequiredService<FileDialogManager>(),
|
||||||
s.GetRequiredService<LightlessMediator>(),
|
s.GetRequiredService<LightlessMediator>()));
|
||||||
s.GetRequiredService<NotificationService>()));
|
|
||||||
collection.AddScoped((s) => new CommandManagerService(commandManager, s.GetRequiredService<PerformanceCollectorService>(),
|
collection.AddScoped((s) => new CommandManagerService(commandManager, s.GetRequiredService<PerformanceCollectorService>(),
|
||||||
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<ApiController>(),
|
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<ApiController>(),
|
||||||
s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<LightlessConfigService>()));
|
s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<LightlessConfigService>()));
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ public record OpenCharaDataHubWithFilterMessage(UserData UserData) : MessageBase
|
|||||||
public record EnableBroadcastMessage(string HashedCid, bool Enabled) : MessageBase;
|
public record EnableBroadcastMessage(string HashedCid, bool Enabled) : MessageBase;
|
||||||
public record BroadcastStatusChangedMessage(bool Enabled, TimeSpan? Ttl) : MessageBase;
|
public record BroadcastStatusChangedMessage(bool Enabled, TimeSpan? Ttl) : MessageBase;
|
||||||
public record SyncshellBroadcastsUpdatedMessage : MessageBase;
|
public record SyncshellBroadcastsUpdatedMessage : MessageBase;
|
||||||
|
public record PairRequestReceivedMessage(string HashedCid, string Message) : MessageBase;
|
||||||
public record PairRequestsUpdatedMessage : MessageBase;
|
public record PairRequestsUpdatedMessage : MessageBase;
|
||||||
|
public record PairDownloadStatusMessage(List<(string PlayerName, float Progress, string Status)> DownloadStatus, int QueueWaiting) : MessageBase;
|
||||||
public record VisibilityChange : MessageBase;
|
public record VisibilityChange : MessageBase;
|
||||||
#pragma warning restore S2094
|
#pragma warning restore S2094
|
||||||
#pragma warning restore MA0048 // File name must match type name
|
#pragma warning restore MA0048 // File name must match type name
|
||||||
@@ -45,7 +45,9 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
public Task StartAsync(CancellationToken cancellationToken)
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Mediator.Subscribe<NotificationMessage>(this, HandleNotificationMessage);
|
Mediator.Subscribe<NotificationMessage>(this, HandleNotificationMessage);
|
||||||
|
Mediator.Subscribe<PairRequestReceivedMessage>(this, HandlePairRequestReceived);
|
||||||
Mediator.Subscribe<PairRequestsUpdatedMessage>(this, HandlePairRequestsUpdated);
|
Mediator.Subscribe<PairRequestsUpdatedMessage>(this, HandlePairRequestsUpdated);
|
||||||
|
Mediator.Subscribe<PairDownloadStatusMessage>(this, HandlePairDownloadStatus);
|
||||||
Mediator.Subscribe<PerformanceNotificationMessage>(this, HandlePerformanceNotification);
|
Mediator.Subscribe<PerformanceNotificationMessage>(this, HandlePerformanceNotification);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@@ -293,33 +295,8 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowPairDownloadNotification(List<(string playerName, float progress, string status)> downloadStatus,
|
|
||||||
int queueWaiting = 0)
|
|
||||||
{
|
|
||||||
var userDownloads = downloadStatus.Where(x => x.playerName != "Pair Queue").ToList();
|
|
||||||
var totalProgress = userDownloads.Count > 0 ? userDownloads.Average(x => x.progress) : 0f;
|
|
||||||
var message = BuildPairDownloadMessage(userDownloads, queueWaiting);
|
|
||||||
|
|
||||||
var notification = new LightlessNotification
|
private string BuildPairDownloadMessage(List<(string PlayerName, float Progress, string Status)> userDownloads,
|
||||||
{
|
|
||||||
Id = "pair_download_progress",
|
|
||||||
Title = "Downloading Pair Data",
|
|
||||||
Message = message,
|
|
||||||
Type = NotificationType.Download,
|
|
||||||
Duration = TimeSpan.FromSeconds(_configService.Current.DownloadNotificationDurationSeconds),
|
|
||||||
ShowProgress = true,
|
|
||||||
Progress = totalProgress
|
|
||||||
};
|
|
||||||
|
|
||||||
Mediator.Publish(new LightlessNotificationMessage(notification));
|
|
||||||
|
|
||||||
if (AreAllDownloadsCompleted(userDownloads))
|
|
||||||
{
|
|
||||||
DismissPairDownloadNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildPairDownloadMessage(List<(string playerName, float progress, string status)> userDownloads,
|
|
||||||
int queueWaiting)
|
int queueWaiting)
|
||||||
{
|
{
|
||||||
var messageParts = new List<string>();
|
var messageParts = new List<string>();
|
||||||
@@ -331,7 +308,7 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
|
|
||||||
if (userDownloads.Count > 0)
|
if (userDownloads.Count > 0)
|
||||||
{
|
{
|
||||||
var completedCount = userDownloads.Count(x => x.progress >= 1.0f);
|
var completedCount = userDownloads.Count(x => x.Progress >= 1.0f);
|
||||||
messageParts.Add($"Progress: {completedCount}/{userDownloads.Count} completed");
|
messageParts.Add($"Progress: {completedCount}/{userDownloads.Count} completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,29 +321,29 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
return string.Join("\n", messageParts);
|
return string.Join("\n", messageParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildActiveDownloadLines(List<(string playerName, float progress, string status)> userDownloads)
|
private string BuildActiveDownloadLines(List<(string PlayerName, float Progress, string Status)> userDownloads)
|
||||||
{
|
{
|
||||||
var activeDownloads = userDownloads
|
var activeDownloads = userDownloads
|
||||||
.Where(x => x.progress < 1.0f)
|
.Where(x => x.Progress < 1.0f)
|
||||||
.Take(_configService.Current.MaxConcurrentPairApplications);
|
.Take(_configService.Current.MaxConcurrentPairApplications);
|
||||||
|
|
||||||
if (!activeDownloads.Any()) return string.Empty;
|
if (!activeDownloads.Any()) return string.Empty;
|
||||||
|
|
||||||
return string.Join("\n", activeDownloads.Select(x => $"• {x.playerName}: {FormatDownloadStatus(x)}"));
|
return string.Join("\n", activeDownloads.Select(x => $"• {x.PlayerName}: {FormatDownloadStatus(x)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FormatDownloadStatus((string playerName, float progress, string status) download) =>
|
private string FormatDownloadStatus((string PlayerName, float Progress, string Status) download) =>
|
||||||
download.status switch
|
download.Status switch
|
||||||
{
|
{
|
||||||
"downloading" => $"{download.progress:P0}",
|
"downloading" => $"{download.Progress:P0}",
|
||||||
"decompressing" => "decompressing",
|
"decompressing" => "decompressing",
|
||||||
"queued" => "queued",
|
"queued" => "queued",
|
||||||
"waiting" => "waiting for slot",
|
"waiting" => "waiting for slot",
|
||||||
_ => download.status
|
_ => download.Status
|
||||||
};
|
};
|
||||||
|
|
||||||
private bool AreAllDownloadsCompleted(List<(string playerName, float progress, string status)> userDownloads) =>
|
private bool AreAllDownloadsCompleted(List<(string PlayerName, float Progress, string Status)> userDownloads) =>
|
||||||
userDownloads.Any() && userDownloads.All(x => x.progress >= 1.0f);
|
userDownloads.Any() && userDownloads.All(x => x.Progress >= 1.0f);
|
||||||
|
|
||||||
public void DismissPairDownloadNotification() =>
|
public void DismissPairDownloadNotification() =>
|
||||||
Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress"));
|
Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress"));
|
||||||
@@ -581,12 +558,25 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
_chatGui.Print(se.BuiltString);
|
_chatGui.Print(se.BuiltString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandlePairRequestReceived(PairRequestReceivedMessage msg)
|
||||||
|
{
|
||||||
|
var request = _pairRequestService.RegisterIncomingRequest(msg.HashedCid, msg.Message);
|
||||||
|
var senderName = string.IsNullOrEmpty(request.DisplayName) ? "Unknown User" : request.DisplayName;
|
||||||
|
|
||||||
|
_shownPairRequestNotifications.Add(request.HashedCid);
|
||||||
|
ShowPairRequestNotification(
|
||||||
|
senderName,
|
||||||
|
request.HashedCid,
|
||||||
|
onAccept: () => _pairRequestService.AcceptPairRequest(request.HashedCid, senderName),
|
||||||
|
onDecline: () => _pairRequestService.DeclinePairRequest(request.HashedCid, senderName));
|
||||||
|
}
|
||||||
|
|
||||||
private void HandlePairRequestsUpdated(PairRequestsUpdatedMessage _)
|
private void HandlePairRequestsUpdated(PairRequestsUpdatedMessage _)
|
||||||
{
|
{
|
||||||
var activeRequests = _pairRequestService.GetActiveRequests();
|
var activeRequests = _pairRequestService.GetActiveRequests();
|
||||||
var activeRequestIds = activeRequests.Select(r => r.HashedCid).ToHashSet();
|
var activeRequestIds = activeRequests.Select(r => r.HashedCid).ToHashSet();
|
||||||
|
|
||||||
// Dismiss notifications for requests that are no longer active
|
// Dismiss notifications for requests that are no longer active (expired)
|
||||||
var notificationsToRemove = _shownPairRequestNotifications
|
var notificationsToRemove = _shownPairRequestNotifications
|
||||||
.Where(hashedCid => !activeRequestIds.Contains(hashedCid))
|
.Where(hashedCid => !activeRequestIds.Contains(hashedCid))
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -597,17 +587,30 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
|
|||||||
Mediator.Publish(new LightlessNotificationDismissMessage(notificationId));
|
Mediator.Publish(new LightlessNotificationDismissMessage(notificationId));
|
||||||
_shownPairRequestNotifications.Remove(hashedCid);
|
_shownPairRequestNotifications.Remove(hashedCid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Show/update notifications for all active requests
|
private void HandlePairDownloadStatus(PairDownloadStatusMessage msg)
|
||||||
foreach (var request in activeRequests)
|
{
|
||||||
|
var userDownloads = msg.DownloadStatus.Where(x => x.PlayerName != "Pair Queue").ToList();
|
||||||
|
var totalProgress = userDownloads.Count > 0 ? userDownloads.Average(x => x.Progress) : 0f;
|
||||||
|
var message = BuildPairDownloadMessage(userDownloads, msg.QueueWaiting);
|
||||||
|
|
||||||
|
var notification = new LightlessNotification
|
||||||
{
|
{
|
||||||
_shownPairRequestNotifications.Add(request.HashedCid);
|
Id = "pair_download_progress",
|
||||||
ShowPairRequestNotification(
|
Title = "Downloading Pair Data",
|
||||||
request.DisplayName,
|
Message = message,
|
||||||
request.HashedCid,
|
Type = NotificationType.Download,
|
||||||
() => _pairRequestService.AcceptPairRequest(request.HashedCid, request.DisplayName),
|
Duration = TimeSpan.FromSeconds(_configService.Current.DownloadNotificationDurationSeconds),
|
||||||
() => _pairRequestService.DeclinePairRequest(request.HashedCid)
|
ShowProgress = true,
|
||||||
);
|
Progress = totalProgress
|
||||||
|
};
|
||||||
|
|
||||||
|
Mediator.Publish(new LightlessNotificationMessage(notification));
|
||||||
|
|
||||||
|
if (userDownloads.Count == 0 || AreAllDownloadsCompleted(userDownloads))
|
||||||
|
{
|
||||||
|
Mediator.Publish(new LightlessNotificationDismissMessage("pair_download_progress"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ public sealed class PairRequestService : DisposableMediatorSubscriberBase
|
|||||||
|
|
||||||
private static readonly TimeSpan Expiration = TimeSpan.FromMinutes(5);
|
private static readonly TimeSpan Expiration = TimeSpan.FromMinutes(5);
|
||||||
|
|
||||||
public PairRequestService(ILogger<PairRequestService> logger, LightlessMediator mediator, DalamudUtilService dalamudUtil, PairManager pairManager, Lazy<WebAPI.ApiController> apiController)
|
public PairRequestService(
|
||||||
|
ILogger<PairRequestService> logger,
|
||||||
|
LightlessMediator mediator,
|
||||||
|
DalamudUtilService dalamudUtil,
|
||||||
|
PairManager pairManager,
|
||||||
|
Lazy<WebAPI.ApiController> apiController)
|
||||||
: base(logger, mediator)
|
: base(logger, mediator)
|
||||||
{
|
{
|
||||||
_dalamudUtil = dalamudUtil;
|
_dalamudUtil = dalamudUtil;
|
||||||
@@ -215,9 +220,13 @@ public sealed class PairRequestService : DisposableMediatorSubscriberBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeclinePairRequest(string hashedCid)
|
public void DeclinePairRequest(string hashedCid, string displayName)
|
||||||
{
|
{
|
||||||
RemoveRequest(hashedCid);
|
RemoveRequest(hashedCid);
|
||||||
|
Mediator.Publish(new NotificationMessage("Pair request declined",
|
||||||
|
"Declined " + displayName + "'s pending pair request.",
|
||||||
|
NotificationType.Info,
|
||||||
|
TimeSpan.FromSeconds(3)));
|
||||||
Logger.LogDebug("Declined pair request from {HashedCid}", hashedCid);
|
Logger.LogDebug("Declined pair request from {HashedCid}", hashedCid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ public sealed class UiService : DisposableMediatorSubscriberBase
|
|||||||
LightlessConfigService lightlessConfigService, WindowSystem windowSystem,
|
LightlessConfigService lightlessConfigService, WindowSystem windowSystem,
|
||||||
IEnumerable<WindowMediatorSubscriberBase> windows,
|
IEnumerable<WindowMediatorSubscriberBase> windows,
|
||||||
UiFactory uiFactory, FileDialogManager fileDialogManager,
|
UiFactory uiFactory, FileDialogManager fileDialogManager,
|
||||||
LightlessMediator lightlessMediator,
|
LightlessMediator lightlessMediator) : base(logger, lightlessMediator)
|
||||||
NotificationService notificationService) : base(logger, lightlessMediator)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logger.LogTrace("Creating {type}", GetType().Name);
|
_logger.LogTrace("Creating {type}", GetType().Name);
|
||||||
|
|||||||
@@ -22,13 +22,12 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
private readonly UiSharedService _uiShared;
|
private readonly UiSharedService _uiShared;
|
||||||
private readonly PairProcessingLimiter _pairProcessingLimiter;
|
private readonly PairProcessingLimiter _pairProcessingLimiter;
|
||||||
private readonly ConcurrentDictionary<GameObjectHandler, bool> _uploadingPlayers = new();
|
private readonly ConcurrentDictionary<GameObjectHandler, bool> _uploadingPlayers = new();
|
||||||
private readonly NotificationService _notificationService;
|
|
||||||
private bool _notificationDismissed = true;
|
private bool _notificationDismissed = true;
|
||||||
private int _lastDownloadStateHash = 0;
|
private int _lastDownloadStateHash = 0;
|
||||||
|
|
||||||
public DownloadUi(ILogger<DownloadUi> logger, DalamudUtilService dalamudUtilService, LightlessConfigService configService,
|
public DownloadUi(ILogger<DownloadUi> logger, DalamudUtilService dalamudUtilService, LightlessConfigService configService,
|
||||||
PairProcessingLimiter pairProcessingLimiter, FileUploadManager fileTransferManager, LightlessMediator mediator, UiSharedService uiShared,
|
PairProcessingLimiter pairProcessingLimiter, FileUploadManager fileTransferManager, LightlessMediator mediator, UiSharedService uiShared,
|
||||||
PerformanceCollectorService performanceCollectorService, NotificationService notificationService)
|
PerformanceCollectorService performanceCollectorService)
|
||||||
: base(logger, mediator, "Lightless Sync Downloads", performanceCollectorService)
|
: base(logger, mediator, "Lightless Sync Downloads", performanceCollectorService)
|
||||||
{
|
{
|
||||||
_dalamudUtilService = dalamudUtilService;
|
_dalamudUtilService = dalamudUtilService;
|
||||||
@@ -36,7 +35,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
_pairProcessingLimiter = pairProcessingLimiter;
|
_pairProcessingLimiter = pairProcessingLimiter;
|
||||||
_fileTransferManager = fileTransferManager;
|
_fileTransferManager = fileTransferManager;
|
||||||
_uiShared = uiShared;
|
_uiShared = uiShared;
|
||||||
_notificationService = notificationService;
|
|
||||||
|
|
||||||
SizeConstraints = new WindowSizeConstraints()
|
SizeConstraints = new WindowSizeConstraints()
|
||||||
{
|
{
|
||||||
@@ -359,7 +357,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
_lastDownloadStateHash = currentHash;
|
_lastDownloadStateHash = currentHash;
|
||||||
if (downloadStatus.Count > 0 || queueWaiting > 0)
|
if (downloadStatus.Count > 0 || queueWaiting > 0)
|
||||||
{
|
{
|
||||||
_notificationService.ShowPairDownloadNotification(downloadStatus, queueWaiting);
|
Mediator.Publish(new PairDownloadStatusMessage(downloadStatus, queueWaiting));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
_uiSharedService.MediumText("Supporter Vanity Settings", UIColors.Get("LightlessPurple"));
|
_uiSharedService.MediumText("Supporter Vanity Settings", UIColors.Get("LightlessPurple"));
|
||||||
ImGui.Dummy(new Vector2(4));
|
ImGui.Dummy(new Vector2(4));
|
||||||
_uiSharedService.DrawNoteLine("# ", UIColors.Get("LightlessPurple"), "Must be a supporter through Patreon/Ko-fi to access these settings.");
|
_uiSharedService.DrawNoteLine("# ", UIColors.Get("LightlessPurple"), "Must be a supporter through Patreon/Ko-fi to access these settings. If you have the vanity role, you must interact with the Discord bot first.");
|
||||||
|
|
||||||
var hasVanity = _apiController.HasVanity;
|
var hasVanity = _apiController.HasVanity;
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ using Dalamud.Bindings.ImGui;
|
|||||||
|
|
||||||
namespace LightlessSync.UI;
|
namespace LightlessSync.UI;
|
||||||
|
|
||||||
public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
public class LightlessNotificationUi : WindowMediatorSubscriberBase
|
||||||
{
|
{
|
||||||
private const float NotificationMinHeight = 60f;
|
private const float _notificationMinHeight = 60f;
|
||||||
private const float NotificationMaxHeight = 250f;
|
private const float _notificationMaxHeight = 250f;
|
||||||
private const float WindowPaddingOffset = 6f;
|
private const float _windowPaddingOffset = 6f;
|
||||||
private const float SlideAnimationDistance = 100f;
|
private const float _slideAnimationDistance = 100f;
|
||||||
private const float OutAnimationSpeedMultiplier = 0.7f;
|
private const float _outAnimationSpeedMultiplier = 0.7f;
|
||||||
private const float ContentPaddingX = 10f;
|
private const float _contentPaddingX = 10f;
|
||||||
private const float ContentPaddingY = 6f;
|
private const float _contentPaddingY = 6f;
|
||||||
private const float TitleMessageSpacing = 4f;
|
private const float _titleMessageSpacing = 4f;
|
||||||
private const float ActionButtonSpacing = 8f;
|
private const float _actionButtonSpacing = 8f;
|
||||||
|
|
||||||
private readonly List<LightlessNotification> _notifications = new();
|
private readonly List<LightlessNotification> _notifications = new();
|
||||||
private readonly object _notificationLock = new();
|
private readonly object _notificationLock = new();
|
||||||
@@ -33,7 +33,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
private readonly Dictionary<string, float> _notificationYOffsets = new();
|
private readonly Dictionary<string, float> _notificationYOffsets = new();
|
||||||
private readonly Dictionary<string, float> _notificationTargetYOffsets = new();
|
private readonly Dictionary<string, float> _notificationTargetYOffsets = new();
|
||||||
|
|
||||||
public LightlessNotificationUI(ILogger<LightlessNotificationUI> logger, LightlessMediator mediator, PerformanceCollectorService performanceCollector, LightlessConfigService configService)
|
public LightlessNotificationUi(ILogger<LightlessNotificationUi> logger, LightlessMediator mediator, PerformanceCollectorService performanceCollector, LightlessConfigService configService)
|
||||||
: base(logger, mediator, "Lightless Notifications##LightlessNotifications", performanceCollector)
|
: base(logger, mediator, "Lightless Notifications##LightlessNotifications", performanceCollector)
|
||||||
{
|
{
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
@@ -155,8 +155,8 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
var width = _configService.Current.NotificationWidth;
|
var width = _configService.Current.NotificationWidth;
|
||||||
|
|
||||||
float posX = corner == NotificationCorner.Left
|
float posX = corner == NotificationCorner.Left
|
||||||
? viewport.WorkPos.X + offsetX - WindowPaddingOffset
|
? viewport.WorkPos.X + offsetX - _windowPaddingOffset
|
||||||
: viewport.WorkPos.X + viewport.WorkSize.X - width - offsetX - WindowPaddingOffset;
|
: viewport.WorkPos.X + viewport.WorkSize.X - width - offsetX - _windowPaddingOffset;
|
||||||
|
|
||||||
return new Vector2(posX, viewport.WorkPos.Y);
|
return new Vector2(posX, viewport.WorkPos.Y);
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
else if (notification.IsAnimatingOut && notification.AnimationProgress > 0f)
|
else if (notification.IsAnimatingOut && notification.AnimationProgress > 0f)
|
||||||
{
|
{
|
||||||
notification.AnimationProgress = Math.Max(0f,
|
notification.AnimationProgress = Math.Max(0f,
|
||||||
notification.AnimationProgress - deltaTime * _configService.Current.NotificationAnimationSpeed * OutAnimationSpeedMultiplier);
|
notification.AnimationProgress - deltaTime * _configService.Current.NotificationAnimationSpeed * _outAnimationSpeedMultiplier);
|
||||||
}
|
}
|
||||||
else if (!notification.IsAnimatingOut && !notification.IsDismissed)
|
else if (!notification.IsAnimatingOut && !notification.IsDismissed)
|
||||||
{
|
{
|
||||||
@@ -289,7 +289,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
private Vector2 CalculateSlideOffset(float alpha)
|
private Vector2 CalculateSlideOffset(float alpha)
|
||||||
{
|
{
|
||||||
var distance = (1f - alpha) * SlideAnimationDistance;
|
var distance = (1f - alpha) * _slideAnimationDistance;
|
||||||
var corner = _configService.Current.NotificationCorner;
|
var corner = _configService.Current.NotificationCorner;
|
||||||
return corner == NotificationCorner.Left ? new Vector2(-distance, 0) : new Vector2(distance, 0);
|
return corner == NotificationCorner.Left ? new Vector2(-distance, 0) : new Vector2(distance, 0);
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
private void DrawNotificationText(LightlessNotification notification, float alpha)
|
private void DrawNotificationText(LightlessNotification notification, float alpha)
|
||||||
{
|
{
|
||||||
var contentPos = new Vector2(ContentPaddingX, ContentPaddingY);
|
var contentPos = new Vector2(_contentPaddingX, _contentPaddingY);
|
||||||
var windowSize = ImGui.GetWindowSize();
|
var windowSize = ImGui.GetWindowSize();
|
||||||
var contentWidth = CalculateContentWidth(windowSize.X);
|
var contentWidth = CalculateContentWidth(windowSize.X);
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float CalculateContentWidth(float windowWidth) =>
|
private float CalculateContentWidth(float windowWidth) =>
|
||||||
windowWidth - (ContentPaddingX * 2);
|
windowWidth - (_contentPaddingX * 2);
|
||||||
|
|
||||||
private bool HasActions(LightlessNotification notification) =>
|
private bool HasActions(LightlessNotification notification) =>
|
||||||
notification.Actions.Count > 0;
|
notification.Actions.Count > 0;
|
||||||
@@ -491,9 +491,9 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
private void PositionActionsAtBottom(float windowHeight)
|
private void PositionActionsAtBottom(float windowHeight)
|
||||||
{
|
{
|
||||||
var actionHeight = ImGui.GetFrameHeight();
|
var actionHeight = ImGui.GetFrameHeight();
|
||||||
var bottomY = windowHeight - ContentPaddingY - actionHeight;
|
var bottomY = windowHeight - _contentPaddingY - actionHeight;
|
||||||
ImGui.SetCursorPosY(bottomY);
|
ImGui.SetCursorPosY(bottomY);
|
||||||
ImGui.SetCursorPosX(ContentPaddingX);
|
ImGui.SetCursorPosX(_contentPaddingX);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float DrawTitle(LightlessNotification notification, float contentWidth, float alpha)
|
private float DrawTitle(LightlessNotification notification, float contentWidth, float alpha)
|
||||||
@@ -530,7 +530,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(notification.Message)) return;
|
if (string.IsNullOrEmpty(notification.Message)) return;
|
||||||
|
|
||||||
var messagePos = contentPos + new Vector2(0f, titleHeight + TitleMessageSpacing);
|
var messagePos = contentPos + new Vector2(0f, titleHeight + _titleMessageSpacing);
|
||||||
var messageColor = new Vector4(0.9f, 0.9f, 0.9f, alpha);
|
var messageColor = new Vector4(0.9f, 0.9f, 0.9f, alpha);
|
||||||
|
|
||||||
ImGui.SetCursorPos(messagePos);
|
ImGui.SetCursorPos(messagePos);
|
||||||
@@ -563,13 +563,13 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
private float CalculateActionButtonWidth(int actionCount, float availableWidth)
|
private float CalculateActionButtonWidth(int actionCount, float availableWidth)
|
||||||
{
|
{
|
||||||
var totalSpacing = (actionCount - 1) * ActionButtonSpacing;
|
var totalSpacing = (actionCount - 1) * _actionButtonSpacing;
|
||||||
return (availableWidth - totalSpacing) / actionCount;
|
return (availableWidth - totalSpacing) / actionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PositionActionButton(int index, float startX, float buttonWidth)
|
private void PositionActionButton(int index, float startX, float buttonWidth)
|
||||||
{
|
{
|
||||||
var xPosition = startX + index * (buttonWidth + ActionButtonSpacing);
|
var xPosition = startX + index * (buttonWidth + _actionButtonSpacing);
|
||||||
ImGui.SetCursorPosX(xPosition);
|
ImGui.SetCursorPosX(xPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
height += 12f;
|
height += 12f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.Clamp(height, NotificationMinHeight, NotificationMaxHeight);
|
return Math.Clamp(height, _notificationMinHeight, _notificationMaxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float CalculateTitleHeight(LightlessNotification notification, float contentWidth)
|
private float CalculateTitleHeight(LightlessNotification notification, float contentWidth)
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
private readonly IProgress<(int, int, FileCacheEntity)> _validationProgress;
|
private readonly IProgress<(int, int, FileCacheEntity)> _validationProgress;
|
||||||
private readonly NameplateService _nameplateService;
|
private readonly NameplateService _nameplateService;
|
||||||
private readonly NameplateHandler _nameplateHandler;
|
private readonly NameplateHandler _nameplateHandler;
|
||||||
private readonly NotificationService _lightlessNotificationService;
|
|
||||||
private (int, int, FileCacheEntity) _currentProgress;
|
private (int, int, FileCacheEntity) _currentProgress;
|
||||||
private bool _deleteAccountPopupModalShown = false;
|
private bool _deleteAccountPopupModalShown = false;
|
||||||
private bool _deleteFilesPopupModalShown = false;
|
private bool _deleteFilesPopupModalShown = false;
|
||||||
@@ -107,8 +106,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
IpcManager ipcManager, CacheMonitor cacheMonitor,
|
IpcManager ipcManager, CacheMonitor cacheMonitor,
|
||||||
DalamudUtilService dalamudUtilService, HttpClient httpClient,
|
DalamudUtilService dalamudUtilService, HttpClient httpClient,
|
||||||
NameplateService nameplateService,
|
NameplateService nameplateService,
|
||||||
NameplateHandler nameplateHandler,
|
NameplateHandler nameplateHandler) : base(logger, mediator, "Lightless Sync Settings",
|
||||||
NotificationService lightlessNotificationService) : base(logger, mediator, "Lightless Sync Settings",
|
|
||||||
performanceCollector)
|
performanceCollector)
|
||||||
{
|
{
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
@@ -130,7 +128,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_uiShared = uiShared;
|
_uiShared = uiShared;
|
||||||
_nameplateService = nameplateService;
|
_nameplateService = nameplateService;
|
||||||
_nameplateHandler = nameplateHandler;
|
_nameplateHandler = nameplateHandler;
|
||||||
_lightlessNotificationService = lightlessNotificationService;
|
|
||||||
AllowClickthrough = false;
|
AllowClickthrough = false;
|
||||||
AllowPinning = true;
|
AllowPinning = true;
|
||||||
_validationProgress = new Progress<(int, int, FileCacheEntity)>(v => _currentProgress = v);
|
_validationProgress = new Progress<(int, int, FileCacheEntity)>(v => _currentProgress = v);
|
||||||
@@ -3616,20 +3613,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_pair", new Vector2(availableWidth, 0)))
|
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_pair", new Vector2(availableWidth, 0)))
|
||||||
{
|
{
|
||||||
_lightlessNotificationService.ShowPairRequestNotification(
|
Mediator.Publish(new PairRequestReceivedMessage("test-uid-123", "Test User wants to pair with you."));
|
||||||
"Test User",
|
|
||||||
"test-uid-123",
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
Mediator.Publish(new NotificationMessage("Accepted", "You accepted the test pair request.",
|
|
||||||
NotificationType.Info));
|
|
||||||
},
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
Mediator.Publish(new NotificationMessage("Declined", "You declined the test pair request.",
|
|
||||||
NotificationType.Info));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UiSharedService.AttachToolTip("Test pair request notification");
|
UiSharedService.AttachToolTip("Test pair request notification");
|
||||||
@@ -3652,15 +3636,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_download", new Vector2(availableWidth, 0)))
|
if (ImGui.Button($"{FontAwesomeIcon.Play.ToIconString()}##test_download", new Vector2(availableWidth, 0)))
|
||||||
{
|
{
|
||||||
_lightlessNotificationService.ShowPairDownloadNotification(
|
Mediator.Publish(new PairDownloadStatusMessage(
|
||||||
new List<(string playerName, float progress, string status)>
|
[
|
||||||
{
|
|
||||||
("Player One", 0.35f, "downloading"),
|
("Player One", 0.35f, "downloading"),
|
||||||
("Player Two", 0.75f, "downloading"),
|
("Player Two", 0.75f, "downloading"),
|
||||||
("Player Three", 1.0f, "downloading")
|
("Player Three", 1.0f, "downloading")
|
||||||
},
|
],
|
||||||
queueWaiting: 2
|
2
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UiSharedService.AttachToolTip("Test download progress notification");
|
UiSharedService.AttachToolTip("Test download progress notification");
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
|||||||
private float _particleSpawnTimer;
|
private float _particleSpawnTimer;
|
||||||
private readonly Random _random = new();
|
private readonly Random _random = new();
|
||||||
|
|
||||||
private const float HeaderHeight = 150f;
|
private const float _headerHeight = 150f;
|
||||||
private const float ParticleSpawnInterval = 0.2f;
|
private const float _particleSpawnInterval = 0.2f;
|
||||||
private const int MaxParticles = 50;
|
private const int _maxParticles = 50;
|
||||||
private const int MaxTrailLength = 50;
|
private const int _maxTrailLength = 50;
|
||||||
private const float EdgeFadeDistance = 30f;
|
private const float _edgeFadeDistance = 30f;
|
||||||
private const float ExtendedParticleHeight = 40f;
|
private const float _extendedParticleHeight = 40f;
|
||||||
|
|
||||||
public UpdateNotesUi(ILogger<UpdateNotesUi> logger,
|
public UpdateNotesUi(ILogger<UpdateNotesUi> logger,
|
||||||
LightlessMediator mediator,
|
LightlessMediator mediator,
|
||||||
@@ -111,16 +111,16 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
|||||||
var headerWidth = (800f * ImGuiHelpers.GlobalScale) - (windowPadding.X * 2);
|
var headerWidth = (800f * ImGuiHelpers.GlobalScale) - (windowPadding.X * 2);
|
||||||
|
|
||||||
var headerStart = windowPos + new Vector2(windowPadding.X, windowPadding.Y);
|
var headerStart = windowPos + new Vector2(windowPadding.X, windowPadding.Y);
|
||||||
var headerEnd = headerStart + new Vector2(headerWidth, HeaderHeight);
|
var headerEnd = headerStart + new Vector2(headerWidth, _headerHeight);
|
||||||
|
|
||||||
var extendedParticleSize = new Vector2(headerWidth, HeaderHeight + ExtendedParticleHeight);
|
var extendedParticleSize = new Vector2(headerWidth, _headerHeight + _extendedParticleHeight);
|
||||||
|
|
||||||
DrawGradientBackground(headerStart, headerEnd);
|
DrawGradientBackground(headerStart, headerEnd);
|
||||||
DrawHeaderText(headerStart);
|
DrawHeaderText(headerStart);
|
||||||
DrawHeaderButtons(headerStart, headerWidth);
|
DrawHeaderButtons(headerStart, headerWidth);
|
||||||
DrawBottomGradient(headerStart, headerEnd, headerWidth);
|
DrawBottomGradient(headerStart, headerEnd, headerWidth);
|
||||||
|
|
||||||
ImGui.SetCursorPosY(windowPadding.Y + HeaderHeight + 5);
|
ImGui.SetCursorPosY(windowPadding.Y + _headerHeight + 5);
|
||||||
ImGui.SetCursorPosX(20);
|
ImGui.SetCursorPosX(20);
|
||||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||||
{
|
{
|
||||||
@@ -260,7 +260,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
|||||||
var deltaTime = ImGui.GetIO().DeltaTime;
|
var deltaTime = ImGui.GetIO().DeltaTime;
|
||||||
_particleSpawnTimer += deltaTime;
|
_particleSpawnTimer += deltaTime;
|
||||||
|
|
||||||
if (_particleSpawnTimer > ParticleSpawnInterval && _particles.Count < MaxParticles)
|
if (_particleSpawnTimer > _particleSpawnInterval && _particles.Count < _maxParticles)
|
||||||
{
|
{
|
||||||
SpawnParticle(bannerSize);
|
SpawnParticle(bannerSize);
|
||||||
_particleSpawnTimer = 0f;
|
_particleSpawnTimer = 0f;
|
||||||
@@ -282,7 +282,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
|||||||
if (particle.Type == ParticleType.ShootingStar && particle.Trail != null)
|
if (particle.Type == ParticleType.ShootingStar && particle.Trail != null)
|
||||||
{
|
{
|
||||||
particle.Trail.Insert(0, particle.Position);
|
particle.Trail.Insert(0, particle.Position);
|
||||||
if (particle.Trail.Count > MaxTrailLength)
|
if (particle.Trail.Count > _maxTrailLength)
|
||||||
particle.Trail.RemoveAt(particle.Trail.Count - 1);
|
particle.Trail.RemoveAt(particle.Trail.Count - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,12 +316,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
|||||||
var lifeFade = Math.Min(fadeIn, fadeOut);
|
var lifeFade = Math.Min(fadeIn, fadeOut);
|
||||||
|
|
||||||
var edgeFadeX = Math.Min(
|
var edgeFadeX = Math.Min(
|
||||||
Math.Min(1f, (particle.Position.X + EdgeFadeDistance) / EdgeFadeDistance),
|
Math.Min(1f, (particle.Position.X + _edgeFadeDistance) / _edgeFadeDistance),
|
||||||
Math.Min(1f, (bannerSize.X - particle.Position.X + EdgeFadeDistance) / EdgeFadeDistance)
|
Math.Min(1f, (bannerSize.X - particle.Position.X + _edgeFadeDistance) / _edgeFadeDistance)
|
||||||
);
|
);
|
||||||
var edgeFadeY = Math.Min(
|
var edgeFadeY = Math.Min(
|
||||||
Math.Min(1f, (particle.Position.Y + EdgeFadeDistance) / EdgeFadeDistance),
|
Math.Min(1f, (particle.Position.Y + _edgeFadeDistance) / _edgeFadeDistance),
|
||||||
Math.Min(1f, (bannerSize.Y - particle.Position.Y + EdgeFadeDistance) / EdgeFadeDistance)
|
Math.Min(1f, (bannerSize.Y - particle.Position.Y + _edgeFadeDistance) / _edgeFadeDistance)
|
||||||
);
|
);
|
||||||
var edgeFade = Math.Min(edgeFadeX, edgeFadeY);
|
var edgeFade = Math.Min(edgeFadeX, edgeFadeY);
|
||||||
|
|
||||||
|
|||||||
@@ -107,17 +107,17 @@ public partial class ApiController
|
|||||||
}
|
}
|
||||||
public Task Client_ReceiveBroadcastPairRequest(UserPairNotificationDto dto)
|
public Task Client_ReceiveBroadcastPairRequest(UserPairNotificationDto dto)
|
||||||
{
|
{
|
||||||
if (dto == null)
|
Logger.LogDebug("Client_ReceiveBroadcastPairRequest: {dto}", dto);
|
||||||
|
|
||||||
|
if (dto is null)
|
||||||
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
var request = _pairRequestService.RegisterIncomingRequest(dto.myHashedCid, dto.message ?? string.Empty);
|
ExecuteSafely(() =>
|
||||||
var senderName = string.IsNullOrEmpty(request.DisplayName) ? "Unknown User" : request.DisplayName;
|
{
|
||||||
|
Mediator.Publish(new PairRequestReceivedMessage(dto.myHashedCid, dto.message ?? string.Empty));
|
||||||
_lightlessNotificationService.ShowPairRequestNotification(
|
});
|
||||||
senderName,
|
|
||||||
request.HashedCid,
|
|
||||||
onAccept: () => _pairRequestService.AcceptPairRequest(request.HashedCid, senderName),
|
|
||||||
onDecline: () => _pairRequestService.DeclinePairRequest(request.HashedCid));
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
|||||||
private readonly ServerConfigurationManager _serverManager;
|
private readonly ServerConfigurationManager _serverManager;
|
||||||
private readonly TokenProvider _tokenProvider;
|
private readonly TokenProvider _tokenProvider;
|
||||||
private readonly LightlessConfigService _lightlessConfigService;
|
private readonly LightlessConfigService _lightlessConfigService;
|
||||||
private readonly NotificationService _lightlessNotificationService;
|
|
||||||
private CancellationTokenSource _connectionCancellationTokenSource;
|
private CancellationTokenSource _connectionCancellationTokenSource;
|
||||||
private ConnectionDto? _connectionDto;
|
private ConnectionDto? _connectionDto;
|
||||||
private bool _doNotNotifyOnNextInfo = false;
|
private bool _doNotNotifyOnNextInfo = false;
|
||||||
@@ -54,7 +53,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
|||||||
_serverManager = serverManager;
|
_serverManager = serverManager;
|
||||||
_tokenProvider = tokenProvider;
|
_tokenProvider = tokenProvider;
|
||||||
_lightlessConfigService = lightlessConfigService;
|
_lightlessConfigService = lightlessConfigService;
|
||||||
_lightlessNotificationService = lightlessNotificationService;
|
|
||||||
_connectionCancellationTokenSource = new CancellationTokenSource();
|
_connectionCancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
Mediator.Subscribe<DalamudLoginMessage>(this, (_) => DalamudUtilOnLogIn());
|
Mediator.Subscribe<DalamudLoginMessage>(this, (_) => DalamudUtilOnLogIn());
|
||||||
|
|||||||
Reference in New Issue
Block a user