From 441545d6adc4155bc75d94985de850119fe98f7c Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 26 May 2026 17:54:16 +0530 Subject: [PATCH] Update architecture docs for user news resource flow --- docs/ArchitectureLearningJourney.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/ArchitectureLearningJourney.md b/docs/ArchitectureLearningJourney.md index d98dadf1e..8eee0419b 100644 --- a/docs/ArchitectureLearningJourney.md +++ b/docs/ArchitectureLearningJourney.md @@ -72,9 +72,9 @@ Here's what's happening in each step. The easiest way to find the associated cod 2 - The ForYouViewModel calls GetUserNewsResourcesUseCase to obtain a stream of news resources with their bookmarked/saved state. No items will be emitted into this stream until both the user and news repositories emit an item. While waiting, the feed state is set to Loading. + The ForYouViewModel calls UserNewsResourceRepository.observeAllForFollowedTopics to obtain a stream of news resources with their bookmarked/saved state. The repository implementation combines news resources from NewsRepository with user data from UserDataRepository. While waiting, the feed state is set to Loading. - Search for usages of NewsFeedUiState.Loading + ForYouViewModel.feedState @@ -144,9 +144,9 @@ Here's what's happening in each step. The easiest way to find the associated cod 11 - GetUserNewsResourcesUseCase combines the list of news resources with the user data to emit a list of UserNewsResources. + CompositeUserNewsResourceRepository combines the list of news resources with the user data to emit a list of UserNewsResources. - GetUserNewsResourcesUseCase.invoke + CompositeUserNewsResourceRepository.observeAll @@ -256,7 +256,7 @@ The [domain layer](https://developer.android.com/topic/architecture/domain-layer These use cases are used to simplify and remove duplicate logic from ViewModels. They typically combine and transform data from repositories. -For example, `GetUserNewsResourcesUseCase` combines a stream (implemented using `Flow`) of `NewsResource`s from a `NewsRepository` with a stream of `UserData` objects from a `UserDataRepository` to create a stream of `UserNewsResource`s. This stream is used by various ViewModels to display news resources on screen with their bookmarked state. +For example, `GetFollowableTopicsUseCase` combines a stream (implemented using `Flow`) of `List` from a `TopicsRepository` with a stream of `UserData` objects from a `UserDataRepository` to create a stream of `List`. This stream is used by various ViewModels to display topics on screen with their followed state. Notably, the domain layer in Now in Android _does not_ (for now) contain any use cases for event handling. Events are handled by the UI layer calling methods on repositories directly.