Skip to content

Latest commit

 

History

History
202 lines (148 loc) · 13 KB

README.md

File metadata and controls

202 lines (148 loc) · 13 KB

License API KotlinWeekly API Stream Feeds

AvengersChat demonstrates modern Android development based on MVVM architecture and Stream Chat SDK for Android.

The purpose of this repository is to demonstrate below:

  • Implementing each different feature with modularization and navigation.
  • Implementation of Android architecture components with Jetpack libraries, such as Hilt and AppStartup.
  • Performing background tasks with Kotlin Coroutines.
  • Integrating chat systems with Stream Chat SDK for Android for real-time event handling.

✍️ Tutorials

banner

You can learn more about this project from the blog posts and Youtube videos. If you're interested in the materials, check out the Tutorials Page!

💡 Additional Repositories

If you're interested in additional repositories that were built with Jetpack Compose and Stream SDK, check out the repositories below:

  • WhatsApp Clone Android: 📱 WhatsApp clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat SDK for Compose.
  • Slack Clone Android: 📱 A chat demo app built with Jetpack Compose and Stream Chat SDK following clean architecture principles.
  • Stream Draw Android: 🛥 Stream Draw is a real-time multiplayer drawing & chat game app built entirely with Jetpack Compose.
  • Facebook Messenger Clone: Facebook Messenger clone using Stream SDK & Jetpack Compose.

📲 Download APK

Go to the Releases to download the latest APK.

⛴ Stream Chat SDK for Android

AvengersChat was built with Stream Chat SDK for Android for implementing messaging systems. You can learn more about the SDK with the materials below:

📷 Previews

If you find funny moments on this demo application, feel free to join and share the moment in this thread!

🛠 Tech stack & Open source libraries

  • Minimum SDK level 21.
  • 100% Kotlin based + Coroutines + Flow for asynchronous.
  • Hilt for dependency injection.
  • Jetpack
    • Lifecycle: Dispose observing data when lifecycle state changes.
    • ViewModel: UI related data holder and lifecycle aware.
    • App Startup: Provides a straightforward, performant way to initialize components at application startup.
    • Navigation: For navigating screens and provides deeplinks.
    • Room: Constructs Database by providing an abstraction layer over SQLite to allow fluent database access.
    • Hilt: Dependency Injection.
  • Architecture
    • MVVM Architecture: View - DataBinding - ViewModel - Model
    • Bindables: Android DataBinding kit for notifying data changes to UI layers.
    • Repository pattern
  • Material Design & Animations: Design system created by Google to help teams build high-quality digital experiences.
  • Retrofit2 & OkHttp3: Construct the REST APIs and paging network data.
  • Sandwich: Construct lightweight http API response and handling error responses.
  • Moshi: A modern JSON library for Kotlin and Java.
  • Coil: Image loading for Android backed by Kotlin Coroutines.
  • TransformationLayout: Implementing transformation motion animations.
  • android-youtube-player: YouTube Player library for Android and Chromecast, stable and customizable.
  • DiscreteScrollView: Implementing a scrollable list of items.
  • Timber: A logger with a small, extensible API which provides utility.

✅ Supported features

  • Light and Dark themes.
  • Different color themes by a chosen character.
  • 100% offline mode supports.
  • Live stream chat example.
  • Channel and message lists.
  • Direct message and group messages.
  • Mentioned message list.
  • Custom emoji reactions.
  • Guest mode.
  • User online/offline status.
  • User last active date.
  • User info & direct message dialogs.
  • Visual animations like transition.
  • And a lot of features by Stream Android SDK!

☑️ TODO

Anyone can contribute to our open source project! Please kindly read this Contributing Guideline before contributing to our project. 😎

  • Modify a user profile image.
  • Login with a new guest user.
  • Push notifications for new messages.
  • Create group chats by selecting users.
  • Access user info dialog everywhere.
  • Add unit test cases for all business logic.

🏛 Architecture

AvengersChat is based on the MVVM architecture and the Repository pattern, which follows the Google's official architecture guidance.

architecture

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

AvengersChat was built with Guide to app architecture, so it would be a great sample to show how the architecture works in real-world projects.

Architecture Overview

architecture

  • 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

architecture

The UI layer consists of UI elements to configure screens that could interact with users and ViewModel that holds app states and restores data when configuration changes.

  • UI elements observe the data flow via DataBinding, which is the most essential part of the MVVM architecture.
  • With Bindables, which is an Android DataBinding kit for notifying data changes, you can implement two-way binding, and data observation in XML very clean.

Data Layer

architecture

The data Layer consists of repositories, which include business logic, such as querying data from the local database and requesting remote data from the network. It is implemented as an offline-first source of business logic and follows the single source of truth principle.

AvengersChat is an offline-first app is an app that is able to perform all, or a critical subset of its core functionality without access to the internet. So users don't need to be up-to-date on the network resources every time and it will decrease users' data consumption. For further information, you can check out Build an offline-first app.

Modularization

architecture

AvengersChat adopted modularization strategies below:

  • Reusability: Modulizing reusable codes properly enable opportunities for code sharing and limits code accessibility in other modules at the same time.
  • Parallel Building: Each module can be run in parallel and it reduces the build time.
  • Strict visibility control: Modules restrict to expose dedicated components and access to other layers, so it prevents they're being used outside the module
  • Decentralized focusing: Each developer team can assign their dedicated module and they can focus on their own modules.

For more information, check out the Guide to Android app modularization.

💯 MAD Score

summary

Content Credits

All copyrights of the contents, concepts, and phrases that are used in this open-source project belong to Marvel Studios.

Find this repository useful? 💙

Support it by joining stargazers for this repository. ⭐
Also, follow maintainers on GitHub for our next creations! 🤩

License

Copyright 2021 Stream.IO, Inc. All Rights Reserved.

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.