Inbox container implementation #396
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements inbox container UI for displaying content cards. The following classes were added as a part of the change:
Data provider
Data modes & state management
readstatusStyling
Composables
Related Issue
Motivation and Context
The implementation of
AepContainerUIContentProviderclass uses a declarative, reactive pipeline to load and display content.Flowreturned by the publicgetContentCardContainerUI()function.Flowis first collected, itsonStartoperator calls therefreshContainer()function. This function is responsible for fetching the container's configuration and emitting it into an internalStateFlow, which holds the current state of the container.containerUIFlowwill emit aFailureresult. TheflatMapLatestblock checks for this condition. If the container isnull(because of the failure), the logic bypasses the content fetching entirely and immediately emits aResult.failuredownstream, ensuring that UI consumers are promptly notified of the error.flatMapLatestoperator observes this internalStateFlow. As soon as a new container state is emitted,flatMapLatestimmediately subscribes to a new innerFlowprovided bycontentCardUIProvider.getUIContent().flatMapLatesttriggers theonStartblock within thegetUIContent()stream. It does two things in parallel:Loadingstate immediately, allowing the UI to show a loading indicator..mapoperator takes the result and transforms it into the final UI state, which can be eitherSuccess(containing the list of content cards) orError.This approach has the following advantages:
FlowfromgetContentCardContainerUI(). ThisFlowencapsulates all the API calls, state transitions(Loading,Success,Error), and cancellation logic.flatMapLatestoperator ensures that only the data request corresponding to the latest call will be processed. For example, if a consumer callsrefreshContainer()multiple times (e.g., from a pull-to-refresh action), any older, in-flight requests are automatically cancelled, which prevents stale data incorrectly updating the UI.How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: