diff --git a/MareSynchronos/Managers/PairManager.cs b/MareSynchronos/Managers/PairManager.cs index 0830b27..641e9dd 100644 --- a/MareSynchronos/Managers/PairManager.cs +++ b/MareSynchronos/Managers/PairManager.cs @@ -66,6 +66,8 @@ public class PairManager : IDisposable public List OnlineUserPairs => _allClientPairs.Where(p => !string.IsNullOrEmpty(p.Value.PlayerNameHash)).Select(p => p.Value).ToList(); public List VisibleUsers => _allClientPairs.Where(p => p.Value.CachedPlayer != null && p.Value.CachedPlayer.IsVisible).Select(p => p.Key).ToList(); + public Pair? LastAddedUser { get; internal set; } + public void AddGroup(GroupFullInfoDto dto) { _allGroups[dto.Group] = dto; @@ -109,8 +111,8 @@ public class PairManager : IDisposable public void AddUserPair(UserPairDto dto) { if (!_allClientPairs.ContainsKey(dto.User)) _allClientPairs[dto.User] = _pairFactory.Create(); - _allClientPairs[dto.User].UserPair = dto; + LastAddedUser = _allClientPairs[dto.User]; _allClientPairs[dto.User].ApplyLastReceivedData(); RecreateLazy(); } diff --git a/MareSynchronos/Managers/ServerConfigurationManager.cs b/MareSynchronos/Managers/ServerConfigurationManager.cs index 0648071..d14873a 100644 --- a/MareSynchronos/Managers/ServerConfigurationManager.cs +++ b/MareSynchronos/Managers/ServerConfigurationManager.cs @@ -74,7 +74,6 @@ public class ServerConfigurationManager { ServerStorage? currentServer; currentServer = serverIdx == -1 ? CurrentServer : GetServerByIndex(serverIdx); - Save(); if (currentServer == null) { currentServer = new(); diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj index 08d4d27..4404bf1 100644 --- a/MareSynchronos/MareSynchronos.csproj +++ b/MareSynchronos/MareSynchronos.csproj @@ -3,7 +3,7 @@ - 0.7.7 + 0.7.8 https://github.com/Penumbra-Sync/client diff --git a/MareSynchronos/UI/CompactUI.cs b/MareSynchronos/UI/CompactUI.cs index 289eb12..68b8491 100644 --- a/MareSynchronos/UI/CompactUI.cs +++ b/MareSynchronos/UI/CompactUI.cs @@ -48,7 +48,7 @@ public class CompactUi : Window, IDisposable private bool _showSyncShells; private readonly GroupPanel _groupPanel; - private UserPairDto? _lastAddedUser; + private Pair? _lastAddedUser; private string _lastAddedUserComment = string.Empty; private readonly SelectGroupForPairUi _selectGroupForPairUi; @@ -190,10 +190,10 @@ public class CompactUi : Window, IDisposable UiShared.DrawWithID("grouping-popup", () => _selectGroupForPairUi.Draw(ShowUidForEntry)); } - if (_configService.Current.OpenPopupOnAdd && _apiController.LastAddedUser != null) + if (_configService.Current.OpenPopupOnAdd && _pairManager.LastAddedUser != null) { - _lastAddedUser = _apiController.LastAddedUser; - _apiController.LastAddedUser = null; + _lastAddedUser = _pairManager.LastAddedUser; + _pairManager.LastAddedUser = null; ImGui.OpenPopup("Set Notes for New User"); _showModalForUserAddition = true; _lastAddedUserComment = string.Empty; @@ -207,11 +207,11 @@ public class CompactUi : Window, IDisposable } else { - UiShared.TextWrapped($"You have successfully added {_lastAddedUser.User.AliasOrUID}. Set a local note for the user in the field below:"); - ImGui.InputTextWithHint("##noteforuser", $"Note for {_lastAddedUser.User.AliasOrUID}", ref _lastAddedUserComment, 100); + UiShared.TextWrapped($"You have successfully added {_lastAddedUser.UserData.AliasOrUID}. Set a local note for the user in the field below:"); + ImGui.InputTextWithHint("##noteforuser", $"Note for {_lastAddedUser.UserData.AliasOrUID}", ref _lastAddedUserComment, 100); if (UiShared.IconTextButton(FontAwesomeIcon.Save, "Save Note")) { - _serverManager.CurrentServer!.UidServerComments[_lastAddedUser.User.UID] = _lastAddedUserComment; + _serverManager.CurrentServer!.UidServerComments[_lastAddedUser.UserData.UID] = _lastAddedUserComment; _serverManager.Save(); _lastAddedUser = null; _lastAddedUserComment = string.Empty; diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index c07d335..423a722 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -452,7 +452,6 @@ public class SettingsUi : Window, IDisposable if (ImGui.Checkbox("Open Notes Popup on user addition", ref openPopupOnAddition)) { - ApiController.LastAddedUser = null; _configService.Current.OpenPopupOnAdd = openPopupOnAddition; _configService.Save(); } diff --git a/MareSynchronos/WebAPI/ApiController.Functions.Callbacks.cs b/MareSynchronos/WebAPI/ApiController.Functions.Callbacks.cs index 2940565..e3726ac 100644 --- a/MareSynchronos/WebAPI/ApiController.Functions.Callbacks.cs +++ b/MareSynchronos/WebAPI/ApiController.Functions.Callbacks.cs @@ -9,7 +9,6 @@ namespace MareSynchronos.WebAPI; public partial class ApiController { - public UserPairDto? LastAddedUser { get; set; } private void ExecuteSafely(Action act) { try