fix open notes popup on user addition, fix saving on every secrey key access
This commit is contained in:
@@ -66,6 +66,8 @@ public class PairManager : IDisposable
|
||||
public List<Pair> OnlineUserPairs => _allClientPairs.Where(p => !string.IsNullOrEmpty(p.Value.PlayerNameHash)).Select(p => p.Value).ToList();
|
||||
public List<UserData> 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();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ public class ServerConfigurationManager
|
||||
{
|
||||
ServerStorage? currentServer;
|
||||
currentServer = serverIdx == -1 ? CurrentServer : GetServerByIndex(serverIdx);
|
||||
Save();
|
||||
if (currentServer == null)
|
||||
{
|
||||
currentServer = new();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.7.7</Version>
|
||||
<Version>0.7.8</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace MareSynchronos.WebAPI;
|
||||
|
||||
public partial class ApiController
|
||||
{
|
||||
public UserPairDto? LastAddedUser { get; set; }
|
||||
private void ExecuteSafely(Action act)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user