Skip to content

This repository is an exercise to create an app with search feature using jetpack compose, mvvm and clean architecture

Notifications You must be signed in to change notification settings

juanchosandox90/MercadoSearch

Repository files navigation

Mercado Search App

Kotlin Version Gradle License

Mercado Search App is a sample project that presents modern, 2022 approach to Android application development using Kotlin, Jetpack Compose and latest tech-stack.

The goal of the project is to demonstrate best practices, provide a set of guidelines, and present modern Android application architecture that is modular, scalable, and maintainable. This application may look simple, but it has all of these small details that will set the rock-solid foundation of the larger app suitable for bigger teams and long application lifecycle management.

This app allows you to find and see information about products exposed on the marketplace of Mercado Libre. You can see information about prices, shipping, condition and also you can take a look at the product on the official store.

Specifications ✅

Current version: 1.0.0

Minimum OS version: Android 8 - Oreo (API level 27)

Maximum OS version: Android 13.1 (API level 33)

Percentage of support devices (based on OS version): ~83%

Support for landscape: Yes

Dark mode: No

Offline support: No

Permissions required: ACCESS_NETWORK_STATE, INTERNET

Architecture 🛠

Following concepts of clean architecture, there 3 packages that represents the data, domain and UI. There's also one package for dependency injection.

Screen Shot 2022-09-11 at 8 26 58 PM

  • In the data layer, network operations resides inside a RemoteProductsDataSource and it is accessible through and implementation of ProductsRepository. Data models are converted to entities using mappers, this way complex deserialization logic doesn't not require changes on the business logic models.

  • In the domain layer, business logic operations lives in usecases and real life objects are represented as entities. There's also the definition of the ProductsRepository, this, in order to follow the dependency inversion principle.

  • In the UI layer, ProductsViewModel handles the events from the UI components and interacts with the domain layer through usecases, the data is presented to the interface using LiveData observables and compose States. observables All the screens are built using composables instead of the view system (XML).

Stack 📝

This apps was built using this libraries and frameworks:

UI

Jetpack Compose, Accompanist , Compose Material , LiveData , Splash Screen

Image Loading:

Coil

Logging:

Timber , OkHttp Logging Interceptor

Dependency Injection:

Hilt

Serialization:

Gson

Networking:

Retrofit

Testing:

MockK , Robolectric , JUnit , kotlinx.coroutines

Testing 🔎

Due to time reasons, testinng efforts were focused on the bussines logic and some part of the data layer. Mappers and networking logic are under unit tests. In the domain layer, some methods and logic of the ProductsViewModel are covered with unit tests, here's the coverage report:

Test coverage

Assumptions/Restrictions 👈

  • Based on the API documentation provided, searchs are limit up to 1000 results because at the endpoint for searching products (search?q) requires an authentication token.

  • There are two entities that wraps the information about a product, DProductDataModel and DProductDetailsDataModel, the first one is used for showing the basic information of a product in the search results list. The second one provides the information of the details screen, this is done with the purpose of presenting the the most recent data.

  • Filters are not available and the sorting criteria of the products is the same as the received from the API.

TROUBLESHOOTING ⚠️

If you are experiencing having troubles when trying to see Previews of composables, upgrade Android Studio to the most recent version. The AS version used for building this project was 2021.1.1 Path 3 with Gradle Plugin 7.1.3 and Gradle Version 7.2.

Sometimes, unit tests that depends on the test coroutines returns failed results when they're in fact successful (false positives), if this happens, please re-run the test again and try to rebuild the project.

Contributions

All contributions are welcome! Please feel free to post questions, recommendations, ideas, bugs by create new issue following the template or if you want create directly new pull request.

Authors

Juan Camilo Sandoval Devia

Linkedin

License

Copyright 2022 Juan Camilo Sandoval

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

This repository is an exercise to create an app with search feature using jetpack compose, mvvm and clean architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages