-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: Course Level Error Handling for Empty States #477
feat: Course Level Error Handling for Empty States #477
Conversation
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.
{ | ||
"images" : [ | ||
{ | ||
"filename" : "campaign_24dp_FILL0_wght400_GRAD0_opsz24.svg", |
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.
Could you please change the file name as per the asset name?
case noVideos(error: String, image: SwiftUI.Image) | ||
case noHandouts(error: String, image: SwiftUI.Image) | ||
case noAnnouncements(error: String, image: SwiftUI.Image) | ||
case noCourseDates(error: String, image: SwiftUI.Image) | ||
case noCourseware(error: String, image: SwiftUI.Image) |
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.
We are passing the same data in all the cases, how about defining a single case for all the cases and use that? Thoughts?
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 was thinking the same thing, but I opted for this approach to accommodate any future type-specific UI requirements. We can opt for single case for now. Thoughts?
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.
Opting for a single case is good at the moment. We will update it in the future as per the need.
GeometryReader { proxy in | ||
VStack(spacing: 20) { | ||
Spacer() | ||
switch errorType { |
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 seems bit odd to use the switch again under a case of the same switch. How about using a single GeometryReader
and configure it according to the need.
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.
Thank you for pointing that out. I have fixed it.
GeometryReader { proxy in | ||
VStack { | ||
ScrollView { | ||
DynamicOffsetView( | ||
coordinate: $coordinate, | ||
collapsed: $collapsed, | ||
viewHeight: $viewHeight | ||
) | ||
|
||
FullScreenErrorView( | ||
type: .noCourseDates( | ||
error: CourseLocalization.Error.courseDateUnavailable, | ||
image: CoreAssets.information.swiftUIImage | ||
) | ||
) |
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.
Is it possible to configure FullScreenErrorView in a way that we can directly use it like we are using OfflineSnackBarView?
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.
LGTM - only small code-style notes
CoreAssets.noWifi.swiftUIImage | ||
switch errorType { | ||
case .noVideos(error: let error, image: let image), | ||
.noHandouts(error: let error, image: let image), |
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.
Please remove the extra indentation
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.
XCode indenting it like this way.
.padding(.top, 8) | ||
.frame( | ||
maxHeight: .infinity, | ||
alignment: .topLeading) |
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.
Could you please move bracket on new line?
viewModel.router.showHandoutsUpdatesView( | ||
handouts: viewModel.handouts, | ||
announcements: nil, | ||
router: viewModel.router, | ||
cssInjector: viewModel.cssInjector) | ||
cssInjector: viewModel.cssInjector, | ||
type: type) |
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.
Could you please move bracket on new line?
announcements: viewModel.updates, | ||
router: viewModel.router, | ||
cssInjector: viewModel.cssInjector, | ||
type: type) |
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.
Could you please move bracket on new line?
@shafqat-muneer Screen.Recording.2024-07-02.at.16.01.12.mov |
@rnr Thank you for pointing that out. I have fixed it. |
@saeedbashir @rnr Feedback addressed. Ready for another round of review. 🎉 |
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.
LGTM
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.
error: DiscussionLocalization.Error.unableToLoadCourseContent, | ||
image: CoreAssets.information.swiftUIImage |
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.
Instead of passing message and icon from everywhere, how about just setting the type and define a method in FullScreenErrorView
for message and icon. You can keep a generic type that will take message and icon as in input for future.
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.
The FullScreenErrorView
is utilized across various modules, with its implementation located in the Core
module to enable application-wide usage. Embedding messages within the full screen would necessitate moving module-specific errors into the core module, which is not ideal. Therefore, I suggest passing the message and icon instead.
152656a
to
d061772
Compare
@saeedbashir Feedback addressed 🎉 |
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.
LGTM 👍
@volodymyr-chekyrta Awaiting your final review prior to merging. |
We're closing this PR and moving these changes to our own fork, as they are critical for us. After our release, we hope to find a way to contribute these changes back, thanks! |
LEARNER-10020: iOS - Course Level Error Handling for Empty States
Portrait Mode:
Landscape Mode: