Skip to content
/ Walkify Public

Android app that enables you to track your walk with images

Notifications You must be signed in to change notification settings

mapm14/Walkify

Repository files navigation

Walkify

Configuration

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.

Modules distribution

Data Module

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/or LocalCacheDataSource
  • Input
    • Data retrieving with Id
    • Data saving <T>
    • Data for HTTP request
  • Output
    • Observable<DomainObject>
    • Completable
    • Single<DomainObject>

Domain Module

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>

Presentation Module

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

App Module

Dependency Injection

  • Role
    • Implement dependency injection for the app
  • Dependencies
    • Dagger2

Architecture

I'm following Clean Architecture principles to keep everything encapsulated, easily testable and not framework / library dependent.

Mockito is beign used for tests.

Dependency Injection

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.

Unit testing

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.

Contributors

@mapm14 - [email protected]