add individual syncshells and shit
This commit is contained in:
2
MareAPI
2
MareAPI
Submodule MareAPI updated: b4b8ff4a52...395123f055
@@ -11,6 +11,7 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
{
|
{
|
||||||
_charaDataFullDto = charaDataFullDto;
|
_charaDataFullDto = charaDataFullDto;
|
||||||
_userList = charaDataFullDto.AllowedUsers.ToList();
|
_userList = charaDataFullDto.AllowedUsers.ToList();
|
||||||
|
_groupList = charaDataFullDto.AllowedGroups.ToList();
|
||||||
_poseList = charaDataFullDto.PoseData.Select(k => new PoseEntry(k.Id)
|
_poseList = charaDataFullDto.PoseData.Select(k => new PoseEntry(k.Id)
|
||||||
{
|
{
|
||||||
Description = k.Description,
|
Description = k.Description,
|
||||||
@@ -22,6 +23,7 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
public CharaDataUpdateDto BaseDto => new(Id)
|
public CharaDataUpdateDto BaseDto => new(Id)
|
||||||
{
|
{
|
||||||
AllowedUsers = AllowedUsers,
|
AllowedUsers = AllowedUsers,
|
||||||
|
AllowedGroups = AllowedGroups,
|
||||||
AccessType = base.AccessType,
|
AccessType = base.AccessType,
|
||||||
CustomizeData = base.CustomizeData,
|
CustomizeData = base.CustomizeData,
|
||||||
Description = base.Description,
|
Description = base.Description,
|
||||||
@@ -192,15 +194,25 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
|
|
||||||
public IEnumerable<UserData> UserList => _userList;
|
public IEnumerable<UserData> UserList => _userList;
|
||||||
private readonly List<UserData> _userList;
|
private readonly List<UserData> _userList;
|
||||||
|
|
||||||
|
public IEnumerable<GroupData> GroupList => _groupList;
|
||||||
|
private readonly List<GroupData> _groupList;
|
||||||
|
|
||||||
public IEnumerable<PoseEntry> PoseList => _poseList;
|
public IEnumerable<PoseEntry> PoseList => _poseList;
|
||||||
private readonly List<PoseEntry> _poseList;
|
private readonly List<PoseEntry> _poseList;
|
||||||
|
|
||||||
public void AddToList(string user)
|
public void AddUserToList(string user)
|
||||||
{
|
{
|
||||||
_userList.Add(new(user, null));
|
_userList.Add(new(user, null));
|
||||||
UpdateAllowedUsers();
|
UpdateAllowedUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddGroupToList(string group)
|
||||||
|
{
|
||||||
|
_groupList.Add(new(group, null));
|
||||||
|
UpdateAllowedGroups();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateAllowedUsers()
|
private void UpdateAllowedUsers()
|
||||||
{
|
{
|
||||||
AllowedUsers = [.. _userList.Select(u => u.UID)];
|
AllowedUsers = [.. _userList.Select(u => u.UID)];
|
||||||
@@ -211,12 +223,28 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveFromList(string user)
|
private void UpdateAllowedGroups()
|
||||||
|
{
|
||||||
|
AllowedGroups = [.. _groupList.Select(u => u.GID)];
|
||||||
|
if (!AllowedGroups.Except(_charaDataFullDto.AllowedGroups.Select(u => u.GID), StringComparer.Ordinal).Any()
|
||||||
|
&& !_charaDataFullDto.AllowedGroups.Select(u => u.GID).Except(AllowedGroups, StringComparer.Ordinal).Any())
|
||||||
|
{
|
||||||
|
AllowedGroups = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveUserFromList(string user)
|
||||||
{
|
{
|
||||||
_userList.RemoveAll(u => string.Equals(u.UID, user, StringComparison.Ordinal));
|
_userList.RemoveAll(u => string.Equals(u.UID, user, StringComparison.Ordinal));
|
||||||
UpdateAllowedUsers();
|
UpdateAllowedUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveGroupFromList(string group)
|
||||||
|
{
|
||||||
|
_groupList.RemoveAll(u => string.Equals(u.GID, group, StringComparison.Ordinal));
|
||||||
|
UpdateAllowedGroups();
|
||||||
|
}
|
||||||
|
|
||||||
public void AddPose()
|
public void AddPose()
|
||||||
{
|
{
|
||||||
_poseList.Add(new PoseEntry(null));
|
_poseList.Add(new PoseEntry(null));
|
||||||
@@ -279,6 +307,7 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
base.CustomizeData = null;
|
base.CustomizeData = null;
|
||||||
base.ManipulationData = null;
|
base.ManipulationData = null;
|
||||||
AllowedUsers = null;
|
AllowedUsers = null;
|
||||||
|
AllowedGroups = null;
|
||||||
Poses = null;
|
Poses = null;
|
||||||
_poseList.Clear();
|
_poseList.Clear();
|
||||||
_poseList.AddRange(_charaDataFullDto.PoseData.Select(k => new PoseEntry(k.Id)
|
_poseList.AddRange(_charaDataFullDto.PoseData.Select(k => new PoseEntry(k.Id)
|
||||||
@@ -316,6 +345,7 @@ public sealed record CharaDataExtendedUpdateDto : CharaDataUpdateDto
|
|||||||
|| base.AccessType != null
|
|| base.AccessType != null
|
||||||
|| base.ShareType != null
|
|| base.ShareType != null
|
||||||
|| AllowedUsers != null
|
|| AllowedUsers != null
|
||||||
|
|| AllowedGroups != null
|
||||||
|| base.GlamourerData != null
|
|| base.GlamourerData != null
|
||||||
|| base.FileSwaps != null
|
|| base.FileSwaps != null
|
||||||
|| base.FileGamePaths != null
|
|| base.FileGamePaths != null
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ internal sealed partial class CharaDataHubUi
|
|||||||
|
|
||||||
private static string GetShareTypeString(ShareTypeDto dto) => dto switch
|
private static string GetShareTypeString(ShareTypeDto dto) => dto switch
|
||||||
{
|
{
|
||||||
ShareTypeDto.Private => "Private",
|
ShareTypeDto.Private => "Code Only",
|
||||||
ShareTypeDto.Shared => "Shared"
|
ShareTypeDto.Shared => "Shared"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using ImGuiNET;
|
|||||||
using MareSynchronos.API.Dto.CharaData;
|
using MareSynchronos.API.Dto.CharaData;
|
||||||
using MareSynchronos.Services.CharaData.Models;
|
using MareSynchronos.Services.CharaData.Models;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using MareSynchronos.Services;
|
||||||
|
|
||||||
namespace MareSynchronos.UI;
|
namespace MareSynchronos.UI;
|
||||||
|
|
||||||
@@ -122,15 +123,15 @@ internal sealed partial class CharaDataHubUi
|
|||||||
ImGui.EndCombo();
|
ImGui.EndCombo();
|
||||||
}
|
}
|
||||||
_uiSharedService.DrawHelpText("You can control who has access to your character data based on the access restrictions." + UiSharedService.TooltipSeparator
|
_uiSharedService.DrawHelpText("You can control who has access to your character data based on the access restrictions." + UiSharedService.TooltipSeparator
|
||||||
+ "Specified: Only people you directly specify in 'Specific Individuals' can access this character data" + Environment.NewLine
|
+ "Specified: Only people and syncshells you directly specify in 'Specific Individuals / Syncshells' can access this character data" + Environment.NewLine
|
||||||
+ "Close Pairs: Only people you have directly paired can access this character data" + Environment.NewLine
|
+ "Close Pairs: Only people you have directly paired can access this character data" + Environment.NewLine
|
||||||
+ "All Pairs: All people you have paired can access this character data" + Environment.NewLine
|
+ "All Pairs: All people you have paired can access this character data" + Environment.NewLine
|
||||||
+ "Everyone: Everyone can access this character data" + UiSharedService.TooltipSeparator
|
+ "Everyone: Everyone can access this character data" + UiSharedService.TooltipSeparator
|
||||||
+ "Note: To access your character data the person in question requires to have the code. Exceptions for 'Shared' data, see 'Sharing' below." + Environment.NewLine
|
+ "Note: To access your character data the person in question requires to have the code. Exceptions for 'Shared' data, see 'Sharing' below." + Environment.NewLine
|
||||||
+ "Note: For 'Close' and 'All Pairs' the pause state plays a role. Paused people will not be able to access your character data." + Environment.NewLine
|
+ "Note: For 'Close' and 'All Pairs' the pause state plays a role. Paused people will not be able to access your character data." + Environment.NewLine
|
||||||
+ "Note: Directly specified individuals in the 'Specific Individuals' list will be able to access your character data regardless of pause or pair state.");
|
+ "Note: Directly specified Individuals or Syncshells in the 'Specific Individuals / Syncshells' list will be able to access your character data regardless of pause or pair state.");
|
||||||
|
|
||||||
DrawSpecificIndividuals(updateDto);
|
DrawSpecific(updateDto);
|
||||||
|
|
||||||
ImGui.SetNextItemWidth(200);
|
ImGui.SetNextItemWidth(200);
|
||||||
var dtoShareType = updateDto.ShareType;
|
var dtoShareType = updateDto.ShareType;
|
||||||
@@ -150,8 +151,8 @@ internal sealed partial class CharaDataHubUi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_uiSharedService.DrawHelpText("This regulates how you want to distribute this character data." + UiSharedService.TooltipSeparator
|
_uiSharedService.DrawHelpText("This regulates how you want to distribute this character data." + UiSharedService.TooltipSeparator
|
||||||
+ "Private: People require to have the code to download this character data" + Environment.NewLine
|
+ "Code Only: People require to have the code to download this character data" + Environment.NewLine
|
||||||
+ "Shared: People that are allowed through 'Access Restrictions' will have this character data entry displayed in 'Shared with You'" + UiSharedService.TooltipSeparator
|
+ "Shared: People that are allowed through 'Access Restrictions' will have this character data entry displayed in 'Shared with You' (it can also be accessed through the code)" + UiSharedService.TooltipSeparator
|
||||||
+ "Note: Shared is incompatible with Access Restriction 'Everyone'");
|
+ "Note: Shared is incompatible with Access Restriction 'Everyone'");
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(10f);
|
ImGuiHelpers.ScaledDummy(10f);
|
||||||
@@ -649,6 +650,7 @@ internal sealed partial class CharaDataHubUi
|
|||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Plus, "New Character Data Entry"))
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Plus, "New Character Data Entry"))
|
||||||
{
|
{
|
||||||
_charaDataManager.CreateCharaDataEntry(_closalCts.Token);
|
_charaDataManager.CreateCharaDataEntry(_closalCts.Token);
|
||||||
|
_selectNewEntry = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_charaDataManager.DataCreationTask != null)
|
if (_charaDataManager.DataCreationTask != null)
|
||||||
@@ -685,49 +687,112 @@ internal sealed partial class CharaDataHubUi
|
|||||||
ImGuiHelpers.ScaledDummy(10);
|
ImGuiHelpers.ScaledDummy(10);
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
|
var charaDataEntries = _charaDataManager.OwnCharaData.Count;
|
||||||
|
if (charaDataEntries != _dataEntries && _selectNewEntry && _charaDataManager.OwnCharaData.Any())
|
||||||
|
{
|
||||||
|
_selectedDtoId = _charaDataManager.OwnCharaData.Last().Value.Id;
|
||||||
|
_selectNewEntry = false;
|
||||||
|
}
|
||||||
|
|
||||||
_ = _charaDataManager.OwnCharaData.TryGetValue(_selectedDtoId, out var dto);
|
_ = _charaDataManager.OwnCharaData.TryGetValue(_selectedDtoId, out var dto);
|
||||||
DrawEditCharaData(dto);
|
DrawEditCharaData(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSpecificIndividuals(CharaDataExtendedUpdateDto updateDto)
|
bool _selectNewEntry = false;
|
||||||
{
|
int _dataEntries = 0;
|
||||||
UiSharedService.DrawTree("Access for Specific Individuals", () =>
|
|
||||||
{
|
|
||||||
ImGui.SetNextItemWidth(200);
|
|
||||||
ImGui.InputText("##AliasToAdd", ref _specificIndividualAdd, 20);
|
|
||||||
ImGui.SameLine();
|
|
||||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_specificIndividualAdd)
|
|
||||||
|| updateDto.UserList.Any(f => string.Equals(f.UID, _specificIndividualAdd, StringComparison.Ordinal) || string.Equals(f.Alias, _specificIndividualAdd, StringComparison.Ordinal))))
|
|
||||||
{
|
|
||||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
|
||||||
{
|
|
||||||
updateDto.AddToList(_specificIndividualAdd);
|
|
||||||
_specificIndividualAdd = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.TextUnformatted("UID/Vanity ID to Add");
|
|
||||||
_uiSharedService.DrawHelpText("Users added to this list will be able to access this character data regardless of your pause or pair state with them." + UiSharedService.TooltipSeparator
|
|
||||||
+ "Note: Mistyped entries will be automatically removed on updating data to server.");
|
|
||||||
|
|
||||||
using (var lb = ImRaii.ListBox("Allowed Individuals", new(200, 200)))
|
private void DrawSpecific(CharaDataExtendedUpdateDto updateDto)
|
||||||
|
{
|
||||||
|
UiSharedService.DrawTree("Access for Specific Individuals / Syncshells", () =>
|
||||||
|
{
|
||||||
|
using (ImRaii.PushId("user"))
|
||||||
{
|
{
|
||||||
foreach (var user in updateDto.UserList)
|
using (ImRaii.Group())
|
||||||
{
|
{
|
||||||
var userString = string.IsNullOrEmpty(user.Alias) ? user.UID : $"{user.Alias} ({user.UID})";
|
ImGui.SetNextItemWidth(200);
|
||||||
if (ImGui.Selectable(userString, string.Equals(user.UID, _selectedSpecificIndividual, StringComparison.Ordinal)))
|
ImGui.InputText("##AliasToAdd", ref _specificIndividualAdd, 20);
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (ImRaii.Disabled(string.IsNullOrEmpty(_specificIndividualAdd)
|
||||||
|
|| updateDto.UserList.Any(f => string.Equals(f.UID, _specificIndividualAdd, StringComparison.Ordinal) || string.Equals(f.Alias, _specificIndividualAdd, StringComparison.Ordinal))))
|
||||||
{
|
{
|
||||||
_selectedSpecificIndividual = user.UID;
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||||
|
{
|
||||||
|
updateDto.AddUserToList(_specificIndividualAdd);
|
||||||
|
_specificIndividualAdd = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted("UID/Vanity UID to Add");
|
||||||
|
_uiSharedService.DrawHelpText("Users added to this list will be able to access this character data regardless of your pause or pair state with them." + UiSharedService.TooltipSeparator
|
||||||
|
+ "Note: Mistyped entries will be automatically removed on updating data to server.");
|
||||||
|
|
||||||
|
using (var lb = ImRaii.ListBox("Allowed Individuals", new(200, 200)))
|
||||||
|
{
|
||||||
|
foreach (var user in updateDto.UserList)
|
||||||
|
{
|
||||||
|
var userString = string.IsNullOrEmpty(user.Alias) ? user.UID : $"{user.Alias} ({user.UID})";
|
||||||
|
if (ImGui.Selectable(userString, string.Equals(user.UID, _selectedSpecificUserIndividual, StringComparison.Ordinal)))
|
||||||
|
{
|
||||||
|
_selectedSpecificUserIndividual = user.UID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (ImRaii.Disabled(string.IsNullOrEmpty(_selectedSpecificUserIndividual)))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Remove selected User"))
|
||||||
|
{
|
||||||
|
updateDto.RemoveUserFromList(_selectedSpecificUserIndividual);
|
||||||
|
_selectedSpecificUserIndividual = string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiHelpers.ScaledDummy(20);
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_selectedSpecificIndividual)))
|
using (ImRaii.PushId("group"))
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Remove selected User"))
|
using (ImRaii.Group())
|
||||||
{
|
{
|
||||||
updateDto.RemoveFromList(_selectedSpecificIndividual);
|
ImGui.SetNextItemWidth(200);
|
||||||
_selectedSpecificIndividual = string.Empty;
|
ImGui.InputText("##GroupAliasToAdd", ref _specificGroupAdd, 20);
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (ImRaii.Disabled(string.IsNullOrEmpty(_specificGroupAdd)
|
||||||
|
|| updateDto.GroupList.Any(f => string.Equals(f.GID, _specificGroupAdd, StringComparison.Ordinal) || string.Equals(f.Alias, _specificGroupAdd, StringComparison.Ordinal))))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||||
|
{
|
||||||
|
updateDto.AddGroupToList(_specificGroupAdd);
|
||||||
|
_specificGroupAdd = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted("GID/Vanity GID to Add");
|
||||||
|
_uiSharedService.DrawHelpText("Users in Syncshells added to this list will be able to access this character data regardless of your pause or pair state with them." + UiSharedService.TooltipSeparator
|
||||||
|
+ "Note: Mistyped entries will be automatically removed on updating data to server.");
|
||||||
|
|
||||||
|
using (var lb = ImRaii.ListBox("Allowed Syncshells", new(200, 200)))
|
||||||
|
{
|
||||||
|
foreach (var group in updateDto.GroupList)
|
||||||
|
{
|
||||||
|
var userString = string.IsNullOrEmpty(group.Alias) ? group.GID : $"{group.Alias} ({group.GID})";
|
||||||
|
if (ImGui.Selectable(userString, string.Equals(group.GID, _selectedSpecificGroupIndividual, StringComparison.Ordinal)))
|
||||||
|
{
|
||||||
|
_selectedSpecificGroupIndividual = group.GID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (ImRaii.Disabled(string.IsNullOrEmpty(_selectedSpecificGroupIndividual)))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Remove selected Syncshell"))
|
||||||
|
{
|
||||||
|
updateDto.RemoveGroupFromList(_selectedSpecificGroupIndividual);
|
||||||
|
_selectedSpecificGroupIndividual = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,13 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||||||
private bool _openMcdOnlineOnNextRun = false;
|
private bool _openMcdOnlineOnNextRun = false;
|
||||||
private bool _readExport;
|
private bool _readExport;
|
||||||
private string _selectedDtoId = string.Empty;
|
private string _selectedDtoId = string.Empty;
|
||||||
private string _selectedSpecificIndividual = string.Empty;
|
private string _selectedSpecificUserIndividual = string.Empty;
|
||||||
|
private string _selectedSpecificGroupIndividual = string.Empty;
|
||||||
private string _sharedWithYouDescriptionFilter = string.Empty;
|
private string _sharedWithYouDescriptionFilter = string.Empty;
|
||||||
private bool _sharedWithYouDownloadableFilter = false;
|
private bool _sharedWithYouDownloadableFilter = false;
|
||||||
private string _sharedWithYouOwnerFilter = string.Empty;
|
private string _sharedWithYouOwnerFilter = string.Empty;
|
||||||
private string _specificIndividualAdd = string.Empty;
|
private string _specificIndividualAdd = string.Empty;
|
||||||
|
private string _specificGroupAdd = string.Empty;
|
||||||
private bool _abbreviateCharaName = false;
|
private bool _abbreviateCharaName = false;
|
||||||
|
|
||||||
public CharaDataHubUi(ILogger<CharaDataHubUi> logger, MareMediator mediator, PerformanceCollectorService performanceCollectorService,
|
public CharaDataHubUi(ILogger<CharaDataHubUi> logger, MareMediator mediator, PerformanceCollectorService performanceCollectorService,
|
||||||
@@ -588,6 +590,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
DrawAddOrRemoveFavorite(_charaDataManager.LastDownloadedMetaInfo);
|
DrawAddOrRemoveFavorite(_charaDataManager.LastDownloadedMetaInfo);
|
||||||
|
|
||||||
|
ImGui.NewLine();
|
||||||
if (!_charaDataManager.DownloadMetaInfoTask?.IsCompleted ?? false)
|
if (!_charaDataManager.DownloadMetaInfoTask?.IsCompleted ?? false)
|
||||||
{
|
{
|
||||||
UiSharedService.ColorTextWrapped("Downloading meta info. Please wait.", ImGuiColors.DalamudYellow);
|
UiSharedService.ColorTextWrapped("Downloading meta info. Please wait.", ImGuiColors.DalamudYellow);
|
||||||
|
|||||||
Reference in New Issue
Block a user