Domain Layer & Use Case Implementation - #31
Merged
AlexisTercero55 merged 12 commits intoAug 7, 2026
Conversation
### MainActivity Refactor: StateFlow Migration - Switched state observation from LiveData to StateFlow using collectAsState(). - Implemented lifecycleScope for error flow collection and onDestroy cleanup. - Refined authentication-driven navigation logic within LaunchedEffect. ### `core:data` Refactor: SessionManager & SessionRepository - SessionManager: Migrated LiveData to StateFlow; added @volatile thread-safety, CoroutineScope for async persistence, and lifecycle init/cleanup methods. - SessionRepository: Extracted persistence into an interface with a SharedPreferences implementation (SessionRepositoryImpl) to decouple storage from the manager.
- Replace live data state with StateFlow. - Update some build files.
- AuthRepository - define login operation. - AuthRepositoryImpl - Mock implementation for development purposes.
- Credentials.kt - user's authentication data - User.kt - user's info. - Result.kt - standardized status holder.
- standardized execution pattern for domain transactions
- LoginUseCase : : BaseUseCase<Credentials, User>() - LoginUseCaseTest. - LoginViewModel migration_2 to StateFlow
features:auth - Compose login screen. - Compose login inputs fields. - Compose action login button.
features:auth - Setup Gradle modules. - Mising login button move.
:core:domain
:core:domain
:core:ui
:features:home :core:ui
AlexisTercero55
requested review from
MarkParedes,
alexistercero-rho-dev and
guslg325
August 7, 2026 00:36
This was
linked to
issues
Aug 7, 2026
alexistercero-rho-dev
approved these changes
Aug 7, 2026
Collaborator
There was a problem hiding this comment.
CODE REVIEW & CI/CD
Ready for application test: install and run on Samsung Galaxy A34 5G.
sha256:cd054915e6969a9847276117c36bfa91c550dff15ae225b164c9df06d600144d
Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio
alexistercero-rho-dev
deleted the
27-plan-domain-layer-use-case-implementation
branch
August 7, 2026 18:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Development iteration: Architectural Evolution & Domain Integrity
This iteration represents the transition of Rho Studio UI from a feature-modularized prototype to a structured Clean Architecture system. We have successfully decoupled business logic from the Android Framework, implemented a reactive unidirectional data flow (UDF), and established a strict hierarchical module boundary system.
Advanced Multi-Module Topology #28
We have moved away from a monolithic
:appstructure to a Feature-Layered Modularization strategy. This optimizes build parallelization and enforces strict dependency inversion.:features:authand:features:homeare now independent Android Libraries. They depend only on:coremodules (:data,:domain,:ui), preventing circular dependencies and ensuring that changes in one feature cannot break another.ServiceModuledata class was migrated from:core:uito:features:home:model. This adheres to the Interface Segregation Principle, ensuring that core modules remain generic and do not carry feature-specific payloads.Domain Layer & Interactor Pattern #29
The implementation of the
:core:domainmodule introduces a platform-agnostic layer that houses the application's "truth."BaseUseCase<P, R>: A standardized abstraction for business logic execution. It leverages Kotlin Coroutines to enforce suspend execution and provides a unified contract for error handling and execution state.LoginUseCase: Encapsulates the authentication transaction. It validates Credentials (Domain Entity) before interacting with the data layer, ensuring business rules are met before network/disk I/O.LogoutUseCase: Orchestrates an atomic session teardown. It coordinates the clearing of tokens inSessionManagerand triggers global state resets.UserandCredentialsare now pure Kotlin data classes, preventing "leakage" of framework-specific logic (like Parcelable or Room annotations) into the business layer.Reactive UI & Orchestration #30
The UI layer has been refined to use Jetpack Compose with a reactive state-push model, eliminating the manual synchronization bugs inherent in View-based systems.
collectAsState(), ensuring that recompositions only occur when the specific backing data changes.MainActivity, we useLaunchedEffectkeyed toisAuthenticatedstate. This transforms a state change into a one-time navigation event, preventing "multiple-navigation" bugs and ensuring that the NavHost is always in sync with theSessionManager.Current State: Manual Dependency Management
While the architecture has been modularized, the project currently utilizes Manual Dependency Management.
SessionManagerare managed as singletons.LogoutUseCase(SessionManager.getInstance())).ViewModelfrom its implementation details.Infrastructure & Verification
CI/CD Pipeline: Implementation of
.github/workflows/android.ymlensures that every commit is verified against adebugbuild and unit test suite.Static Analysis: All source files have been standardized with
ASCII brandingand metadata headers, and code style is enforced through automated linting to maintain high maintainability standards.Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio