Coder Social home page Coder Social logo

macxtor / cryptoincompose Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 279 KB

A sample Android application using Jetpack compose , Clean architecture and crypto API

Kotlin 100.00%
android clean clean-architecture clean-code dependency-injection hilt-android mockk mockk-android mvvm mvvm-android

cryptoincompose's Introduction

Architecture Diagram

CryptoInCompose Android App

CryptoInCompose is an Android application that allows users to explore and track cryptocurrency data using Jetpack Compose.

Overview

CryptoInCompose leverages the power of Jetpack Compose to provide an intuitive and modern user interface for interacting with cryptocurrency information. Users can view a list of trending cryptocurrencies, their prices, and relevant market data.

Features

  • Trending Crypto List: Browse a list of trending cryptocurrencies.
  • Detailed Information: View detailed information about each cryptocurrency, including current price and 24-hour price change percentage.
  • Market Data: Access market data such as market cap and trading volume.
  • Crypto Details(Coming Soon)
  • Favourite Crypto(Coming Soon)
  • Search Crypto(Coming Soon)
  • Authentication(Coming Soon)

Installation

To run CryptoInCompose locally, follow these steps:

git clone https://github.com/macxtor/CryptoInCompose.git
cd cryptoincompose
./gradlew build

Clean Architecture

CryptoInCompose is designed based on the principles of Clean Architecture. This architectural approach separates the application into distinct layers, each with its own responsibilities:

  • Presentation Layer (ViewModel & View): Jetpack Compose components for the UI. In CryptoInCompose, this is where the user interface is defined using modern Compose elements. HomeViewModel is responsible for managing UI-related data and orchestrating interactions between the presentation layer and the domain layer. It contains the business logic and state management.
  • Domain Layer (UseCase and entities): UseCases, such as GetTrendingCryptoUseCase, encapsulate the business logic, ensuring separation from the presentation layer. Entities represent the core data models used throughout the application.
  • Data Layer (Repository and API): The CryptoRepositoryImpl communicates with the CryptoApi to fetch cryptocurrency data. This separation allows for easier testing and modification of data sources.

This architecture promotes maintainability, testability, and flexibility in adapting to future changes.

Unit Testing

CryptoInCompose follows a robust unit testing approach using the JUnit framework and the MockK library for Kotlin. Unit tests are written to ensure the correctness and reliability of individual components:

  • ViewModel Tests: The HomeViewModelTest class contains tests for the HomeViewModel, verifying its behavior under different scenarios.
  • UseCase Tests: The GetTrendingCryptoUseCaseTest class contains tests for the GetTrendingCryptoUseCase, verifying its behavior under different scenarios.
  • Mapper Tests: The CoinsMapperTest class contains test for the Mapper, to check if appropriate mapping is done from data to domain layer.
  • Repository Tests: The CryptoRepositoryImplTest class tests the CryptoRepositoryImpl implementation, ensuring proper handling of API responses and errors.

To run unit tests, use the following command:

./gradlew test

References:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.