make server selection and legacy key entry hidden in advaced options during setup
This commit is contained in:
@@ -216,23 +216,33 @@ 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.");
|
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;
|
||||||
if (serverIdx != _prevIdx)
|
|
||||||
{
|
|
||||||
_uiShared.RestOAuthTasksState();
|
|
||||||
_prevIdx = serverIdx;
|
|
||||||
}
|
|
||||||
var selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
var selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
||||||
_useLegacyLogin = !selectedServer.UseOAuth2;
|
|
||||||
|
|
||||||
if (ImGui.Checkbox("Use Legacy Login with Secret Key", ref _useLegacyLogin))
|
using (var node = ImRaii.TreeNode("Advanced Options"))
|
||||||
{
|
{
|
||||||
_serverConfigurationManager.GetServerByIndex(serverIdx).UseOAuth2 = !_useLegacyLogin;
|
if (node)
|
||||||
_serverConfigurationManager.Save();
|
{
|
||||||
|
serverIdx = _uiShared.DrawServiceSelection(selectOnChange: true, showConnect: false);
|
||||||
|
if (serverIdx != _prevIdx)
|
||||||
|
{
|
||||||
|
_uiShared.ResetOAuthTasksState();
|
||||||
|
_prevIdx = serverIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedServer = _serverConfigurationManager.GetServerByIndex(serverIdx);
|
||||||
|
_useLegacyLogin = !selectedServer.UseOAuth2;
|
||||||
|
|
||||||
|
if (ImGui.Checkbox("Use Legacy Login with Secret Key", ref _useLegacyLogin))
|
||||||
|
{
|
||||||
|
_serverConfigurationManager.GetServerByIndex(serverIdx).UseOAuth2 = !_useLegacyLogin;
|
||||||
|
_serverConfigurationManager.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_useLegacyLogin)
|
if (_useLegacyLogin)
|
||||||
@@ -298,7 +308,7 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
else
|
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.");
|
UiSharedService.TextWrapped("Now press the update UIDs button to get a list of all of your UIDs on the server.");
|
||||||
_uiShared.DrawUpdateOAuthUIDsButton(selectedServer);
|
_uiShared.DrawUpdateOAuthUIDsButton(selectedServer);
|
||||||
var playerName = _dalamudUtilService.GetPlayerName();
|
var playerName = _dalamudUtilService.GetPlayerName();
|
||||||
@@ -310,28 +320,26 @@ public partial class IntroUi : WindowMediatorSubscriberBase
|
|||||||
var auth = selectedServer.Authentications.Find(a => string.Equals(a.CharacterName, playerName, StringComparison.Ordinal) && a.WorldId == playerWorld);
|
var auth = selectedServer.Authentications.Find(a => string.Equals(a.CharacterName, playerName, StringComparison.Ordinal) && a.WorldId == playerWorld);
|
||||||
if (auth == null)
|
if (auth == null)
|
||||||
{
|
{
|
||||||
selectedServer.Authentications.Add(new Authentication()
|
auth = new Authentication()
|
||||||
{
|
{
|
||||||
CharacterName = playerName,
|
CharacterName = playerName,
|
||||||
WorldId = playerWorld
|
WorldId = playerWorld
|
||||||
});
|
};
|
||||||
|
selectedServer.Authentications.Add(auth);
|
||||||
_serverConfigurationManager.Save();
|
_serverConfigurationManager.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth != null)
|
_uiShared.DrawUIDComboForAuthentication(0, auth, selectedServer.ServerUri);
|
||||||
{
|
|
||||||
_uiShared.DrawUIDComboForAuthentication(0, auth, selectedServer.ServerUri);
|
|
||||||
|
|
||||||
using (ImRaii.Disabled(string.IsNullOrEmpty(auth.UID)))
|
using (ImRaii.Disabled(string.IsNullOrEmpty(auth.UID)))
|
||||||
|
{
|
||||||
|
if (_uiShared.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Link, "Connect to Service"))
|
||||||
{
|
{
|
||||||
if (_uiShared.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Link, "Connect to Service"))
|
_ = Task.Run(() => _uiShared.ApiController.CreateConnectionsAsync());
|
||||||
{
|
|
||||||
_ = Task.Run(() => _uiShared.ApiController.CreateConnectionsAsync());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(auth.UID))
|
|
||||||
UiSharedService.AttachToolTip("Select a UID to be able to connect to the service");
|
|
||||||
}
|
}
|
||||||
|
if (string.IsNullOrEmpty(auth.UID))
|
||||||
|
UiSharedService.AttachToolTip("Select a UID to be able to connect to the service");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
public override void OnOpen()
|
public override void OnOpen()
|
||||||
{
|
{
|
||||||
_uiShared.RestOAuthTasksState();
|
_uiShared.ResetOAuthTasksState();
|
||||||
_speedTestCts = new();
|
_speedTestCts = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1380,7 +1380,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
var idx = _uiShared.DrawServiceSelection();
|
var idx = _uiShared.DrawServiceSelection();
|
||||||
if (_lastSelectedServerIndex != idx)
|
if (_lastSelectedServerIndex != idx)
|
||||||
{
|
{
|
||||||
_uiShared.RestOAuthTasksState();
|
_uiShared.ResetOAuthTasksState();
|
||||||
_secretKeysConversionCts = _secretKeysConversionCts.CancelRecreate();
|
_secretKeysConversionCts = _secretKeysConversionCts.CancelRecreate();
|
||||||
_secretKeysConversionTask = null;
|
_secretKeysConversionTask = null;
|
||||||
_lastSelectedServerIndex = idx;
|
_lastSelectedServerIndex = idx;
|
||||||
|
|||||||
@@ -926,7 +926,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
selectedServer.OAuthToken = null;
|
selectedServer.OAuthToken = null;
|
||||||
_serverConfigurationManager.Save();
|
_serverConfigurationManager.Save();
|
||||||
RestOAuthTasksState();
|
ResetOAuthTasksState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawHelpText("Hold CTRL to unlink the current OAuth2 connection.");
|
DrawHelpText("Hold CTRL to unlink the current OAuth2 connection.");
|
||||||
@@ -1052,7 +1052,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
[LibraryImport("user32")]
|
[LibraryImport("user32")]
|
||||||
internal static partial short GetKeyState(int nVirtKey);
|
internal static partial short GetKeyState(int nVirtKey);
|
||||||
|
|
||||||
internal void RestOAuthTasksState()
|
internal void ResetOAuthTasksState()
|
||||||
{
|
{
|
||||||
_discordOAuthCheck = null;
|
_discordOAuthCheck = null;
|
||||||
_discordOAuthGetCts = _discordOAuthGetCts.CancelRecreate();
|
_discordOAuthGetCts = _discordOAuthGetCts.CancelRecreate();
|
||||||
|
|||||||
Reference in New Issue
Block a user