Add blocking options to syncshell ui user menu as well
This commit is contained in:
@@ -76,8 +76,55 @@ public class Pair : DisposableMediatorSubscriberBase
|
||||
|
||||
private PairHandler? CachedPlayer { get; set; }
|
||||
|
||||
public void AddContextMenu(IMenuOpenedArgs args)
|
||||
public bool IsWhitelisted
|
||||
{
|
||||
get
|
||||
{
|
||||
return _serverConfigurationManager.IsUidWhitelisted(UserData.UID);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_serverConfigurationManager.AddWhitelistUid(UserData.UID);
|
||||
UnholdApplication("Blacklist", skipApplication: true);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_serverConfigurationManager.RemoveWhitelistUid(UserData.UID);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBlacklisted
|
||||
{
|
||||
get
|
||||
{
|
||||
return _serverConfigurationManager.IsUidBlacklisted(UserData.UID);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_serverConfigurationManager.AddBlacklistUid(UserData.UID);
|
||||
HoldApplication("Blacklist", maxValue: 1);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_serverConfigurationManager.RemoveBlacklistUid(UserData.UID);
|
||||
UnholdApplication("Blacklist", skipApplication: true);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddContextMenu(IMenuOpenedArgs args)
|
||||
{
|
||||
if (CachedPlayer == null || (args.Target is not MenuTargetDefault target) || target.TargetObjectId != CachedPlayer.PlayerCharacterId || IsPaused) return;
|
||||
|
||||
void Add(string name, Action<IMenuItemClickedArgs>? action)
|
||||
@@ -92,34 +139,31 @@ public class Pair : DisposableMediatorSubscriberBase
|
||||
}
|
||||
|
||||
bool isBlocked = IsApplicationBlocked;
|
||||
bool isBlacklisted = _serverConfigurationManager.IsUidBlacklisted(UserData.UID);
|
||||
bool isWhitelisted = _serverConfigurationManager.IsUidWhitelisted(UserData.UID);
|
||||
bool isBlacklisted = IsBlacklisted;
|
||||
bool isWhitelisted = IsWhitelisted;
|
||||
|
||||
Add("Open Profile", _ => Mediator.Publish(new ProfileOpenStandaloneMessage(this)));
|
||||
|
||||
if (!isBlocked && !isBlacklisted)
|
||||
Add("Always Block Modded Appearance", _ => {
|
||||
_serverConfigurationManager.AddBlacklistUid(UserData.UID);
|
||||
HoldApplication("Blacklist", maxValue: 1);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
Add("Always Block Modded Appearance", _ =>
|
||||
{
|
||||
IsBlacklisted = true;
|
||||
});
|
||||
else if (isBlocked && !isWhitelisted)
|
||||
Add("Always Allow Modded Appearance", _ => {
|
||||
_serverConfigurationManager.AddWhitelistUid(UserData.UID);
|
||||
UnholdApplication("Blacklist", skipApplication: true);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
Add("Always Allow Modded Appearance", _ =>
|
||||
{
|
||||
IsWhitelisted = true;
|
||||
});
|
||||
|
||||
if (isWhitelisted)
|
||||
Add("Remove from Whitelist", _ => {
|
||||
_serverConfigurationManager.RemoveWhitelistUid(UserData.UID);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
Add("Remove from Whitelist", _ =>
|
||||
{
|
||||
IsWhitelisted = false;
|
||||
});
|
||||
else if (isBlacklisted)
|
||||
Add("Remove from Blacklist", _ => {
|
||||
_serverConfigurationManager.RemoveBlacklistUid(UserData.UID);
|
||||
UnholdApplication("Blacklist", skipApplication: true);
|
||||
ApplyLastReceivedData(forced: true);
|
||||
Add("Remove from Blacklist", _ =>
|
||||
{
|
||||
IsBlacklisted = false;
|
||||
});
|
||||
|
||||
Add("Reapply last data", _ => ApplyLastReceivedData(forced: true));
|
||||
@@ -129,7 +173,7 @@ public class Pair : DisposableMediatorSubscriberBase
|
||||
Add("Change Permissions", _ => Mediator.Publish(new OpenPermissionWindow(this)));
|
||||
Add("Cycle pause state", _ => Mediator.Publish(new CyclePauseMessage(UserData)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyData(OnlineUserCharaDataDto data)
|
||||
{
|
||||
|
||||
@@ -344,6 +344,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_pair.IsPaused)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.User, "Open Profile"))
|
||||
@@ -352,6 +353,22 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
bool isBlocked = _pair.IsApplicationBlocked;
|
||||
bool isBlacklisted = _pair.IsBlacklisted;
|
||||
bool isWhitelisted = _pair.IsWhitelisted;
|
||||
|
||||
if (!isBlocked && !isBlacklisted)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.EyeSlash, "Block Modded Appearance"))
|
||||
_pair.IsBlacklisted = true;
|
||||
}
|
||||
else if (isBlacklisted)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ThumbsUp, "Remove from Blacklist"))
|
||||
_pair.IsBlacklisted = false;
|
||||
}
|
||||
|
||||
if (_pair.IsVisible)
|
||||
{
|
||||
#if DEBUG
|
||||
|
||||
Reference in New Issue
Block a user