Pekwerike / MadeInLagos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MadeInLagos

MadeInLagos is an android application that displays a collection of products for a user to buy.

Architecture  

MadeInLagos was built with the Model View ViewModel (MVVM) architectural pattern. MVVM architecture allows the app to utilize the long-term benefits that come with separation of concerns, easier testing for individual components, and emphasis on SOLID principles

Application layers

Network 

The app uses Retrofit to make HTTP requests to https://tour.silent.ws/product and Retrofit-Moshi converter to parse HTTP responses into Kotlin objects.

Cache/Persistence

MadeInLagos utilizes the Room persistence library to cache the network results into an on-device database. The database is made up of two tables the Product table and the Product Review table. The app defines a one-many relationship between the product table and the product review table.

Repository

MadeInLagos defines the Main Repository API which specifies the various operations for the app Main Repository. The main repository layer acts as a mediator between the network layer and the database layer. This layer is also responsible for providing data to the ViewModels.

ViewModels

The app ViewModels hold the UI states for activities or other possible UI controllers like fragments. By using this pattern, the app can survive configuration changes, theme switches, and other system events that can lead to the destruction of an activity/ UI controller. 

Concurrency

To make the most of the device processor and bestow on the app a buttery smooth experience, Kotlin coroutines and flow, along with other java functionalities like synchronization are used for asynchronous operations.

Dependency Injection and Management

MadeInLagos uses Dagger-Hilt for automated dependency injection and dependency management across all the layers of the app.

UI

MadeInLagos UI is made up of multiple activities. As opposed to the Single Activity Multiple fragment patterns, using multiple activities for this project provided a higher level of stability(less system bug encounter), faster configuration, and better integration with the android material design container transformation library. 

Test 

The test layer boasts of several instrumentation unit and local unit tests for various components of the app. 

Screenshots

Watch video preview

Watch video

Open Source Libraries

  • Android jetpack libraries - Jetpack is a suite of libraries to help developers follow best practices, reduce boilerplate code, and write code that works consistently across Android versions and devices so that developers can focus on the code they care about.
    • Hilt - Hilt is a dependency injection library for Android that reduces the boilerplate of doing manual dependency injection in your project.
    • Room - The Room persistence library provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.
    • ViewModel - The ViewModel class is designed to store and manage UI-related data in a lifecycle conscious way.
    • LiveData - LiveData is an observable data holder class
  • Retrofit - A type-safe HTTP client for Android and Java
  • Moshi - Moshi is a modern JSON library for Android and Java.
  • Glide - Glide is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.
  • Mockito - Tasty mocking framework for unit tests in Java
  • JUnit - JUnit is a simple framework to write repeatable tests

How to install and run the app?

Clone this repository and open it using android studio 4.2 or higher.

TODOs

  1. UI Tests
  2. Integrate CI/CD

About


Languages

Language:Kotlin 100.0%