Repository of a multi-platform application running the same Compose source code on all platforms

Overview

Compose multiplatform demo

demo.mov

Using the same compose user interface (UI) from android on all principal platforms 🎊 🎉

App Features

This is a single UI codebase for an application that runs on all principal platforms, containing 3 screens:

  • Seconds counter: Basic compose UI with a button and a coroutine that each seconds uptades the state.
  • Shared drawing pad: Compose canvas allowing the user to make some drawings, also sends and receives the drawings to/from the TCP server so everyone connected can see and draw together.
  • Chat screen: TCP chat that allows sending text messages to everyone connected to the chat room.

App Architectural pattern

For having a pure Kotlin and reactive approach with a centralized state management, it implements a multiplatform MVI framework (if you are not familiar with it, take a look at mobius from Spotify) located at the common sourceSet, some of the benefits from this approach are:

  • It makes it easy and organized to run background tasks via coroutines with a background dispatcher (connecting to a server or quering from a database) inside the Effects Processor.
  • Makes sure the state is only updated in a single place, the Updater class.
  • Delivers the state from the ViewModel in a reactive way using StateFlow.
  • Convenient way of mapping models from the domain into a UI layer.

App theming for each platform

The current theming is only changing colors and compositions, for example:

  • On iOS the look and feel of the TopBar is obtained purely with colors and back arrow manipulation, instead of using the default material back arrow like Android and Desktop does, a combination of SVG and text is used

Theming related elements are defined on each platform´s sourceSet as following:

Project Features

This is a fullstack (? - pending web) solution written in kotlin, using coroutines and flow showcasing the current capabilities of Jetbrains compose containing the following elements:

  • TCP server: for allowing apps communicate between them.
  • Android Client app
  • iOS Client app
  • Windows Client app
  • Mac Client app
  • Linux client app

Each client runs the same compose base code with their own theming (mostly varying color and some UI effects), and for desktop, multiple desktop-only features are added like:

  • Desktop notifications
  • Tray section icon display
  • Window title bar actions menu
  • Mouse pointer events handling
  • Local image resource displaying

Running it all

  1. Start TCP server and configure it to your IP address and desired port: e.g. 192.168.0.10 8081

    • from console at the root of the solution: ./gradlew :server:run

    • from gradle tasks panel inside IntelliJ

  2. Launching Android app:

    • from the run section on IntelliJ
  3. Launching iOS app (works only on Mac computers, requires XCode and XCode command line tools installed and configured):

    • from the tasks panel on IntelliJ
  4. Launching Desktop app (same for Windows, Mac, Linux):

    • from the tasks panel on IntelliJ

The first time you go into the chat or drawing screen you will need to define the server address and port, after they have been set you will be able to move back and forward without doing it again

Running via IntelliJ IDEA 2022.1.4

Credits

License

MIT

You might also like...
Android Ptrace Inject for all ABIs and all APIs. Help you inject Shared Library on Android.

Android Ptrace Inject 中文可以参考我的注释内容进行理解 我写的注释相对来说比较全面了 How to build Make sure you have CMake and Ninja in your PATH Edit CMakeLists.txt. Set ANDROID_ND

Same as an Outlined text fields presented in Material Design page but with some dynamic changes
Same as an Outlined text fields presented in Material Design page but with some dynamic changes

README SSCustomEditTextOutlineBorder Getting Started SSCustomEditTextOutLineBorder is a small kotlin library for android to support outlined (stroked)

 Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon
Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon

Stfalcon Fixturer A Utility for developers and QAs which helps minimize time wasting on writing the same data for testing over and over again. You can

PackageReferenceComparison - Do app/module dependencies that share a dependency use the same Singleton ref?
PackageReferenceComparison - Do app/module dependencies that share a dependency use the same Singleton ref?

PackageReferenceComparison Do app/module dependencies that share a dependency us

Reason about resource-safety in the same way you reason about Structured Concurrency with SuspendApp!

Reason about resource-safety in the same way you reason about Structured Concurrency with SuspendApp!

Free & Open-Source External Scripting Platform
Free & Open-Source External Scripting Platform

LeagueOfJire Free & Open-Source External Scripting Platform What features does this have? All of the feature's source-code can be found in the userscr

An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.
An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.

Simple Currency Converter Simple Currency Converter Android App by Isaev Semyon An example of a test task for creating a simple currency converter app

Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.
Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.

MoneyHeist-Chars Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Room

Built with Jetpack compose, multi modules MVVM clean architecture, coroutines + flow, dependency injection, jetpack navigation and other jetpack components

RickAndMortyCompose - Work in progress A simple app using Jetpack compose, clean architecture, multi modules, coroutines + flows, dependency injection

Owner
David Coronel
David Coronel
Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Chris Russell 1 Feb 11, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Jan 8, 2023
An Android Library that provides social login for 15 platforms within by RxJava2, Kotlin and Firebase Authentication.

RxSocialLogin The license information for logo is located at the bottom of the document. These instructions are available in their respective language

WindSekirun (wind.seo) 124 Nov 21, 2022
A Kotlin Multiplatform Project using TMDB Api. Currently supports Android,iOS,Desktop and web platforms

A Kotlin Multiplatform Project using TMDB Api(https://www.themoviedb.org/). Currently this project is implemented in following platforms Andr

Jackson E J 11 Nov 10, 2022
This provides the javafx runtimes for windows, linux, and mac os x86 platforms for Ignition

ignition JavaFX Provider This provides the javafx runtimes for windows, linux, and mac os x86 platforms for Ignition Steps to use run gradlew build st

Jonathan Coffman 2 Oct 17, 2022
This repository contains the source code for the PokeApi Android app.

PokeApi App This repository contains the source code for the PokeApi Android app.

Nilton Huamaní Carlos 0 Nov 4, 2021
A simple Kotlin multi-platform abstraction around the javax.inject annotations.

Inject A simple Kotlin multi-platform abstraction around the javax.inject annotations. This allows using the annotations in Kotlin common code so that

Christopher 43 Aug 17, 2022
KMM RSS Reader: an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile.

KMM RSS Reader This is an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile. It's a simple RSS reader, and you ca

Kotlin 1.4k Jan 4, 2023
The Action helps you to send a message to a queue on a RabbitMQ running Server

Rabbit Sender Action This Action helps you to send a message to a queue on a RabbitMQ running Server. Inputs Arg Default Description RABBIT_USERNAME g

Quique Ferraris 12 Dec 1, 2022
Kotlin library for creating long running connections using MQTT protocol

About Courier Courier is a kotlin library for creating long running connections using MQTT protocol. Long running connection is a persistent connectio

Gojek 92 Dec 23, 2022