Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Use the MoreNavigationController DidShowViewController callback for shell sections #6786

Merged
merged 3 commits into from
Jan 31, 2020
Merged

Conversation

Dresel
Copy link
Contributor

@Dresel Dresel commented Jul 5, 2019

Description of Change

When SelectedViewController is called for MoreNavigationController, register for DidShowViewController to make it possible to set ShellItem.CurrentItem when selecting shell sections aggregated in more tab. Implementation is based on this SO thread.

Automated test is skipped because lack of information (is there any guidance available?) of how to setup UI tests for XF.

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Testing Procedure

Check #6784.

PR Checklist

  • Has automated tests
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@rmarinho
Copy link
Member

rmarinho commented Jul 9, 2019

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@samhouts samhouts requested review from PureWeen and removed request for paymicro July 15, 2019 17:29
Copy link
Member

@samhouts samhouts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

failing unit test

@samhouts
Copy link
Member

Xamarin.Forms.Core.UnitTests.ShellTests.NavigationBetweenShellContentsPassesQueryString
System.ArgumentException : Duplicated Route: "details"

@PureWeen
Copy link
Contributor

@Dresel can you rebase against master? That should fix the unit test error

@Dresel
Copy link
Contributor Author

Dresel commented Aug 14, 2019

Rebase done

Copy link
Contributor

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dresel I ran into a slight issue while testing this

it looks like after you select the item from the more list the first time then it won't reopen the more list when navigating back to it unless you click it twice.

Apologies this took so long to review. Let me know if you don't have time and I can look into this issue.

FYI I also rebased this PR to the latest 4.3.0 so it would build.

As far as UI tests if you want to give it a try you can see an example of a Shell UI tests here

2019-09-23_12-51-14

@Dresel
Copy link
Contributor Author

Dresel commented Oct 3, 2019

Currently busy but I'll be able to tackle this latest end of this month

@samhouts samhouts changed the base branch from 4.3.0 to master October 18, 2019 17:39
@samhouts samhouts requested a review from PureWeen November 5, 2019 20:17
@PureWeen PureWeen added the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Nov 7, 2019
@woutervanoorschot
Copy link

@PureWeen I think that this is the correct behaviour. At least on iOS it is the default behaviour that a tab stays the same (also within the more page) when navigated to and from. If a page has been opened in the more tab, navigating to another tab and returning to it should return you to the opened page. The second tap returns you to the root of the tab (in the more tab: the list of pages).

This works the same as in other tabs, if you navigate within a tab it stays the same after navigating between tabs. When tapping on a tab which is selected, navigationpage within the tab goes to the root page.

Anyway, very nice that someone is looking after this, as it seems to fix the very long standing issue of the more tab in xamarin.

@Dresel
Copy link
Contributor Author

Dresel commented Jan 2, 2020

Sorry, took me longer than expected.

@Dresel I ran into a slight issue while testing this

it looks like after you select the item from the more list the first time then it won't reopen the more list when navigating back to it unless you click it twice.

This can be "corrected" by calling PopToRootViewController on the MoreNavigationController.

For consistency we should also set CustomizableViewControllers to an empty array (or null) to avoid the "Edit" button on top of the MoreNavigationController:

This property controls which items in the tab bar can be rearranged by the user. When the user taps the More item on the tab bar view, a custom interface appears displaying any items that did not fit on the main tab bar. This interface also contains an Edit button that allows the user to rearrange the items. Only the items whose associated view controllers are in this array can be rearranged from this interface. If the array is empty or the value of this property is nil, the tab bar does not allow any items to be rearranged.

Let me know if you want this in a separate PR or if I can combine it with this one.

I have rebased and pushed latest changes, let me know what you think.

I'm now working on a UI test case for that, it's a pity that this does not work with remote debugger on windows...

@woutervanoorschot
Copy link

I think you should combine it in this PR, as it creates inconsistent behavior across platforms if the edit button is visible (as you said already). Just my 2 cents

Great work!

@Dresel
Copy link
Contributor Author

Dresel commented Jan 4, 2020

UI test added, let me know if this fits.

@samhouts samhouts changed the base branch from master to 4.5.0 January 7, 2020 00:59
@samhouts samhouts removed the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Jan 15, 2020
@samhouts samhouts self-requested a review January 15, 2020 23:43
@Dresel
Copy link
Contributor Author

Dresel commented Jan 17, 2020

Could not reproduce the failing UI tests (SDK 12.4 build, iPhone X 11.4 simulator).

@woutervanoorschot
Copy link

@PureWeen any chance this can be included in Xamarin Forms 4.5?

@PureWeen PureWeen merged commit 62a4724 into xamarin:4.5.0 Jan 31, 2020
@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Feb 3, 2020
@samhouts samhouts added this to the 4.5.0 milestone Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/shell 🐚 approved Has two approvals, no pending reviews, and no changes requested p/iOS 🍎 t/bug 🐛
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants