Skip to content
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

[MBL-1453] PagedTabBar implementation and adding to PagedContainerViewController #2131

Merged
merged 15 commits into from
Aug 27, 2024

Conversation

stevestreza-ksr
Copy link
Contributor

📲 What

image

Reimplements the paged tab bar look in SwiftUI, integrates it into Amy's existing PagedContainerViewController, and adds tests for it.

🛠 How

The PagedTabBar takes a list of instances of TabBarPage items, a basic protocol that has a name and badge count. It uses the PagedContainerViewModel for determining which tab to show.

The PagedContainerViewModel was cleaned up and had nearly all calls to index-based pages removed in favor of returning the TabBarPage instances. This should prevent worrying about over-indexing and risking runtime crashes.

The new PagedTabBar has some screenshot tests and the PagedContainerViewModel has had some unit tests added.

Note: Originally there was a separate PagedTabBarViewModel that worked together with the PagedContainerViewModel, but this ended up being way too easy to accidentally end up with an infinitely recursive scenario where the PagedTabBarViewModel called the PagedContainerViewModel which called the PagedTabBarViewModel which called … [etc]. Since they are both relying on reactivity to update UI, for now they just use the same view model.

👀 See

Figma and the screenshot at the top of the screen

♿️ Accessibility

  • Tap targets use minimum of 44x44 pts dimensions
  • Works with VoiceOver
  • Supports Dynamic Type

✅ Acceptance criteria

  • [x]Built in SwiftUI or UIKit (developer’s choice; the container screen is a UIViewController)
  • N/A: Could possibly be reused from SortPagerViewController
  • Gracefully displays arbitrary titles and badges, even with long tab names (i.e. German)
  • Supports basic accessibility needs (adaptive fonts, VoiceOver)
  • Animates pleasingly when tabs are switched
  • Provides an appropriate delegate / callback / binding method so that a view using the tab bar knows when the tabs are swapped

⏰ TODO

  • Animation. Tried a few techniques for doing this but was having trouble getting SwiftUI to not break when doing them. May have to spin this into a fast-follow task.

Copy link
Contributor

@ifosli ifosli left a comment

Choose a reason for hiding this comment

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

Nice! I left a few comments, but overall I like it! I am quite concerned by the reliance on a badge number, though, since we're not going to get that on the user object for milestone 1. It might be worth confirming with Alison what we want this to look like for now before getting rid of it entirely, though. (I'm not actually sure if we'll want to show the count on the activity tab only - it'd be useful info but it'd look kinda weird.) If you do have an idea for how to get the badge number for the project alerts I'm happy to approve this pr as is; just let me know!

@nativeksr
Copy link
Collaborator

nativeksr commented Aug 26, 2024

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@stevestreza-ksr stevestreza-ksr requested a review from ifosli August 27, 2024 21:11
Copy link
Contributor

@ifosli ifosli left a comment

Choose a reason for hiding this comment

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

Looks great!!

@stevestreza-ksr stevestreza-ksr merged commit eaa9458 into main Aug 27, 2024
5 checks passed
@stevestreza-ksr stevestreza-ksr deleted the stevestreza/ppo/paged-tab-bar branch August 27, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants