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

Commit 7183891

Browse files
Fixing more issues after merge
1 parent e86bde3 commit 7183891

File tree

10 files changed

+25
-36
lines changed

10 files changed

+25
-36
lines changed

src/GitHub.App/SampleData/PullRequestAnnotationItemViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public sealed class PullRequestAnnotationItemViewModelDesigner : IPullRequestAnn
1313
public bool IsExpanded { get; set; }
1414
public string LineDescription => $"{Annotation.StartLine}:{Annotation.EndLine}";
1515
public bool IsFileInPullRequest { get; set; }
16-
public ReactiveCommand<Unit> OpenAnnotation { get; }
16+
public ReactiveCommand<Unit, Unit> OpenAnnotation { get; }
1717
}
1818
}

src/GitHub.App/SampleData/PullRequestFilesViewModelDesigner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public PullRequestFilesViewModelDesigner()
3636
public ReactiveCommand<IPullRequestFileNode, Unit> DiffFileWithWorkingDirectory { get; }
3737
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFileInWorkingDirectory { get; }
3838
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstComment { get; }
39-
public ReactiveCommand<Unit> OpenFirstAnnotationNotice { get; }
40-
public ReactiveCommand<Unit> OpenFirstAnnotationWarning { get; }
41-
public ReactiveCommand<Unit> OpenFirstAnnotationFailure { get; }
39+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationNotice { get; }
40+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationWarning { get; }
41+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationFailure { get; }
4242

4343
public Task InitializeAsync(
4444
IPullRequestSession session,

src/GitHub.App/ViewModels/GitHubPane/PullRequestAnnotationItemViewModel.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ public PullRequestAnnotationItemViewModel(CheckSuiteModel checkSuite,
4141

4242
IsFileInPullRequest = session.PullRequest.ChangedFiles.Any(model => model.FileName == annotation.Path);
4343

44-
OpenAnnotation = ReactiveCommand.CreateAsyncTask(Observable.Return(IsFileInPullRequest), async x =>
45-
{
46-
await editorService.OpenDiff(session, annotation.Path, checkSuite.HeadSha, annotation.EndLine - 1);
47-
});
44+
OpenAnnotation = ReactiveCommand.CreateFromTask<Unit>(
45+
async _ => await editorService.OpenDiff(session, annotation.Path, checkSuite.HeadSha, annotation.EndLine - 1),
46+
Observable.Return(IsFileInPullRequest));
4847
}
4948

5049
/// <inheritdoc />
@@ -57,7 +56,7 @@ public PullRequestAnnotationItemViewModel(CheckSuiteModel checkSuite,
5756
public string LineDescription => $"{Annotation.StartLine}:{Annotation.EndLine}";
5857

5958
/// <inheritdoc />
60-
public ReactiveCommand<Unit> OpenAnnotation { get; }
59+
public ReactiveCommand<Unit, Unit> OpenAnnotation { get; }
6160

6261
/// <inheritdoc />
6362
public bool IsExpanded

src/GitHub.App/ViewModels/GitHubPane/PullRequestFilesViewModel.cs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,14 @@ public PullRequestFilesViewModel(
6666
}
6767
});
6868

69-
OpenFirstAnnotationNotice = ReactiveCommand.CreateAsyncTask(async x =>
70-
{
71-
await OpenFirstAnnotation(editorService, (IPullRequestFileNode) x, CheckAnnotationLevel.Notice);
72-
});
69+
OpenFirstAnnotationNotice = ReactiveCommand.CreateFromTask<IPullRequestFileNode>(
70+
async file => await OpenFirstAnnotation(editorService, file, CheckAnnotationLevel.Notice));
7371

74-
OpenFirstAnnotationWarning = ReactiveCommand.CreateAsyncTask(async x =>
75-
{
76-
await OpenFirstAnnotation(editorService, (IPullRequestFileNode) x, CheckAnnotationLevel.Warning);
77-
});
72+
OpenFirstAnnotationWarning = ReactiveCommand.CreateFromTask<IPullRequestFileNode>(
73+
async file => await OpenFirstAnnotation(editorService, file, CheckAnnotationLevel.Warning));
7874

79-
OpenFirstAnnotationFailure = ReactiveCommand.CreateAsyncTask(async x =>
80-
{
81-
await OpenFirstAnnotation(editorService, (IPullRequestFileNode) x, CheckAnnotationLevel.Failure);
82-
});
75+
OpenFirstAnnotationNotice = ReactiveCommand.CreateFromTask<IPullRequestFileNode>(
76+
async file => await OpenFirstAnnotation(editorService, file, CheckAnnotationLevel.Failure));
8377
}
8478

8579
private async Task OpenFirstAnnotation(IPullRequestEditorService editorService, IPullRequestFileNode file,
@@ -187,13 +181,13 @@ public async Task InitializeAsync(
187181
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstComment { get; }
188182

189183
/// <inheritdoc/>
190-
public ReactiveCommand<Unit> OpenFirstAnnotationNotice { get; }
184+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationNotice { get; }
191185

192186
/// <inheritdoc/>
193-
public ReactiveCommand<Unit> OpenFirstAnnotationWarning { get; }
187+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationWarning { get; }
194188

195189
/// <inheritdoc/>
196-
public ReactiveCommand<Unit> OpenFirstAnnotationFailure { get; }
190+
public ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationFailure { get; }
197191

198192
static int CountComments(
199193
IEnumerable<IInlineCommentThreadModel> thread,

src/GitHub.InlineReviews/ViewModels/InlineAnnotationViewModel.cs renamed to src/GitHub.App/ViewModels/InlineAnnotationViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using GitHub.Models;
2+
using GitHub.ViewModels;
23

34
namespace GitHub.InlineReviews.ViewModels
45
{

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IPullRequestAnnotationItemViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public interface IPullRequestAnnotationItemViewModel
3232
/// <summary>
3333
/// Gets a command which opens the annotation in the diff view.
3434
/// </summary>
35-
ReactiveCommand<Unit> OpenAnnotation { get; }
35+
ReactiveCommand<Unit, Unit> OpenAnnotation { get; }
3636
}
3737
}

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IPullRequestFilesViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@ public interface IPullRequestFilesViewModel : IViewModel, IDisposable
5555
/// Gets a command that opens the first annotation notice for a <see cref="IPullRequestFileNode"/> in
5656
/// the diff viewer.
5757
/// </summary>
58-
ReactiveCommand<Unit> OpenFirstAnnotationNotice { get; }
58+
ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationNotice { get; }
5959

6060
/// <summary>
6161
/// Gets a command that opens the first annotation warning for a <see cref="IPullRequestFileNode"/> in
6262
/// the diff viewer.
6363
/// </summary>
64-
ReactiveCommand<Unit> OpenFirstAnnotationWarning { get; }
64+
ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationWarning { get; }
6565

6666
/// <summary>
6767
/// Gets a command that opens the first annotation failure for a <see cref="IPullRequestFileNode"/> in
6868
/// the diff viewer.
6969
/// </summary>
70-
ReactiveCommand<Unit> OpenFirstAnnotationFailure { get; }
70+
ReactiveCommand<IPullRequestFileNode, Unit> OpenFirstAnnotationFailure { get; }
7171

7272
/// <summary>
7373
/// Initializes the view model.

src/GitHub.InlineReviews/ViewModels/IInlineAnnotationViewModel.cs renamed to src/GitHub.Exports.Reactive/ViewModels/IInlineAnnotationViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using GitHub.Models;
22

3-
namespace GitHub.InlineReviews.ViewModels
3+
namespace GitHub.ViewModels
44
{
55
/// <summary>
66
/// A view model that represents a single inline annotation.

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
<Compile Include="Margins\InlineCommentMarginVisible.cs" />
8383
<Compile Include="Margins\InlineCommentMarginEnabled.cs" />
8484
<Compile Include="SampleData\InlineAnnotationViewModelDesigner.cs" />
85-
<Compile Include="Services\CommentService.cs" />
86-
<Compile Include="Services\ICommentService.cs" />
8785
<Compile Include="PullRequestStatusBarPackage.cs" />
8886
<Compile Include="InlineReviewsPackage.cs" />
8987
<Compile Include="Models\InlineCommentThreadModel.cs" />
@@ -113,8 +111,6 @@
113111
<Compile Include="Tags\ShowInlineCommentAnnotationGlyph.xaml.cs">
114112
<DependentUpon>ShowInlineCommentAnnotationGlyph.xaml</DependentUpon>
115113
</Compile>
116-
<Compile Include="ViewModels\IInlineAnnotationViewModel.cs" />
117-
<Compile Include="ViewModels\InlineAnnotationViewModel.cs" />
118114
<Compile Include="ViewModels\PullRequestFileMarginViewModel.cs" />
119115
<Compile Include="ViewModels\InlineCommentPeekViewModel.cs" />
120116
<Compile Include="ViewModels\IPullRequestReviewCommentViewModel.cs" />
@@ -473,9 +469,7 @@
473469
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
474470
</Content>
475471
</ItemGroup>
476-
<ItemGroup>
477-
<Folder Include="SampleData\" />
478-
</ItemGroup>
472+
<ItemGroup />
479473
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
480474
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' And '$(NCrunch)' != '1'" />
481475
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

src/GitHub.InlineReviews/SampleData/InlineAnnotationViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using GitHub.InlineReviews.ViewModels;
33
using GitHub.Models;
4+
using GitHub.ViewModels;
45

56
namespace GitHub.InlineReviews.SampleData
67
{

0 commit comments

Comments
 (0)