Seperated pair tags and syncshell tags, added function to be able to add syncshell tags.
This commit is contained in:
@@ -5,5 +5,6 @@ public class ServerTagStorage
|
|||||||
{
|
{
|
||||||
public HashSet<string> OpenPairTags { get; set; } = new(StringComparer.Ordinal);
|
public HashSet<string> OpenPairTags { get; set; } = new(StringComparer.Ordinal);
|
||||||
public HashSet<string> ServerAvailablePairTags { get; set; } = new(StringComparer.Ordinal);
|
public HashSet<string> ServerAvailablePairTags { get; set; } = new(StringComparer.Ordinal);
|
||||||
|
public HashSet<string> ServerAvailableSyncshellTags { get; set; } = new(StringComparer.Ordinal);
|
||||||
public Dictionary<string, List<string>> UidServerPairedUserTags { get; set; } = new(StringComparer.Ordinal);
|
public Dictionary<string, List<string>> UidServerPairedUserTags { get; set; } = new(StringComparer.Ordinal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace LightlessSync.LightlessConfiguration;
|
namespace LightlessSync.LightlessConfiguration;
|
||||||
|
|
||||||
public class ServerTagConfigService : ConfigurationServiceBase<ServerTagConfig>
|
public class PairTagConfigService : ConfigurationServiceBase<ServerTagConfig>
|
||||||
{
|
{
|
||||||
public const string ConfigName = "servertags.json";
|
public const string ConfigName = "servertags.json";
|
||||||
|
|
||||||
public ServerTagConfigService(string configDir) : base(configDir)
|
public PairTagConfigService(string configDir) : base(configDir)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using LightlessSync.LightlessConfiguration.Configurations;
|
||||||
|
|
||||||
|
namespace LightlessSync.LightlessConfiguration;
|
||||||
|
|
||||||
|
public class SyncshellTagConfigService : ConfigurationServiceBase<ServerTagConfig>
|
||||||
|
{
|
||||||
|
public const string ConfigName = "serversyncshelltags.json";
|
||||||
|
|
||||||
|
public SyncshellTagConfigService(string configDir) : base(configDir)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ConfigurationName => ConfigName;
|
||||||
|
}
|
||||||
@@ -175,7 +175,8 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton((s) => new LightlessConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new LightlessConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ServerConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new ServerConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ServerTagConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new PairTagConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
|
collection.AddSingleton((s) => new SyncshellTagConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new TransientConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new TransientConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new XivDataStorageService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new XivDataStorageService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new PlayerPerformanceConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new PlayerPerformanceConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
@@ -183,7 +184,8 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<LightlessConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<LightlessConfigService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<ServerConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<ServerConfigService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<NotesConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<NotesConfigService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<ServerTagConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<PairTagConfigService>());
|
||||||
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<SyncshellTagConfigService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<TransientConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<TransientConfigService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<XivDataStorageService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<XivDataStorageService>());
|
||||||
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<PlayerPerformanceConfigService>());
|
collection.AddSingleton<IConfigService<ILightlessConfiguration>>(s => s.GetRequiredService<PlayerPerformanceConfigService>());
|
||||||
|
|||||||
@@ -23,15 +23,17 @@ public class ServerConfigurationManager
|
|||||||
private readonly ILogger<ServerConfigurationManager> _logger;
|
private readonly ILogger<ServerConfigurationManager> _logger;
|
||||||
private readonly LightlessMediator _lightlessMediator;
|
private readonly LightlessMediator _lightlessMediator;
|
||||||
private readonly NotesConfigService _notesConfig;
|
private readonly NotesConfigService _notesConfig;
|
||||||
private readonly ServerTagConfigService _serverTagConfig;
|
private readonly PairTagConfigService _pairTagConfig;
|
||||||
|
private readonly SyncshellTagConfigService _syncshellTagConfig;
|
||||||
|
|
||||||
public ServerConfigurationManager(ILogger<ServerConfigurationManager> logger, ServerConfigService configService,
|
public ServerConfigurationManager(ILogger<ServerConfigurationManager> logger, ServerConfigService configService,
|
||||||
ServerTagConfigService serverTagConfig, NotesConfigService notesConfig, DalamudUtilService dalamudUtil,
|
PairTagConfigService pairTagConfig, SyncshellTagConfigService syncshellTagConfig, NotesConfigService notesConfig, DalamudUtilService dalamudUtil,
|
||||||
LightlessConfigService lightlessConfigService, HttpClient httpClient, LightlessMediator lightlessMediator)
|
LightlessConfigService lightlessConfigService, HttpClient httpClient, LightlessMediator lightlessMediator)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
_serverTagConfig = serverTagConfig;
|
_pairTagConfig = pairTagConfig;
|
||||||
|
_syncshellTagConfig = syncshellTagConfig;
|
||||||
_notesConfig = notesConfig;
|
_notesConfig = notesConfig;
|
||||||
_dalamudUtil = dalamudUtil;
|
_dalamudUtil = dalamudUtil;
|
||||||
_lightlessConfigService = lightlessConfigService;
|
_lightlessConfigService = lightlessConfigService;
|
||||||
@@ -285,7 +287,7 @@ public class ServerConfigurationManager
|
|||||||
internal void AddOpenPairTag(string tag)
|
internal void AddOpenPairTag(string tag)
|
||||||
{
|
{
|
||||||
CurrentServerTagStorage().OpenPairTags.Add(tag);
|
CurrentServerTagStorage().OpenPairTags.Add(tag);
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddServer(ServerStorage serverStorage)
|
internal void AddServer(ServerStorage serverStorage)
|
||||||
@@ -294,10 +296,17 @@ public class ServerConfigurationManager
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddTag(string tag)
|
internal void AddPairTag(string tag)
|
||||||
{
|
{
|
||||||
CurrentServerTagStorage().ServerAvailablePairTags.Add(tag);
|
CurrentServerTagStorage().ServerAvailablePairTags.Add(tag);
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
|
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddSyncshellTag(string tag)
|
||||||
|
{
|
||||||
|
CurrentServerTagStorage().ServerAvailableSyncshellTags.Add(tag);
|
||||||
|
_pairTagConfig.Save();
|
||||||
_lightlessMediator.Publish(new RefreshUiMessage());
|
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +322,7 @@ public class ServerConfigurationManager
|
|||||||
CurrentServerTagStorage().UidServerPairedUserTags[uid] = [tagName];
|
CurrentServerTagStorage().UidServerPairedUserTags[uid] = [tagName];
|
||||||
}
|
}
|
||||||
|
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool ContainsOpenPairTag(string tag)
|
internal bool ContainsOpenPairTag(string tag)
|
||||||
@@ -369,6 +378,11 @@ public class ServerConfigurationManager
|
|||||||
return CurrentServerTagStorage().ServerAvailablePairTags;
|
return CurrentServerTagStorage().ServerAvailablePairTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal HashSet<string> GetServerAvailableSyncshellTags()
|
||||||
|
{
|
||||||
|
return CurrentServerTagStorage().ServerAvailableSyncshellTags;
|
||||||
|
}
|
||||||
|
|
||||||
internal Dictionary<string, List<string>> GetUidServerPairedUserTags()
|
internal Dictionary<string, List<string>> GetUidServerPairedUserTags()
|
||||||
{
|
{
|
||||||
return CurrentServerTagStorage().UidServerPairedUserTags;
|
return CurrentServerTagStorage().UidServerPairedUserTags;
|
||||||
@@ -399,7 +413,7 @@ public class ServerConfigurationManager
|
|||||||
internal void RemoveOpenPairTag(string tag)
|
internal void RemoveOpenPairTag(string tag)
|
||||||
{
|
{
|
||||||
CurrentServerTagStorage().OpenPairTags.Remove(tag);
|
CurrentServerTagStorage().OpenPairTags.Remove(tag);
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RemoveTag(string tag)
|
internal void RemoveTag(string tag)
|
||||||
@@ -409,7 +423,7 @@ public class ServerConfigurationManager
|
|||||||
{
|
{
|
||||||
RemoveTagForUid(uid, tag, save: false);
|
RemoveTagForUid(uid, tag, save: false);
|
||||||
}
|
}
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
_lightlessMediator.Publish(new RefreshUiMessage());
|
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +435,7 @@ public class ServerConfigurationManager
|
|||||||
|
|
||||||
if (save)
|
if (save)
|
||||||
{
|
{
|
||||||
_serverTagConfig.Save();
|
_pairTagConfig.Save();
|
||||||
_lightlessMediator.Publish(new RefreshUiMessage());
|
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,7 +493,7 @@ public class ServerConfigurationManager
|
|||||||
private ServerTagStorage CurrentServerTagStorage()
|
private ServerTagStorage CurrentServerTagStorage()
|
||||||
{
|
{
|
||||||
TryCreateCurrentServerTagStorage();
|
TryCreateCurrentServerTagStorage();
|
||||||
return _serverTagConfig.Current.ServerTagStorage[CurrentApiUrl];
|
return _pairTagConfig.Current.ServerTagStorage[CurrentApiUrl];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnsureMainExists()
|
private void EnsureMainExists()
|
||||||
@@ -501,9 +515,9 @@ public class ServerConfigurationManager
|
|||||||
|
|
||||||
private void TryCreateCurrentServerTagStorage()
|
private void TryCreateCurrentServerTagStorage()
|
||||||
{
|
{
|
||||||
if (!_serverTagConfig.Current.ServerTagStorage.ContainsKey(CurrentApiUrl))
|
if (!_pairTagConfig.Current.ServerTagStorage.ContainsKey(CurrentApiUrl))
|
||||||
{
|
{
|
||||||
_serverTagConfig.Current.ServerTagStorage[CurrentApiUrl] = new();
|
_pairTagConfig.Current.ServerTagStorage[CurrentApiUrl] = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -516,7 +516,8 @@ public class CompactUi : WindowMediatorSubscriberBase
|
|||||||
else
|
else
|
||||||
drawFolders.AddRange(groupFolders);
|
drawFolders.AddRange(groupFolders);
|
||||||
|
|
||||||
var tags = _tagHandler.GetAllTagsSorted();
|
var tags = _tagHandler.GetAllPairTagsSorted();
|
||||||
|
_logger.LogInformation($"Loading {tags.Count} pair tags");
|
||||||
foreach (var tag in tags)
|
foreach (var tag in tags)
|
||||||
{
|
{
|
||||||
var allTagPairs = ImmutablePairList(allPairs
|
var allTagPairs = ImmutablePairList(allPairs
|
||||||
@@ -527,6 +528,18 @@ public class CompactUi : WindowMediatorSubscriberBase
|
|||||||
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(tag, filteredTagPairs, allTagPairs));
|
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(tag, filteredTagPairs, allTagPairs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var syncshellTags = _tagHandler.GetAllSyncshellTagsSorted();
|
||||||
|
_logger.LogInformation($"Loading {syncshellTags.Count} syncshell tags");
|
||||||
|
foreach (var syncshelltag in syncshellTags)
|
||||||
|
{
|
||||||
|
var allTagPairs = ImmutablePairList(allPairs
|
||||||
|
.Where(u => FilterTagusers(u, syncshelltag)));
|
||||||
|
var filteredTagPairs = BasicSortedDictionary(filteredPairs
|
||||||
|
.Where(u => FilterTagusers(u, syncshelltag) && FilterOnlineOrPausedSelf(u)));
|
||||||
|
|
||||||
|
drawFolders.Add(_drawEntityFactory.CreateDrawTagFolder(syncshelltag, filteredTagPairs, allTagPairs));
|
||||||
|
}
|
||||||
|
|
||||||
var allOnlineNotTaggedPairs = ImmutablePairList(allPairs
|
var allOnlineNotTaggedPairs = ImmutablePairList(allPairs
|
||||||
.Where(FilterNotTaggedUsers));
|
.Where(FilterNotTaggedUsers));
|
||||||
var onlineNotTaggedPairs = BasicSortedDictionary(filteredPairs
|
var onlineNotTaggedPairs = BasicSortedDictionary(filteredPairs
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class RenameTagUi
|
|||||||
_tagHandler.RemoveTag(oldTag);
|
_tagHandler.RemoveTag(oldTag);
|
||||||
|
|
||||||
//Creation of new tag and adding of old group pairs in new one.
|
//Creation of new tag and adding of old group pairs in new one.
|
||||||
_tagHandler.AddTag(newTag);
|
_tagHandler.AddPairTag(newTag);
|
||||||
foreach (Pair pair in pairs)
|
foreach (Pair pair in pairs)
|
||||||
{
|
{
|
||||||
var isInTag = _peopleInGroup.Contains(pair.UserData.UID);
|
var isInTag = _peopleInGroup.Contains(pair.UserData.UID);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class SelectTagForPairUi
|
|||||||
|
|
||||||
if (ImGui.BeginPopup(popupName))
|
if (ImGui.BeginPopup(popupName))
|
||||||
{
|
{
|
||||||
var tags = _tagHandler.GetAllTagsSorted();
|
var tags = _tagHandler.GetAllPairTagsSorted();
|
||||||
var childHeight = tags.Count != 0 ? tags.Count * 25 : 1;
|
var childHeight = tags.Count != 0 ? tags.Count * 25 : 1;
|
||||||
var childSize = new Vector2(0, childHeight > 100 ? 100 : childHeight) * ImGuiHelpers.GlobalScale;
|
var childSize = new Vector2(0, childHeight > 100 ? 100 : childHeight) * ImGuiHelpers.GlobalScale;
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public class SelectTagForPairUi
|
|||||||
{
|
{
|
||||||
if (!_tagNameToAdd.IsNullOrWhitespace() && _tagNameToAdd is not (TagHandler.CustomOfflineTag or TagHandler.CustomOnlineTag or TagHandler.CustomVisibleTag))
|
if (!_tagNameToAdd.IsNullOrWhitespace() && _tagNameToAdd is not (TagHandler.CustomOfflineTag or TagHandler.CustomOnlineTag or TagHandler.CustomVisibleTag))
|
||||||
{
|
{
|
||||||
_tagHandler.AddTag(_tagNameToAdd);
|
_tagHandler.AddPairTag(_tagNameToAdd);
|
||||||
if (_pair != null)
|
if (_pair != null)
|
||||||
{
|
{
|
||||||
_tagHandler.AddTagToPairedUid(_pair.UserData.UID, _tagNameToAdd);
|
_tagHandler.AddTagToPairedUid(_pair.UserData.UID, _tagNameToAdd);
|
||||||
|
|||||||
@@ -17,25 +17,21 @@ public class TagHandler
|
|||||||
_serverConfigurationManager = serverConfigurationManager;
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTag(string tag)
|
public void AddPairTag(string tag) => _serverConfigurationManager.AddPairTag(tag);
|
||||||
{
|
public void AddSyncshellTag(string tag) => _serverConfigurationManager.AddSyncshellTag(tag);
|
||||||
_serverConfigurationManager.AddTag(tag);
|
public void AddTagToPairedUid(string uid, string tagName) => _serverConfigurationManager.AddTagForUid(uid, tagName);
|
||||||
}
|
|
||||||
|
|
||||||
public void AddTagToPairedUid(string uid, string tagName)
|
public List<string> GetAllPairTagsSorted() => [
|
||||||
{
|
|
||||||
_serverConfigurationManager.AddTagForUid(uid, tagName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<string> GetAllTagsSorted()
|
|
||||||
{
|
|
||||||
return
|
|
||||||
[
|
|
||||||
.. _serverConfigurationManager.GetServerAvailablePairTags()
|
.. _serverConfigurationManager.GetServerAvailablePairTags()
|
||||||
.OrderBy(s => s, StringComparer.OrdinalIgnoreCase)
|
.OrderBy(s => s, StringComparer.OrdinalIgnoreCase)
|
||||||
,
|
,
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
public List<string> GetAllSyncshellTagsSorted() => [
|
||||||
|
.. _serverConfigurationManager.GetServerAvailableSyncshellTags()
|
||||||
|
.OrderBy(s => s, StringComparer.OrdinalIgnoreCase)
|
||||||
|
,
|
||||||
|
];
|
||||||
|
|
||||||
public HashSet<string> GetOtherUidsForTag(string tag)
|
public HashSet<string> GetOtherUidsForTag(string tag)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user