android / android/architecture-samples

[Question] Should Use Case access another use case or Should use case access multiple repositories?

Open
#754 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
45.8k
Forks
11.9k
PR merge metrics
No merged PRs in 30d

Description

I have some question regarding clean architecture. My Condition is like this

LoginRepositoryImpl.doLogin()
Request -> Do Login to Server
Response <- LoginStatus, ServerToken

the only thing I need to provide for my presentation layer (ViewModel in this scenario) is the LoginStatus. I also need to save the ServerToken to my local storage (SharedPref). What is the proper implementation of clean architecture in this case?

1. Use case Access another use case
DoLoginUseCase(val setServerToken: SetServerTokenUseCase, val repo : LoginRepository)

2. use case access multiple repositories
DoLoginUseCase(val repoToken: TokenRepository, val repoLogin : LoginRepository)

3. another solution?

also, how do I do the package/module separation for that mentioned scenario?

Contributor guide

Open the contributing guide

Research direction

Search for the named LoginRepositoryImpl, DoLoginUseCase, SetServerTokenUseCase, TokenRepository, LoginRepository, ViewModel, and SharedPref usage in the sample. Compare their current package or module boundaries with the three alternatives in the issue; done means documenting an agreed architecture and separation guidance, since no specific file or test is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.