Added refresh on leave of syncshell.
This commit is contained in:
@@ -107,6 +107,7 @@ public record GPoseLobbyReceiveWorldData(UserData UserData, WorldData WorldData)
|
||||
public record OpenCharaDataHubWithFilterMessage(UserData UserData) : MessageBase;
|
||||
public record EnableBroadcastMessage(string HashedCid, bool Enabled) : MessageBase;
|
||||
public record BroadcastStatusChangedMessage(bool Enabled, TimeSpan? Ttl) : MessageBase;
|
||||
public record UserLeftSyncshellReloadFinderUi(bool hasLeft, string gid) : MessageBase;
|
||||
public record SyncshellBroadcastsUpdatedMessage : MessageBase;
|
||||
public record PairRequestReceivedMessage(string HashedCid, string Message) : MessageBase;
|
||||
public record PairRequestsUpdatedMessage : MessageBase;
|
||||
|
||||
@@ -111,6 +111,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.GroupLeave(_groupFullInfoDto);
|
||||
_lightlessMediator.Publish(new UserLeftSyncshellReloadFinderUi(hasLeft: true, _groupFullInfoDto.GID));
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold CTRL and click to leave this Syncshell" + (!string.Equals(_groupFullInfoDto.OwnerUID, _apiController.UID, StringComparison.Ordinal)
|
||||
|
||||
@@ -14,6 +14,7 @@ using LightlessSync.Services.Mediator;
|
||||
using LightlessSync.Utils;
|
||||
using LightlessSync.WebAPI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Specialized;
|
||||
using System.Numerics;
|
||||
|
||||
namespace LightlessSync.UI;
|
||||
@@ -67,6 +68,7 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
|
||||
|
||||
Mediator.Subscribe<SyncshellBroadcastsUpdatedMessage>(this, async _ => await RefreshSyncshellsAsync().ConfigureAwait(false));
|
||||
Mediator.Subscribe<BroadcastStatusChangedMessage>(this, async _ => await RefreshSyncshellsAsync().ConfigureAwait(false));
|
||||
Mediator.Subscribe<UserLeftSyncshellReloadFinderUi>(this, async _ => await RefreshSyncshellsAsync(_.gid).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
public override async void OnOpen()
|
||||
@@ -121,7 +123,6 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
|
||||
return;
|
||||
}
|
||||
|
||||
// Build card data (same as you had)
|
||||
var cardData = new List<(GroupJoinDto Shell, string BroadcasterName)>();
|
||||
var broadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts();
|
||||
|
||||
@@ -131,7 +132,6 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
|
||||
|
||||
if (_useTestSyncshells)
|
||||
{
|
||||
// Fake broadcaster for test mode
|
||||
var displayName = !string.IsNullOrEmpty(shell.Group.Alias)
|
||||
? shell.Group.Alias
|
||||
: shell.Group.GID;
|
||||
@@ -473,24 +473,22 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
|
||||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
private async Task RefreshSyncshellsAsync()
|
||||
private async Task RefreshSyncshellsAsync(string gid = null)
|
||||
{
|
||||
var syncshellBroadcasts = _broadcastScannerService.GetActiveSyncshellBroadcasts();
|
||||
_currentSyncshells = [.. _pairManager.GroupPairs.Select(g => g.Key)];
|
||||
|
||||
_recentlyJoined.RemoveWhere(gid =>
|
||||
_currentSyncshells.Any(s => string.Equals(s.GID, gid, StringComparison.Ordinal)));
|
||||
_currentSyncshells.Exists(s => string.Equals(s.GID, gid, StringComparison.Ordinal)));
|
||||
|
||||
List<GroupJoinDto>? updatedList = [];
|
||||
|
||||
if (_useTestSyncshells)
|
||||
{
|
||||
// ---- TEST DATA PATH ----
|
||||
updatedList = BuildTestSyncshells();
|
||||
}
|
||||
else
|
||||
{
|
||||
// ---- NORMAL BEHAVIOUR ----
|
||||
if (syncshellBroadcasts.Count == 0)
|
||||
{
|
||||
ClearSyncshells();
|
||||
@@ -516,6 +514,11 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase
|
||||
return;
|
||||
}
|
||||
|
||||
if (gid != null && _recentlyJoined.Contains(gid))
|
||||
{
|
||||
_recentlyJoined.Remove(gid);
|
||||
}
|
||||
|
||||
var previousGid = GetSelectedGid();
|
||||
|
||||
_nearbySyncshells.Clear();
|
||||
|
||||
Reference in New Issue
Block a user