/GitHub-Example-App

An android example app using the GitHub API

Primary LanguageKotlin

GitHub-Example-App

An android example app using the GitHub API to display GitHub's most popular repositories based on their star count.

Note that there is no authentication setup in the app which means that the app is limited to 10 requests per minute. However, this also means that you can easily test the error handling in the app.

Architecture

An MVVM/MVI architecture where the UI has ViewModels that observes the state of interactors and all state changes is delivered with partial states updating the interactors state object in a unidirectional way without side effects.

The app consists of three modules:

An app module where you find:

  • the UI
  • ViewModels
  • Interactors
  • Repositories

A data module where you find:

  • Network services
  • ObjectMappers

A domain module where you find:

  • Domain model objects mapped from the network model objects.
  • Network service interfaces that the data module implements.

Unit testing

There is unit tests that you can find in the app module. It's using OkHttps MockWebServer that reads a copy of the GitHub API response from the resources folder and like that you can unit test everything from ViewModels all the way down to the network services and this can run on a CI server without any need of an emulator or device.

Third party Dependencies

RxKotlin

All the communication between the different layers are using RxKotlin.

Retrofit

To talk to the REST API.

Dagger

For dependency injection.

This library goes hand in hand with data binding where you pretty much never have to make your own adapters again.

Apache Commons Lang

It contains a HashCodeBuilder that is very convenient to use when you wanna ensure unique ids for your adapters.