Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-23 17:39:23 +05:00
parent d2f28313e9
commit 96d5f31d82
4 changed files with 25 additions and 26 deletions

View file

@ -28,7 +28,7 @@ interface NewsRepository {
*
* @param config config for getting news list
*/
fun getNews(config: NewsListConfig, limit: Int): Flow<List<ShortArticle>>
fun getNews(config: NewsListConfig, limit: Int): Flow<Either<Throwable, List<ShortArticle>>>
/**
* Observes cached detailed articles.

View file

@ -8,11 +8,9 @@ import kotlinx.coroutines.flow.Flow
class GetNewsUseCase(private val repository: NewsRepository) {
fun getNews(limit: Int, newsListConfig: NewsListConfig): Either<Throwable, Flow<List<ShortArticle>>> =
Either.catch {
repository.getNews(
config = newsListConfig,
limit = limit,
)
}
fun getNews(limit: Int, newsListConfig: NewsListConfig): Flow<Either<Throwable, List<ShortArticle>>> =
repository.getNews(
config = newsListConfig,
limit = limit,
)
}