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

Commit 999e41b

Browse files
committed
Always default to clipboard URL for clone dialog
Default to clipboard URL when cloning form Start Page and Connect page. This makes it consistent with current File > Open > Open from GitHub behavior.
1 parent 82cdf6a commit 999e41b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/GitHub.App/Services/DialogService.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,31 @@ public class DialogService : IDialogService
1616
{
1717
readonly IViewViewModelFactory factory;
1818
readonly IShowDialogService showDialog;
19+
readonly IGitHubContextService gitHubContextService;
1920

2021
[ImportingConstructor]
2122
public DialogService(
2223
IViewViewModelFactory factory,
23-
IShowDialogService showDialog)
24+
IShowDialogService showDialog,
25+
IGitHubContextService gitHubContextService)
2426
{
2527
Guard.ArgumentNotNull(factory, nameof(factory));
2628
Guard.ArgumentNotNull(showDialog, nameof(showDialog));
29+
Guard.ArgumentNotNull(showDialog, nameof(gitHubContextService));
2730

2831
this.factory = factory;
2932
this.showDialog = showDialog;
33+
this.gitHubContextService = gitHubContextService;
3034
}
3135

3236
public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, string url = null)
3337
{
38+
if (string.IsNullOrEmpty(url))
39+
{
40+
var clipboardContext = gitHubContextService.FindContextFromClipboard();
41+
url = clipboardContext?.Url;
42+
}
43+
3444
var viewModel = factory.CreateViewModel<IRepositoryCloneViewModel>();
3545
if (url != null)
3646
{

src/GitHub.VisualStudio/Commands/OpenFromUrlCommand.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public OpenFromUrlCommand(
4141

4242
public override async Task Execute(string url)
4343
{
44-
if (string.IsNullOrEmpty(url))
45-
{
46-
var clipboardContext = gitHubContextService.Value.FindContextFromClipboard();
47-
url = clipboardContext?.Url;
48-
}
49-
5044
var cloneDialogResult = await dialogService.Value.ShowCloneDialog(null, url);
5145
if (cloneDialogResult != null)
5246
{

0 commit comments

Comments
 (0)