Skip to content

code from Jules - #1

Open
diegaspar wants to merge 2 commits into
mainfrom
codebase-improvements-multiple
Open

diegaspar wants to merge 2 commits into
mainfrom
codebase-improvements-multiple

Conversation

@diegaspar

Copy link
Copy Markdown
Owner

Refactor: Improve ViewModel interactions, repository structure, and Proguard configuration.

This commit addresses several points from the issue:

  1. ViewModel Interaction (Issue 2):
    I refactored PokemonListScreen and PokemonDetailScreen to use lambda functions for event callbacks to child composables (EmptyErrorState, PokemonList, PokemonDetailed, etc.). This replaces direct ViewModel passing, improving composable reusability and testability.

  2. Repository Location (Issue 4):
    I moved the PokemonRepo.kt (repository interface) from the repo package to the domain package within the core-base module. All import statements have been updated accordingly. This aligns the project with clean architecture principles.

  3. Unused Files (Issue 3):
    I removed empty proguard-rules.pro and consumer-rules.pro files from core-base, core-ui, features/pokemonDetail, and features/pokemonList modules.
    I also updated the corresponding build.gradle.kts files to remove references to these deleted files, simplifying the build configurations.

  4. LazyColumn Performance (Issue 1):
    I reviewed the usage of LazyColumn extensions in PokemonListScreen. The existing pagination logic, which relies on LazyListState attributes, was confirmed to be correctly using derivedStateOf. No further changes were needed for this point based on the initial issue description.

…roguard configuration.

This commit addresses several points from the issue:

1.  **ViewModel Interaction (Issue 2):**
    I refactored `PokemonListScreen` and `PokemonDetailScreen` to use lambda functions for event callbacks to child composables (`EmptyErrorState`, `PokemonList`, `PokemonDetailed`, etc.). This replaces direct ViewModel passing, improving composable reusability and testability.

2.  **Repository Location (Issue 4):**
    I moved the `PokemonRepo.kt` (repository interface) from the `repo` package to the `domain` package within the `core-base` module. All import statements have been updated accordingly. This aligns the project with clean architecture principles.

3.  **Unused Files (Issue 3):**
    I removed empty `proguard-rules.pro` and `consumer-rules.pro` files from `core-base`, `core-ui`, `features/pokemonDetail`, and `features/pokemonList` modules.
    I also updated the corresponding `build.gradle.kts` files to remove references to these deleted files, simplifying the build configurations.

4.  **LazyColumn Performance (Issue 1):**
    I reviewed the usage of `LazyColumn` extensions in `PokemonListScreen`. The existing pagination logic, which relies on `LazyListState` attributes, was confirmed to be correctly using `derivedStateOf`. No further changes were needed for this point based on the initial issue description.
I've added necessary JVM arguments (`--add-opens`) to `gradle.properties`
to allow Kotlin Kapt to access internal Java compiler APIs.

This addresses the `java.lang.IllegalAccessError: class ... cannot access
class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler)`
error that occurs when using Kapt (e.g., for Room) with JDK versions
16 and above due to Java Platform Module System (JPMS) restrictions.

The `core-base` module uses Kapt for Room's annotation processor,
which was triggering this error.
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