glific / mobile

8 stars 17 forks source link

Implements dynamic notifications #91

Closed VishalZ123 closed 1 year ago

VishalZ123 commented 1 year ago

Summary:

This PR implements the functionality to fetch notifications when the notification icon is clicked. It introduces the GET_NOTIFICATIONS query to retrieve the notifications from the server. The response is then formatted using the formatNotifications function, which converts the data into the desired format. Additionally, the notifications array is sorted in descending order based on the time to display the most recent notifications on top. The time is also formatted to show the duration in minutes, hours, days, etc. To avoid overflow of long notification messages, restricted the message text view to 3 lines.

Changes Made:

Issue: This PR addresses issue #88 .

https://github.com/glific/mobile/assets/76409986/e61c086d-cf2a-4142-a417-fc6dc61c36f4

Reviewer: @mdshamoon Please review the changes and provide your feedback.

Thank you.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -2.23 :warning:

Comparison is base (136cc3c) 55.00% compared to head (85f5d5c) 52.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #91 +/- ## ========================================== - Coverage 55.00% 52.78% -2.23% ========================================== Files 39 46 +7 Lines 529 593 +64 Branches 122 129 +7 ========================================== + Hits 291 313 +22 - Misses 234 275 +41 - Partials 4 5 +1 ``` | [Impacted Files](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific) | Coverage Δ | | |---|---|---| | [components/NotificationItem.tsx](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific#diff-Y29tcG9uZW50cy9Ob3RpZmljYXRpb25JdGVtLnRzeA==) | `77.77% <ø> (-22.23%)` | :arrow_down: | | [components/ui/SearchBar.tsx](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific#diff-Y29tcG9uZW50cy91aS9TZWFyY2hCYXIudHN4) | `88.23% <ø> (ø)` | | | [constants/theme.ts](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific#diff-Y29uc3RhbnRzL3RoZW1lLnRz) | `100.00% <ø> (ø)` | | | [graphql/queries/Notification.ts](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific#diff-Z3JhcGhxbC9xdWVyaWVzL05vdGlmaWNhdGlvbi50cw==) | `100.00% <100.00%> (+100.00%)` | :arrow_up: | | [screens/Notifications.tsx](https://app.codecov.io/gh/glific/mobile/pull/91?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific#diff-c2NyZWVucy9Ob3RpZmljYXRpb25zLnRzeA==) | `97.61% <100.00%> (+4.51%)` | :arrow_up: | ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/glific/mobile/pull/91/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=glific)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

VishalZ123 commented 1 year ago

@mdshamoon Please review the PR. Wrote tests for new Notification screen. Old test was failing as it was written for static notification.

VishalZ123 commented 1 year ago

Hey @mdshamoon Can you review and merge these changes so that I can work on the Deep Scan issue?