diff --git a/tools/DevDiagnostics/DevHome.DevDiagnostics/Models/RestoreState.cs b/tools/DevDiagnostics/DevHome.DevDiagnostics/Models/RestoreState.cs deleted file mode 100644 index 1e1206a6eb..0000000000 --- a/tools/DevDiagnostics/DevHome.DevDiagnostics/Models/RestoreState.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using Microsoft.UI.Xaml.Controls; - -namespace DevHome.DevDiagnostics.Models; - -internal sealed class RestoreState -{ - internal double Left { get; set; } - - internal double Top { get; set; } - - internal double Width { get; set; } - - internal double Height { get; set; } - - internal Orientation BarOrientation { get; set; } - - internal bool IsLargePanelVisible { get; set; } -} diff --git a/tools/SetupFlow/DevHome.SetupFlow.UnitTest/BaseSetupFlowTest.cs b/tools/SetupFlow/DevHome.SetupFlow.UnitTest/BaseSetupFlowTest.cs index b88b11e919..5c68dfd5ac 100644 --- a/tools/SetupFlow/DevHome.SetupFlow.UnitTest/BaseSetupFlowTest.cs +++ b/tools/SetupFlow/DevHome.SetupFlow.UnitTest/BaseSetupFlowTest.cs @@ -11,7 +11,6 @@ using DevHome.SetupFlow.ViewModels; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Internal.Windows.DevHome.Helpers.Restore; using Moq; namespace DevHome.SetupFlow.UnitTest; @@ -26,8 +25,6 @@ public class BaseSetupFlowTest protected Mock ThemeSelectorService { get; private set; } - protected Mock RestoreInfo { get; private set; } - protected Mock StringResource { get; private set; } protected Mock LocalSettingsService { get; private set; } @@ -40,7 +37,6 @@ public void TestInitialize() { WindowsPackageManager = new Mock(); ThemeSelectorService = new Mock(); - RestoreInfo = new Mock(); StringResource = new Mock(); LocalSettingsService = new Mock(); TestHost = CreateTestHost(); @@ -76,11 +72,8 @@ private IHost CreateTestHost() // App-management services services.AddSingleton(WindowsPackageManager.Object); services.AddTransient(); - services.AddTransient(); - services.AddSingleton(RestoreInfo.Object); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton(new Mock().Object); services.AddSingleton(new Mock().Object); diff --git a/tools/SetupFlow/DevHome.SetupFlow.UnitTest/ViewModels/WinGetPackageRestoreDataSourceTest.cs b/tools/SetupFlow/DevHome.SetupFlow.UnitTest/ViewModels/WinGetPackageRestoreDataSourceTest.cs deleted file mode 100644 index d690627ba0..0000000000 --- a/tools/SetupFlow/DevHome.SetupFlow.UnitTest/ViewModels/WinGetPackageRestoreDataSourceTest.cs +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using DevHome.Common.Extensions; -using DevHome.Services.WindowsPackageManager.Contracts; -using DevHome.Services.WindowsPackageManager.Exceptions; -using DevHome.Services.WindowsPackageManager.Models; -using DevHome.SetupFlow.Services; -using DevHome.SetupFlow.UnitTest.Helpers; -using Microsoft.Internal.Windows.DevHome.Helpers.Restore; -using Microsoft.Management.Deployment; -using Moq; -using Windows.Storage.Streams; - -namespace DevHome.SetupFlow.UnitTest.ViewModels; - -[TestClass] -public class WinGetPackageRestoreDataSourceTest : BaseSetupFlowTest -{ - // Icon stream size - private const ulong EmptyIconStreamSize = 0; - private const ulong NonEmptyIconStreamSize = 1; - - [TestMethod] - public void LoadCatalogs_EmptyPackages_ReturnsNoCatalogs() - { - // Arrange - var expectedPackages = new List(); - var restoreApplicationInfoList = expectedPackages.Select(p => CreateRestoreApplicationInfo(p.Id).Object).ToList(); - WindowsPackageManager.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ReturnsAsync(expectedPackages); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, restoreApplicationInfoList); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(0, loadedPackages.Count); - WindowsPackageManager.Verify(wpm => wpm.GetPackagesAsync(It.IsAny>()), Times.Never()); - } - - [TestMethod] - public void LoadCatalogs_ExceptionThrownWhenGettingPackages_ReturnsNoCatalogs() - { - // Arrange - WindowsPackageManager!.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ThrowsAsync(new FindPackagesException(FindPackagesResultStatus.CatalogError)); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, new List()); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(0, loadedPackages.Count); - } - - [TestMethod] - [DataRow(RestoreDeviceInfoStatus.NotAvailable)] - [DataRow(RestoreDeviceInfoStatus.Error)] - public void LoadCatalogs_NonSuccessStatus_ReturnsNoCatalogs(RestoreDeviceInfoStatus status) - { - // Arrange - ConfigureRestoreDeviceInfo(status, new List()); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(0, loadedPackages.Count); - } - - [TestMethod] - [DataRow("mock1", "mock2")] - [DataRow("mock2", "mock1")] - public void LoadCatalogs_OrderedPackages_ReturnsWinGetCatalogWithMatchingInputOrder(string packageId1, string packageId2) - { - // Arrange - var expectedPackages = new List - { - PackageHelper.CreatePackage(packageId1).Object, - PackageHelper.CreatePackage(packageId2).Object, - }; - var restoreApplicationInfoList = expectedPackages.Select(p => CreateRestoreApplicationInfo(p.Id).Object).ToList(); - WindowsPackageManager.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ReturnsAsync(expectedPackages); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, restoreApplicationInfoList); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(1, loadedPackages.Count); - Assert.AreEqual(expectedPackages.Count, loadedPackages[0].Packages.Count); - Assert.AreEqual(expectedPackages[0].Id, loadedPackages[0].Packages.ElementAt(0).Id); - Assert.IsNotNull(expectedPackages[0].LightThemeIcon); - Assert.IsNotNull(expectedPackages[0].DarkThemeIcon); - Assert.AreEqual(expectedPackages[1].Id, loadedPackages[0].Packages.ElementAt(1).Id); - Assert.IsNotNull(expectedPackages[1].LightThemeIcon); - Assert.IsNotNull(expectedPackages[1].DarkThemeIcon); - } - - [TestMethod] - public void LoadCatalogs_Success_ReturnsWinGetCatalogs() - { - // Arrange - var expectedPackages = new List - { - PackageHelper.CreatePackage("mock1").Object, - PackageHelper.CreatePackage("mock2").Object, - }; - var restoreApplicationInfoList = expectedPackages.Select(p => CreateRestoreApplicationInfo(p.Id).Object).ToList(); - WindowsPackageManager.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ReturnsAsync(expectedPackages); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, restoreApplicationInfoList); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(1, loadedPackages.Count); - Assert.AreEqual(expectedPackages.Count, loadedPackages[0].Packages.Count); - Assert.AreEqual(expectedPackages[0].Id, loadedPackages[0].Packages.ElementAt(0).Id); - Assert.IsNotNull(expectedPackages[0].LightThemeIcon); - Assert.IsNotNull(expectedPackages[0].DarkThemeIcon); - Assert.AreEqual(expectedPackages[1].Id, loadedPackages[0].Packages.ElementAt(1).Id); - Assert.IsNotNull(expectedPackages[1].LightThemeIcon); - Assert.IsNotNull(expectedPackages[1].DarkThemeIcon); - } - - [TestMethod] - public void LoadCatalogs_ExceptionThrownWhenGettingRestoreApplicationIcon_ReturnsNullForIcon() - { - var expectedPackages = new List - { - PackageHelper.CreatePackage("mock").Object, - }; - var restoreApplicationInfoList = expectedPackages.Select(p => - { - var restoreAppInfo = CreateRestoreApplicationInfo(p.Id); - - // Mock restore application icon not found by throwing an exception - restoreAppInfo - .Setup(appInfo => appInfo.GetIconAsync(It.IsAny())) - .Throws(new ArgumentOutOfRangeException()); - - return restoreAppInfo.Object; - }).ToList(); - WindowsPackageManager.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ReturnsAsync(expectedPackages); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, restoreApplicationInfoList); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(1, loadedPackages.Count); - Assert.AreEqual(expectedPackages.Count, loadedPackages[0].Packages.Count); - Assert.AreEqual(expectedPackages[0].Id, loadedPackages[0].Packages.ElementAt(0).Id); - Assert.IsNull(expectedPackages[0].LightThemeIcon); - Assert.IsNull(expectedPackages[0].DarkThemeIcon); - } - - [TestMethod] - public void LoadCatalogs_GettingRestoreApplicationIconWithEmptyStream_ReturnsNullForIcon() - { - var expectedPackages = new List - { - PackageHelper.CreatePackage("mock").Object, - }; - var restoreApplicationInfoList = expectedPackages.Select(p => CreateRestoreApplicationInfo(p.Id, EmptyIconStreamSize).Object).ToList(); - WindowsPackageManager.Setup(wpm => wpm.GetPackagesAsync(It.IsAny>())).ReturnsAsync(expectedPackages); - WindowsPackageManager.Setup(wpm => wpm.CreateWinGetCatalogPackageUri(It.IsAny())).Returns(new WinGetPackageUri("x-ms-winget://mock/mock")); - ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus.Ok, restoreApplicationInfoList); - - // Act - var loadedPackages = LoadCatalogsFromRestoreDataSource(); - - // Assert - Assert.AreEqual(1, loadedPackages.Count); - Assert.AreEqual(expectedPackages.Count, loadedPackages[0].Packages.Count); - Assert.AreEqual(expectedPackages[0].Id, loadedPackages[0].Packages.ElementAt(0).Id); - Assert.IsNull(expectedPackages[0].LightThemeIcon); - Assert.IsNull(expectedPackages[0].DarkThemeIcon); - } - - /// - /// Load catalogs from restore data source - /// - /// List of package catalogs - private IList LoadCatalogsFromRestoreDataSource() - { - var restoreDataSource = TestHost!.GetService(); - restoreDataSource.InitializeAsync().GetAwaiter().GetResult(); - return restoreDataSource.LoadCatalogsAsync().GetAwaiter().GetResult(); - } - - /// - /// Configure a restore device info including WinGet packages to restore - /// - /// Result status - /// Mock a list of application info to restore - private void ConfigureRestoreDeviceInfo(RestoreDeviceInfoStatus status, IList restoreApplicationInfoList) - { - // Mock restore device info - var deviceInfo = new Mock(); - deviceInfo.Setup(di => di.WinGetApplicationsInfo).Returns(restoreApplicationInfoList); - - // Mock restore device info result - var restoreDeviceInfoResult = new Mock(); - restoreDeviceInfoResult.Setup(result => result.Status).Returns(status); - restoreDeviceInfoResult.Setup(result => result.RestoreDeviceInfo).Returns(deviceInfo.Object); - RestoreInfo.Setup(restore => restore.GetRestoreDeviceInfoAsync()).Returns(Task.FromResult(restoreDeviceInfoResult.Object).AsAsyncOperation()); - } - - /// - /// Create an application info to restore - /// - /// Id of the package corresponding to the application to restore - /// Restore application info - private Mock CreateRestoreApplicationInfo(string packageId, ulong iconStreamSize = NonEmptyIconStreamSize) - { - var appInfo = new Mock(); - - // Mock id - appInfo.Setup(app => app.Id).Returns(packageId); - - // Mock icon - var mockIconStream = new Mock(); - mockIconStream.SetupGet(stream => stream.Size).Returns(iconStreamSize); - appInfo - .Setup(app => app.GetIconAsync(It.IsAny())) - .Returns(Task.FromResult(mockIconStream.Object).AsAsyncOperation()); - - return appInfo; - } -} diff --git a/tools/SetupFlow/DevHome.SetupFlow/Extensions/ServiceExtensions.cs b/tools/SetupFlow/DevHome.SetupFlow/Extensions/ServiceExtensions.cs index 85caef575b..cbfbce2781 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Extensions/ServiceExtensions.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Extensions/ServiceExtensions.cs @@ -12,7 +12,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.Internal.Windows.DevHome.Helpers; -using Microsoft.Internal.Windows.DevHome.Helpers.Restore; namespace DevHome.SetupFlow.Extensions; @@ -58,13 +57,11 @@ private static IServiceCollection AddAppManagement(this IServiceCollection servi services.AddTransient(); // Services - services.AddSingleton(); services.AddSingleton(); services.AddTransient(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(sp => { var dataSourcePath = sp.GetService>().Value.WinGetPackageJsonDataSourcePath; diff --git a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs index 3f546d665e..7a015f1a6f 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs @@ -80,9 +80,6 @@ public static class StringResourceKey public static readonly string RemovedAllApplications = nameof(RemovedAllApplications); public static readonly string ResultCountPlural = nameof(ResultCountPlural); public static readonly string ResultCountSingular = nameof(ResultCountSingular); - public static readonly string RestorePackagesTitle = nameof(RestorePackagesTitle); - public static readonly string RestorePackagesDescription = nameof(RestorePackagesDescription); - public static readonly string RestorePackagesDescriptionWithDate = nameof(RestorePackagesDescriptionWithDate); public static readonly string Repository = nameof(Repository); public static readonly string ReviewNothingToSetUpToolTip = nameof(ReviewNothingToSetUpToolTip); public static readonly string SelectedPackagesCount = nameof(SelectedPackagesCount); diff --git a/tools/SetupFlow/DevHome.SetupFlow/Services/WinGetPackageRestoreDataSource.cs b/tools/SetupFlow/DevHome.SetupFlow/Services/WinGetPackageRestoreDataSource.cs deleted file mode 100644 index 530e9bfe3d..0000000000 --- a/tools/SetupFlow/DevHome.SetupFlow/Services/WinGetPackageRestoreDataSource.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Threading.Tasks; -using DevHome.Common.Extensions; -using DevHome.Services.WindowsPackageManager.Contracts; -using DevHome.Services.WindowsPackageManager.Models; -using DevHome.SetupFlow.Models; -using DevHome.Telemetry; -using Microsoft.Diagnostics.Telemetry.Internal; -using Microsoft.Internal.Windows.DevHome.Helpers.Restore; -using Serilog; -using Windows.Storage.Streams; - -namespace DevHome.SetupFlow.Services; - -public class WinGetPackageRestoreDataSource : WinGetPackageDataSource -{ - private readonly ILogger _log = Log.ForContext("SourceContext", nameof(WinGetPackageRestoreDataSource)); - private readonly IRestoreInfo _restoreInfo; - private readonly ISetupFlowStringResource _stringResource; - private IRestoreDeviceInfo _restoreDeviceInfo; - - public WinGetPackageRestoreDataSource( - ISetupFlowStringResource stringResource, - IWinGet winget, - IRestoreInfo restoreInfo) - : base(winget) - { - _stringResource = stringResource; - _restoreInfo = restoreInfo; - } - - /// - /// Gets the total number of package catalogs available in this data source - /// - /// - /// Each collection of packages from a restore device is compiled into a - /// catalog. At most show one catalog. - /// - public override int CatalogCount => _restoreDeviceInfo == null ? 0 : 1; - - /// - /// Gets the restore device information - /// - public async override Task InitializeAsync() - { - var restoreDeviceInfoResult = await _restoreInfo.GetRestoreDeviceInfoAsync(); - if (restoreDeviceInfoResult.Status == RestoreDeviceInfoStatus.Ok) - { - _restoreDeviceInfo = restoreDeviceInfoResult.RestoreDeviceInfo; - TelemetryFactory.Get().Log("AppInstall_RestoreApps_Found", LogLevel.Critical, new EmptyEvent(PartA_PrivTags.ProductAndServicePerformance)); - } - else - { - _log.Warning($"Restore data source skipped with status: {restoreDeviceInfoResult.Status}"); - } - } - - public async override Task> LoadCatalogsAsync() - { - var result = new List(); - if (_restoreDeviceInfo == null) - { - _log.Warning($"Load catalogs skipped because no restore device information was found"); - return result; - } - - try - { - _log.Information("Finding packages from restore data"); - var packages = await GetPackagesAsync(_restoreDeviceInfo.WinGetApplicationsInfo.Select(p => GetPackageUri(p)).ToList()); - foreach (var package in packages) - { - var packageUri = WinGet.CreatePackageUri(package); - _log.Information($"Obtaining icon information for restore package {package.Id}"); - var appInfo = _restoreDeviceInfo.WinGetApplicationsInfo.FirstOrDefault(p => packageUri == GetPackageUri(p)); - if (appInfo != null) - { - package.LightThemeIcon = await GetRestoreApplicationIconAsync(appInfo, RestoreApplicationIconTheme.Light); - package.DarkThemeIcon = await GetRestoreApplicationIconAsync(appInfo, RestoreApplicationIconTheme.Dark); - } - } - - if (packages.Any()) - { - result.Add(new PackageCatalog() - { - Name = _stringResource.GetLocalized(StringResourceKey.RestorePackagesTitle, _restoreDeviceInfo.DisplayName), - Description = GetDescription(), - Packages = packages.ToReadOnlyCollection(), - }); - } - else - { - _log.Information("No packages found from restore"); - } - } - catch (Exception e) - { - _log.Error(e, $"Error loading packages from winget restore catalog."); - } - - if (result.Count > 0) - { - TelemetryFactory.Get().Log("AppInstall_RestoreApps_Loaded", LogLevel.Critical, new EmptyEvent(PartA_PrivTags.ProductAndServicePerformance)); - } - - return result; - } - - /// - /// Get the icon for a restore application based on the provided theme - /// - /// Restore application - /// Target theme - /// Restore application icon stream, or null if no corresponding icon was found - private async Task GetRestoreApplicationIconAsync(IRestoreApplicationInfo appInfo, RestoreApplicationIconTheme theme) - { - try - { - // Load icon from restore app data - var iconTask = appInfo.GetIconAsync(theme); - - // Check if no icon is available - if (iconTask != null) - { - var icon = await iconTask; - - // Ensure stream is not empty to prevent rendering an empty image - if (icon.Size > 0) - { - return icon; - } - } - } - catch (Exception e) - { - _log.Error(e, $"Failed to get icon for restore package {appInfo.Id}"); - } - - _log.Warning($"No {theme} icon found for restore package {appInfo.Id}. A default one will be provided."); - return null; - } - - /// - /// Gets the restore catalog description - /// - /// Localized restore catalog description - private string GetDescription() - { - // Check if last modified time is not available - if (_restoreDeviceInfo.LastModifiedTime == DateTime.MinValue) - { - return _stringResource.GetLocalized(StringResourceKey.RestorePackagesDescription, _restoreDeviceInfo.DisplayName); - } - - return _stringResource.GetLocalized(StringResourceKey.RestorePackagesDescriptionWithDate, _restoreDeviceInfo.DisplayName, _restoreDeviceInfo.LastModifiedTime.ToString("d", CultureInfo.CurrentCulture)); - } - - /// - /// Gets the package URI for a restore application - /// - /// Application information - /// Package URI - /// All restored applications are from winget catalog - private WinGetPackageUri GetPackageUri(IRestoreApplicationInfo appInfo) - { - return WinGet.CreateWinGetCatalogPackageUri(appInfo.Id); - } -} diff --git a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw index c841bfdcff..c915664c7e 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw +++ b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw @@ -601,18 +601,6 @@ {0} Results found for "{1}" {Locked="{0}", "{1}"} Label for a search result counter. {0} is replaced by the number of result items. {1} is replaced with the search term. - - On {0} - {Locked="{0}"} Header text of a section for restoring packages from another device. {0} is replaced by a device name. - - - These applications are from {0}. Select the ones to install. - {Locked="{0}"} Description text of a section for restoring packages from another device. {0} is replaced by a device name. - - - These applications are from {0} (last synced on {1}). Select the ones to install. - {Locked="{0}","{1}"} Description text of a section for restoring packages from another device. {0} is replaced by a device name. {1} is replaced by a date. - {0} packages {Locked="{0}"} Display the number of packages. {0} is replaced by the number of packages. @@ -661,10 +649,6 @@ Previous Label for a "go to previous page" button - - Restore - Label for restore button - Generate Configuration file Text for a generating configuration file button diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs index 89af8dfb97..e8435c0efe 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs @@ -11,7 +11,7 @@ using DevHome.Services.WindowsPackageManager.Contracts; using DevHome.SetupFlow.Models; using DevHome.SetupFlow.Services; -using Microsoft.Internal.Windows.DevHome.Helpers.Restore; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; using Windows.Storage.Streams; using Windows.System; @@ -86,8 +86,8 @@ public PackageViewModel( _orchestrator = orchestrator; // Lazy-initialize optional or expensive view model members - _packageDarkThemeIcon = new Lazy(() => GetIconByTheme(RestoreApplicationIconTheme.Dark)); - _packageLightThemeIcon = new Lazy(() => GetIconByTheme(RestoreApplicationIconTheme.Light)); + _packageDarkThemeIcon = new Lazy(() => GetIconByTheme()); + _packageLightThemeIcon = new Lazy(() => GetIconByTheme()); SelectedVersion = GetDefaultSelectedVersion(); InstallPackageTask = CreateInstallTask(); @@ -203,20 +203,11 @@ private void ToggleSelection() _screenReaderService.Announce(announcementText); } - /// - /// Gets the package icon based on the provided theme - /// - /// Package icon theme - /// Package icon - private BitmapImage GetIconByTheme(RestoreApplicationIconTheme theme) + private BitmapImage GetIconByTheme() { - return theme switch + return _themeSelector.GetActualTheme() switch { - // Get default dark theme icon if corresponding package icon was not found - RestoreApplicationIconTheme.Dark => - _package.DarkThemeIcon == null ? DefaultDarkPackageIconSource : CreateBitmapImage(_package.DarkThemeIcon), - - // Get default light theme icon if corresponding package icon was not found + ElementTheme.Dark => _package.DarkThemeIcon == null ? DefaultDarkPackageIconSource : CreateBitmapImage(_package.DarkThemeIcon), _ => _package.LightThemeIcon == null ? DefaultLightPackageIconSource : CreateBitmapImage(_package.LightThemeIcon), }; }