Gods Unchained Demo

This app allows you to view a page of Gods Unchained cards and highlight a specific one to see a larger version in Shadow quality instead of plain. You can also filter the cards by name and effect.

Architecture

Dependency injection (Hilt) is used to separate the networking dependency, allowing the entire user flow and business logic to be unit tested by the ViewModel. Coroutines are used to handle threading with the Default dispatcher being injected into the ViewModel so it can be replaced with a test dispatcher.

The UI is built in Jetpack Compose, the latest UI framework which was released to stable this year. The image loading is being handled by a third party library Coil.

The networking is done using Retrofit which could also be altered to use protobufs instead of the JSON response currently being used.

For testing MockK is used to mock the dependencies (Repository) injected into the ViewModel and verify the correct interactions are made. Coroutines testing is also leveraged to be able to pause and resume the dispatchers to test the states inbetween processing.

device-2021-11-03-204234

device-2021-11-03-213020_Trim.mp4


GitHub

View Github