Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit f53f08a

Browse files
committed
Use async in LoginFactory
1 parent 87201aa commit f53f08a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CodeHub.Core/Factories/ILoginFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface ILoginFactory
99

1010
Task<GitHubSharp.Client> LoginAccount(GitHubAccount account);
1111

12-
LoginData Authenticate(string domain, string user, string pass, string twoFactor, bool enterprise, GitHubAccount existingAccount);
12+
Task<LoginData> Authenticate(string domain, string user, string pass, string twoFactor, bool enterprise, GitHubAccount existingAccount);
1313
}
1414

1515
public class LoginData

CodeHub.Core/Factories/LoginFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<Client> LoginAccount(GitHubAccount account)
6262
return client;
6363
}
6464

65-
public LoginData Authenticate(string domain, string user, string pass, string twoFactor, bool enterprise, GitHubAccount account)
65+
public async Task<LoginData> Authenticate(string domain, string user, string pass, string twoFactor, bool enterprise, GitHubAccount account)
6666
{
6767
//Fill these variables in during the proceeding try/catch
6868
var apiUrl = domain;
@@ -92,7 +92,7 @@ public LoginData Authenticate(string domain, string user, string pass, string tw
9292
}
9393
else
9494
{
95-
var auth = client.Execute(client.Authorizations.GetOrCreate("72f4fb74bdba774b759d", "9253ab615f8c00738fff5d1c665ca81e581875cb", new System.Collections.Generic.List<string>(Scopes), "CodeHub", null));
95+
var auth = await client.ExecuteAsync(client.Authorizations.GetOrCreate("72f4fb74bdba774b759d", "9253ab615f8c00738fff5d1c665ca81e581875cb", new System.Collections.Generic.List<string>(Scopes), "CodeHub", null));
9696
account.OAuth = auth.Data.Token;
9797
}
9898

CodeHub.Core/ViewModels/Accounts/AddAccountViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ private async Task Login()
100100
{
101101
IsLoggingIn = true;
102102
Console.WriteLine(apiUrl);
103-
var loginData = await Task.Run(() => _loginFactory.Authenticate(apiUrl, Username, Password, TwoFactor, IsEnterprise, _attemptedAccount));
104-
var client = await Task.Run(() => _loginFactory.LoginAccount(loginData.Account));
103+
var loginData = await _loginFactory.Authenticate(apiUrl, Username, Password, TwoFactor, IsEnterprise, _attemptedAccount);
104+
var client = await _loginFactory.LoginAccount(loginData.Account);
105105
_application.ActivateUser(loginData.Account, client);
106106
}
107107
catch (Exception e)

0 commit comments

Comments
 (0)