-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: Notifications Inbox Screen Implementation #113
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Notifications/Notifications/Presentation/NotificationsInbox/NotificationsInboxView.swift
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/NotificationsInboxView.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/NotificationsInboxViewModel.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Data/Network/NotificationsEndpoint.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/AttributedText/AttributedText.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/NotificationsInboxView.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/NotificationsInboxViewModel.swift
Outdated
Show resolved
Hide resolved
.padding() | ||
``` | ||
*/ | ||
public struct AttributedText: View { |
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.
Have we considered implementing it based on the built in HTML support of NSAttributedString
as a simple solution?
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.
} | ||
|
||
/// Starts the text parsing process. The results of this method will be placed in the `formattedText` variable. | ||
internal func parse() { |
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.
Have we considered implementing this logic based on XMLParser instead of writing our own?
if totalPages > 1 { | ||
if index == flatNotifications.count - 3 { | ||
if totalPages != 1 { | ||
if nextPage <= totalPages { |
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 can be simplified to a single condition without nesting.
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.
For easy understandable, I used this approach and it’s also already using at many places in codebase. Example: AllCoursesViewModel.swift
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Sorry, I hadn't checked the design details initially. Added relevant comments now.
.accessibilityIdentifier("discussions_icon") | ||
} | ||
.frame(maxHeight: .infinity, alignment: .top) | ||
.padding(.top, 5) |
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 reference design has a padding of 8px on both the top and the bottom of the row. So I would suggest to apply it on the upper HStack
Notifications/Notifications/Presentation/NotificationsInbox/SingleNotificationView.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/SingleNotificationView.swift
Outdated
Show resolved
Hide resolved
Notifications/Notifications/Presentation/NotificationsInbox/SingleNotificationView.swift
Outdated
Show resolved
Hide resolved
// Open three dots menu | ||
} label: { | ||
NotificationsAssets.threeDotsMenu.swiftUIImage | ||
.padding(.vertical, 10) |
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 should be 4px as per the reference design.
} label: { | ||
NotificationsAssets.threeDotsMenu.swiftUIImage | ||
.padding(.vertical, 10) | ||
.padding(.horizontal, isHorizontal ? 48 : 25) |
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 should be 10px as per the reference design. It can also be simplified by setting a frame of 24x24 instead of applying padding.
Additional adjustment should be done on the button instead of the image in my opinion.
.backViewStyle() | ||
.frame(width: 30, height: 30) | ||
.offset(y: 10) | ||
.padding(.leading, isHorizontal ? 48 : 10) |
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.
There is no need apply backViewStyle()
since the styling is being done on top of it as well. Also the frame size is 24x24 in the reference design. There's no offset and the padding is 24px.
.foregroundColor(Theme.Colors.textSecondary) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.padding(.bottom, 5) | ||
.padding(.horizontal, 20) |
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 padding should be 24 on all sides as per the design.
Notifications/Notifications/Data/Network/NotificationsEndpoint.swift
Outdated
Show resolved
Hide resolved
@shafqat-muneer for "also Mark notifications as seen APIs integrated with Notification Inbox Screen" there should be menu in three-dot menu, right? Did it add too? |
![]() @shafqat-muneer Why Notifications text is greyed out now? Looks like disabled. Is it by design? |
@shafqat-muneer If we follow this: "Once the inbox screen is opened the Mark as Seen API needs to be hit with app_name as discussion which would set the count in the API to 0" then what is the moment when we should hide unread mark on the Learn page? Now only re-run updates this mark Screen.Recording.2025-01-17.at.17.00.55.mov |
@rnr There are three APIs:
In short, we have a separate ticket for the three-dot menu, and it will be addressed in a separate PR. |
@rnr You're right; it will look better after applying the Theme. Currently, these values are not part of our existing Theme. I used a similar one that seemed appropriate. Do you have any suggestions for this based on our current theming colors? I noticed
|
@rnr Yes, when the user lands on the Notification Inbox screen, we make the |
@rnr That's correct. Currently, the notification marker updates on app relaunch or whenever the API is called. I think we should update it when the user navigates back from the Notification Inbox screen. We can handle this in a separate PR. |
Is there a reason why we need a separate PR to fix this bug (I guess we could call it a bug since we are sending an API request, but the UI is not updating)? We don't have product decision how it should work? Or it's tracked as bug somewhere? |
If we need to follow the design, we can create a new color in the whitelabel configuration. But here's a question for @moiz994 - is there a design reason why this screen is using new colors for the text rather than reusing existing colors? |
I thought this should ideally have been part of the original PR that implemented the API integration, but since that PR is already merged, creating a separate PR for it makes sense. However, you're also right that this can also be considered a bug. Let's fix it in the current PR to avoid confusion. Thanks! |
@rnr It's done. |
@@ -333,6 +335,7 @@ public struct PrimaryCourseDashboardView<ProgramView: View>: View { | |||
Spacer() | |||
if viewModel.config.pushNotificationsEnabled { | |||
Button(action: { | |||
viewModel.setNotificationMarkAsRead() |
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.
@shafqat-muneer Is it acceptable when an error appears on the Notifications Inbox View and the user cannot “read” the notifications (but we have already hidden the unread mark)?
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.
@rnr When user returns from Inbox screen, we make /api/notifications/count/
API call to get actual count for the following reasons:
- A new notification might arrive while the user is on the notifications inbox screen. When they return, the unread marker will update.
- We also make an API call when switching tabs.
In case of an error, unread marker will update automatically.
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.
Awesome. Thank you
LEARNER-10288: Notifications Inbox Screen Implementation
Description:
We need to implement a Notifications screen in the edX mobile app. This screen will display notifications fetched from the notifications table, allowing learners to stay updated on relevant discussions and interactions.
Design cases:
Design UI for the notifications screen. Main components include:
Tasks:
Notifications Screen UI:
Acceptance Criteria:
A functional Notifications screen is implemented, displaying notifications from the notifications table in an organized list.
LEARNER-10356: Notifications marked as seen & read integration with Notifications Inbox Screen.
Mark notifications as seen
Once the inbox screen is opened the Mark as Seen API needs to be hit with
app_name
asdiscussion
which would set the count in the API to0
Single notification marked as read
When a learner taps on a single notification, the notification will be marked read, and the unread indicator should go away. The indicator is just the red dot on the notification.
Screenshots:
Demo:
Simulator.Screen.Recording.-.iPhone.16.-.2025-01-09.at.13.16.16.mp4
Simulator.Screen.Recording.-.iPhone.16.-.2025-01-09.at.13.16.32.mp4
Figma:
Mobile Notifications UI Screen