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<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 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)
|
public void AddGroup(GroupFullInfoDto dto)
|
||||||
{
|
{
|
||||||
_allGroups[dto.Group] = dto;
|
_allGroups[dto.Group] = dto;
|
||||||
@@ -109,8 +111,8 @@ public class PairManager : IDisposable
|
|||||||
public void AddUserPair(UserPairDto dto)
|
public void AddUserPair(UserPairDto dto)
|
||||||
{
|
{
|
||||||
if (!_allClientPairs.ContainsKey(dto.User)) _allClientPairs[dto.User] = _pairFactory.Create();
|
if (!_allClientPairs.ContainsKey(dto.User)) _allClientPairs[dto.User] = _pairFactory.Create();
|
||||||
|
|
||||||
_allClientPairs[dto.User].UserPair = dto;
|
_allClientPairs[dto.User].UserPair = dto;
|
||||||
|
LastAddedUser = _allClientPairs[dto.User];
|
||||||
_allClientPairs[dto.User].ApplyLastReceivedData();
|
_allClientPairs[dto.User].ApplyLastReceivedData();
|
||||||
RecreateLazy();
|
RecreateLazy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ public class ServerConfigurationManager
|
|||||||
{
|
{
|
||||||
ServerStorage? currentServer;
|
ServerStorage? currentServer;
|
||||||
currentServer = serverIdx == -1 ? CurrentServer : GetServerByIndex(serverIdx);
|
currentServer = serverIdx == -1 ? CurrentServer : GetServerByIndex(serverIdx);
|
||||||
Save();
|
|
||||||
if (currentServer == null)
|
if (currentServer == null)
|
||||||
{
|
{
|
||||||
currentServer = new();
|
currentServer = new();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.7.7</Version>
|
<Version>0.7.8</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CompactUi : Window, IDisposable
|
|||||||
|
|
||||||
private bool _showSyncShells;
|
private bool _showSyncShells;
|
||||||
private readonly GroupPanel _groupPanel;
|
private readonly GroupPanel _groupPanel;
|
||||||
private UserPairDto? _lastAddedUser;
|
private Pair? _lastAddedUser;
|
||||||
private string _lastAddedUserComment = string.Empty;
|
private string _lastAddedUserComment = string.Empty;
|
||||||
|
|
||||||
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
||||||
@@ -190,10 +190,10 @@ public class CompactUi : Window, IDisposable
|
|||||||
UiShared.DrawWithID("grouping-popup", () => _selectGroupForPairUi.Draw(ShowUidForEntry));
|
UiShared.DrawWithID("grouping-popup", () => _selectGroupForPairUi.Draw(ShowUidForEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configService.Current.OpenPopupOnAdd && _apiController.LastAddedUser != null)
|
if (_configService.Current.OpenPopupOnAdd && _pairManager.LastAddedUser != null)
|
||||||
{
|
{
|
||||||
_lastAddedUser = _apiController.LastAddedUser;
|
_lastAddedUser = _pairManager.LastAddedUser;
|
||||||
_apiController.LastAddedUser = null;
|
_pairManager.LastAddedUser = null;
|
||||||
ImGui.OpenPopup("Set Notes for New User");
|
ImGui.OpenPopup("Set Notes for New User");
|
||||||
_showModalForUserAddition = true;
|
_showModalForUserAddition = true;
|
||||||
_lastAddedUserComment = string.Empty;
|
_lastAddedUserComment = string.Empty;
|
||||||
@@ -207,11 +207,11 @@ public class CompactUi : Window, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UiShared.TextWrapped($"You have successfully added {_lastAddedUser.User.AliasOrUID}. Set a local note for the user in the field below:");
|
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.User.AliasOrUID}", ref _lastAddedUserComment, 100);
|
ImGui.InputTextWithHint("##noteforuser", $"Note for {_lastAddedUser.UserData.AliasOrUID}", ref _lastAddedUserComment, 100);
|
||||||
if (UiShared.IconTextButton(FontAwesomeIcon.Save, "Save Note"))
|
if (UiShared.IconTextButton(FontAwesomeIcon.Save, "Save Note"))
|
||||||
{
|
{
|
||||||
_serverManager.CurrentServer!.UidServerComments[_lastAddedUser.User.UID] = _lastAddedUserComment;
|
_serverManager.CurrentServer!.UidServerComments[_lastAddedUser.UserData.UID] = _lastAddedUserComment;
|
||||||
_serverManager.Save();
|
_serverManager.Save();
|
||||||
_lastAddedUser = null;
|
_lastAddedUser = null;
|
||||||
_lastAddedUserComment = string.Empty;
|
_lastAddedUserComment = string.Empty;
|
||||||
|
|||||||
@@ -452,7 +452,6 @@ public class SettingsUi : Window, IDisposable
|
|||||||
|
|
||||||
if (ImGui.Checkbox("Open Notes Popup on user addition", ref openPopupOnAddition))
|
if (ImGui.Checkbox("Open Notes Popup on user addition", ref openPopupOnAddition))
|
||||||
{
|
{
|
||||||
ApiController.LastAddedUser = null;
|
|
||||||
_configService.Current.OpenPopupOnAdd = openPopupOnAddition;
|
_configService.Current.OpenPopupOnAdd = openPopupOnAddition;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ namespace MareSynchronos.WebAPI;
|
|||||||
|
|
||||||
public partial class ApiController
|
public partial class ApiController
|
||||||
{
|
{
|
||||||
public UserPairDto? LastAddedUser { get; set; }
|
|
||||||
private void ExecuteSafely(Action act)
|
private void ExecuteSafely(Action act)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user