InboxUIState
Sealed interface representing different states for the Inbox UI.
States
Loading
Indicates that the inbox is currently fetching content from the device cache.
data-slots=heading, code
data-repeat=1
data-languages=Kotlin
Kotlin
object Loading : InboxUIState
Success
Indicates that the inbox content was loaded successfully. Contains the inbox template and list of content cards.
data-slots=heading, code
data-repeat=1
data-languages=Kotlin
Kotlin
data class Success(
val template: InboxTemplate,
val items: List<AepUI<*, *>>
) : InboxUIState
Properties
Property
Type
Description
template
The properties to be used for rendering the inbox (heading, layout, capacity, etc.).
Error
Indicates that an error occurred while loading inbox content.
data-slots=heading, code
data-repeat=1
data-languages=Kotlin
Kotlin
data class Error(
val error: Throwable
) : InboxUIState
Properties
Property
Type
Description
error
Throwable
The throwable that caused the error.
Usage Example
data-slots=heading, code
data-repeat=1
data-languages=Kotlin
Kotlin
val inboxUIState by viewModel.inboxUIState.collectAsStateWithLifecycle()
when (inboxUIState) {
is InboxUIState.Loading -> {
// Show loading indicator
}
is InboxUIState.Success -> {
val successState = inboxUIState as InboxUIState.Success
val cardCount = successState.items.size
val heading = successState.template.heading
// Render inbox with cards
}
is InboxUIState.Error -> {
val errorState = inboxUIState as InboxUIState.Error
// Show error message: errorState.error.message
}
}