[Test]
+ public async Task GlobalNavigateTwice()
+ {
+
+ var shell = new Shell();
+ var item1 = CreateShellItem(asImplicit: true, shellContentRoute: "rootlevelcontent1");
+
+ shell.Items.Add(item1);
+ Routing.RegisterRoute("cat", typeof(ContentPage));
+ Routing.RegisterRoute("details", typeof(ContentPage));
+
+ await shell.GoToAsync("cat");
+ await shell.GoToAsync("details");
+
+ Assert.AreEqual("app:///rootlevelcontent1/cat/details", shell.CurrentState.Location.ToString());
+ await shell.GoToAsync("//rootlevelcontent1/details");
+ Assert.AreEqual("app:///rootlevelcontent1/details", shell.CurrentState.Location.ToString());
+ }
+
+
+ [Test]
public async Task GlobalRegisterAbsoluteMatching()
{
var shell = new Shell() { RouteScheme = "app", Route = "shellroute" };
}
else
{
- await CurrentItem.CurrentItem.GoToAsync(navigationRequest.Request.GlobalRoutes, queryData, animate);
+ await CurrentItem.CurrentItem.GoToAsync(navigationRequest, queryData, animate);
}
//if (Routing.CompareWithRegisteredRoutes(shellItemRoute))
if (shellContent == null)
return Task.FromResult(true);
-
- if(request.Request.GlobalRoutes.Count > 0)
+ if (request.Request.GlobalRoutes.Count > 0)
{
// TODO get rid of this hack and fix so if there's a stack the current page doesn't display
Device.BeginInvokeOnMainThread(async () =>
{
- await GoToAsync(request.Request.GlobalRoutes, queryData, false);
+ await GoToAsync(request, queryData, false);
});
}
return (ShellSection)(ShellContent)page;
}
- public virtual async Task GoToAsync(List<string> routes, IDictionary<string, string> queryData, bool animate)
+ internal async Task GoToAsync(NavigationRequest request, IDictionary<string, string> queryData, bool animate)
{
+ List<string> routes = request.Request.GlobalRoutes;
if (routes == null || routes.Count == 0)
{
await Navigation.PopToRootAsync(animate);
continue;
}
- while (_navStack.Count > i + 1)
+ if (request.StackRequest == NavigationRequest.WhatToDoWithTheStack.ReplaceIt)
{
- await OnPopAsync(false);
+ while (_navStack.Count > i + 1)
+ {
+ await OnPopAsync(false);
+ }
}
}