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

Commit dee143e

Browse files
committed
Remove EnterpriseProbe(Task).
These classes are now present in Octokit, so simply export one of these.
1 parent 72ec853 commit dee143e

File tree

12 files changed

+41
-149
lines changed

12 files changed

+41
-149
lines changed

src/DesignTimeStyleHelper/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public CustomServiceProvider()
7373
new AssemblyCatalog(typeof(GitHub.Api.ApiClient).Assembly), // GitHub.App
7474
new AssemblyCatalog(typeof(GitHub.Api.SimpleApiClient).Assembly), // GitHub.Api
7575
new AssemblyCatalog(typeof(Rothko.Environment).Assembly), // Rothko
76-
new AssemblyCatalog(typeof(EnterpriseProbeTask).Assembly) // GitHub.Exports
76+
new AssemblyCatalog(typeof(WikiProbe).Assembly) // GitHub.Exports
7777
);
7878
container = new CompositionContainer(catalog, CompositionOptions.IsThreadSafe | CompositionOptions.DisableSilentRejection);
7979

src/GitHub.Api/SimpleApiClient.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class SimpleApiClient : ISimpleApiClient
1414
public HostAddress HostAddress { get; }
1515
public UriString OriginalUrl { get; }
1616

17-
readonly Lazy<IEnterpriseProbeTask> enterpriseProbe;
17+
readonly Lazy<IEnterpriseProbe> enterpriseProbe;
1818
readonly Lazy<IWikiProbe> wikiProbe;
1919
static readonly SemaphoreSlim sem = new SemaphoreSlim(1);
2020

@@ -24,7 +24,7 @@ public class SimpleApiClient : ISimpleApiClient
2424
bool? hasWiki;
2525

2626
public SimpleApiClient(UriString repoUrl, IGitHubClient githubClient,
27-
Lazy<IEnterpriseProbeTask> enterpriseProbe, Lazy<IWikiProbe> wikiProbe)
27+
Lazy<IEnterpriseProbe> enterpriseProbe, Lazy<IWikiProbe> wikiProbe)
2828
{
2929
Guard.ArgumentNotNull(repoUrl, nameof(repoUrl));
3030
Guard.ArgumentNotNull(githubClient, nameof(githubClient));
@@ -127,14 +127,17 @@ async Task<bool> HasWikiInternal(Repository repo)
127127

128128
async Task<bool> IsEnterpriseInternal()
129129
{
130+
if (HostAddress == HostAddress.GitHubDotComHostAddress)
131+
return false;
132+
130133
var probe = enterpriseProbe.Value;
131134
Debug.Assert(probe != null, "Lazy<Enterprise> probe is not set, something is wrong.");
132135
#if !DEBUG
133136
if (probe == null)
134137
return false;
135138
#endif
136-
var ret = await probe.ProbeAsync(HostAddress.WebUri);
137-
return (ret == Services.EnterpriseProbeResult.Ok);
139+
var ret = await probe.Probe(HostAddress.WebUri);
140+
return (ret == EnterpriseProbeResult.Ok);
138141
}
139142
}
140143
}

src/GitHub.Api/SimpleApiClientFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class SimpleApiClientFactory : ISimpleApiClientFactory
1515
{
1616
readonly IKeychain keychain;
1717
readonly ProductHeaderValue productHeader;
18-
readonly Lazy<IEnterpriseProbeTask> lazyEnterpriseProbe;
18+
readonly Lazy<IEnterpriseProbe> lazyEnterpriseProbe;
1919
readonly Lazy<IWikiProbe> lazyWikiProbe;
2020

2121
static readonly ConcurrentDictionary<UriString, ISimpleApiClient> cache = new ConcurrentDictionary<UriString, ISimpleApiClient>();
@@ -24,7 +24,7 @@ public class SimpleApiClientFactory : ISimpleApiClientFactory
2424
public SimpleApiClientFactory(
2525
IProgram program,
2626
IKeychain keychain,
27-
Lazy<IEnterpriseProbeTask> enterpriseProbe,
27+
Lazy<IEnterpriseProbe> enterpriseProbe,
2828
Lazy<IWikiProbe> wikiProbe)
2929
{
3030
this.keychain = keychain;

src/GitHub.App/GitHub.App.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@
189189
<Compile Include="SampleData\SampleViewModels.cs" />
190190
<Compile Include="Api\ApiClient.cs" />
191191
<Compile Include="Factories\ApiClientFactory.cs" />
192-
<Compile Include="Services\EnterpriseProbe.cs" />
193192
<Compile Include="Services\ErrorMap.cs" />
194193
<Compile Include="Services\ErrorMessage.cs" />
195194
<Compile Include="Services\ErrorMessageTranslator.cs" />
196-
<Compile Include="Services\IEnterpriseProbe.cs" />
197195
<Compile Include="Services\RepositoryCreationService.cs" />
198196
<Compile Include="Services\GistPublishService.cs" />
199197
<Compile Include="Services\RepositoryPublishService.cs" />

src/GitHub.App/Infrastructure/ExportWrappers.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.ComponentModel.Composition;
2+
using GitHub.Models;
3+
using Octokit;
24
using Octokit.Internal;
3-
using System;
4-
using System.Net.Http;
55

66
namespace GitHub.Infrastructure
77
{
@@ -16,4 +16,14 @@ public ExportedHttpClient() :
1616
base(HttpMessageHandlerFactory.CreateDefault)
1717
{}
1818
}
19+
20+
[Export(typeof(IEnterpriseProbe))]
21+
public class ExportedEnterpriseProbe : EnterpriseProbe
22+
{
23+
[ImportingConstructor]
24+
public ExportedEnterpriseProbe(IProgram program, IHttpClient client)
25+
: base(program.ProductHeader, client)
26+
{
27+
}
28+
}
1929
}

src/GitHub.App/Services/EnterpriseProbe.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/GitHub.App/Services/IEnterpriseProbe.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@
252252
<Compile Include="Exports\ExportMetadata.cs" />
253253
<Compile Include="Primitives\StringEquivalent.cs" />
254254
<Compile Include="Primitives\UriString.cs" />
255-
<Compile Include="Services\EnterpriseProbeTask.cs" />
256255
<Compile Include="Services\ExportFactoryProvider.cs" />
257-
<Compile Include="Services\IEnterpriseProbeTask.cs" />
258256
<Compile Include="Services\IGitHubServiceProvider.cs" />
259257
<Compile Include="Services\IWikiProbe.cs" />
260258
<Compile Include="Services\WikiProbe.cs" />

src/GitHub.Exports/Services/EnterpriseProbeTask.cs

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/GitHub.Exports/Services/IEnterpriseProbeTask.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)