Show error notification when new streams notifications failed

This commit is contained in:
Stypox 2021-12-31 20:04:56 +01:00
parent cd95ec4e12
commit ccbc3af964
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
2 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,7 @@ public enum UserAction {
DOWNLOAD_OPEN_DIALOG("download open dialog"), DOWNLOAD_OPEN_DIALOG("download open dialog"),
DOWNLOAD_POSTPROCESSING("download post-processing"), DOWNLOAD_POSTPROCESSING("download post-processing"),
DOWNLOAD_FAILED("download failed"), DOWNLOAD_FAILED("download failed"),
NEW_STREAMS_NOTIFICATIONS("new streams notifications"),
PREFERENCES_MIGRATION("migration of preferences"), PREFERENCES_MIGRATION("migration of preferences"),
SHARE_TO_NEWPIPE("share to newpipe"), SHARE_TO_NEWPIPE("share to newpipe"),
CHECK_FOR_NEW_APP_VERSION("check for new app version"); CHECK_FOR_NEW_APP_VERSION("check for new app version");

View file

@ -17,6 +17,9 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.core.Single
import org.schabi.newpipe.App import org.schabi.newpipe.App
import org.schabi.newpipe.R import org.schabi.newpipe.R
import org.schabi.newpipe.error.ErrorInfo
import org.schabi.newpipe.error.ErrorUtil
import org.schabi.newpipe.error.UserAction
import org.schabi.newpipe.local.feed.service.FeedLoadManager import org.schabi.newpipe.local.feed.service.FeedLoadManager
import org.schabi.newpipe.local.feed.service.FeedLoadService import org.schabi.newpipe.local.feed.service.FeedLoadService
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -59,7 +62,10 @@ class NotificationWorker(
} }
.doOnError { throwable -> .doOnError { throwable ->
Log.e(TAG, "Error while displaying streams notifications", throwable) Log.e(TAG, "Error while displaying streams notifications", throwable)
// TODO show error notification ErrorUtil.createNotification(
applicationContext,
ErrorInfo(throwable, UserAction.NEW_STREAMS_NOTIFICATIONS, "main worker")
)
} }
.onErrorReturnItem(Result.failure()) .onErrorReturnItem(Result.failure())
} else { } else {