Closed MaxFmi closed 1 year ago
@dansiegel I'm interested in implementing this feature.
I look forward to the PR 👍
ping me on Slack if you have any questions.
I'll add that you can't simply change the way deep link navigation works when dealing with a selected tab to automatically start nesting the nav process. That would be a massive navigation behavior break. instead, you will need some type of flag or way to opt-into a nested navigation operation for tabs.
If you manage to implement this feature, you'll also have to update the INavigationServiceExtensions.GetNavigationUriPath
method to account for nested tab navigation stacks to return the proper nav uri
Something like this Brian?
On Wed., Apr. 8, 2020, 7:09 p.m. Brian Lagunas, notifications@github.com wrote:
I'll add that you can't simply change the way deep link navigation works when dealing with a selected tab to automatically start nesting the nav process. That would be a massive navigation behavior break. instead, you will need some type of flag or way to opt-into a nested navigation operation for tabs.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/PrismLibrary/Prism/issues/2038#issuecomment-611239660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOBL7RWHODEHLGCP4QQVTDRLT73HANCNFSM4LGQGQUA .
I do want to add some notes here as well for clarification... There are a couple of parts to this issue as I see it.
The following is pretty much what was discussed on the stream from @dylanberry
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=ViewB&selectedTab=ViewB/ViewC");
This code current should and should always continue to push ViewC modally over the TabbedPage. Any time we run into a /
we should always treat this as a new navigation segment not a continuation of the existing segment.
When we're trying to deal with the first issue I listed and to deal with the issue of treating a forward slash as a new navigation segment the answer is quite simple... URL Encode your parameters. The result is now something like this:
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=NavigationPage%2FViewB%2FViewC%2FViewD&selectedTab={NavigationPage|ViewB|ViewD}/ViewE");
This would be the equivalent of:
var tabbedPage = new TabbedPage();
var navigationPage = new NavigationPage(new ViewB());
await navigationPage.PushAsync(new ViewC());
await navigationPage.PushAsync(new ViewD());
tabbedPage.Children.Add(new ViewA());
tabbedPage.Children.Add(navigationPage);
tabbedPage.CurrentPage = navigationPage;
navigationPage.PushAsync(new ViewE());
I'm certainly open to community feedback on this, however I do believe that if we are supporting NavigationPage's as tabs then this adds some complexity in determining what the Selected tab is.
With those issues addressed we should next tackle the issue of navigating from the context of the current tab. If the current tab is a NavigationPage then we should push subsequent pages into that NavigationPage unless it's been overridden with the useModalNavigation
querystring parameter.
Based on discussions with @brianlagunas, if we implement this using the "slash approach", it breaks from the master-detail navigation behavior and existing tab navigation behavior.
We should aim for a few things:
With those considerations in mind, uri encoding makes already complex uris even more difficult to read and the "slash approach" doesn't allow for a mix of pushing pages onto the selected tab's navigation stack and creation of new modal stack, it also breaks existing behavior. In order to keep the consistent approach established by createTab
, using pipes looks to be the best way to implement this:
TabbedPage?selectTab=Tab2|ViewA|ViewB|ViewC/AnotherPage
TabbedPage?createTab=Tab1&createTab=NavigationPage|Tab2&createTab=Tab3&selectTab=Tab2|ViewA|ViewB|ViewC/AnotherPage
@brianlagunas @dansiegel gents, any issues with me updating the HelloWorld app projects to the latest Xamarin + XF?
@dylanberry we have an open PR #2103 that is going to be updating the Xamarin.Forms reference in the primary Prism repo... is this what you're asking about or are you asking about the samples?
Just the sample projects used for the UI tests :)
that should always be in sync with Prism.Forms... so it will be updated with 2103
@brianlagunas @dansiegel with Maui now coming into the picture, I'm more hesitant about the Uri structure. I'll give this some more thought and follow-up.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is something that tripped us up recently, we wanted to build a nav stack on a tab based on a notification type been selection, we just pushed it to the bottom of the backlog for now
@mackayn I know @dylanberry was working on this.. I don't know if he just needs a few beers sent to him to finish this up or if someone needs to take over the PR to get it across the finish line... maybe he can tell us :)
@dansiegel @dylanberry Can you tell me about the current state of the PR or the plans for this feature? If there is not much left to do I'd like to give it a shot because this is a feature I really need inside my apps. Thanks in advance! :)
@vniehues at this point the PR needs to be rebased. It was never merged due to failing UI tests. If you'd like to give it a go and open a new PR to replace this one we're all for it. @dylanberry has been swamped by his pesky job so I'm sure he won't mind 😂
@dansiegel I have the project up and running on my system now. All build-errors are eliminated and all unit tests are passing. I have never worked with UI tests in xamarin. How do i find out, if they pass now? :)
@dansiegel I would really like to help implement these changes as I can imagine that they would help many people like me. Please let me know how I can proceed with this PR. Also, please have mercy as this is my first PR.
Again: I already rebased the PR on the current Master and fixed all build-errors. Also all unit tests are passing as of right now.
@vniehues best place to start is with this video from when we setup the UI Tests... that should help give you the info you need to get started and understand how to run and work with the UI Tests https://www.youtube.com/watch?v=gsqf52Q5QOw
This will not be backported for Xamarin.Forms but should be supported already in Prism.Maui
Summary
DeepLink into a subPage of one TabbarItem. Navigate by an absolute path -> /NavigationPage/TabbedPage/TabA/ViewA_Page/ViewB_Page
API Changes
_navigationService.NavigateAsync($"/NavigationPage/TabbedPage?{KnownNavigationParameters.SelectedTab}=TabAContentPage/ViewA_Page/ViewB_Page");
Intended Use Case
Having a consumer application where it is possible to see some electronic devices and buy additional features. One tab would be for device settings. Some detail pages have a linkt to the shop tab and it's detailPages for specific Items. So we want to navigate from "/TabbedPage/TabDevices/DeviceOne/PrintCartridgeStatus" to "/TabbedPage/TabShop/PrinterCartridges".
Related issue: https://github.com/PrismLibrary/Prism/issues/2033