From ac5015d0815d67057ed4af0ce3c8ebd1504f57e4 Mon Sep 17 00:00:00 2001 From: Agne Lukoseviciute Date: Wed, 24 Apr 2024 12:40:36 -0700 Subject: [PATCH 1/7] working e2e --- src/Services/AppInstallActivationHandler.cs | 128 +++++++++++++----- .../Services/StringResourceKey.cs | 2 + .../Strings/en-us/Resources.resw | 8 ++ .../TaskGroups/AppManagementTaskGroup.cs | 6 +- .../ViewModels/MainPageViewModel.cs | 11 +- .../ViewModels/SetupFlowViewModel.cs | 2 +- 6 files changed, 112 insertions(+), 45 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 833352f200..7465b8c8b7 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -28,20 +28,32 @@ public class AppInstallActivationHandler : ActivationHandler term.Trim(' ', '"')) - .FirstOrDefault(); + _log.Information("Starting add-apps-to-cart activation"); + _navigationService.NavigateTo(typeof(SetupFlowViewModel).FullName!); + _setupFlowViewModel.StartAppManagementFlow(queryType == ActivationQueryType.Search ? identifiers[0] : null); + await HandleAppSelectionAsync(identifiers, queryType); + } - if (string.IsNullOrEmpty(firstSearchTerm)) + private async Task HandleAppSelectionAsync(string[] identifiers, ActivationQueryType queryType) + { + try { - _log.Warning("No valid search term was extracted from the query."); - return; + await SearchAndSelectAsync(identifiers); } + catch (Exception ex) + { + _log.Error(ex, "Error executing the add-apps-to-cart activation flow"); + } + } + + private string[] ParseIdentifiers(string query, ActivationQueryType queryType) + { + switch (queryType) + { + case ActivationQueryType.Search: + var terms = query.Split(Separator, StringSplitOptions.RemoveEmptyEntries); + if (terms.Length > 0) + { + var firstTerm = terms[0].Replace("\"", string.Empty).Trim(); + return string.IsNullOrEmpty(firstTerm) ? Array.Empty() : new[] { firstTerm }; + } + + return Array.Empty(); + + case ActivationQueryType.WingetIds: + return query.Split(Separator, StringSplitOptions.RemoveEmptyEntries) + .Select(id => id.Trim(' ', '"')) + .ToArray(); - var searchResults = await _windowsPackageManager.SearchAsync(firstSearchTerm, 1); - if (searchResults.Count == 0) + default: + _log.Warning("Unsupported activation query type: {QueryType}", queryType); + return Array.Empty(); + } + } + + private async Task SearchAndSelectAsync(string[] identifiers) + { + if (identifiers == null || identifiers.Length == 0) { - _log.Warning("No results found for the search term: {SearchTerm}", firstSearchTerm); + _log.Warning("No valid identifiers provided in the query."); return; } - var firstResult = _packageProvider.CreateOrGet(searchResults[0]); - firstResult.IsSelected = true; + foreach (var identifier in identifiers) + { + var searchResults = await _windowsPackageManager.SearchAsync(identifier, 1); + if (searchResults.Count == 0) + { + _log.Warning("No results found for the identifier: {Identifier}", identifier); + continue; + } + + var package = _packageProvider.CreateOrGet(searchResults[0]); + package.IsSelected = true; + _log.Information("Selected package with identifier {Identifier} for addition to cart.", identifier); + } } } diff --git a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs index ac3e3edb2e..220929cbd8 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs @@ -14,6 +14,7 @@ public static class StringResourceKey public static readonly string AddAllApplications = nameof(AddAllApplications); public static readonly string AddApplication = nameof(AddApplication); public static readonly string AddedApplication = nameof(AddedApplication); + public static readonly string AppInstallActivationTitle = nameof(AppInstallActivationTitle); public static readonly string ApplicationsAddedPlural = nameof(ApplicationsAddedPlural); public static readonly string ApplicationsAddedSingular = nameof(ApplicationsAddedSingular); public static readonly string Applications = nameof(Applications); @@ -85,6 +86,7 @@ public static class StringResourceKey public static readonly string SelectedPackagesCount = nameof(SelectedPackagesCount); public static readonly string SetUpButton = nameof(SetUpButton); public static readonly string SizeWithColon = nameof(SizeWithColon); + public static readonly string URIActivationFailedBusy = nameof(URIActivationFailedBusy); public static readonly string LoadingPageHeaderLocalText = nameof(LoadingPageHeaderLocalText); public static readonly string LoadingPageHeaderTargetText = nameof(LoadingPageHeaderTargetText); public static readonly string LoadingPageSetupTargetText = nameof(LoadingPageSetupTargetText); diff --git a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw index e8d2b9a8cd..a31807f410 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw +++ b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw @@ -137,6 +137,10 @@ Select packages to restore from your backup, clone from repository, or search with Windows Package Manager. Description for Add packages page + + App Install Activation + Title displayed to the user when they attempt to activate the app through a URI but the machine configuration flow is currently in progress. + Transfer developer machine settings Title text of an instruction banner section for transferring settings from a developer machine @@ -1183,6 +1187,10 @@ Enter the full path and folder name Error message to tell the user to fully qualify their clone path + + The URI activation flow cannot be initiated while machine configuration is in progress. Please complete or cancel your current configuration tasks and then try again. + Message displayed to the user when they attempt to activate the app through a URI but the machine configuration flow is currently in progress. + Enter a repository name beginning with https:// Error string to show the user if the url is not an absolute URL diff --git a/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs b/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs index 28b7c62939..b53cf2b0be 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs @@ -39,11 +39,9 @@ public AppManagementTaskGroup( public void HandleSearchQuery(string query) { - var searchParameter = HttpUtility.ParseQueryString(query)["search"]; - if (!string.IsNullOrEmpty(searchParameter)) + if (!string.IsNullOrEmpty(query)) { - var trimmedSearchParameter = searchParameter.Trim('\"'); - _appManagementViewModel.PerformSearch(trimmedSearchParameter); + _appManagementViewModel.PerformSearch(query); } } } diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs index 00ce9b1806..126d10a9ca 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs @@ -103,12 +103,15 @@ public async Task StartConfigurationFileAsync(StorageFile file) } } - internal void StartAppManagementFlow(string query) + internal void StartAppManagementFlow(string query = null) { - _log.Information($"Launching app management flow for query:{query}"); + _log.Information("Launching app management flow"); var appManagementSetupFlow = _host.GetService(); - StartSetupFlowForTaskGroups(null, "App Search URI", appManagementSetupFlow); - appManagementSetupFlow.HandleSearchQuery(query); + StartSetupFlowForTaskGroups(null, "App Activation URI", appManagementSetupFlow); + if (!string.IsNullOrEmpty(query)) + { + appManagementSetupFlow.HandleSearchQuery(query); + } } protected async override Task OnFirstNavigateToAsync() diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/SetupFlowViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/SetupFlowViewModel.cs index b4bedba0dc..fff1bd2375 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/SetupFlowViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/SetupFlowViewModel.cs @@ -144,7 +144,7 @@ public void OnNavigatedTo(NavigationEventArgs args) } } - public void StartAppManagementFlow(string query) + public void StartAppManagementFlow(string query = null) { Orchestrator.FlowPages = [_mainPageViewModel]; _mainPageViewModel.StartAppManagementFlow(query); From 99c96fc12f8b1b503e0278815e97dd9ae85453d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agne=20Lukoseviciute=20=F0=9F=A6=8B?= Date: Wed, 1 May 2024 11:12:39 -0700 Subject: [PATCH 2/7] works with wingetUris and getPackagesAsync --- src/Services/AppInstallActivationHandler.cs | 78 +++++++++++++++------ 1 file changed, 57 insertions(+), 21 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 7465b8c8b7..92222e3d33 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -7,6 +7,7 @@ using DevHome.Common.Extensions; using DevHome.Common.Services; using DevHome.Settings.ViewModels; +using DevHome.SetupFlow.Models; using DevHome.SetupFlow.Services; using DevHome.SetupFlow.ViewModels; using Microsoft.UI.Xaml; @@ -35,7 +36,7 @@ public class AppInstallActivationHandler : ActivationHandler(); - case ActivationQueryType.WingetIds: + case ActivationQueryType.WingetURIs: return query.Split(Separator, StringSplitOptions.RemoveEmptyEntries) .Select(id => id.Trim(' ', '"')) .ToArray(); @@ -144,6 +134,52 @@ private string[] ParseIdentifiers(string query, ActivationQueryType queryType) } } + private async Task HandleAppSelectionAsync(string[] identifiers, ActivationQueryType queryType) + { + try + { + switch (queryType) + { + case ActivationQueryType.Search: + await SearchAndSelectAsync(identifiers); + return; + + case ActivationQueryType.WingetURIs: + await PackageSearchAsync(identifiers); + return; + } + } + catch (Exception ex) + { + _log.Error(ex, $"Error executing the {AppSearchUri} activation flow"); + } + } + + private async Task PackageSearchAsync(string[] identifiers) + { + if (identifiers == null || identifiers.Length == 0) + { + _log.Warning("No valid identifiers provided in the query."); + return; + } + + List uris = []; + + foreach (var identifier in identifiers) + { + // ensure we handle the case where the identifier is invalid. + uris.Add(new WinGetPackageUri(identifier)); + } + + var list = await _windowsPackageManager.GetPackagesAsync(uris); + foreach (var item in list) + { + var package = _packageProvider.CreateOrGet(item); + package.IsSelected = true; + _log.Information("Selected package with identifier {Identifier} for addition to cart.", item); + } + } + private async Task SearchAndSelectAsync(string[] identifiers) { if (identifiers == null || identifiers.Length == 0) From 7f76b620ddcea43373ba17ddaaa6060cb1587817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agne=20Lukoseviciute=20=F0=9F=A6=8B?= Date: Wed, 1 May 2024 13:48:50 -0700 Subject: [PATCH 3/7] some refactoring --- src/Services/AppInstallActivationHandler.cs | 100 +++++++++----------- 1 file changed, 45 insertions(+), 55 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 92222e3d33..836dd6e2a4 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -18,7 +18,7 @@ namespace DevHome.Services; /// -/// Class that handles the activation of the application when an add-apps-to-cart URI protcol is used. +/// Class that handles the activation of the application when an add-apps-to-cart URI protocol is used. /// public class AppInstallActivationHandler : ActivationHandler { @@ -68,8 +68,7 @@ protected async override Task HandleInternalAsync(ProtocolActivatedEventArgs arg var parameters = HttpUtility.ParseQueryString(uri.Query); if (parameters != null) - { - // TODO should probably make these case insensitive + { var searchQuery = parameters.Get("search"); var wingetURIs = parameters.Get("URIs"); @@ -88,7 +87,7 @@ private async Task AppActivationFlowAsync(string query, ActivationQueryType quer { if (_setupFlowOrchestrator.IsMachineConfigurationInProgress) { - _log.Warning("Cannot activate the add-apps-to-cart flow because the machine configuration is in progress"); + _log.Warning($"Cannot activate the {AppSearchUri} flow because the machine configuration is in progress"); await _mainWindow.ShowErrorMessageDialogAsync( _setupFlowStringResource.GetLocalized(StringResourceKey.AppInstallActivationTitle), _setupFlowStringResource.GetLocalized(StringResourceKey.URIActivationFailedBusy), @@ -113,26 +112,25 @@ private string[] ParseIdentifiers(string query, ActivationQueryType queryType) { switch (queryType) { - case ActivationQueryType.Search: - var terms = query.Split(Separator, StringSplitOptions.RemoveEmptyEntries); - if (terms.Length > 0) - { - var firstTerm = terms[0].Replace("\"", string.Empty).Trim(); - return string.IsNullOrEmpty(firstTerm) ? Array.Empty() : new[] { firstTerm }; - } - - return Array.Empty(); - - case ActivationQueryType.WingetURIs: - return query.Split(Separator, StringSplitOptions.RemoveEmptyEntries) - .Select(id => id.Trim(' ', '"')) - .ToArray(); - - default: - _log.Warning("Unsupported activation query type: {QueryType}", queryType); - return Array.Empty(); + case ActivationQueryType.Search: + var terms = SplitAndTrimIdentifiers(query); + return terms.Length > 0 ? [terms[0]] : []; + + case ActivationQueryType.WingetURIs: + return SplitAndTrimIdentifiers(query); + + default: + _log.Warning("Unsupported activation query type: {QueryType}", queryType); + return []; } - } + } + + private string[] SplitAndTrimIdentifiers(string query) + { + return query.Split(Separator, StringSplitOptions.RemoveEmptyEntries) + .Select(id => id.Trim(' ', '"')) + .ToArray(); + } private async Task HandleAppSelectionAsync(string[] identifiers, ActivationQueryType queryType) { @@ -141,7 +139,7 @@ private async Task HandleAppSelectionAsync(string[] identifiers, ActivationQuery switch (queryType) { case ActivationQueryType.Search: - await SearchAndSelectAsync(identifiers); + await SearchAndSelectAsync(identifiers[0]); return; case ActivationQueryType.WingetURIs: @@ -157,49 +155,41 @@ private async Task HandleAppSelectionAsync(string[] identifiers, ActivationQuery private async Task PackageSearchAsync(string[] identifiers) { - if (identifiers == null || identifiers.Length == 0) - { - _log.Warning("No valid identifiers provided in the query."); - return; - } - List uris = []; foreach (var identifier in identifiers) - { - // ensure we handle the case where the identifier is invalid. + { uris.Add(new WinGetPackageUri(identifier)); } - var list = await _windowsPackageManager.GetPackagesAsync(uris); - foreach (var item in list) + try { - var package = _packageProvider.CreateOrGet(item); - package.IsSelected = true; - _log.Information("Selected package with identifier {Identifier} for addition to cart.", item); + var list = await _windowsPackageManager.GetPackagesAsync(uris); + foreach (var item in list) + { + var package = _packageProvider.CreateOrGet(item); + package.IsSelected = true; + _log.Information($"Selected package: {item} for addition to cart."); + } + } + catch (Exception ex) + { + _log.Error(ex, $"Error occurred during package search for URIs: {uris}."); } } - private async Task SearchAndSelectAsync(string[] identifiers) + private async Task SearchAndSelectAsync(string identifier) { - if (identifiers == null || identifiers.Length == 0) - { - _log.Warning("No valid identifiers provided in the query."); - return; - } - - foreach (var identifier in identifiers) + var searchResults = await _windowsPackageManager.SearchAsync(identifier, 1); + if (searchResults.Count == 0) { - var searchResults = await _windowsPackageManager.SearchAsync(identifier, 1); - if (searchResults.Count == 0) - { - _log.Warning("No results found for the identifier: {Identifier}", identifier); - continue; - } - - var package = _packageProvider.CreateOrGet(searchResults[0]); - package.IsSelected = true; - _log.Information("Selected package with identifier {Identifier} for addition to cart.", identifier); + _log.Warning($"No results found for the identifier: {identifier}"); + } + else + { + var package = _packageProvider.CreateOrGet(searchResults[0]); + package.IsSelected = true; + _log.Information($"Selected package: {package} for addition to cart."); } } } From a9b5c1d48a8b60b3b68b241891f2ea861efa6784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agne=20Lukoseviciute=20=F0=9F=A6=8B?= Date: Wed, 1 May 2024 14:46:59 -0700 Subject: [PATCH 4/7] addressing feedback --- src/Services/AppInstallActivationHandler.cs | 6 +++--- .../DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs | 5 +---- .../DevHome.SetupFlow/ViewModels/MainPageViewModel.cs | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 836dd6e2a4..7d94dc949b 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -63,8 +63,8 @@ protected override bool CanHandleInternal(ProtocolActivatedEventArgs args) } protected async override Task HandleInternalAsync(ProtocolActivatedEventArgs args) - { - var uri = args.Uri; + { + var uri = args.Uri; var parameters = HttpUtility.ParseQueryString(uri.Query); if (parameters != null) @@ -120,7 +120,7 @@ private string[] ParseIdentifiers(string query, ActivationQueryType queryType) return SplitAndTrimIdentifiers(query); default: - _log.Warning("Unsupported activation query type: {QueryType}", queryType); + _log.Warning($"Unsupported activation query type: {queryType}"); return []; } } diff --git a/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs b/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs index b53cf2b0be..781a2b2ec7 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/TaskGroups/AppManagementTaskGroup.cs @@ -39,9 +39,6 @@ public AppManagementTaskGroup( public void HandleSearchQuery(string query) { - if (!string.IsNullOrEmpty(query)) - { - _appManagementViewModel.PerformSearch(query); - } + _appManagementViewModel.PerformSearch(query); } } diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs index 126d10a9ca..1d32121f85 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/MainPageViewModel.cs @@ -108,10 +108,7 @@ internal void StartAppManagementFlow(string query = null) _log.Information("Launching app management flow"); var appManagementSetupFlow = _host.GetService(); StartSetupFlowForTaskGroups(null, "App Activation URI", appManagementSetupFlow); - if (!string.IsNullOrEmpty(query)) - { - appManagementSetupFlow.HandleSearchQuery(query); - } + appManagementSetupFlow.HandleSearchQuery(query); } protected async override Task OnFirstNavigateToAsync() From 269e2636261af903f0d68f1ea448219da455aff9 Mon Sep 17 00:00:00 2001 From: Agne Lukoseviciute Date: Wed, 22 May 2024 09:36:37 -0700 Subject: [PATCH 5/7] addressing feedback --- src/Services/AppInstallActivationHandler.cs | 4 ++-- .../SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 7d94dc949b..6effb5ae2e 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -69,8 +69,8 @@ protected async override Task HandleInternalAsync(ProtocolActivatedEventArgs arg if (parameters != null) { - var searchQuery = parameters.Get("search"); - var wingetURIs = parameters.Get("URIs"); + var searchQuery = parameters.Get(ActivationQueryType.Search.ToString()); + var wingetURIs = parameters.Get(ActivationQueryType.WingetURIs.ToString()); if (!string.IsNullOrEmpty(searchQuery)) { diff --git a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw index a31807f410..69e39a4f07 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw +++ b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw @@ -138,7 +138,7 @@ Description for Add packages page - App Install Activation + Configuration in progress Title displayed to the user when they attempt to activate the app through a URI but the machine configuration flow is currently in progress. From 5243e03f9d5c860e2d9489dded5b6e48441118df Mon Sep 17 00:00:00 2001 From: Agne Lukoseviciute Date: Wed, 22 May 2024 10:20:47 -0700 Subject: [PATCH 6/7] simplifying enum logic --- src/Services/AppInstallActivationHandler.cs | 38 ++++++--------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 6effb5ae2e..396c405234 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -69,16 +69,15 @@ protected async override Task HandleInternalAsync(ProtocolActivatedEventArgs arg if (parameters != null) { - var searchQuery = parameters.Get(ActivationQueryType.Search.ToString()); - var wingetURIs = parameters.Get(ActivationQueryType.WingetURIs.ToString()); - - if (!string.IsNullOrEmpty(searchQuery)) - { - await AppActivationFlowAsync(searchQuery, ActivationQueryType.Search); - } - else if (!string.IsNullOrEmpty(wingetURIs)) - { - await AppActivationFlowAsync(wingetURIs, ActivationQueryType.WingetURIs); + foreach (ActivationQueryType queryType in Enum.GetValues(typeof(ActivationQueryType))) + { + var query = parameters.Get(queryType.ToString()); + + if (!string.IsNullOrEmpty(query)) + { + await AppActivationFlowAsync(query, queryType); + return; // Exit after handling the first non-null query + } } } } @@ -95,7 +94,7 @@ await _mainWindow.ShowErrorMessageDialogAsync( return; } - var identifiers = ParseIdentifiers(query, queryType); + var identifiers = SplitAndTrimIdentifiers(query); if (identifiers.Length == 0) { _log.Warning("No valid identifiers provided in the query."); @@ -108,23 +107,6 @@ await _mainWindow.ShowErrorMessageDialogAsync( await HandleAppSelectionAsync(identifiers, queryType); } - private string[] ParseIdentifiers(string query, ActivationQueryType queryType) - { - switch (queryType) - { - case ActivationQueryType.Search: - var terms = SplitAndTrimIdentifiers(query); - return terms.Length > 0 ? [terms[0]] : []; - - case ActivationQueryType.WingetURIs: - return SplitAndTrimIdentifiers(query); - - default: - _log.Warning($"Unsupported activation query type: {queryType}"); - return []; - } - } - private string[] SplitAndTrimIdentifiers(string query) { return query.Split(Separator, StringSplitOptions.RemoveEmptyEntries) From b3ad57874e261e4dab8f31e477134629922928ef Mon Sep 17 00:00:00 2001 From: Agne Lukoseviciute Date: Wed, 22 May 2024 12:03:02 -0700 Subject: [PATCH 7/7] switching out WindowEx for Window --- src/Services/AppInstallActivationHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/AppInstallActivationHandler.cs b/src/Services/AppInstallActivationHandler.cs index 396c405234..c74675e12a 100644 --- a/src/Services/AppInstallActivationHandler.cs +++ b/src/Services/AppInstallActivationHandler.cs @@ -29,7 +29,7 @@ public class AppInstallActivationHandler : ActivationHandler