adjust initial dialog to opt in/out into census with buttons
This commit is contained in:
@@ -13,7 +13,7 @@ public class ServerConfig : IMareConfiguration
|
||||
{ new ServerStorage() { ServerName = ApiController.MainServer, ServerUri = ApiController.MainServiceUri } },
|
||||
};
|
||||
|
||||
public bool SendCensusData { get; set; } = true;
|
||||
public bool SendCensusData { get; set; } = false;
|
||||
public bool ShownCensusPopup { get; set; } = false;
|
||||
|
||||
public int Version { get; set; } = 1;
|
||||
|
||||
@@ -22,6 +22,8 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
|
||||
public Vector2 PopupSize => new(500, 250);
|
||||
|
||||
public bool ShowClose => true;
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
UiSharedService.TextWrapped("User " + (_reportedPair.UserData.AliasOrUID) + " will be banned and removed from this Syncshell.");
|
||||
@@ -37,10 +39,6 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
UiSharedService.TextWrapped("The reason will be displayed in the banlist. The current server-side alias if present (Vanity ID) will automatically be attached to the reason.");
|
||||
}
|
||||
|
||||
public void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
public void Open(OpenBanUserPopupMessage message)
|
||||
{
|
||||
_reportedPair = message.PairToBan;
|
||||
|
||||
@@ -17,13 +17,20 @@ public class CensusPopupHandler : IPopupHandler
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public Vector2 PopupSize => new(600, 350);
|
||||
private Vector2 _size = new(600, 450);
|
||||
public Vector2 PopupSize => _size;
|
||||
|
||||
public bool ShowClose => false;
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
var start = 0f;
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
UiSharedService.TextWrapped("Mare Census Opt-Out");
|
||||
ImGuiHelpers.ScaledDummy(5, 5);
|
||||
{
|
||||
start = ImGui.GetCursorPosY() - ImGui.CalcTextSize("Mare Census Data").Y;
|
||||
UiSharedService.TextWrapped("Mare Census Participation");
|
||||
}
|
||||
ImGuiHelpers.ScaledDummy(5f);
|
||||
UiSharedService.TextWrapped("If you are seeing this popup you are updating from a Mare version that did not collect census data. Please read the following carefully.");
|
||||
ImGui.Separator();
|
||||
UiSharedService.TextWrapped("Mare Census is a data collecting service that can be used for statistical purposes. " +
|
||||
@@ -34,17 +41,25 @@ public class CensusPopupHandler : IPopupHandler
|
||||
+ "- Current Gender (reflecting Glamourer changes)" + Environment.NewLine
|
||||
+ "- Current Race (reflecting Glamourer changes)" + Environment.NewLine
|
||||
+ "- Current Clan (i.e. Seeker of the Sun, Keeper of the Moon, etc., reflecting Glamourer changes)");
|
||||
UiSharedService.TextWrapped("If you do not consent to the data mentioned above being sent, untick the checkbox below.");
|
||||
UiSharedService.TextWrapped("To consent to collecting census data press the appropriate button below.");
|
||||
UiSharedService.TextWrapped("This setting can be changed anytime in the Mare Settings.");
|
||||
var sendCensus = _serverConfigurationManager.SendCensusData;
|
||||
if (ImGui.Checkbox("Allow sending census data", ref sendCensus))
|
||||
{
|
||||
_serverConfigurationManager.SendCensusData = sendCensus;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClose()
|
||||
var width = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
var buttonSize = ImGuiHelpers.GetButtonSize("I consent to send my census data");
|
||||
ImGuiHelpers.ScaledDummy(5f);
|
||||
if (ImGui.Button("I consent to send my census data", new Vector2(width, buttonSize.Y * 2.5f)))
|
||||
{
|
||||
_serverConfigurationManager.SendCensusData = true;
|
||||
_serverConfigurationManager.ShownCensusPopup = true;
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
ImGuiHelpers.ScaledDummy(1f);
|
||||
if (ImGui.Button("I do not consent to send my census data", new Vector2(width, buttonSize.Y)))
|
||||
{
|
||||
_serverConfigurationManager.SendCensusData = false;
|
||||
_serverConfigurationManager.ShownCensusPopup = true;
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
var height = ImGui.GetCursorPosY() - start;
|
||||
_size = _size with { Y = height };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ namespace MareSynchronos.UI.Components.Popup;
|
||||
public interface IPopupHandler
|
||||
{
|
||||
Vector2 PopupSize { get; }
|
||||
bool ShowClose { get; }
|
||||
|
||||
void DrawContent();
|
||||
|
||||
void OnClose();
|
||||
}
|
||||
@@ -69,17 +69,13 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
using var popup = ImRaii.Popup(WindowName, ImGuiWindowFlags.Modal);
|
||||
if (!popup) return;
|
||||
_currentHandler.DrawContent();
|
||||
if (_currentHandler.ShowClose)
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_currentHandler.OnClose();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
_currentHandler?.OnClose();
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
|
||||
public Vector2 PopupSize => new(500, 500);
|
||||
|
||||
public bool ShowClose => true;
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
@@ -49,10 +51,6 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
public void Open(OpenReportPopupMessage msg)
|
||||
{
|
||||
_reportedPair = msg.PairToReport;
|
||||
|
||||
Reference in New Issue
Block a user