fix: Unable to tab to Contacts - WPB-10514 #1830
Merged
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.
This PR was automatically cherry-picked based on the following PR:
Original PR description:
Issue
This PR fixes an unreleased bug that prevents showing the contacts view when the navigation is in a certain state. For example the following would occur prior to this fix 100% of the time:
Folders
Contacts
Contacts
- Nothing happens no matter how many times the user tapsContacts
.The root cause of the issue is that currently
ConversationListViewController
is the delegate of theUITabBarController
and we have two instances ofConversationListViewController
- used forConversations
&Folders
tabs - which both set themselves as the delegate ofUITabBarController
and respond to taps on theContacts
&Archive
tabs by presenting a corresponding view controller onself
- i.e whicheverConversationListViewController
instance is the true delegate ofUITabBarController
. This can lead to some messed up state.The above is necessary because how we are currently (maybe) misusing our
UITabBarController
- Two tabs (Conversations
&Folders
) containConversationListViewController
instances with real content. The other two tabs (Contacts
&Archive
) contain emptyUIViewController
instances. We use these empty tabs as buttons and have theUITabBarControllerDelegate
perform actions depending on which tab is selected.To address this issue, this PR introduces
TabBarChangeHandler
which becomes the single delegate of the mainUITabBarController
instance. It tracks the currently selected real content tab (i.eConversations
orFolders
) and makes sure to present content forContacts
&Archive
on the correct real content tab.The solution is not pretty but seems to work and is temporary. This work will all be discarded in our ongoing navigation overhaul #1361. I have attempted to minimize changes to avoid conflicts with #1361.
Testing
Folders
Contacts
Contacts
- This should workChecklist
[WPB-XXX]
.