Show notification on error

This commit is contained in:
topjohnwu 2019-07-29 00:37:01 -07:00
parent 85f5ff3c14
commit 0e9b71e7a9

View File

@ -49,7 +49,11 @@ abstract class RemoteFileService : NotificationService() {
.doOnSubscribe { update(subject.hashCode()) { it.setContentTitle(subject.title) } } .doOnSubscribe { update(subject.hashCode()) { it.setContentTitle(subject.title) } }
.subscribeK(onError = { .subscribeK(onError = {
Timber.e(it) Timber.e(it)
remove(subject.hashCode()) finishNotify(subject.hashCode()) { notification ->
notification.setContentText(getString(R.string.download_file_error))
.setSmallIcon(android.R.drawable.stat_notify_error)
.setOngoing(false)
}
}) { }) {
val newId = finishNotify(it, subject) val newId = finishNotify(it, subject)
get<Activity?>()?.run { get<Activity?>()?.run {