Skip to content

CryptoSpark is a sample project showcasing a contemporary Android app development approach. It integrates widely-used Android tools and illustrates best development practices by leveraging cutting-edge technologies such as Compose, Kotlin Flow, and Koin.

Notifications You must be signed in to change notification settings

patriziolerede/CryptoSpark

Repository files navigation

CryptoSpark

Language

CryptoSpark is a sample project showcasing a contemporary Android app development approach.

It integrates widely-used Android tools and illustrates best development practices by leveraging cutting-edge technologies such as Compose, Kotlin Flow, and Koin.

This sample app embodies a scalable and maintainable modern Android application architecture through a MVI (Model-View-Intent) design pattern.

Description

Platform

Kotlin 1.9.0 and Android Studio Hedgehog | 2023.1.1 Patch 1

Architecture

The project is layered traditionally with a View, Presentation, Model separation and presents a MVI but adapted to Compose.

Architecture layers:

  • View - Composable screens responsible for consuming state, applying effects, and handling events.
  • ViewModel - That effectively manages and reduces the state of the associated screen. Moreover, it intercepts UI events and generates side-effects. The lifecycle scope of the ViewModel is linked to the corresponding screen composable.
  • Model - Repository classes designed to retrieve data. Within a clean architecture framework, it is recommended to utilize use-cases that interface with repositories.

There are a three core components described:

  • State - This is a data class that holds the state content of the corresponding screen, such as a list of User and loading status. The state is exposed as a Compose runtime MutableState object, which perfectly matches the use case of receiving continuous updates with an initial value.

  • Event - It is a plain object that is sent through callbacks from the UI to the presentation layer. Events should reflect UI events caused by the user. Event updates are exposed as a MutableSharedFlow type, which is similar to StateFlow and behaves as, in the absence of a subscriber, any posted event will be immediately dropped.

  • Effect - This is a plain object that signals one-time side-effect actions affecting the UI. For example, it could trigger a navigation action or display a message such as a Toast or SnackBar. Effects are accessible as ChannelFlow, where each event is delivered to a single subscriber. If an event is posted without any subscribers, it will suspend as soon as the channel buffer becomes full, waiting for a subscriber to appear.

Each screen or flow defines its own contract class that outlines all the corresponding core components mentioned above: state content, events, and effects.

Test

Unit test coverage for the networking and mapping functions

Screen

About

CryptoSpark is a sample project showcasing a contemporary Android app development approach. It integrates widely-used Android tools and illustrates best development practices by leveraging cutting-edge technologies such as Compose, Kotlin Flow, and Koin.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages