- CharacterListState (characters, isLoading, isLoadingNextPage, currentPage, endReached, error: UiText?), CharacterListAction (OnCharacterClick/OnRetry/OnLoadNextPage), CharacterListEvent (NavigateToDetail/ShowSnackbar). - CharacterListViewModel: state via .update, one-time events via Channel, DataError -> UiText on failure, pagination persisted in SavedStateHandle (rebuilds list up to the saved page after process death). - CharacterUi + Character.toCharacterUi(). - NO Compose/Views deps: verified no androidx.compose on the compile classpath. Stability via ImmutableList instead of @Stable (which would require compose-runtime) — the only compose-named transitive is kotlinx-immutable's annotations-only stub, not the Compose framework.
24 lines
984 B
Kotlin
24 lines
984 B
Kotlin
plugins {
|
|
alias(libs.plugins.architecture.android.library)
|
|
alias(libs.plugins.architecture.koin)
|
|
}
|
|
|
|
// UI-agnostic presentation: the MVI ViewModel + State/Action/Event live here and are shared by
|
|
// BOTH the Compose and the Views renderers. No Compose, no Views dependencies on purpose.
|
|
android {
|
|
namespace = "com.example.architecture.feature.characters.presentation"
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":core:domain"))
|
|
implementation(project(":core:presentation"))
|
|
implementation(project(":feature:characters:domain"))
|
|
|
|
implementation(libs.androidx.lifecycle.viewmodel.ktx)
|
|
implementation(libs.androidx.lifecycle.viewmodel.savedstate)
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
// Stable collection for state — makes the list Compose-stable WITHOUT a Compose dependency,
|
|
// so this module stays UI-agnostic (no @Stable annotation, which would require compose-runtime).
|
|
implementation(libs.kotlinx.collections.immutable)
|
|
}
|