Mare 0.9 (#65)

* add jwt expiry

* start of 0.9 api impl

* some stuff idk

* some more impl

* some cleanup

* remove grouppair, add configuration, rework some pair drawing stuff

* do some stuff

* rework some ui

* I don't even know anymore

* add cancellationtoken

* token bla

* ui fixes etc

* probably individual adding/removing now working fully as expected

* add working report popup

* I guess it's more syncshell shit or so

* popup shit idk

* work out most of the syncshell bullshit I guess

* delete some old crap

* are we actually getting closer to the end

* update pair info stuff

* more fixes/adjustments, idk

* refactor some things

* some rework

* some more cleanup

* cleanup

* make menu buttons w i d e

* better icon text buttons

* add all syncshell folder and ordering fixes

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2023-10-17 21:36:44 +02:00
committed by GitHub
parent f15b8f6bbd
commit 14575a4a6b
111 changed files with 3456 additions and 3174 deletions

View File

@@ -1,84 +0,0 @@
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using ImGuiNET;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.UI.Handlers;
using MareSynchronos.WebAPI;
namespace MareSynchronos.UI.Components;
public abstract class DrawPairBase
{
protected static bool _showModalReport = false;
protected readonly ApiController _apiController;
protected readonly UidDisplayHandler _displayHandler;
protected Pair _pair;
private static bool _reportPopupOpen = false;
private static string _reportReason = string.Empty;
private readonly string _id;
protected DrawPairBase(string id, Pair entry, ApiController apiController, UidDisplayHandler uIDDisplayHandler)
{
_id = id;
_pair = entry;
_apiController = apiController;
_displayHandler = uIDDisplayHandler;
}
public string UID => _pair.UserData.UID;
public void DrawPairedClient()
{
var originalY = ImGui.GetCursorPosY();
var pauseIconSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Play);
var textSize = ImGui.CalcTextSize(_pair.UserData.AliasOrUID);
var textPosY = originalY + pauseIconSize.Y / 2 - textSize.Y / 2;
DrawLeftSide(textPosY, originalY);
ImGui.SameLine();
var posX = ImGui.GetCursorPosX();
var rightSide = DrawRightSide(textPosY, originalY);
DrawName(originalY, posX, rightSide);
if (_showModalReport && !_reportPopupOpen)
{
ImGui.OpenPopup("Report Profile");
_reportPopupOpen = true;
}
if (!_showModalReport) _reportPopupOpen = false;
if (ImGui.BeginPopupModal("Report Profile", ref _showModalReport, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("Report " + (_pair.UserData.AliasOrUID) + " Mare Profile");
ImGui.InputTextMultiline("##reportReason", ref _reportReason, 500, new System.Numerics.Vector2(500 - ImGui.GetStyle().ItemSpacing.X * 2, 200));
UiSharedService.TextWrapped($"Note: Sending a report will disable the offending profile globally.{Environment.NewLine}" +
$"The report will be sent to the team of your currently connected Mare Synchronos Service.{Environment.NewLine}" +
$"The report will include your user and your contact info (Discord User).{Environment.NewLine}" +
$"Depending on the severity of the offense the users Mare profile or account can be permanently disabled or banned.");
UiSharedService.ColorTextWrapped("Report spam and wrong reports will not be tolerated and can lead to permanent account suspension.", ImGuiColors.DalamudRed);
if (string.IsNullOrEmpty(_reportReason)) ImGui.BeginDisabled();
if (ImGui.Button("Send Report"))
{
ImGui.CloseCurrentPopup();
var reason = _reportReason;
_ = _apiController.UserReportProfile(new(_pair.UserData, reason));
_reportReason = string.Empty;
_showModalReport = false;
_reportPopupOpen = false;
}
if (string.IsNullOrEmpty(_reportReason)) ImGui.EndDisabled();
UiSharedService.SetScaledWindowSize(500);
ImGui.EndPopup();
}
}
protected abstract void DrawLeftSide(float textPosY, float originalY);
protected abstract float DrawRightSide(float textPosY, float originalY);
private void DrawName(float originalY, float leftSide, float rightSide)
{
_displayHandler.DrawPairText(_id, _pair, leftSide, originalY, () => rightSide - leftSide);
}
}