This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix Shell Navigation for Hierarchally registered Global Routes #13330
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f908cf8
Fix Shell Navigation for Hierarchally registered Global Routes
PureWeen 3ef7380
- fix added paths
PureWeen 900c7e5
- fix relative hierarchical routing
PureWeen b5709bb
- remove extra comment
PureWeen 09cebfb
- remove comments
PureWeen 83f7806
- generalize shell setter
PureWeen 990d7ef
- additional test
PureWeen 6c72bcb
Update BaseShellItem.cs
PureWeen cde6308
- fix routes pushed with longer uris
PureWeen 0fcd981
- improve matching
PureWeen 3ccb100
- clean up comments
PureWeen f849399
- fix multiple back navigation with hierarchies
PureWeen 84c116f
- fix root routes
PureWeen b0cf455
- fix absolute routes
PureWeen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Diagnostics; | ||
|
||
namespace Xamarin.Forms | ||
{ | ||
[DebuggerDisplay("RequestDefinition = {Request}, StackRequest = {StackRequest}")] | ||
internal class NavigationRequest | ||
{ | ||
public enum WhatToDoWithTheStack | ||
{ | ||
ReplaceIt, | ||
PushToIt | ||
} | ||
|
||
public NavigationRequest(RequestDefinition definition, WhatToDoWithTheStack stackRequest, string query, string fragment) | ||
{ | ||
StackRequest = stackRequest; | ||
Query = query; | ||
Fragment = fragment; | ||
Request = definition; | ||
} | ||
|
||
public WhatToDoWithTheStack StackRequest { get; } | ||
public string Query { get; } | ||
public string Fragment { get; } | ||
public RequestDefinition Request { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
namespace Xamarin.Forms | ||
{ | ||
[DebuggerDisplay("Full = {FullUri}, Short = {ShortUri}")] | ||
internal class RequestDefinition | ||
{ | ||
public RequestDefinition(RouteRequestBuilder theWinningRoute, Shell shell) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No changes here just moving this class to its own file |
||
{ | ||
Item = theWinningRoute.Item; | ||
Section = theWinningRoute.Section ?? Item?.CurrentItem; | ||
Content = theWinningRoute.Content ?? Section?.CurrentItem; | ||
GlobalRoutes = theWinningRoute.GlobalRouteMatches; | ||
|
||
List<String> builder = new List<string>(); | ||
if (Item?.Route != null) | ||
builder.Add(Item.Route); | ||
|
||
if (Section?.Route != null) | ||
builder.Add(Section?.Route); | ||
|
||
if (Content?.Route != null) | ||
builder.Add(Content?.Route); | ||
|
||
if (GlobalRoutes != null) | ||
builder.AddRange(GlobalRoutes); | ||
|
||
var uriPath = MakeUriString(builder); | ||
var uri = ShellUriHandler.CreateUri(uriPath); | ||
FullUri = ShellUriHandler.ConvertToStandardFormat(shell, uri); | ||
|
||
} | ||
|
||
string MakeUriString(List<string> segments) | ||
{ | ||
if (segments[0].StartsWith("/", StringComparison.Ordinal) || segments[0].StartsWith("\\", StringComparison.Ordinal)) | ||
return String.Join("/", segments); | ||
|
||
return $"//{String.Join("/", segments)}"; | ||
} | ||
|
||
public Uri FullUri { get; } | ||
public ShellItem Item { get; } | ||
public ShellSection Section { get; } | ||
public ShellContent Content { get; } | ||
public List<string> GlobalRoutes { get; } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes here just moving this class to its own file