Giter Club home page Giter Club logo

converto's Introduction

πŸ’Ή Converto

A simple app for currency conversion which uses Open Exchange Rates (free account)

Splash Home Converion
Splash Home Conversion

πŸ‘·β€β™‚οΈ Architecture

This project follows MVVM (clean architecture) which increases code testability and quality. As this is a small project, I've skipped the UseCase layer (beneficial for large projects with many screens and use-cases). Hilt library is used for dependency injection which helps achieving dependency inversion.

This app is created using latest UI framework (Jetpack Compose). Also added support for "Material You" theme engine (i.e. App adapts to device theme colors).

πŸ“ Caching

App caches the latest currency rates and countries to save bandwidth which is refreshed after 30 minutes. Shared Prefs is used for caching as it is simple and saves development time but Datastore or Room is a preferred way (which is easy to migrate from as MVVM clean architecture used, can see impl_datastore branch for implementation).

App also caches user's last session data containing selected currencies.

πŸ§ͺ Unit tests

Unit tests for Data layer, Utils and ViewModels are added to ensure functional correctness. I was unable to cover 100% code coverage given time constraints but I'm sure that I've covered almost all the important functions and all the different scenarios which can be referred to write other testcases.

πŸ›οΈ Directory structure

Here is the directory structure of the app with unit tests code coverage

Converto
β”œβ”€β”€ data                      // Data layer (Class 68%, Method 58%, Line 71%)
β”‚   β”œβ”€β”€ datasources           // Class 63%, Method 60%, Line 70%
β”‚   β”‚   β”œβ”€β”€ local             // Class 68%, Method 63%, Line 64%
β”‚   β”‚   β”‚   └── prefs
β”‚   β”‚   └── remote            // Class 57%, Method 54%, Line 75%
β”‚   β”‚       β”œβ”€β”€ interceptors
β”‚   β”‚       β”œβ”€β”€ mappers
β”‚   β”‚       └── services
β”‚   β”œβ”€β”€ models
β”‚   └── repos                 // Class 75%, Method 51%, Line 67%
β”‚       β”œβ”€β”€ open_exchange
β”‚       └── user             
β”œβ”€β”€ di
β”œβ”€β”€ ui
β”‚   β”œβ”€β”€ components
β”‚   β”‚   └── core
β”‚   β”œβ”€β”€ models
β”‚   β”œβ”€β”€ screens
β”‚   β”‚   └── home              // HomeContentViewModel (Class 85%, Method 92%, Line 90%)
β”‚   └── theme
└── utils                     // Class 92%, Method 94%, Line 91%
    └── extensions

πŸ—οΈ Build

To build this project add "openExchangeServiceKey" in local.properties

openExchangeServiceKey="YOUR_APP_KEY"

Other details:

Android Studio: Android Studio Electric Eel | 2022.1.1
Kotlin: 1.8.10
Gradle: 7.5 (AGP 7.4.0)
Proguard: Not added yet only tested with debug build

πŸ“ƒTODO

  • Add feature to search currencies
  • Show last updated time
  • Migrate from SharedPrefs to Datastore for caching

πŸ”– License

MIT License

Copyright (c) 2023 Pavitra Raut

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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.