To configure the project in your machine you will only have to clone the project repository,
create an Flickr API key and replace it in the file apikey.properties
.
RemoteDataSource
- Role
- Constructing the request data
- Fetching data from a service (Retrofit)
- Handling the HTTP result and modify the
Single
if is necessary (specific error code return or error reason) - Map Data objects to Domain objects
- Dependencies
- API service (Retrofit)
- Input
- API request parameters
- Output
Single<DomainObject>
Completable
LocalDataSource
- Role
- Storing / fetching data on disk
- Map Data objects to Domain objects
- Clear database
- Dependencies
- Input
- Data to save
- Id for data retrieving
- Output
Single<DomainObject>
Observable<List<DomainObject>>
Completable
AndroidLocationProvider
- Role
- Fetching location updates
- Dependencies
- Android context (optional)
FusedLocationProvider
- Input
- Smallest displacement in meters
- Output
- Observable
Repository
- Role
- Fetching and storing data
- Connect to different
DataSources
and make the decision from where to fetch the data
- Dependencies
RemoteDataSource
and/orLocalCacheDataSource
- Input
- Data retrieving with Id
- Data saving <T>
- Data for HTTP request
- Output
Observable<DomainObject>
Completable
Single<DomainObject>
UseCase
- Role
- Processing data based on business logic
- Single task responsibility
- Concat with other use cases to make more complex business logic
- Dependencies
- Repositories
- UseCases (optional)
- Input
- Param classes
- Output
Single<DomainObject>
Observable<DomainObject>
Completable<DomainObject>
ViewModel
- Role
- Expose data to be displayed to the UI
- Trigger actions on UseCases based on user actions
- Subscribe and dispose observables
- Dependencies
- UseCases
- Input
- Id's
- User actions
- Output
LiveData<DomainModel or UIModel>
Views
- Role
- Display data to the user
- Dependencies
ViewModels
- Input
- Output
Dependency Injection
- Role
- Implement dependency injection for the app
- Dependencies
- Dagger2
I'm following Clean Architecture principles to keep everything encapsulated, easily testable and not framework / library dependent.
Mockito is beign used for tests.
The dependency injection is implemented with Dagger2, located in the app module.
All Dagger modules are separated by the modules that the app is made of, data and presentation. Domain doesn't need any Dagger Module.
We only have unit tests for domain
and data
(for now 😅) so we use Mockito
and .test()
, method from RxJava framework, to make all the tests.
For the tests I'm following the AAA pattern (Arrange, Act, Assert), more info in this medium post.
@mapm14 - mapm14@gmail.com