-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Feature: Drag to clone #16920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feature: Drag to clone #16920
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e5d96d1
Added Git action
yaira2 d59f503
Git icon
yaira2 4a2505c
Update GitCloneAction.cs
yaira2 ad79328
Update BaseLayoutViewModel.cs
yaira2 44a06e6
Update src/Files.App/Dialogs/CloneRepoDialog.xaml
yaira2 27b7c06
Localization
yaira2 a40b70b
Added cannot clone repo prompt
yaira2 d85bb39
Update DynamicDialogFactory.cs
yaira2 3ffa357
Update GitHelpers.cs
yaira2 6620581
Fixed params
yaira2 c5c11ac
Move TargetDirectory handling
yaira2 b12d246
IsGitRepository
yaira2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Files Community | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Files.App.Actions | ||
| { | ||
| internal sealed partial class GitCloneAction : ObservableObject, IAction | ||
| { | ||
| private readonly IContentPageContext pageContext = Ioc.Default.GetRequiredService<IContentPageContext>(); | ||
| private readonly IDialogService dialogService = Ioc.Default.GetRequiredService<IDialogService>(); | ||
|
|
||
| public string Label { get; } = Strings.GitClone.GetLocalizedResource(); | ||
|
|
||
| public string Description { get; } = Strings.GitCloneDescription.GetLocalizedResource(); | ||
|
|
||
| public bool IsExecutable | ||
| => pageContext.CanCreateItem; | ||
|
|
||
| public RichGlyph Glyph | ||
| => new(themedIconStyle: "App.ThemedIcons.Git"); | ||
|
|
||
| public GitCloneAction() | ||
| { | ||
| pageContext.PropertyChanged += Context_PropertyChanged; | ||
| } | ||
|
|
||
| public Task ExecuteAsync(object? parameter = null) | ||
| { | ||
| if (pageContext.ShellPage is null) | ||
| return Task.CompletedTask; | ||
|
|
||
| var repoUrl = parameter?.ToString() ?? string.Empty; | ||
| var viewModel = new CloneRepoDialogViewModel(repoUrl, pageContext.ShellPage.ShellViewModel.WorkingDirectory); | ||
| return dialogService.ShowDialogAsync(viewModel); | ||
| } | ||
|
|
||
| private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
| { | ||
| if (e.PropertyName is nameof(IContentPageContext.CanCreateItem)) | ||
| OnPropertyChanged(nameof(IsExecutable)); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,6 +230,7 @@ public enum CommandCodes | |
| PlayAll, | ||
|
|
||
| // Git | ||
| GitClone, | ||
| GitFetch, | ||
| GitInit, | ||
| GitPull, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,5 +16,6 @@ public enum StatusCenterItemIconKind | |
| Compress, | ||
| Successful, | ||
| Error, | ||
| GitClone | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!-- Copyright (c) Files Community. Licensed under the MIT License. --> | ||
| <ContentDialog | ||
| x:Class="Files.App.Dialogs.CloneRepoDialog" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:converters="using:CommunityToolkit.WinUI.Converters" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:helpers="using:Files.App.Helpers" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| Title="{helpers:ResourceString Name=CloneRepo}" | ||
| HighContrastAdjustment="None" | ||
| IsPrimaryButtonEnabled="{x:Bind ViewModel.CanCloneRepo, Mode=OneWay}" | ||
| PrimaryButtonCommand="{x:Bind ViewModel.CloneRepoCommand, Mode=OneWay}" | ||
| PrimaryButtonStyle="{ThemeResource AccentButtonStyle}" | ||
| PrimaryButtonText="{helpers:ResourceString Name=Clone}" | ||
| RequestedTheme="{x:Bind RootAppElement.RequestedTheme, Mode=OneWay}" | ||
| SecondaryButtonText="{helpers:ResourceString Name=Cancel}" | ||
| Style="{StaticResource DefaultContentDialogStyle}" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <Grid Width="340"> | ||
| <StackPanel Spacing="8"> | ||
| <TextBox | ||
| Header="{helpers:ResourceString Name=RepositoryURL}" | ||
| PlaceholderText="https://github.com/files-community/Files" | ||
| Text="{x:Bind ViewModel.RepoUrl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | ||
| </StackPanel> | ||
| </Grid> | ||
|
|
||
| </ContentDialog> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Files Community | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.UI.Xaml; | ||
| using Microsoft.UI.Xaml.Controls; | ||
| using Windows.ApplicationModel.DataTransfer; | ||
|
|
||
| namespace Files.App.Dialogs | ||
| { | ||
| public sealed partial class CloneRepoDialog : ContentDialog, IDialog<CloneRepoDialogViewModel> | ||
| { | ||
| private FrameworkElement RootAppElement | ||
| => (FrameworkElement)MainWindow.Instance.Content; | ||
|
|
||
| public CloneRepoDialogViewModel ViewModel | ||
| { | ||
| get => (CloneRepoDialogViewModel)DataContext; | ||
| set => DataContext = value; | ||
| } | ||
|
|
||
| public CloneRepoDialog() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| public new async Task<DialogResult> ShowAsync() | ||
| { | ||
| return (DialogResult)await base.ShowAsync(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.