diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt index 515d34f0..dd28b0cc 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt @@ -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) } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt index 695fd5ee..122701c9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt @@ -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) { 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, expanded: Boolean) { diff --git a/app/src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt b/app/src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt index 9c0cd0c7..5aef288c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/ShareShortcutHelper.kt @@ -89,6 +89,7 @@ fun updateShortcut(context: Context, account: AccountEntity) { } .subscribeOn(Schedulers.io()) + .onErrorReturnItem(false) .subscribe()