-
Notifications
You must be signed in to change notification settings - Fork 5
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
IOS-9356 Adjust crouton constraints above the tabbar or the safe area #422
base: main
Are you sure you want to change the base?
Conversation
Screenshot tests report ✔️ All passing |
Record screenshots on PR comment: succeeded ✅ |
…when a TabTar is present
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.
Really good work!!
|
||
directionalLayoutMargins = Constants.margins | ||
private func findTabBar(in view: UIView) -> UITabBar? { | ||
for subview in view.subviews { |
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.
I'm afraid of finding the new tabBar in iPad...
https://developer.apple.com/documentation/uikit/elevating-your-ipad-app-with-a-tab-bar-and-sidebar
Could we check if it's a bottom 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.
It’s possible to implement a logic to check if a tabBar exists and if it is positioned at the bottom of the device. If this condition isn't met, it would continue searching. I am going to add this logic to prevent cases like this.
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.
done and added tests
|
||
directionalLayoutMargins = Constants.marginsWhenUsingSafeArea | ||
if let tabBar = tabBar, !tabBar.isHidden { | ||
bottomConstraint = bottomAnchor.constraint(equalTo: container.bottomAnchor, constant: -(tabBar.bounds.height + 8)) |
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.
A lot of 8
's, I would move it to enum Constants
😄
} else if hasSafeArea { | ||
bottomConstraint = bottomAnchor.constraint(equalTo: container.safeAreaLayoutGuide.bottomAnchor, constant: -8) |
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 case is repeated in else
. Could we merge it?
} else { | ||
let bottomConstraint: NSLayoutConstraint | ||
bottomConstraint = bottomAnchor.constraint(equalTo: container.safeAreaLayoutGuide.bottomAnchor, constant: -8) |
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... let me check
for: [BrandStyle.movistar], | ||
and: [.light], |
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.
thanks!
} | ||
|
||
private extension CroutonTests { | ||
func makeCrouton(withText text: String, actionTitle: String? = nil, style: CroutonStyle) -> UIViewController { | ||
let viewController = CroutonTestViewController( | ||
func makeCrouton(withText text: String, actionTitle: String? = nil, style: CroutonStyle, withTabBar: Bool = false) -> UIViewController { |
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.
withTabBar: Bool
is a bad practice.
- It makes you to add an
if
inside the method -> create two methods then! - we should avoid having
if
/guard
/... in tests. Otherwise we should test our tests 😄
An extra point: |
I don't really have a strong opinion about this because testing “all brand” increases the size of the repo, makes it difficult to check the PR but I'm afraid that removing it will hide some bug. But if you agree we can remove it. |
then, we should add test to the palette, etc |
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.
@L-Trujillo26 I have a doubt, where the crouton is fixed at the end? I mean the view is added to the current view and therefore disappears if we navigate to another site or on the other hand is fixed to the root view of the app and therefore the crouton is fixed even after browsing.
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.
If a exact UIViewController isn't specified, the crouton will be add to the RootViewController making it visible during navigation. Its persistence depends on the configuration set in the initialization. This behavior has been confirmed with the design team.
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.
I've created a pet project to test this from UIKit.
I just found this glitch, could you check it please: bug_dismiss.mp4 |
This is the animation for the crouton positioned at the bottom. I have updated it to match the snackbar animation (it fades in and out gradually). Attached video of the Snackbar animation in SwiftUI and UIKit. animationSnackbar.mov |
Warning
Should a designer need to review/verify this PR?
🎟️ Jira ticket
IOS-9356
![image-2024-11-07-16-49-23-770](https://private-user-images.githubusercontent.com/53877180/412828306-b575db50-cc08-4aeb-8cea-8a313ce47e33.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5OTEwNDcsIm5iZiI6MTczOTk5MDc0NywicGF0aCI6Ii81Mzg3NzE4MC80MTI4MjgzMDYtYjU3NWRiNTAtY2MwOC00YWViLThjZWEtOGEzMTNjZTQ3ZTMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE4NDU0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZjZTliZmVmZDE5YmI1OGM5ODgzOGQ2N2JmNmFmOGNmNGQxM2JmZTlhODg1ZTZkMjhjYWFjOGYxYmIyNzlmMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.uvay7BhOsD18B8jwdfcKEs01TW5G1dwN_K7qWEKyg68)
🥅 What's the goal?
The Crouton design is deprecated and replaced with a new design that matches the appearance and behavior of the snackbar, as specified in the Figma:
https://www.figma.com/design/yCHLIfy4WMfRdlADwyL4kZ/%F0%9F%94%B8-Snackbar-Specs?t=bb57Dv8A0XsJVGqF-0
The component name has not yet been changed, but a floating design is implemented that respects the safe area and elements like the TabBar ensuring proper display in the view hierarchy.
🚧 How do we do it?
Design changes have been made(behavior is aligns with the Figma specifications)
🧪 How can I verify this?
MisticaCatalog -> Crouton (UIKit)-> show Crouton
This screenshot shows the Snackbar in SwiftUI and the Crouton in UIKit.
![crouton](https://private-user-images.githubusercontent.com/53877180/412825519-37c3bc9f-767b-4fec-9c6e-2913fe0fb83e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5OTEwNDcsIm5iZiI6MTczOTk5MDc0NywicGF0aCI6Ii81Mzg3NzE4MC80MTI4MjU1MTktMzdjM2JjOWYtNzY3Yi00ZmVjLTljNmUtMjkxM2ZlMGZiODNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE4NDU0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4OTZlMzlkYzg0NzhkMjAxMzk3ZGRkZGFjOWMzMmZhMDFmMGUyOTA4ZTdiODVkMjU5NmNlNjVkNDUzNWI0NzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.QLngGNFJiWxUsdFGi5OxgpwzVvWrDEEJVqsv0uVuNl8)
animationSnackbar.mov
🏑 AppCenter build
https://appcenter.ms/orgs/Tuenti-Organization/apps/Mistica-SwiftUI-iOS/distribute/releases