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