Skip to content
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

Hide disabled widgets #3253

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/Dashboard/DevHome.Dashboard/Helpers/WidgetHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public static async Task<bool> IsIncludedWidgetProviderAsync(WidgetProviderDefin
var endOfPfnIndex = providerId.IndexOf('!', StringComparison.Ordinal);
var familyNamePartOfProviderId = providerId[..endOfPfnIndex];

// Get the list of packages that contain Dev Home widgets.
// Get the list of packages that contain Dev Home widgets and are enabled.
var extensionService = Application.Current.GetService<IExtensionService>();
var enabledWidgetProviderIds = await extensionService.GetInstalledDevHomeWidgetPackageFamilyNamesAsync(true);
var enabledWidgetProviderIds = await extensionService.GetInstalledDevHomeWidgetPackageFamilyNamesAsync(includeDisabledExtensions: false);

// Check if the specified widget provider is in the list.
var include = enabledWidgetProviderIds.ToList().Contains(familyNamePartOfProviderId);
Expand Down
2 changes: 1 addition & 1 deletion tools/Dashboard/DevHome.Dashboard/Views/DashboardView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</Grid>

<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1">
<!-- This Grid helps keep the content centered -->
<!-- This Grid helps keep the content centered -->
krschau marked this conversation as resolved.
Show resolved Hide resolved
<Grid>
<StackPanel MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}">
<!-- Top Banner - Default/First run experience - shown until user dismissed -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ private async Task RestorePinnedWidgetsAsync(ComSafeWidget[] hostWidgets)
continue;
}

// Ensure only one copy of a widget is pinned if that widget's definition only allows for one instance.
var comSafeWidgetDefinition = new ComSafeWidgetDefinition(widgetDefinitionId);
if (!await comSafeWidgetDefinition.PopulateAsync())
{
Expand All @@ -311,6 +310,14 @@ private async Task RestorePinnedWidgetsAsync(ComSafeWidget[] hostWidgets)
continue;
}

// If the widget's extension was disabled, hide the widget (don't add it to the list), but don't delete it.
if (!await WidgetHelpers.IsIncludedWidgetProviderAsync(comSafeWidgetDefinition.ProviderDefinition))
{
_log.Information($"Not adding widget from disabled extension {comSafeWidgetDefinition.ProviderDefinitionId}");
continue;
}

// Ensure only one copy of a widget is pinned if that widget's definition only allows for one instance.
if (comSafeWidgetDefinition.AllowMultiple == false)
{
if (pinnedSingleInstanceWidgets.Contains(widgetDefinitionId))
Expand Down
Loading