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

Commit 455e64b

Browse files
authored
Merge branch 'master' into fixes/351-show-login-error-message
2 parents 8fc2e55 + 0962668 commit 455e64b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+312
-370
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
[submodule "submodules/akavache"]
1414
path = submodules/akavache
1515
url = https://github.com/shana/Akavache
16-
[submodule "submodules/libgit2sharp"]
17-
path = submodules/libgit2sharp
18-
url = https://github.com/shana/libgit2sharp.git
1916
[submodule "script"]
2017
path = script
2118
url = [email protected]:github/VisualStudioBuildScripts

GitHubVS.sln

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Submodules", "Submodules",
2626
EndProject
2727
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rothko", "submodules\Rothko\src\Rothko.csproj", "{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}"
2828
EndProject
29-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LibGit2Sharp", "LibGit2Sharp", "{8446C785-A5B4-4676-9B38-560FCA0563E0}"
30-
EndProject
31-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp", "submodules\libgit2sharp\LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
32-
EndProject
3329
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{8E1F1B4E-AEA2-4AB1-8F73-423A903550A1}"
3430
ProjectSection(SolutionItems) = preProject
3531
script\Modules\BuildUtils.psm1 = script\Modules\BuildUtils.psm1
@@ -246,22 +242,6 @@ Global
246242
{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
247243
{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}.XamlDesign|x86.ActiveCfg = Release|Any CPU
248244
{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}.XamlDesign|x86.Build.0 = Release|Any CPU
249-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
250-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|Any CPU.Build.0 = Debug|Any CPU
251-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|x86.ActiveCfg = Debug|Any CPU
252-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Debug|x86.Build.0 = Debug|Any CPU
253-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Publish|Any CPU.ActiveCfg = Release|Any CPU
254-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Publish|Any CPU.Build.0 = Release|Any CPU
255-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Publish|x86.ActiveCfg = Release|Any CPU
256-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Publish|x86.Build.0 = Release|Any CPU
257-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Any CPU.ActiveCfg = Release|Any CPU
258-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|Any CPU.Build.0 = Release|Any CPU
259-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|x86.ActiveCfg = Release|Any CPU
260-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.Release|x86.Build.0 = Release|Any CPU
261-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
262-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
263-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.XamlDesign|x86.ActiveCfg = Debug|Any CPU
264-
{EE6ED99F-CB12-4683-B055-D28FC7357A34}.XamlDesign|x86.Build.0 = Debug|Any CPU
265245
{9AEA02DB-02B5-409C-B0CA-115D05331A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
266246
{9AEA02DB-02B5-409C-B0CA-115D05331A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
267247
{9AEA02DB-02B5-409C-B0CA-115D05331A6B}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -587,8 +567,6 @@ Global
587567
GlobalSection(NestedProjects) = preSolution
588568
{596595A6-2A3C-469E-9386-9E3767D863A5} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
589569
{4A84E568-CA86-4510-8CD0-90D3EF9B65F9} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB8}
590-
{8446C785-A5B4-4676-9B38-560FCA0563E0} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB8}
591-
{EE6ED99F-CB12-4683-B055-D28FC7357A34} = {8446C785-A5B4-4676-9B38-560FCA0563E0}
592570
{8E1F1B4E-AEA2-4AB1-8F73-423A903550A1} = {7B6C5F8D-14B3-443D-B044-0E209AE12BDF}
593571
{1ED83084-2A57-4F89-915C-8A2167C0D6BC} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFF}
594572
{1E7F7253-A6AF-43C4-A955-37BEDDA01AC0} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB8}

src/GitHub.App/Caches/ImageCache.cs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -213,33 +213,8 @@ static string GetCacheKey(Uri url)
213213
return url.ToString();
214214
}
215215

216-
bool disposed;
217-
void Dispose(bool disposing)
218-
{
219-
if (disposing)
220-
{
221-
if (disposed) return;
222-
223-
try
224-
{
225-
cacheFactory.Select(x =>
226-
{
227-
x.Dispose();
228-
return x.Shutdown;
229-
}).Wait();
230-
}
231-
catch (Exception e)
232-
{
233-
log.Warn("Exception occured while disposing ImageCache", e);
234-
}
235-
disposed = true;
236-
}
237-
}
238-
239216
public void Dispose()
240-
{
241-
Dispose(true);
242-
}
217+
{}
243218

244219
class UriComparer : IEqualityComparer<Uri>
245220
{

src/GitHub.App/Caches/LoginCache.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,7 @@ public IObservable<Unit> Flush()
5656
return cache.Secure.Flush();
5757
}
5858

59-
bool disposed;
60-
void Dispose(bool disposing)
61-
{
62-
if (disposing)
63-
{
64-
if (disposed) return;
65-
66-
try
67-
{
68-
cache.Dispose();
69-
}
70-
catch (Exception e)
71-
{
72-
log.Warn("Exception occurred while disposing shared cache", e);
73-
}
74-
disposed = true;
75-
}
76-
}
77-
7859
public void Dispose()
79-
{
80-
Dispose(true);
81-
}
60+
{}
8261
}
8362
}

src/GitHub.App/Controllers/UIController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ void End(bool success)
601601
ShutdownFlow(activeFlow);
602602

603603
// if the auth was cancelled, we need to stop everything, otherwise we'll go into a loop
604-
if (activeFlow == mainFlow || (activeFlow == UIControllerFlow.Authentication && !Success.Value))
604+
if (activeFlow == mainFlow || !Success.Value)
605605
stopping = true;
606606

607607
Fire(Trigger.Next);

src/GitHub.App/Factories/HostCacheFactory.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,8 @@ public IBlobCache Create(HostAddress hostAddress)
4040
IOperatingSystem OperatingSystem { get { return operatingSystem.Value; } }
4141
IBlobCacheFactory BlobCacheFactory { get { return blobCacheFactory.Value; } }
4242

43-
bool disposed;
4443
protected virtual void Dispose(bool disposing)
45-
{
46-
if (disposing)
47-
{
48-
if (disposed) return;
49-
disposed = true;
50-
if (blobCacheFactory.IsValueCreated)
51-
blobCacheFactory.Value.Dispose();
52-
}
53-
}
44+
{}
5445

5546
public void Dispose()
5647
{

src/GitHub.App/Factories/RepositoryHostFactory.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GitHub.Models;
66
using GitHub.Primitives;
77
using GitHub.Services;
8+
using System.Reactive.Disposables;
89

910
namespace GitHub.Factories
1011
{
@@ -17,6 +18,7 @@ public class RepositoryHostFactory : IRepositoryHostFactory
1718
readonly ILoginCache loginCache;
1819
readonly IAvatarProvider avatarProvider;
1920
readonly ITwoFactorChallengeHandler twoFactorChallengeHandler;
21+
readonly CompositeDisposable hosts = new CompositeDisposable();
2022

2123
[ImportingConstructor]
2224
public RepositoryHostFactory(
@@ -38,8 +40,14 @@ public IRepositoryHost Create(HostAddress hostAddress)
3840
var apiClient = apiClientFactory.Create(hostAddress);
3941
var hostCache = hostCacheFactory.Create(hostAddress);
4042
var modelService = new ModelService(apiClient, hostCache, avatarProvider);
43+
var host = new RepositoryHost(apiClient, modelService, loginCache, twoFactorChallengeHandler);
44+
hosts.Add(host);
45+
return host;
46+
}
4147

42-
return new RepositoryHost(apiClient, modelService, loginCache, twoFactorChallengeHandler);
48+
public void Remove(IRepositoryHost host)
49+
{
50+
hosts.Remove(host);
4351
}
4452

4553
bool disposed;
@@ -48,11 +56,8 @@ protected virtual void Dispose(bool disposing)
4856
if (disposing)
4957
{
5058
if (disposed) return;
51-
52-
loginCache.Dispose();
53-
avatarProvider.Dispose();
54-
hostCacheFactory.Dispose();
5559
disposed = true;
60+
hosts.Dispose();
5661
}
5762
}
5863

src/GitHub.App/Factories/SqlitePersistentBlobCacheFactory.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
using System;
55
using System.Collections.Generic;
66
using System.ComponentModel.Composition;
7-
using System.Reactive.Disposables;
7+
using System.Reactive.Linq;
8+
using System.Threading.Tasks;
89

910
namespace GitHub.Factories
1011
{
1112
[Export(typeof(IBlobCacheFactory))]
1213
[PartCreationPolicy(CreationPolicy.Shared)]
1314
public class SqlitePersistentBlobCacheFactory : IBlobCacheFactory
1415
{
15-
readonly CompositeDisposable disposables = new CompositeDisposable();
1616
static readonly Logger log = LogManager.GetCurrentClassLogger();
1717
Dictionary<string, IBlobCache> cache = new Dictionary<string, IBlobCache>();
1818

@@ -26,7 +26,6 @@ public IBlobCache CreateBlobCache(string path)
2626
{
2727
var c = new SQLitePersistentBlobCache(path);
2828
cache.Add(path, c);
29-
disposables.Add(c);
3029
return c;
3130
}
3231
catch(Exception ex)
@@ -43,7 +42,14 @@ protected virtual void Dispose(bool disposing)
4342
{
4443
if (disposed) return;
4544
disposed = true;
46-
disposables.Dispose();
45+
Task.Run(() =>
46+
{
47+
foreach (var c in cache.Values)
48+
{
49+
c.Dispose();
50+
c.Shutdown.Wait();
51+
}
52+
}).Wait(500);
4753
}
4854
}
4955

src/GitHub.App/Factories/UIFactory.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ public IUIPair CreateViewAndViewModel(UIViewType viewType)
3535
{
3636
return new UIPair(viewType, factory.GetView(viewType), factory.GetViewModel(viewType));
3737
}
38+
39+
protected virtual void Dispose(bool disposing)
40+
{}
41+
42+
public void Dispose()
43+
{
44+
Dispose(true);
45+
GC.SuppressFinalize(this);
46+
}
47+
3848
}
3949

4050
/// <summary>

src/GitHub.App/GitHub.App.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -51,6 +52,10 @@
5152
<DelaySign>false</DelaySign>
5253
</PropertyGroup>
5354
<ItemGroup>
55+
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
56+
<HintPath>..\..\packages\LibGit2Sharp.0.22.0\lib\net40\LibGit2Sharp.dll</HintPath>
57+
<Private>True</Private>
58+
</Reference>
5459
<Reference Include="Microsoft.VisualStudio.ComponentModelHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
5560
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
5661
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
@@ -193,6 +198,7 @@
193198
<Compile Include="ViewModels\BaseViewModel.cs" />
194199
<Compile Include="Models\ConnectionRepositoryHostMap.cs" />
195200
<Compile Include="ViewModels\GistCreationViewModel.cs" />
201+
<Compile Include="ViewModels\LoggedOutViewModel.cs" />
196202
<Compile Include="ViewModels\LogoutRequiredViewModel.cs" />
197203
<Compile Include="ViewModels\PullRequestCreationViewModel.cs" />
198204
<Compile Include="ViewModels\PullRequestDetailViewModel.cs" />
@@ -245,11 +251,6 @@
245251
<Project>{252ce1c2-027a-4445-a3c2-e4d6c80a935a}</Project>
246252
<Name>Splat-Net45</Name>
247253
</ProjectReference>
248-
<ProjectReference Include="..\..\submodules\libgit2sharp\LibGit2Sharp\LibGit2Sharp.csproj">
249-
<Project>{EE6ED99F-CB12-4683-B055-D28FC7357A34}</Project>
250-
<Name>LibGit2Sharp</Name>
251-
<Private>False</Private>
252-
</ProjectReference>
253254
<ProjectReference Include="..\CredentialManagement\CredentialManagement.csproj">
254255
<Project>{41a47c5b-c606-45b4-b83c-22b9239e4da0}</Project>
255256
<Name>CredentialManagement</Name>
@@ -293,6 +294,7 @@
293294
</PropertyGroup>
294295
<Error Condition="!Exists('..\..\packages\Fody.1.28.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.1.28.0\build\Fody.targets'))" />
295296
<Error Condition="!Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets'))" />
297+
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
296298
</Target>
297299
<Import Project="..\..\packages\Fody.1.28.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.1.28.0\build\Fody.targets')" />
298300
<Import Project="..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets" Condition="Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" />

0 commit comments

Comments
 (0)