diff --git a/LightlessSync/Services/UiFactory.cs b/LightlessSync/Services/UiFactory.cs index 9b90830..33ab3ae 100644 --- a/LightlessSync/Services/UiFactory.cs +++ b/LightlessSync/Services/UiFactory.cs @@ -105,6 +105,7 @@ public class UiFactory groupData: groupData, isLightfinderContext: isLightfinderContext, lightfinderCid: lightfinderCid, - performanceCollector: _performanceCollectorService); + performanceCollector: _performanceCollectorService, + _apiController); } } diff --git a/LightlessSync/UI/StandaloneProfileUi.cs b/LightlessSync/UI/StandaloneProfileUi.cs index d1ebdbe..c33c522 100644 --- a/LightlessSync/UI/StandaloneProfileUi.cs +++ b/LightlessSync/UI/StandaloneProfileUi.cs @@ -11,6 +11,7 @@ using LightlessSync.Services.ServerConfiguration; using LightlessSync.UI.Services; using LightlessSync.UI.Tags; using LightlessSync.Utils; +using LightlessSync.WebAPI; using Microsoft.Extensions.Logging; using System.Numerics; @@ -22,6 +23,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase private readonly PairUiService _pairUiService; private readonly ServerConfigurationManager _serverManager; private readonly ProfileTagService _profileTagService; + private readonly ApiController _apiController; private readonly UiSharedService _uiSharedService; private readonly UserData? _userData; private readonly GroupData? _groupData; @@ -60,7 +62,8 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase GroupData? groupData, bool isLightfinderContext, string? lightfinderCid, - PerformanceCollectorService performanceCollector) + PerformanceCollectorService performanceCollector, + ApiController apiController) : base(logger, mediator, BuildWindowTitle( userData, groupData, @@ -94,6 +97,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase .Apply(); IsOpen = true; + _apiController = apiController; } public Pair? Pair { get; } @@ -248,19 +252,33 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase ResetBannerTexture(); _lastBannerPicture = bannerBytes; } - string? noteText = null; - string statusLabel = _isLightfinderContext ? "Exploring" : "Offline"; + + var isSelfProfile = !_isLightfinderContext + && _userData is not null + && !string.IsNullOrEmpty(_apiController.UID) + && string.Equals(_userData.UID, _apiController.UID, StringComparison.Ordinal); + + string statusLabel = _isLightfinderContext + ? "Exploring" + : isSelfProfile ? "Online" : "Offline"; + string? visiblePlayerName = null; bool directPair = false; bool youPaused = false; bool theyPaused = false; List syncshellLines = []; + if (!_isLightfinderContext) + { + noteText = _serverManager.GetNoteForUid(_userData!.UID); + } + if (!_isLightfinderContext && Pair != null) { var snapshot = _pairUiService.GetSnapshot(); noteText = _serverManager.GetNoteForUid(Pair.UserData.UID); + statusLabel = Pair.IsVisible ? "Visible" : (Pair.IsOnline ? "Online" : "Offline"); visiblePlayerName = Pair.IsVisible ? Pair.PlayerName : null; @@ -282,11 +300,15 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase var groupLabel = snapshot.GroupsByGid.TryGetValue(gid, out var groupInfo) ? groupInfo.GroupAliasOrGID : gid; + var groupNote = _serverManager.GetNoteForGid(gid); syncshellLines.Add(string.IsNullOrEmpty(groupNote) ? groupLabel : $"{groupNote} ({groupLabel})"); } } } + + if (isSelfProfile) + statusLabel = "Online"; } var presenceTokens = new List