-
Notifications
You must be signed in to change notification settings - Fork 97
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: [IOCOM-1391] Flag to enable Messages Home with the new DS #5766
Conversation
Affected stories
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5766 +/- ##
==========================================
+ Coverage 48.42% 49.54% +1.12%
==========================================
Files 1488 1604 +116
Lines 31617 31869 +252
Branches 7669 7702 +33
==========================================
+ Hits 15311 15790 +479
+ Misses 16238 16016 -222
+ Partials 68 63 -5
... and 416 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
# Conflicts: # ts/features/messages/screens/MessagesHomeScreen.tsx
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.
Are we also removing unused selectors in messagesStatus.ts
as part of this PR? Could you please create a ticket to address this issue? If it doesn't fit into any specific stream board, you might use our cross board if that makes sense to you.
Linked using the title |
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
…sages' Home (#5770)⚠️ This PR depends on #5766⚠️ ## Short description This PR adds the Chip behaviour to the new DS Messages' Home. |Inbox|Archived| |-|-| |![Simulator Screenshot - iPhone 15 - 2024-05-15 at 14 50 34](https://github.com/pagopa/io-app/assets/5150343/9164fd98-6cff-4087-8f0e-5e10f6144d3a)|![Simulator Screenshot - iPhone 15 - 2024-05-15 at 14 50 37](https://github.com/pagopa/io-app/assets/5150343/59ede441-3b3d-4888-8e80-cb835dcdae89)| ## List of changes proposed in this pull request New Messages Home is organised as follows: ``` MessagesHome \_TabNavigationContainer \_InboxTab \_ArchivedTab \_ViewPagerContainer \_MessageList // Inbox \_MessageList // Archive ``` The major challenge is to avoid unnecessary re-renderings in the components included by the`ViewPager`. In order to do so, the shown category (inbox or archive) is stored into redux (`ts/features/messages/store/reducers/allPaginated.ts`), inside the `allPaginated` state (which is not persisted) as a literal which value can be either `inbox` or `archive`. Named `shownCategory`, its value can be retrieved using a selector (`shownMessageCategorySelector`). The `TabNavigationContainer` component uses such value in order to display the selected tab. On every change, it re-renders itself. On a press event, it dispatches an action to trigger the change into redux and it also instructs the `ViewPager` component to scroll to the desired page. This is necessary since the `ViewPager` does not have a method to show the current page based on a changing value (i.e., it needs to be done programmatically). A guard prevents the event logic to be fired if the already selected Tab is pressed. The `ViewPagerContainer` shows the Inbox and Archive message lists using the new `MessageList` component (and specialising it by assigning the proper category). Since there are only two pages, both instances of `MessageList` are rendered upon first ViewPagerContainer loading. In order to avoid unnecessary re-renderings when the user scrolls horizontally between the pages, the underlying `ViewPager` uses the `onPageSelected` event to dispatch the redux action that updates the `shownCategory`. This triggers the re-rendering of `TabNavigationContainer`, keeping the UI aligned. This event is triggered only when the page changes (i.e., there is no need for a "same-page" guard like in `TabNavigationContainer`). Finally, the logic that triggers the first message loading is placed inside the `TabNavigationContainer`, since it is the only component that can use an `useEffect` hook that triggers every time the screen changes. Loading is fired only if the related message section pot (inbox or archived) is `pot.none`. As a last note, this PR also moves legacy messages' screens and legacy messages home's components into related `legacy` folders. ## How to test Enable both new DS and new Messages' Home (from Profile). Check that: - tap on a Chip switches both Chip and View Pager - slide on the View Pager switches both View Pager and Chip - upon first full displaying of each inbox and archive screens, a `reloadAllMessage.request` should be fired (but no more afterwards) - check that the only component that re-renders itself multiple times is `TabNavigationContainer`
Short description
This PR adds a persisted preference to display the Messages Home with the new DS.
List of changes proposed in this pull request
isNewHomeSectionEnabled
property onpersistedPreferences
, with its migrationDeveloperModeSection
component has a new switch to control such property valueTabNavigator
spawns either the Legacy or the newMessagesHomeScreen
MessagesHomeScreen
renamed toLegacyMessagesHomeScreen
How to test
Using the io-dev-api-server, check that both the new and the old messages home screen is displayed, when the related toggle is changed in the debug profile options.