Skip to content

Commit

Permalink
Added feedback link
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer committed Jan 28, 2024
1 parent 19cd70d commit 4863cd5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
27 changes: 27 additions & 0 deletions src/Commands/ReportFeedbackCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using GitHubActionsVS.ToolWindows;
using Microsoft.VisualStudio.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GitHubActionsVS;

[Command(PackageIds.ReportFeedbackCommand)]
internal sealed class ReportFeedbackCommand : BaseCommand<ReportFeedbackCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
ToolWindowMessenger messenger = await Package.GetServiceAsync<ToolWindowMessenger, ToolWindowMessenger>();

var vsVersion = await VS.Shell.GetVsVersionAsync();

messenger.Send(new(MessageCommand.ReportFeedback, vsVersion.ToString()));
}).FireAndForget();
}
}
1 change: 1 addition & 0 deletions src/GitHubActionsVS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Compile Include="Commands\GotoRepoCommand.cs" />
<Compile Include="Commands\OpenSettingsCommand.cs" />
<Compile Include="Commands\RefreshRepoCommand.cs" />
<Compile Include="Commands\ReportFeedbackCommand.cs" />
<Compile Include="Converters\ConclusionColorConverter.cs" />
<Compile Include="Converters\ConclusionIconConverter.cs" />
<Compile Include="Converters\NullToVisibilityConverter.cs" />
Expand Down
9 changes: 8 additions & 1 deletion src/ToolWindows/GHActionsToolWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ private void OnMessageReceived(object sender, MessagePayload payload)
MessageCommand.Refresh => GetRepoInfoAsync(),
MessageCommand.GotoRepo => GotoRepoAsync(),
MessageCommand.OpenSettings => OpenSettingsAsync(),

MessageCommand.ReportFeedback => ReportFeedbackAsync(text),
_ => Task.CompletedTask
});
}).FireAndForget();
}

private Task ReportFeedbackAsync(string text)
{
Process.Start($"https://github.com/timheuer/GitHubActionsVS/issues/new?assignees=timheuer&labels=bug&projects=&template=bug_report.yaml&title=%5BBUG%5D%3A+&vsversion={text}");

return Task.CompletedTask;
}

private async Task OpenSettingsAsync()
{
await VS.Settings.OpenAsync(typeof(OptionsProvider.ExtensionOptionsOptions));
Expand Down
3 changes: 2 additions & 1 deletion src/ToolWindows/MessageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public enum MessageCommand
{
GotoRepo,
Refresh,
OpenSettings
OpenSettings,
ReportFeedback
}
1 change: 1 addition & 0 deletions src/VSCommandTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ internal sealed partial class PackageIds
public const int RefreshRepoCommand = 0x0111;
public const int GotoRepoCommand = 0x0112;
public const int OpenSettingsCommand = 0x0113;
public const int ReportFeedbackCommand = 0x0114;
}
}
10 changes: 10 additions & 0 deletions src/VSCommandTable.vsct
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@
<LocCanonicalName>.View.OpenSettings</LocCanonicalName>
</Strings>
</Button>
<Button guid="GitHubActionsVS" id="ReportFeedbackCommand" priority="0x0004" type="Button">
<Parent guid="GitHubActionsVS" id="TWindowToolbarGroup"/>
<Icon guid="ImageCatalogGuid" id="Feedback"/>
<CommandFlag>IconIsMoniker</CommandFlag>
<Strings>
<ButtonText>Report Feedback about this extension</ButtonText>
<LocCanonicalName>.View.ReportFeedback</LocCanonicalName>
</Strings>
</Button>
</Buttons>
</Commands>

Expand All @@ -84,6 +93,7 @@
<IDSymbol name="RefreshRepoCommand" value="0x0111" />
<IDSymbol name="GotoRepoCommand" value="0x0112" />
<IDSymbol name="OpenSettingsCommand" value="0x0113" />
<IDSymbol name="ReportFeedbackCommand" value="0x0114"/>
</GuidSymbol>
</Symbols>
</CommandTable>

0 comments on commit 4863cd5

Please sign in to comment.