Skip to content

sebacipolat/DroidBank

Repository files navigation

A banking app demonstrates modern Android development using Hilt, Coroutines, Jetpack Compose, Room, ViewModel, MVVM architecture.dark and ligth theme, offline support.

Based on https://developer.android.com/topic/architecture?hl=es-419


Features

  • Home, Cards, Transactions.
  • Light and Dark theme
  • Offline support
  • Error handling

Stack

  • Minimum SDK level 24
  • Kotlin
  • MVVM
  • Coroutines
  • Jetpack Compose
  • Room
  • Hilt
  • Architecture
    • MVVM Architecture + full Repository Pattern
  • Retrofit2 & OkHttp3: Construct the REST APIs and paging network data.
  • Moshi: A modern JSON library for Kotlin and Java.
  • Material-Components: Material design components for building ripple animation, and CardView.
  • Coil,

Architecture

DroidBank has three main features home, cards, transactions. Each of them is based on the MVVM architecture and the Repository pattern, which follows the Google's official architecture guidance.

The overall architecture is composed of three layers; the UI layer, domain layer and data layer. Each layer has dedicated components and they have each different responsibilities, as defined below:

Architecture Overview

  • Each layer follows unidirectional event/data flow; the UI layer emits user events to the data layer, and the data layer exposes data as a stream to other layers.
  • The data layer is designed to work independently from other layers and must be pure, which means it doesn't have any dependencies on the other layers.

With this loosely coupled architecture, you can increase the reusability of components and scalability of your app.

UI Layer

The UI layer is based on Jetpack Compoase consists the screens interacract with ViewModel that holds app states and restores data when configuration changes.

Domain Layer

The Viewmodel from ui layer interact with the uses cases where the business logic is present it take data from the data layer.

Data Layer

The data Layer consists of repositories, who query data from the local database or requesting remote data from the network depends the cache state. DroidBank is an offline app so the app could display information without internet access depeding the stored data.

There are a validation by time stamp and eexpiration time where depending the expiration value the app will get data from db or api rest.

ie: cards feature

image

Into the repository there are the logic to give the domain layer the data from the local db o api rest

Cache Control

The first purpose is to avoid heavy use of the backend this will be called only when the data is expired.

Card table content: image

We use last_update (timestamp on miliseconds) value to check the expiration.

The search is based on this query timeLimit is the expiration time on minutes

"SELECT * FROM user_cards WHERE (:timeStamp - last_update) / 60000 <= :timeLimit"

control de cache_droid_bank

Testing

Unit test using jUnit + mockK

Linter

Next Steps

*Convert to a multu module app: https://github.com/sebacipolat/DroidBank-modular/blob/main/README.md

License

Designed and developed by 2023 Sebastian Cipolat

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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages