From c671003bac34ab5268415f4bc1ef2a0753701979 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Tue, 29 Oct 2024 21:38:28 +0100 Subject: [PATCH] add contextual information to settings ui --- MareSynchronos/UI/SettingsUi.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index 1abda4a..b570f27 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -1325,7 +1325,16 @@ public class SettingsUi : WindowMediatorSubscriberBase { thisIsYou = true; } - if (ImGui.TreeNode($"chara", (thisIsYou ? "[CURRENT] " : "") + $"Character: {item.CharacterName}, World: {worldPreview}, {friendlyNameTranslation}: {friendlyName}")) + bool misManaged = false; + if (selectedServer.UseOAuth2 && !string.IsNullOrEmpty(selectedServer.OAuthToken) && string.IsNullOrEmpty(item.UID)) + { + misManaged = true; + } + if (!selectedServer.UseOAuth2 && item.SecretKeyIdx == -1) + { + misManaged = true; + } + if (ImGui.TreeNode($"chara", (misManaged ? "[!! MISMANAGED !!] " : "") + (thisIsYou ? "[CURRENT] " : "") + $"Character: {item.CharacterName}, World: {worldPreview}, {friendlyNameTranslation}: {friendlyName}")) { var charaName = item.CharacterName; if (ImGui.InputText("Character Name", ref charaName, 64)) @@ -1477,6 +1486,12 @@ public class SettingsUi : WindowMediatorSubscriberBase if (useOauth) { _uiShared.DrawOAuth(selectedServer); + if (!string.IsNullOrEmpty(_serverConfigurationManager.GetDiscordUserFromToken(selectedServer)) + && selectedServer.Authentications.TrueForAll(u => string.IsNullOrEmpty(u.UID))) + { + UiSharedService.ColorTextWrapped("You have enabled OAuth2 but no characters configured. Set the correct UIDs for your characters in \"Character Management\".", + ImGuiColors.DalamudRed); + } } if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer)