-
Notifications
You must be signed in to change notification settings - Fork 1
Android Architecture
Garot Conklin edited this page Dec 15, 2024
·
1 revision
RunOn! follows Clean Architecture principles with MVVM (Model-View-ViewModel) pattern for the presentation layer. This ensures separation of concerns, testability, and maintainability.
- Activities/Composables: UI containers and navigation hosts
- Compose UI: Declarative UI components
- ViewModels: UI state management and business logic
- UI State: Immutable state objects
- UI Events: User interactions and UI events
- Unidirectional Data Flow: State flows down, events flow up
- State Hoisting: State management pattern for Compose
- Screen-based Architecture: Each major feature is a separate screen module
- Use Cases: Business logic operations
- Domain Models: Core business objects
- Repository Interfaces: Data access contracts
- Domain Events: Business event definitions
- Clean Architecture: Separation of domain logic
- Single Responsibility: Each use case handles one operation
- Dependency Inversion: Domain layer defines interfaces
- Repositories: Data access implementation
- Data Sources: Remote and local data providers
- DTOs: Data transfer objects
- Mappers: Object transformations
- Repository Pattern: Single source of truth
- Offline First: Local cache as primary data source
- Data Mapping: Clear separation between data and domain models
app/
├── core/
│ ├── common/ # Shared utilities and extensions
│ ├── design/ # Design system and UI components
│ ├── navigation/ # Navigation components
│ └── testing/ # Test utilities and fakes
├── data/
│ ├── remote/ # API and remote data sources
│ ├── local/ # Room database and local storage
│ └── repository/ # Repository implementations
├── domain/
│ ├── model/ # Domain models
│ ├── repository/ # Repository interfaces
│ └── usecase/ # Business logic use cases
└── features/
├── events/ # Event discovery feature
├── calendar/ # Calendar integration
├── social/ # Social features
└── profile/ # User profile management
- Hilt for dependency injection
- Module-level component provision
- Scoped dependencies for efficient resource usage
- Navigation Compose for screen navigation
- Deep linking support
- Type-safe navigation arguments
data class EventsUiState(
val events: List<Event> = emptyList(),
val isLoading: Boolean = false,
val error: String? = null
)
sealed interface EventsUiEvent {
data class OnEventSelected(val eventId: String) : EventsUiEvent
object OnRefreshRequested : EventsUiEvent
// ... other events
}- Centralized error handling
- Error mapping to UI states
- Consistent error presentation
- Unit Tests: Domain and ViewModel logic
- Integration Tests: Repository and data layer
- UI Tests: Critical user flows
- Screenshot Tests: UI components
-
UI Layer:
- Composables observe ViewModel state
- User actions trigger UI events
- ViewModels process events
-
Domain Layer:
- Use cases execute business logic
- Repository interfaces define data contracts
- Domain models represent business objects
-
Data Layer:
- Repositories coordinate data sources
- Data sources handle raw data
- Mappers transform between layers
- Data Encryption: Sensitive data encryption at rest
- Network Security: SSL pinning and secure communication
- Authentication: AWS Cognito integration
- Authorization: Role-based access control
- Lazy Loading: On-demand resource loading
- Caching: Multi-level caching strategy
- Background Processing: WorkManager for background tasks
- Memory Management: Lifecycle-aware components
- Crash Reporting: Crashlytics integration
- Performance Monitoring: Firebase Performance
- Analytics: User behavior tracking
- Logging: Structured logging strategy
- Modularization: Further module separation
- Dynamic Features: On-demand feature delivery
- Compose Multiplatform: Potential iOS support
- Backend-Driven UI: Server-driven UI components
© RunOn! 2024
Full-Featured Documentation
- Android Technical Stack (Archived)
- Android Architecture (Archived)
- Business Prospectus (Archived)
- Feature Specifications (Archived)
- UI/UX Design (Archived)