Skip to content

Conversation

@DTPelopones
Copy link

No description provided.

data class Error(val message: String) : Result()
object ServerError : Result() No newline at end of file
sealed class Result {
data class Success(val fact: Single<Fact>) : Result()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хранится Single, а в MainActivity используется result.fact как Fact
Мы уже получили значение из RxJava цепочки в subscribe, поэтому нужно хранить сам Fact, а не Single. Измените на data class Success(val fact: Fact)

.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ fact ->
_catsLiveData.value = Result.Success(Single.just(fact))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь передается Single.just(fact)
Если исправить sealed, то тут будет Result.Success(fact)

compositeDisposable.add(disposable)
}

private fun handleError(throwable: Throwable) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Метод не используется и его можно удалить

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants