From 94d7fa1082e6739901f95e608694c050e03f7b49 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 23 Oct 2018 15:43:18 -0400 Subject: [PATCH 1/2] Tiny fixes with hostnames and web/api urls --- src/GitHub.Api/Application/ApiClient.cs | 6 +++--- .../Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs | 4 ++-- .../GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs | 2 +- .../Assets/Editor/GitHub.Unity/UI/PublishView.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GitHub.Api/Application/ApiClient.cs b/src/GitHub.Api/Application/ApiClient.cs index dc3a0f6e5..0f0c8a7c6 100644 --- a/src/GitHub.Api/Application/ApiClient.cs +++ b/src/GitHub.Api/Application/ApiClient.cs @@ -262,7 +262,7 @@ public void LoginWithToken(string token, Action result) Guard.ArgumentNotNull(result, "result"); new FuncTask(taskManager.Token, - () => loginManager.LoginWithToken(HostAddress.WebUri.Host, token)) + () => loginManager.LoginWithToken(UriString.ToUriString(HostAddress.WebUri), token)) .FinallyInUI((success, ex, res) => { if (!success) @@ -279,7 +279,7 @@ public void LoginWithToken(string token, Action result) public void CreateOAuthToken(string code, Action result) { - var command = "token -h " + HostAddress.ApiUri.Host; + var command = "token -h " + HostAddress.WebUri.Host; var octorunTask = new OctorunTask(taskManager.Token, environment, command, code) .Configure(processManager); @@ -388,7 +388,7 @@ private Connection Connection { if (connection == null) { - connection = keychain.Connections.FirstOrDefault(x => x.Host == (UriString)HostAddress.WebUri.Host); + connection = keychain.Connections.FirstOrDefault(x => x.Host.ToUriString().Host == HostAddress.WebUri.Host); } return connection; diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs index b31dd9ea5..80e2a3aa4 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs @@ -216,7 +216,7 @@ private void OnOAuthCallback(string state, string code) if (state.Equals(oAuthState)) { isBusy = true; - authenticationService.LoginWithOAuthCode(code, DoOAuthCodeResult); + authenticationService.LoginWithOAuthCode(code, (b, s) => TaskManager.RunInUI(() => DoOAuthCodeResult(b, s))); } } @@ -292,7 +292,7 @@ private AuthenticationService AuthenticationService { if (authenticationService == null) { - AuthenticationService = new AuthenticationService(HostAddress.GitHubDotComHostAddress.WebUri.Host, Platform.Keychain, Manager.ProcessManager, Manager.TaskManager, Environment); + AuthenticationService = new AuthenticationService(UriString.ToUriString(HostAddress.GitHubDotComHostAddress.WebUri), Platform.Keychain, Manager.ProcessManager, Manager.TaskManager, Environment); } return authenticationService; } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs index fe3643964..da02f3a84 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs @@ -334,7 +334,7 @@ private void OnOAuthCallback(string state, string code) if (state.Equals(oAuthState)) { isBusy = true; - authenticationService.LoginWithOAuthCode(code, DoOAuthCodeResult); + authenticationService.LoginWithOAuthCode(code, (b, s) => TaskManager.RunInUI(() => DoOAuthCodeResult(b, s))); } }); } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PublishView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PublishView.cs index d057adee7..832cfa7c7 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PublishView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PublishView.cs @@ -59,7 +59,7 @@ private void MaybeUpdateData() { connectionsNeedLoading = false; connections = Platform.Keychain.Connections.OrderByDescending(HostAddress.IsGitHubDotCom).ToArray(); - connectionLabels = connections.Select(c => HostAddress.IsGitHubDotCom(c) ? "GitHub" : c.Host).ToArray(); + connectionLabels = connections.Select(c => HostAddress.IsGitHubDotCom(c) ? "GitHub" : c.Host.ToUriString().Host).ToArray(); var connection = connections.First(); selectedConnection = 0; From 0f623d5ee2eb6c6da528ce20cf3aec0c5091dd34 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 24 Oct 2018 18:23:05 -0400 Subject: [PATCH 2/2] Fixing Prompt --- .../Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs | 2 +- .../GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs index 80e2a3aa4..921d190b0 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubAuthenticationView.cs @@ -160,7 +160,7 @@ private void OnGUILogin() GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); - if (GUILayout.Button("Signin with your browser", Styles.HyperlinkStyle)) + if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle)) { GUI.FocusControl(null); Application.OpenURL(oAuthOpenUrl); diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs index da02f3a84..29f2e93e7 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitHubEnterpriseAuthenticationView.cs @@ -126,7 +126,7 @@ public override void OnGUI() GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); - if (GUILayout.Button("Signin with your browser", Styles.HyperlinkStyle)) + if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle)) { GUI.FocusControl(null); Application.OpenURL(oAuthOpenUrl);