diff --git a/src/GitHubExtension/Widgets/GitHubReviewWidget.cs b/src/GitHubExtension/Widgets/GitHubReviewWidget.cs index 29eb512..c0420ac 100644 --- a/src/GitHubExtension/Widgets/GitHubReviewWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubReviewWidget.cs @@ -1,16 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Text.Json.Nodes; -using GitHubExtension.DataManager; using GitHubExtension.Helpers; -using Microsoft.Windows.Widgets.Providers; using Octokit; namespace GitHubExtension.Widgets; internal sealed class GitHubReviewWidget : GitHubUserWidget { + protected override string DefaultShowCategory => "PullRequests"; + protected override string GetTitleIconData() { return IconLoader.GetIconAsBase64("pulls.png"); diff --git a/src/GitHubExtension/Widgets/GitHubUserWidget.cs b/src/GitHubExtension/Widgets/GitHubUserWidget.cs index ee8ee1b..187e640 100644 --- a/src/GitHubExtension/Widgets/GitHubUserWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubUserWidget.cs @@ -19,6 +19,8 @@ internal abstract class GitHubUserWidget : GitHubWidget protected SearchCategory ShowCategory { get; set; } = SearchCategory.Unknown; + protected virtual string DefaultShowCategory => string.Empty; + private string _userName = string.Empty; protected string UserName @@ -115,7 +117,7 @@ protected override void ResetWidgetInfoFromState() try { dataObject ??= JsonNode.Parse(ConfigurationData); - ShowCategory = EnumHelper.StringToSearchCategory(dataObject!["showCategory"]?.GetValue() ?? string.Empty); + ShowCategory = EnumHelper.StringToSearchCategory(dataObject!["showCategory"]?.GetValue() ?? DefaultShowCategory); DeveloperLoginId = dataObject!["account"]?.GetValue() ?? string.Empty; UpdateTitle(dataObject); } @@ -147,7 +149,7 @@ public override void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs) return; } - ShowCategory = EnumHelper.StringToSearchCategory(dataObject["showCategory"]?.GetValue() ?? string.Empty); + ShowCategory = EnumHelper.StringToSearchCategory(dataObject["showCategory"]?.GetValue() ?? DefaultShowCategory); DeveloperLoginId = dataObject["account"]?.GetValue() ?? string.Empty; UpdateTitle(dataObject); diff --git a/src/GitHubExtension/Widgets/Templates/GitHubReviewConfigurationTemplate.json b/src/GitHubExtension/Widgets/Templates/GitHubReviewConfigurationTemplate.json index 00fb626..f2d150b 100644 --- a/src/GitHubExtension/Widgets/Templates/GitHubReviewConfigurationTemplate.json +++ b/src/GitHubExtension/Widgets/Templates/GitHubReviewConfigurationTemplate.json @@ -23,19 +23,6 @@ "label": "%Widget_Template/WidgetTitleLabel%", "value": "${widgetTitle}" }, - { - "type": "Input.ChoiceSet", - "id": "showCategory", - "isMultiSelect": false, - "isVisible": false, - "value": "PullRequests", - "choices": [ - { - "title": "%Widget_Template/PullRequests%", - "value": "PullRequests" - } - ] - }, { "type": "ColumnSet", "columns": [