-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[MBL-2915] Integrate New Floating Tab Bar #2684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| color: featureFloatingTabBarEnabled() ? .clear : tabBarDeselectedColor | ||
| ) | ||
| let selectedImage = strokedRoundImage( | ||
| fromImage: avatar, | ||
| size: tabBarAvatarSize, | ||
| color: tabBarSelectedColor, | ||
| color: featureFloatingTabBarEnabled() ? Colors.FloatingTabBar.profileIconBorderColor | ||
| .uiColor() : tabBarSelectedColor, | ||
| lineWidth: 2.0 | ||
| ) |
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.
Sets the border color of the profile image when logged in
|
There is a bit of an issue where the tab bar doesn't fully swap out when the feature flag is turned and then the app is reopened after being backgrounded. It isn't until the app is fully closed and reopened that the tab bar changes correctly. Will need to test how this works on the Beta of course, but just noting it. |
|
|
||
| if featureFloatingTabBarEnabled() { | ||
| let customTabBar = FloatingTabBar() | ||
| self.setValue(customTabBar, forKey: "tabBar") |
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.
What's going on here? Can a comment be added as to why this is here if this is necessary?
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.
This is how we can replace the UITabBarController’s tab bar with our custom subclass.
UITabBarController has a read-only tabBar property and Apple doesn't provide a public setter or override for it.
UITabBarController also still uses Key-Value Coding internally to assign its tab bar which is why we need "tabBar" as the key.
| profileNav.setViewControllers([profileVC, threadsVC, messageThreadVC], animated: true) | ||
| } | ||
|
|
||
| private func configureFloatingTabBarItems(isLoggedIn: Bool) { |
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.
Curious why we are reusing tab bar items here, can we just recreate the array here? Don't need to worry about how many items there are in the existing array then.
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.
Yeah I figured reusing the existing tab items keeps all of UIKit’s built in wiring for selection, VC mapping, state, etc. intact. We’re really only changing the visuals here so recreating the items could lead to weird edge cases around controller selection/binding.
I haven't take the time to explore that deeply tbh, but I didn't think that was worth the effort here.
📲 What
When the Floating Tab Bar feature flag is enabled, replace our current tab bar UI with the new Floating Tab Bar.
🤔 Why
We're moving to a new tab bar UI. See figma: https://www.figma.com/design/kTLSpgGAE8N4Ql00LSYqSn/Visioning--Components?node-id=0-1&p=f&m=dev
🛠 How
RootTabBarViewControllerto use the newFloatingTabBarwhen FF is enabledDiscoverViewController's bottom constraint so that the view extends to the bottom of the screen and the FloatingTabBar can appear to be "floating".👀 See
Keep in mind the new design system colors being used in the Figma designs aren't finalized.
We've agreed to use the closest colors of our current design system for now.
This really only effects the green selection indicator behind the selected tab.
✅ Acceptance criteria
⏰ TODO