Skip to content

Commit 30a1482

Browse files
committed
Added cannot clone repo prompt
1 parent 27b7c06 commit 30a1482

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,5 +424,17 @@ await commands.OpenSettings.ExecuteAsync(
424424
new SettingsNavigationParams() { PageKind = SettingsPageKind.DevToolsPage }
425425
);
426426
}
427+
428+
public static DynamicDialog GetFor_CannotCloneRepo(string exception)
429+
{
430+
DynamicDialog dialog = new(new DynamicDialogViewModel
431+
{
432+
TitleText = "CannotCloneRepoTitle".GetLocalizedResource(),
433+
SubtitleText = exception,
434+
PrimaryButtonText = "OK".GetLocalizedResource(),
435+
DynamicButtons = DynamicDialogButtons.Primary
436+
});
437+
return dialog;
438+
}
427439
}
428440
}

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,4 +4123,8 @@
41234123
<value>Repository URL</value>
41244124
<comment>URL textbox header in the clone repo dialog</comment>
41254125
</data>
4126+
<data name="CannotCloneRepoTitle" xml:space="preserve">
4127+
<value>Cannot clone repo</value>
4128+
<comment>Cannot clone repo dialog title</comment>
4129+
</data>
41264130
</root>

src/Files.App/Utils/Git/GitHelpers.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,10 @@ public static async Task CloneRepoAsync(string repoUrl, string repoName, string
911911
Repository.Clone(repoUrl, targetDirectory, cloneOptions);
912912
return true;
913913
}
914-
catch
914+
catch (Exception ex)
915915
{
916+
_ = DynamicDialogFactory.GetFor_CannotCloneRepo(ex.Message);
917+
916918
return false;
917919
}
918920
}, banner.CancellationToken);

0 commit comments

Comments
 (0)