Skip to content

Commit

Permalink
Revert NavigateFromAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
niimima committed Jan 21, 2024
1 parent cc7456e commit 1a4860c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
17 changes: 0 additions & 17 deletions src/Maui/Prism.Maui/Navigation/INavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,4 @@ public interface INavigationService
/// <param name="parameters">The navigation parameters</param>
/// <returns><see cref="INavigationResult"/> indicating whether the request was successful or if there was an encountered <see cref="Exception"/>.</returns>
Task<INavigationResult> SelectTabAsync(string name, INavigationParameters parameters);

/// <summary>
/// Initiates navigation to the target specified by the <paramref name="viewName"/> from the <paramref name="route"/>.
/// </summary>
/// <param name="viewName">The name of the View to navigate to</param>
/// <param name="route">The route Uri to navigate to</param>
/// <returns>If <c>true</c> a navigate from operation was successful. If <c>false</c> the navigate from operation failed.</returns>
Task<INavigationResult> NavigateFromAsync(string viewName, Uri route);

/// <summary>
/// Initiates navigation to the target specified by the <paramref name="viewName"/> from the <paramref name="route"/>.
/// </summary>
/// <param name="viewName">The name of the View to navigate to</param>
/// <param name="route">The route Uri to navigate to</param>
/// <param name="parameters">The navigation parameters</param>
/// <returns>If <c>true</c> a navigate from operation was successful. If <c>false</c> the navigate from operation failed.</returns>
Task<INavigationResult> NavigateFromAsync(string viewName, Uri route, INavigationParameters parameters);
}
53 changes: 0 additions & 53 deletions src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,57 +1324,4 @@ private Page GetPageFromWindow()
}
#endif
}

/// <inheritdoc />
public virtual async Task<INavigationResult> NavigateFromAsync(string viewName, Uri route)
{
return await NavigateFromAsync(viewName, route, null);
}

/// <inheritdoc />
public virtual async Task<INavigationResult> 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<string>();
viewNameSegment.Enqueue(viewName);
var navigationSegments = new Queue<string>(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();
}
}
}

0 comments on commit 1a4860c

Please sign in to comment.