Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 2.3 KB

File metadata and controls

69 lines (52 loc) · 2.3 KB

Chat Application

A modern chat application built with Kotlin Multiplatform and Compose UI.

Features

  • Two-User Chat Interface: Switch between User1 and User2 to simulate a conversation
  • Real-time UI Updates: Messages appear instantly with smooth animations
  • Auto-responses: The app simulates responses from the other user
  • Modern Material 3 Design: Beautiful UI with proper theming and message bubbles
  • Message Persistence: Messages are stored in memory during the session
  • Timestamp Display: Each message shows the time it was sent
  • Clear Chat: Option to clear all messages
  • Cross-platform: Works on Android and iOS

Architecture

  • MVVM Pattern: Clean separation of concerns with ViewModel managing state
  • Repository Pattern: Data layer abstraction for future database integration
  • Compose UI: Modern declarative UI framework
  • Kotlin Multiplatform: Shared business logic across platforms
  • Flow-based State Management: Reactive UI updates

UI Components

ChatScreen

  • Main chat interface with message list and input field
  • Top bar with user switching and clear chat options
  • Auto-scrolling to latest messages
  • Material 3 theming

MessageBubble

  • Individual message component with sender-specific styling
  • Timestamp display
  • Different colors for current user vs other user
  • Rounded corners with proper spacing

ChatViewModel

  • Manages chat state and business logic
  • Handles message sending and user switching
  • Simulates auto-responses from other user

How to Use

  1. Send Messages: Type in the input field and press send or hit enter
  2. Switch Users: Tap the person icon in the top bar to switch between User1 and User2
  3. Clear Chat: Tap the clear icon to remove all messages
  4. Auto-responses: After sending a message, the other user will automatically respond

Future Enhancements

  • SQLDelight database integration for persistent storage
  • User authentication
  • Real-time messaging with WebSocket
  • Message reactions and replies
  • File and image sharing
  • Push notifications

Running the App

# For Android
./gradlew :composeApp:assembleDebug

# For iOS (requires Xcode)
./gradlew :composeApp:iosApp

The app demonstrates a complete chat interface with all the essential features needed for a messaging application.