How ironmanyg/echojournal works
Main components
• User Interface / Presentation Layer:
• Composed mostly of Jetpack Compose UI screens and components (e.g., SplashScreen, Entries Screen, Create Record Screen, etc.)
• Navigation components (root, journal screens, entry screens)
• Custom design system including themed components, Chip, FAB, TopAppBar, and other custom widgets.
• Domain Layer:
• Contains business logic such as AudioLog, Mood, AudioPlayer, AudioRecorder, and various domain models.
• Holds use cases and state management classes for MVI (such as ViewModels, Events, and States).
• Data Layer:
• Repositories and data sources that abstract out local database access and data mappers.
• Local data sources (Room database with DAOs, entities, and data mappers).
• Dependency injection modules for data (e.g., CoreDataModule and DatabaseModule).
• Infrastructure / Framework Integrations:
• Integration of native Android tools like MediaRecorder and MediaPlayer for recording and playback.
• External libraries such as Kotlin Coroutines, Flow, and Timber for logging.
• Configuration and Build:
• Gradle files and build scripts illustrating the project’s dependency management.
• Environment configuration files (.gitignore, gradle.properties, etc.)
Relationships and interactions
• The Presentation layer (UI screens and Compose components) sends user intents to ViewModels.
• The ViewModels interact with the Domain layer, which handles business logic and state.
• Domain calls into repositories defined in the Data layer which handle data operations either from local data sources (Room database) or potentially remote (future expansion).
• The Data layer uses DAOs and mappers to convert between entities and domain models.
• Dependency injection (set up via Koin) binds these layers together and manages lifecycle dependencies.
• User actions such as recording or playing audio trigger native Android services (MediaRecorder/MediaPlayer).
Important architectural patterns and design principles
• MVI (Model-View-Intent): Ensures a unidirectional data flow, making state management predictable and easier to debug.
• Repository Pattern: Abstracts the data sources from the domain logic, making switching between local and remote sources smoother.
• Separation of Concerns: Clear division between UI (presentation), domain (business logic), and data (storage/access).
• Single Module MVP: Although simple now, the current architecture enables a smoother transition to a multi-module structure if necessary in the future.
Relevant technologies and frameworks
• Kotlin and Jetpack Compose for application development.
• Android Architecture Components (like ViewModel, StateFlow, and Navigation Compose).
• Room for local database operations.
• Koin for dependency injection.
• Media APIs (MediaRecorder and MediaPlayer) for audio capabilities.
• In the Presentation layer, include components such as UI screens, Composable functions, and Navigation.
• In the Domain layer, outline business models, use cases, and ViewModels along with the MVI pattern components like Events and States.
Additional detailed notes
• Though the project is single-module, clearly delineate layered responsibilities to aid any future scalability.