Release v1.0.2 - Rho Studio UI - #35
Merged
Merged
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
- Fix Test report - REVIEW - NEW Release Action
AlexisTercero55
requested review from
MarkParedes,
alexistercero-rho-dev and
guslg325
August 11, 2026 00:20
This was
linked to
issues
Aug 11, 2026
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.
Technical Report: Rho Studio UI
An Android Jetpack Compose app.
Enterprise-Grade Android Architecture with Jetpack Compose
This document provides a comprehensive technical overview of the Rho Studio UI application. It serves as the primary architectural reference for developers, outlining the system's design, layer responsibilities, and technical standards.
1. Executive Summary
Rho Studio UI is the base application template designed to establish and enforce the Rho Studio Android App Standards. It provides a robust foundation for building secure, authenticated mobile experiences within the Rho Studio ecosystem.
The application is a pure Jetpack Compose implementation following a Single-Activity Architecture, leveraging a reactive MVVM (Model-View-ViewModel) pattern to ensure a clean separation of concerns, testability, and a fluid user experience driven by Unidirectional Data Flow (UDF). This architectural foundation ensures a focus on Fluid UX, Transactional Integrity, and Decoupled Business Logic.
Core Features:
2. Architectural Framework
The application follows a Single-Activity Architecture and is structured according to Clean Architecture principles. It utilizes a Feature-Layered Modularization strategy to ensure scalability and maintainability.
2.1 Layered Structure
The system is divided into three primary logical layers, enforcing a strict unidirectional dependency flow: UI → Domain ← Data.
graph TD subgraph "UI Layer (Presentation)" UI[Jetpack Compose Screens] VM[ViewModels] Nav[Navigation / NavHost] end subgraph "Domain Layer (Business Logic)" UC[Use Cases / Interactors] Entities[Domain Entities] Int[Repository Interfaces] end subgraph "Data Layer (Infrastructure)" Repo[Repository Implementations] SM[Session Manager] Local[Local / Network Data Sources] end UI --> VM VM --> UC UC --> Entities UC --> Int Repo -.-> Int Repo --> SM Repo --> Local2.2 Multi-Module Topology
We have moved away from a monolithic
:appstructure to a Feature-Layered Modularization strategy. This optimizes build parallelization and enforces strict dependency inversion.flowchart TD APP[":app<br/>MainActivity, NavHost"] AUTH[":features:auth<br/>LoginScreen, LoginViewModel"] HOME[":features:home<br/>HomeScreen, HomeViewModel"] UI_CORE[":core:ui<br/>Theme, Common Composables"] DOMAIN[":core:domain<br/>Use Cases, Models, Contracts"] DATA[":core:data<br/>Repositories, SessionManager"] APP --> AUTH APP --> HOME AUTH --> UI_CORE AUTH --> DOMAIN HOME --> UI_CORE HOME --> DOMAIN UI_CORE --> DOMAIN DOMAIN -.->|"implemented by"| DATA style APP fill:#e94560,stroke:#c62828,color:#ffffff style AUTH fill:#1a1a2e,stroke:#e94560,color:#ffffff style HOME fill:#1a1a2e,stroke:#e94560,color:#ffffff style UI_CORE fill:#16213e,stroke:#0f3460,color:#ffffff style DOMAIN fill:#0f3460,stroke:#16213e,color:#ffffff style DATA fill:#1a1a2e,stroke:#e94560,color:#ffffff3. Layer Detail & Responsibilities
3.1 UI Layer (Presentation)
Goal: Transform application state into a visual interface and handle user interactions.
StateFlow, exposing it to the UI in a lifecycle-aware manner.MainActivityusesLaunchedEffectkeyed to authentication state, transforming state changes into one-time navigation events.MainActivity.kt: The entry point and navigation orchestrator.LoginViewModel.kt&HomeViewModel.kt: Feature-specific state holders.BaseViewModel.kt: Provides shared logic for loading states, error handling, and navigation side-effects.HeaderViewModel.kt: BridgesSessionManagerstate to common UI componentsflowchart TB subgraph Navigation["Navigation Orchestration"] MA["MainActivity.kt<br/>- NavHost<br/>- Session-based routing"] end subgraph Shared["Shared UI Components"] PV["BaseViewModel.kt<br/>- Loading states<br/>- Error handling"] HV["HeaderViewModel.kt<br/>- Session state bridging"] PH["PageHeader.kt"] PF["PageFooter.kt"] end subgraph Auth["Authentication Feature"] LS["LoginScreen.kt"] LVM["LoginViewModel.kt<br/>- Form state<br/>- Debounced validation"] end subgraph Home["Home Feature"] HS["HomeScreen.kt"] HVM["HomeViewModel.kt<br/>- Home state<br/>- Session termination"] end MA --> LS MA --> HS LS --> LVM HS --> HVM LVM --> PV HVM --> PV HV --> PV style Navigation fill:#e94560,stroke:#c62828,color:#ffffff style Shared fill:#16213e,stroke:#0f3460,color:#ffffff style Auth fill:#1a1a2e,stroke:#e94560,color:#ffffff style Home fill:#1a1a2e,stroke:#e94560,color:#ffffff3.2 Domain Layer (Business Logic)
Goal: House the platform-agnostic business rules and "truth" of the application.
Context, noParcelable).LoginUseCase). This promotes the Single Responsibility Principle and makes logic reusable across ViewModels.UserandCredentialsrepresent the core business models.BaseUseCase<P, R>: Standardizes execution context (Coroutines) and error handling.SessionManagerInterface: Defines the contract for session operations without revealing implementation details.LoginUseCase: Encapsulates the authentication transaction.LogoutUseCase: Orchestrates atomic session teardown.3.3 Data Layer (Infrastructure)
Goal: Manage data acquisition, persistence, and external service coordination.
SessionManagerserves as the Single Source of Truth (SSOT) for the user's authentication state, exposingStateFlow<AuthState>for the UI to observe.SharedPreferenceswithGsonserialization for persistence and mock authentication for development.SessionManager.kt: Singleton coordinator for authentication state and user profile.SessionRepository.kt: Coordinates data retrieval strategies.SessionRepositoryImpl.kt: Manages persistent storage using SharedPreferences. Migrated to Room Database in the future.AuthRepositoryImpl.kt: Mock implementation (temporary) simulating network delay and user creation. Replaced by Firebase Auth in the future.flowchart TB subgraph SSOT["Single Source of Truth"] SM["SessionManager.kt<br/>- AuthState Flow<br/>- updateSession()<br/>- clearSession()"] end subgraph Repos["Repository Implementations"] ARI["AuthRepositoryImpl<br/>- Mock login()"] SRI["SessionRepositoryImpl<br/>- SharedPreferences"] end subgraph Sources["Data Sources (Planned)"] Remote["Remote API<br/>- Firebase Auth"] Local["Local Storage<br/>- Room Database"] end SM --> SRI ARI --> Remote SRI --> Local style SSOT fill:#e94560,stroke:#c62828,color:#ffffff style Repos fill:#1a1a2e,stroke:#e94560,color:#ffffff style Sources fill:#0f3460,stroke:#16213e,color:#ffffff4. Technical Implementation Standards
4.1 Reactive Orchestration
The application uses Kotlin Coroutines and Flow for all asynchronous operations.
MainActivityobservesSessionManager.isAuthenticated; state changes trigger navigation transitions viaLaunchedEffect.sequenceDiagram participant UI as MainActivity participant SM as SessionManager participant Nav as NavController UI->>SM: collectAsState() SM-->>UI: AuthState (Unauthenticated) UI->>Nav: navigate to Login Note over UI,Nav: User clicks Login UI->>LoginViewModel: onLoginClicked() LoginViewModel->>LoginUseCase: login(email, password) LoginUseCase->>AuthRepository: login(credentials) AuthRepository-->>LoginUseCase: User LoginUseCase->>SessionManager: updateSession(user) SM-->>UI: AuthState (Authenticated) UI->>Nav: navigate to Home4.2 Modularization Strategy
The project is split into granular Gradle modules to improve build times and enforce architectural boundaries:
:app: The main coordinator and DI root.:features:*: Feature-specific UI and ViewModels (e.g.,:features:auth,:features:home).:core:ui: Shared design system components and theming.:core:domain: The platform-agnostic business layer.:core:data: Implementation details for data and external services.4.3 Design System
Located in
:core:ui, the design system defines the application's visual language:RhoRed,RhoStrongGray).5. Roadmap & Evolution: Strategic Phases
The application is transitioning from a modular prototype to a production-hardened system. The evolution is structured into three strategic phases:
Phase I: Dependency Orchestration & Decoupling
@Componentand@Moduleboundaries for:coreand:features.@Injectfor UseCase and ViewModel construction to ensure compile-time dependency safety.Phase II: Transactional Integrity & persistence
flowchart TD A[1. Acquisition<br/>LoginUseCase --> AuthRepository.login] B[2. Persistence<br/>SessionRepository.saveToken] C[3. Validation<br/>ValidateTokenUseCase] D[4. Refresh<br/>RefreshTokenUseCase] E[5. Recovery<br/>SessionManager.initializeSession] F[6. Invalidation<br/>LogoutUseCase] A --> B --> C C -->|"Valid"| G[Use Access Token] C -->|"Expired"| D --> B E --> C F --> H[Reset AuthState] style A fill:#e94560,stroke:#c62828,color:#ffffff style B fill:#16213e,stroke:#0f3460,color:#ffffff style C fill:#1a1a2e,stroke:#e94560,color:#ffffff style D fill:#0f3460,stroke:#16213e,color:#ffffff style E fill:#16213e,stroke:#0f3460,color:#ffffff style F fill:#e94560,stroke:#c62828,color:#ffffff style G fill:#0f3460,stroke:#16213e,color:#ffffff style H fill:#1a1a2e,stroke:#e94560,color:#ffffffPhase III: Verification & Quality Engineering
:core:domainlogic using JUnit 5 and MockK.flowchart LR subgraph Current["Current Flow"] C1[UI] --> C2[ViewModel] --> C3[UseCase] --> C4[Repository] --> C5[SharedPreferences/Mock Auth] end subgraph Planned["Planned Flow"] P1[UI] --> P2[ViewModel] --> P3[UseCase] --> P4[Repository] P4 --> P5[Local: Room Database] P4 --> P6[Remote: Retrofit/Firebase] end Current -.->|"Evolution"| Planned style Current fill:#1a1a2e,stroke:#e94560,color:#ffffff style Planned fill:#0f3460,stroke:#16213e,color:#ffffff6. Verification & Quality Assurance
7. File Registry and responsibilities
Here is the updated table based on the file structure provided:
MainActivity.ktBaseViewModel.ktHeaderViewModel.ktPageHeader.kt/PageFooter.ktLoginScreen.ktLoginViewModel.ktLoginEmailField.ktLoginPasswordField.ktLoginButton.ktHomeScreen.ktHomeViewModel.ktServiceList.ktServiceItem.ktServiceModule.ktBaseUseCase.ktLoginUseCase.ktLogoutUseCase.ktSessionManagerInterface.ktAuthRepository.ktSessionRepository.ktUser.kt/Credentials.ktSessionManager.ktAuthRepositoryImpl.ktSessionRepositoryImpl.ktRefreshTokenUseCase.ktDagger Components8. References & Standards
Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio