From 1a4860ccb11af96b8ee654a35eb955eaf41eea53 Mon Sep 17 00:00:00 2001 From: niimima Date: Sun, 21 Jan 2024 17:37:28 +0900 Subject: [PATCH] Revert NavigateFromAsync --- .../Navigation/INavigationService.cs | 17 ------ .../Navigation/PageNavigationService.cs | 53 ------------------- 2 files changed, 70 deletions(-) diff --git a/src/Maui/Prism.Maui/Navigation/INavigationService.cs b/src/Maui/Prism.Maui/Navigation/INavigationService.cs index e94eacfd7c..53759e964c 100644 --- a/src/Maui/Prism.Maui/Navigation/INavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/INavigationService.cs @@ -62,21 +62,4 @@ public interface INavigationService /// The navigation parameters /// indicating whether the request was successful or if there was an encountered . Task SelectTabAsync(string name, INavigationParameters parameters); - - /// - /// Initiates navigation to the target specified by the from the . - /// - /// The name of the View to navigate to - /// The route Uri to navigate to - /// If true a navigate from operation was successful. If false the navigate from operation failed. - Task NavigateFromAsync(string viewName, Uri route); - - /// - /// Initiates navigation to the target specified by the from the . - /// - /// The name of the View to navigate to - /// The route Uri to navigate to - /// The navigation parameters - /// If true a navigate from operation was successful. If false the navigate from operation failed. - Task NavigateFromAsync(string viewName, Uri route, INavigationParameters parameters); } diff --git a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs index e61137dca7..c505cacc18 100644 --- a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs @@ -1324,57 +1324,4 @@ private Page GetPageFromWindow() } #endif } - - /// - public virtual async Task NavigateFromAsync(string viewName, Uri route) - { - return await NavigateFromAsync(viewName, route, null); - } - - /// - public virtual async Task NavigateFromAsync(string viewName, Uri route, INavigationParameters parameters) - { - await _semaphore.WaitAsync(); - // Ensure adequate time has passed since last navigation so that UI Refresh can Occur - if (DateTime.Now - _lastNavigate < TimeSpan.FromMilliseconds(150)) - { - await Task.Delay(150); - } - - try - { - if (parameters is null) - parameters = new NavigationParameters(); - - NavigationSource = PageNavigationSource.NavigationService; - - var routeSegments = UriParsingHelper.GetUriSegments(route); - - var page = GetPageFromWindow(); - if(page is not null && ViewModelLocator.GetNavigationName(page) == viewName) - { - await ProcessNavigation(page, routeSegments, parameters, null, true); - } - else - { - var viewNameSegment = new Queue(); - viewNameSegment.Enqueue(viewName); - var navigationSegments = new Queue(viewNameSegment.Concat(routeSegments)); - - await ProcessNavigationForAbsoluteUri(routeSegments, parameters, null, true); - } - - return Notify(route, parameters); - } - catch (Exception ex) - { - return Notify(route, parameters, ex); - } - finally - { - _lastNavigate = DateTime.Now; - NavigationSource = PageNavigationSource.Device; - _semaphore.Release(); - } - } }