New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network e Repository(Paging) layers implementados. #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No geral, muito bom, bem organizado e seguindo boas práticas de programação. Deixei alguns comentários e alguns links de recomendações, mas pra um primeiro PR tá super bacana. 😄
app/src/main/java/com/lucascabral/marvelsuperheroes/helper/ConstantKeys.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lucascabral/marvelsuperheroes/presenter/di/NetworkModule.kt
Show resolved
Hide resolved
app/src/main/java/com/lucascabral/marvelsuperheroes/presenter/view/AllCharactersActivity.kt
Outdated
Show resolved
Hide resolved
...rc/main/java/com/lucascabral/marvelsuperheroes/presenter/viewmodel/AllCharactersViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lucascabral/marvelsuperheroes/presenter/di/NetworkModule.kt
Show resolved
Hide resolved
…ite. Todos os testes de modulos do koin passaram. Criado o companion object para evitar magic numbers.
|
||
val viewModelModule = module { | ||
|
||
single { AllCharactersViewModel() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui poderia usar viewModel { AllCharactersViewModel() }
, mas acredito que com um single
funcione também.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vou testar.
Foi criado:
a camada de network em um modulo usando koin.
a classe de paginação (usando a biblioteca paging3), que esta sendo utilizada no viewModel dentro da função getListData. A activity através desta função observará as mudanças de paginação e notificará o Adapter.
OBS: Futuramente penso em fazer algumas modificações para deixar o código escalável e melhor testável. A classe criada para fazer a paginação não trabalha como um repositório em si. Como estou usando o paging3 pela primeira vez, resolvi fazer primeiro dessa maneira. Também penso em fazer cache das páginas usando room.
Após fazer essa modificações, consigo trabalhar melhor com o koin e criar os modulos para o repository e viewModel.
Link trello:
https://trello.com/c/XrDUhcKv/49-projeto-final-marvel-cria%C3%A7%C3%A3o-da-camada-de-repository-do-projeto