GithubTrendingMVIFlow
Build
Architecture:
This project shows trending github repositories using MVI (Model View Intent) using kotlin flows and multi module clean architecture
- Model View Intent
- DI (Dagger / Hilt)
- Kotlin Flows
- Coroutines
- Kotlin Multi Module (KMM)
- Clean Architecture (S.O.L.I.D)
- Unit Testing (Junit & MockitTo)
- Ui Testing (Espresso & RoboElectric)
layers:
ui
: contains activity/fragment/views
presentation
: contains view models
use cases
: contains use cases for handling data (//TODO explain more)
repos
: contains data repositories (e.g. api repo, persistence repo)
remote
: contains network related stuff
cache
: contains database/shared Preferences related stuff
dependencies
you can get the dependencies graph by running ./gradlew moduleDependencies
ui
|---> presentation
|---> use-cases
|---> repos
|---> remote
|---> cache
Model
- for each entity we create a model for
- remote =>
FooRemote
- cache =>
FooCache
- repos/use-cases/presentation =>
FooItem
- ui =>
FooUiModel
- remote =>
ui (FooUiModel)
|---> presentation (FooItem)
|---> use-cases (FooItem)
|---> repos (FooItem)
|---> remote (FooRemote)
|---> cache (FooCache)
-
each layer should accept only its type and the above layer is required to provide it, ao the remote layer will accept
FooRemote
and the repos layer must provide to it -
mappers graph:
ui (FooUiModel <-> FooItem)
|---> presentation
|---> use-cases
|---> repos (FooItem <-> FooRemote) & (FooItem <-> FooCache)
|---> remote
|---> cache
Code Style:
We are following Google's Kotlin Style Guide. To use this style in Android Studio goto: Settings -> Editor -> Code Style -> Kotlin -> Set from... -> Kotlin Style Guide