Skip to content
Launch GitLab Knowledge Graph

Refactor to Hilt dependency injection for RecommendationService

Overview

Migrates RecommendationService from manual DI to Hilt for better testability and cleaner code.

Changes

  • Created NetworkModule with Hilt annotations
  • Migrated RecommendationViewModel to use @HiltViewModel
  • Removed manual DI boilerplate
  • Added OkHttp interceptor for auth token injection

Benefits

  • Easier to write unit tests with test modules
  • Reduced boilerplate code by ~40%
  • Better separation of concerns
  • Standardized DI approach across the app

Testing

  • All existing unit tests pass
  • Added new tests for NetworkModule
  • Verified recommendation loading in app

Closes #11 (closed)

@stanhu FYI we are standardizing on Hilt across the Android app

Merge request reports

Loading