fix crashes related to missing Rx error handler (#1561)
This commit is contained in:
parent
7bccf23f69
commit
d6ec5ca8d3
3 changed files with 12 additions and 3 deletions
|
@ -59,6 +59,7 @@ class ConversationsViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
|
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
|
||||||
|
.onErrorReturnItem(0)
|
||||||
.subscribe()
|
.subscribe()
|
||||||
.addTo(disposables)
|
.addTo(disposables)
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,7 @@ class ConversationsViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
|
.doOnError { t -> Log.w("ConversationViewModel", "Failed to favourite conversation", t) }
|
||||||
|
.onErrorReturnItem(0)
|
||||||
.subscribe()
|
.subscribe()
|
||||||
.addTo(disposables)
|
.addTo(disposables)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.keylesspalace.tusky.viewdata.StatusViewData
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
|
import io.reactivex.rxkotlin.addTo
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SearchViewModel @Inject constructor(
|
class SearchViewModel @Inject constructor(
|
||||||
|
@ -89,9 +90,14 @@ class SearchViewModel @Inject constructor(
|
||||||
|
|
||||||
fun removeItem(status: Pair<Status, StatusViewData.Concrete>) {
|
fun removeItem(status: Pair<Status, StatusViewData.Concrete>) {
|
||||||
timelineCases.delete(status.first.id)
|
timelineCases.delete(status.first.id)
|
||||||
.subscribe()
|
.subscribe({
|
||||||
if (loadedStatuses.remove(status))
|
if (loadedStatuses.remove(status))
|
||||||
repoResultStatus.value?.refresh?.invoke()
|
repoResultStatus.value?.refresh?.invoke()
|
||||||
|
}, {
|
||||||
|
err -> Log.d(TAG, "Failed to delete status", err)
|
||||||
|
})
|
||||||
|
.addTo(disposables)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expandedChange(status: Pair<Status, StatusViewData.Concrete>, expanded: Boolean) {
|
fun expandedChange(status: Pair<Status, StatusViewData.Concrete>, expanded: Boolean) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ fun updateShortcut(context: Context, account: AccountEntity) {
|
||||||
|
|
||||||
}
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
.onErrorReturnItem(false)
|
||||||
.subscribe()
|
.subscribe()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue