fix crashes related to missing Rx error handler (#1561)

This commit is contained in:
Konrad Pozniak 2019-11-17 20:59:13 +01:00 committed by GitHub
parent 7bccf23f69
commit d6ec5ca8d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -59,6 +59,7 @@ class ConversationsViewModel @Inject constructor(
}
.subscribeOn(Schedulers.io())
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
.onErrorReturnItem(0)
.subscribe()
.addTo(disposables)
}
@ -77,6 +78,7 @@ class ConversationsViewModel @Inject constructor(
}
.subscribeOn(Schedulers.io())
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
.onErrorReturnItem(0)
.subscribe()
.addTo(disposables)
}

View File

@ -19,6 +19,7 @@ import com.keylesspalace.tusky.viewdata.StatusViewData
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.addTo
import javax.inject.Inject
class SearchViewModel @Inject constructor(
@ -89,9 +90,14 @@ class SearchViewModel @Inject constructor(
fun removeItem(status: Pair<Status, StatusViewData.Concrete>) {
timelineCases.delete(status.first.id)
.subscribe()
if (loadedStatuses.remove(status))
repoResultStatus.value?.refresh?.invoke()
.subscribe({
if (loadedStatuses.remove(status))
repoResultStatus.value?.refresh?.invoke()
}, {
err -> Log.d(TAG, "Failed to delete status", err)
})
.addTo(disposables)
}
fun expandedChange(status: Pair<Status, StatusViewData.Concrete>, expanded: Boolean) {

View File

@ -89,6 +89,7 @@ fun updateShortcut(context: Context, account: AccountEntity) {
}
.subscribeOn(Schedulers.io())
.onErrorReturnItem(false)
.subscribe()