This repository was archived by the owner on Jun 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Allow CoreWidgetProvider to be disposed #3524
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae0fcc3
Change name of GetInstalledExtensionsAsync in ExtensionLibraryViewMod…
krschau c12aec1
Update ExtensionService with new methods and remove unused one
krschau d9aa0ef
Update ExtensionWrapper to throw at the right time
krschau e22f9d3
Add WidgetExtensionService
krschau 2826533
Start core widget extension
krschau c67b963
CR comments
krschau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tools/Dashboard/DevHome.Dashboard/Services/IWidgetExtensionService.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace DevHome.Dashboard.Services; | ||
|
||
internal interface IWidgetExtensionService | ||
{ | ||
bool IsCoreWidgetExtension(string providerDefinitionId); | ||
dhoehna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Task EnsureCoreWidgetExtensionStarted(string providerDefinitionId); | ||
} |
58 changes: 58 additions & 0 deletions
58
tools/Dashboard/DevHome.Dashboard/Services/WidgetExtensionService.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using DevHome.Common.Services; | ||
|
||
namespace DevHome.Dashboard.Services; | ||
|
||
internal sealed class WidgetExtensionService : IWidgetExtensionService | ||
{ | ||
private const string ExtensionUniqueIdStable = "Microsoft.Windows.DevHome_8wekyb3d8bbwe!App!PG-SP-ID1"; | ||
private const string ExtensionUniqueIdCanary = "Microsoft.Windows.DevHome.Canary_8wekyb3d8bbwe!App!PG-SP-ID1"; | ||
private const string ExtensionUniqueIdDev = "Microsoft.Windows.DevHome.Dev_8wekyb3d8bbwe!App!PG-SP-ID1"; | ||
|
||
private const string ProviderDefinitionStable = "Microsoft.Windows.DevHome_8wekyb3d8bbwe!App!!CoreWidgetProvider"; | ||
private const string ProviderDefinitionCanary = "Microsoft.Windows.DevHome.Canary_8wekyb3d8bbwe!App!!CoreWidgetProvider"; | ||
private const string ProviderDefinitionDev = "Microsoft.Windows.DevHome.Dev_8wekyb3d8bbwe!App!!CoreWidgetProvider"; | ||
|
||
private readonly IExtensionService _extensionService; | ||
|
||
public WidgetExtensionService(IExtensionService extensionService) | ||
{ | ||
_extensionService = extensionService; | ||
} | ||
|
||
public bool IsCoreWidgetExtension(string providerDefinitionId) | ||
{ | ||
return providerDefinitionId.Equals(ProviderDefinitionStable, StringComparison.Ordinal) || | ||
providerDefinitionId.Equals(ProviderDefinitionCanary, StringComparison.Ordinal) || | ||
providerDefinitionId.Equals(ProviderDefinitionDev, StringComparison.Ordinal); | ||
} | ||
|
||
public async Task EnsureCoreWidgetExtensionStarted(string providerDefinitionId) | ||
{ | ||
if (providerDefinitionId.StartsWith(ProviderDefinitionStable, StringComparison.Ordinal)) | ||
{ | ||
await EnsureExtensionStarted(ExtensionUniqueIdStable); | ||
} | ||
else if (providerDefinitionId.StartsWith(ProviderDefinitionCanary, StringComparison.Ordinal)) | ||
{ | ||
await EnsureExtensionStarted(ExtensionUniqueIdCanary); | ||
} | ||
else if (providerDefinitionId.StartsWith(ProviderDefinitionDev, StringComparison.Ordinal)) | ||
{ | ||
await EnsureExtensionStarted(ExtensionUniqueIdDev); | ||
} | ||
} | ||
|
||
private async Task EnsureExtensionStarted(string extensionUniqueId) | ||
{ | ||
var extensionWrapper = _extensionService.GetInstalledExtension(extensionUniqueId); | ||
if (!extensionWrapper.IsRunning()) | ||
{ | ||
await extensionWrapper.StartExtensionAsync(); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.