Skip to content

Commit

Permalink
✨ Handle other Git clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamparter committed Sep 7, 2024
1 parent 0150790 commit b2d3e39
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FluentHub.App/UserControls/GitCloneFlyout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
FontFamily="{StaticResource Octicons}"
FontSize="14"
Glyph="" />
<TextBlock Text="Open with GitHub Desktop" />
<TextBlock Text="Open in your local Git client" />
</StackPanel>
</Button>

Expand Down
25 changes: 24 additions & 1 deletion src/FluentHub.App/UserControls/GitCloneFlyout.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,30 @@ private async void OpenGitHubDesktopButton_Click(object sender, RoutedEventArgs
}
else
{
Log.Error("Error opening GitHub Desktop");
Log.Error("Error opening GitHub Desktop; opening GitKraken instead");
// Try GitKraken
string openGitKrakenUrl = $"gitkraken://repolink/-?url=https%3A%2F%2Fgithub.com%2F{ViewModel.Repository.Owner.Login}%2F{ViewModel.Repository.Name}.git";
var gitKrakenUri = new Uri(openGitKrakenUrl);
var secondSuccess = await Windows.System.Launcher.LaunchUriAsync(gitKrakenUri);
if (secondSuccess)
{
Log.Write(Serilog.Events.LogEventLevel.Information, "Opened GitKraken with the repository");
}
else
{
Log.Error("Error opening GitKraken; opening GitHub Desktop download page instead.");
// Open GitHub Desktop download page
var downloadUri = new Uri("https://desktop.github.com/");
var thirdSuccess = await Windows.System.Launcher.LaunchUriAsync(downloadUri);
if (thirdSuccess)
{
Log.Write(Serilog.Events.LogEventLevel.Information, "Opened GitHub Desktop download page");
}
else
{
Log.Error("Error opening GitHub Desktop download page; cancelling operation");
}
}
}
}

Expand Down

0 comments on commit b2d3e39

Please sign in to comment.