feat(characters:presentation): UI-agnostic MVI ViewModel (REDI-87)
- 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.
This commit is contained in:
@@ -17,4 +17,7 @@ dependencies {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user