make server selection and legacy key entry hidden in advaced options during setup
This commit is contained in:
@@ -216,17 +216,25 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
||||
|
||||
UiSharedService.TextWrapped("For all other non official services you will have to contact the appropriate service provider how to obtain a secret key.");
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.DistanceSeparator();
|
||||
|
||||
UiSharedService.TextWrapped("Once you have received a secret key you can connect to the service using the tools provided below.");
|
||||
UiSharedService.TextWrapped("Once you have registered you can connect to the service using the tools provided below.");
|
||||
|
||||
var serverIdx = _uiShared.DrawServiceSelection(selectOnChange: true, showConnect: false);
|
||||
int serverIdx = 0;
|
||||
var selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
||||
|
||||
using (var node = ImRaii.TreeNode("Advanced Options"))
|
||||
{
|
||||
if (node)
|
||||
{
|
||||
serverIdx = _uiShared.DrawServiceSelection(selectOnChange: true, showConnect: false);
|
||||
if (serverIdx != _prevIdx)
|
||||
{
|
||||
_uiShared.RestOAuthTasksState();
|
||||
_uiShared.ResetOAuthTasksState();
|
||||
_prevIdx = serverIdx;
|
||||
}
|
||||
var selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
||||
|
||||
selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
||||
_useLegacyLogin = !selectedServer.UseOAuth2;
|
||||
|
||||
if (ImGui.Checkbox("Use Legacy Login with Secret Key", ref _useLegacyLogin))
|
||||
@@ -234,6 +242,8 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
||||
_serverConfigurationManager.GetServerByIndex(serverIdx).UseOAuth2 = !_useLegacyLogin;
|
||||
_serverConfigurationManager.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_useLegacyLogin)
|
||||
{
|
||||
@@ -298,7 +308,7 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.ColorTextWrapped($"OAuth2 is enabled, linked to: Discord User {_serverConfigurationManager.GetDiscordUserFromToken(selectedServer)}", ImGuiColors.HealerGreen);
|
||||
UiSharedService.ColorTextWrapped($"OAuth2 is connected. Linked to: Discord User {_serverConfigurationManager.GetDiscordUserFromToken(selectedServer)}", ImGuiColors.HealerGreen);
|
||||
UiSharedService.TextWrapped("Now press the update UIDs button to get a list of all of your UIDs on the server.");
|
||||
_uiShared.DrawUpdateOAuthUIDsButton(selectedServer);
|
||||
var playerName = _dalamudUtilService.GetPlayerName();
|
||||
@@ -310,16 +320,15 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
||||
var auth = selectedServer.Authentications.Find(a => string.Equals(a.CharacterName, playerName, StringComparison.Ordinal) && a.WorldId == playerWorld);
|
||||
if (auth == null)
|
||||
{
|
||||
selectedServer.Authentications.Add(new Authentication()
|
||||
auth = new Authentication()
|
||||
{
|
||||
CharacterName = playerName,
|
||||
WorldId = playerWorld
|
||||
});
|
||||
};
|
||||
selectedServer.Authentications.Add(auth);
|
||||
_serverConfigurationManager.Save();
|
||||
}
|
||||
|
||||
if (auth != null)
|
||||
{
|
||||
_uiShared.DrawUIDComboForAuthentication(0, auth, selectedServer.ServerUri);
|
||||
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(auth.UID)))
|
||||
@@ -334,7 +343,6 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Mediator.Publish(new SwitchToMainUiMessage());
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
_uiShared.RestOAuthTasksState();
|
||||
_uiShared.ResetOAuthTasksState();
|
||||
_speedTestCts = new();
|
||||
}
|
||||
|
||||
@@ -1380,7 +1380,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
var idx = _uiShared.DrawServiceSelection();
|
||||
if (_lastSelectedServerIndex != idx)
|
||||
{
|
||||
_uiShared.RestOAuthTasksState();
|
||||
_uiShared.ResetOAuthTasksState();
|
||||
_secretKeysConversionCts = _secretKeysConversionCts.CancelRecreate();
|
||||
_secretKeysConversionTask = null;
|
||||
_lastSelectedServerIndex = idx;
|
||||
|
||||
@@ -926,7 +926,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
{
|
||||
selectedServer.OAuthToken = null;
|
||||
_serverConfigurationManager.Save();
|
||||
RestOAuthTasksState();
|
||||
ResetOAuthTasksState();
|
||||
}
|
||||
}
|
||||
DrawHelpText("Hold CTRL to unlink the current OAuth2 connection.");
|
||||
@@ -1052,7 +1052,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
[LibraryImport("user32")]
|
||||
internal static partial short GetKeyState(int nVirtKey);
|
||||
|
||||
internal void RestOAuthTasksState()
|
||||
internal void ResetOAuthTasksState()
|
||||
{
|
||||
_discordOAuthCheck = null;
|
||||
_discordOAuthGetCts = _discordOAuthGetCts.CancelRecreate();
|
||||
|
||||
Reference in New Issue
Block a user