Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7f295a4

Browse files
committed
Remove unused code.
1 parent d7a8b69 commit 7f295a4

File tree

2 files changed

+2
-54
lines changed

2 files changed

+2
-54
lines changed

src/GitHub.App/Api/ApiClient.cs

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@
77
using System.Reactive.Linq;
88
using System.Security.Cryptography;
99
using System.Text;
10+
using GitHub.Extensions;
11+
using GitHub.Logging;
1012
using GitHub.Primitives;
1113
using Octokit;
1214
using Octokit.Reactive;
13-
using ReactiveUI;
14-
using System.Threading.Tasks;
15-
using System.Reactive.Threading.Tasks;
16-
using Octokit.Internal;
17-
using System.Collections.Generic;
18-
using GitHub.Models;
19-
using GitHub.Extensions;
20-
using GitHub.Logging;
2115
using Serilog;
2216

2317
namespace GitHub.Api
@@ -29,11 +23,6 @@ public partial class ApiClient : IApiClient
2923
static readonly ILogger log = LogManager.ForContext<ApiClient>();
3024

3125
readonly IObservableGitHubClient gitHubClient;
32-
// There are two sets of authorization scopes, old and new:
33-
// The old scopes must be used by older versions of Enterprise that don't support the new scopes:
34-
readonly string[] oldAuthorizationScopes = { "user", "repo", "gist" };
35-
// These new scopes include write:public_key, which allows us to add public SSH keys to an account:
36-
readonly string[] newAuthorizationScopes = { "user", "repo", "gist", "write:public_key" };
3726
readonly static Lazy<string> lazyNote = new Lazy<string>(() => ProductName + " on " + GetMachineNameSafe());
3827
readonly static Lazy<string> lazyFingerprint = new Lazy<string>(GetFingerprint);
3928

@@ -101,42 +90,6 @@ public IObservable<User> GetUser()
10190
return gitHubClient.User.Current();
10291
}
10392

104-
public IObservable<ApplicationAuthorization> GetOrCreateApplicationAuthenticationCode(
105-
Func<TwoFactorAuthorizationException, IObservable<TwoFactorChallengeResult>> twoFactorChallengeHander,
106-
string authenticationCode = null,
107-
bool useOldScopes = false,
108-
bool useFingerPrint = true)
109-
{
110-
var newAuthorization = new NewAuthorization
111-
{
112-
Scopes = useOldScopes
113-
? oldAuthorizationScopes
114-
: newAuthorizationScopes,
115-
Note = lazyNote.Value,
116-
Fingerprint = useFingerPrint ? lazyFingerprint.Value : null
117-
};
118-
119-
Func<TwoFactorAuthorizationException, IObservable<TwoFactorChallengeResult>> dispatchedHandler =
120-
ex => Observable.Start(() => twoFactorChallengeHander(ex), RxApp.MainThreadScheduler).Merge();
121-
122-
var authorizationsClient = gitHubClient.Authorization;
123-
124-
return string.IsNullOrEmpty(authenticationCode)
125-
? authorizationsClient.CreateAndDeleteExistingApplicationAuthorization(
126-
ClientId,
127-
ClientSecret,
128-
newAuthorization,
129-
dispatchedHandler,
130-
true)
131-
: authorizationsClient.CreateAndDeleteExistingApplicationAuthorization(
132-
ClientId,
133-
ClientSecret,
134-
newAuthorization,
135-
dispatchedHandler,
136-
authenticationCode,
137-
true);
138-
}
139-
14093
public IObservable<Organization> GetOrganizations()
14194
{
14295
// Organization.GetAllForCurrent doesn't return all of the information we need (we

src/GitHub.Exports.Reactive/Api/IApiClient.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ public interface IApiClient
2727
/// </summary>
2828
/// <returns></returns>
2929
IObservable<Repository> GetRepositoriesForOrganization(string organization);
30-
IObservable<ApplicationAuthorization> GetOrCreateApplicationAuthenticationCode(
31-
Func<TwoFactorAuthorizationException, IObservable<TwoFactorChallengeResult>> twoFactorChallengeHander,
32-
string authenticationCode = null,
33-
bool useOldScopes = false,
34-
bool useFingerprint = true);
3530

3631
IObservable<string> GetGitIgnoreTemplates();
3732
IObservable<LicenseMetadata> GetLicenses();

0 commit comments

Comments
 (0)