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

[Horizon] Add navigation bar #3034

Merged

Conversation

Ahmed-Naguib93
Copy link
Contributor

[ignore-commit-lint]
@inst-danger
Copy link
Contributor

inst-danger commented Dec 17, 2024

Horizon Build QR Code:

@inst-danger
Copy link
Contributor

inst-danger commented Dec 17, 2024

Fails
🚫 Build failed, skipping coverage check
❌ XCTest failed: CoreTests/AssignmentCellViewModelTests/testSubmissionStatusAndIconAndColor
XCTAssertEqual failed: ("#6a7883") is not equal to ("#697783")
XCTAssertEqual failed: ("#03893d") is not equal to ("#03893c")
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testAutomaticRead
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x104823000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x600000712d60>>".
XCTAssertNotNil failed
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x104823000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x600000712d60>>".
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x104823000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x600000712d60>>".
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testLayout
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x10784e600; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000072a6e0>>".
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x10784e600; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000072a6e0>>".
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x10784e600; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000072a6e0>>".
XCTAssertTrue failed
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x10784e600; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000072a6e0>>".
XCTAssertTrue failed
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testShowEntry
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x106863000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x6000007226e0>>".
XCTAssertEqual failed: ("nil") is not equal to ("Optional("4")")
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testShowReplies
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x11100a600; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000071a5e0>>".
XCTAssertTrue failed
XCTAssertTrue failed
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testStudentGroupTopic
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x111043000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000071ae60>>".
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testStudentGroupTopicWhenUserNotInAGroup
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x10489b000; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x60000072cb20>>".
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed
❌ XCTest failed: CoreTests/DiscussionDetailsViewControllerTests/testTeacherGroupTopic
Asynchronous wait failed: Exceeded timeout of 9 seconds, with unfulfilled expectations: "Expect predicate `runningCount == 0` for object <_TtCC9CoreTests36DiscussionDetailsViewControllerTests11MockWebView: 0x11784e800; frame = (0 0; 375 100); opaque = NO; backgroundColor = <UIDynamicCatalogColor: 0x60000237caf0; name = backgroundLightest>; layer = <CALayer: 0x6000006f94c0>>".
XCTAssertTrue failed
XCTAssertTrue failed
XCTAssertTrue failed

Generated by 🚫 dangerJS against ef016c5

@Ahmed-Naguib93 Ahmed-Naguib93 self-assigned this Dec 17, 2024
.scrollIndicators(.hidden, axes: .vertical)
.background(Color.backgroundLight)
.onFirstAppear { viewModel.viewController = viewController}

Choose a reason for hiding this comment

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

I don't love the pattern of requiring the view to set a property on the view model. I think it's better just to pass the viewController as an argument to the notebookDidTap method. That way it's always clear what is required. Otherwise it can be unclear to someone using the view model that they need to set that property before it'll work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok but i need to pass the closure direct to view model, because the navigation logic must be set in viewModel.

Choose a reason for hiding this comment

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

It would just be one of the parameters passed in the onEvent handler:

func onEvent(event: HorizonUI.NavigationBar.Trailing.Event, viewController: WeakViewController)

You might also consider creating a separate ViewModel to pair with the HorizonUI.NavigationBar.Trailing and putting the onEvent handler in there. Otherwise we must handle the navigation logic in the ViewModel for every View that uses the HorizonUI.NavigationBar.Trailing view.

Choose a reason for hiding this comment

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

If I'm being honest though, the amount of logic that would go into the Trailing view controller is so small and unlikely to be broken, I'd probably just put it into the view. So it's up to you what you want to do there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, HorizonUI is just for creating UI only and shouldn't have any logic in it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this component will be used only on the dashboard, I'd simply pass 3 named () -> Void closure to the HorizonUI.NavigationBar.Trailing initializer then we can have:

viewModel.notebookDidTap(viewController)
viewModel.notificationDidTap(viewController)
...the rest

that is readable easily.

reabbotted
reabbotted previously approved these changes Dec 18, 2024
Copy link
Contributor

@szabinst szabinst left a comment

Choose a reason for hiding this comment

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

Please see my comments below.

.scrollIndicators(.hidden, axes: .vertical)
.background(Color.backgroundLight)
.onFirstAppear { viewModel.viewController = viewController}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this component will be used only on the dashboard, I'd simply pass 3 named () -> Void closure to the HorizonUI.NavigationBar.Trailing initializer then we can have:

viewModel.notebookDidTap(viewController)
viewModel.notificationDidTap(viewController)
...the rest

that is readable easily.

@Ahmed-Naguib93 Ahmed-Naguib93 merged commit 062ac88 into feature/horizon Jan 7, 2025
2 of 4 checks passed
@Ahmed-Naguib93 Ahmed-Naguib93 deleted the feature/horizon-CLX-282-top-nav-bar-components branch January 7, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants