How team-toyou/toyou-android works
Main Components
• User Interface/Presentation Layer:
• This layer includes all your Activity/Fragment files, ViewModels, and related UI resources. Notice the “presentation” folder (subfolders for fragments, viewmodels, and base) that houses all UI logic.
• Domain Layer:
• This layer encapsulates your business logic and repository interfaces. It’s located in the “domain” package (with subpackages for create, home, notice, record, social) to abstract data operations.
• Data Layer:
• Found in the “data” package, with submodules (create, emotion, home, mypage, notice, onboarding, record, and social) also containing DTOs, entities, and service classes.
• Network Module:
• The “network” package holds Retrofit configuration, API modules, custom responses and modules to facilitate communication with external APIs (e.g., Kakao Open API, Firebase).
• FCM Module:
• Contains FCM message handling logic (service, domain, dto) for push notifications.
• Models & Utilities:
• “model” holds various data models (including calendar and local data) and “utils” contains helper classes, token management, calendar utilities, or custom binding adapters.
• Android Resources and Configuration:
• The “res” folder resources along with Gradle build scripts are essential for UI theming, graphics, and project configuration.
Relationships and Interactions
• The presentation layer interacts with the domain layer via ViewModels to retrieve or send user data.
• The domain layer interfaces with the data layer, which handles network and local database operations (Room is used, as hinted by the presence of UserDatabase/UserDao and Room libraries).
• The network module provides the bridge to external services (Retrofit/OkHttp integration, third-party APIs like Kakao or Firebase) and supplies data to the data layer.
• The FCM submodule listens for incoming push notifications and interacts with the domain and network layers as needed.
• Utility classes are consumed anywhere in the code to support common functions (e.g., calendar handling, token storage).
Architectural Patterns and Design Principles
• MVVM: Indicated by a clear separation of UI (Fragments, Activities, ViewModels) and domain/data logic.
• Clean Architecture: A separation of concerns is presented between domain, data, and presentation layers.
• Repository Pattern: Present in “domain” where repositories provide an abstraction between data sources and business logic.
• Single-Activity Architecture with multiple Fragments: Based on the navigation component implementation and fragment usage.
• Dependency Injection (implied): Although not specified here in a DI framework, there’s a structure that allows for DI (e.g., separate modules for network, repositories, viewmodel factories).
Final Elements
– The Presentation Layer (activities, fragments, viewmodels) drives the UI.
– The Domain Layer insulates business logic and abstracts repository patterns.
– The Data Layer interacts with both local persistence (Room) and remote services (Retrofit, external APIs).
– There’s a dedicated FCM module for handling notifications.
– Utility classes and models support all layers.