android / android/architecture-samples

getTasks(forceUpdate: Boolean) redundant?

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

Description

`suspend fun getTasks(forceUpdate: Boolean): Result>`

This is implemented by DefaultTasksRepository. Is it really necessary if the tasks are refreshed by ViewModel, which in turn calls updateTasksFromRemoteDataSource() ?

```
override suspend fun getTasks(forceUpdate: Boolean): Result> {
if (forceUpdate) {
try {
updateTasksFromRemoteDataSource()
} catch (ex: Exception) {
return Result.Error(ex)
}
}
return tasksLocalDataSource.getTasks()
}
```

Contributor guide

Open the contributing guide

Research direction

Read DefaultTasksRepository's getTasks(forceUpdate) implementation alongside the ViewModel call to updateTasksFromRemoteDataSource() and tasksLocalDataSource.getTasks(). Trace when each entry point refreshes data, then document and implement the decided repository API behavior, with tests covering refresh and local-read paths.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.