Skip to content

Conversation

@rafaeltonholo
Copy link
Member

@rafaeltonholo rafaeltonholo commented Dec 11, 2025

Description

Part of #9497.
Depends on #10170, #10227

Note

I may split this PR into smaller ones to make the review process more manageable. For now, I want to provide an overview of the intended approach for the new MessageListViewModel and how we plan to integrate it with the existing message list implementation.

  • Extract all the MessageListFragment implementation to an abstract class implementation
  • Rename MessageListFragment to LegacyMessageListFragment, extending AbstractMessageListFragment
  • Create the new implementation of the MessageListFragment, extending AbstractMessageListFragment`
  • Introduce the MessageListStateMachine, acting as a state machine wrapper for the Message List, including all the state transitions configuration
  • Add use case to fetch the MessageListPreferences
  • Enable both singleListOf and factoryListOf to accept parameters
  • Add a state change side effect handler for:
    • Load the saved swipe actions
    • Load the saved sort type
  • Integrate the new MessageListPreferences with the legacy implementation of the MessageListFragment via abstract function override.
  • Integrate the SortType stored in the new MessageListState with the legacy implementation of the MessageListFragment via abstract function override.
  • Add detekt suppression to legacy implementation.

Know issue

When the message list loads for the first time, we are not yet using the new state to load the message items. As a result, the SortType and the MessageList loading process are not synchronized. This leads to the app performing a sort operation after the items have loaded, which displays an animation as the items are sorted. This issue should be resolved once we start loading the message items using the new MessageListState.

How to test

The new MessageListFragment and MessageListState are activated by a feature flag called enable_message_list_new_state, which is enabled by default in development builds.

Once you build and launch the app, it will automatically utilize the new MessageListState for the above-mentioned features. Please ensure that all the message list features function as intended, particularly the sorting and preference changes.

You can disable the feature flag by accessing the secret debug screen through the overflow button on the top bar. This is a good way to compare the new implementation with the old one.

Additionally, make sure that the legacy implementation continues to work as expected.

@rafaeltonholo rafaeltonholo force-pushed the feat/9497/new-message-list-view-model branch 2 times, most recently from c5fd504 to 9220017 Compare December 12, 2025 16:10
@rafaeltonholo rafaeltonholo force-pushed the feat/9497/new-message-list-view-model branch from 9220017 to 01e3138 Compare January 5, 2026 19:41
@rafaeltonholo rafaeltonholo force-pushed the feat/9497/new-message-list-view-model branch from 01e3138 to 61d14ce Compare January 6, 2026 11:50
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.

1 participant