forked from github/wulkanowy-mirror
Remove retry sync work when completed lessons is disabled (#294)
This commit is contained in:
parent
20d0abba29
commit
4b78862486
@ -11,6 +11,7 @@ import androidx.work.WorkerParameters
|
|||||||
import com.squareup.inject.assisted.Assisted
|
import com.squareup.inject.assisted.Assisted
|
||||||
import com.squareup.inject.assisted.AssistedInject
|
import com.squareup.inject.assisted.AssistedInject
|
||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
|
import io.github.wulkanowy.api.interceptor.FeatureDisabledException
|
||||||
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
|
||||||
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
|
import io.github.wulkanowy.data.repositories.semester.SemesterRepository
|
||||||
import io.github.wulkanowy.data.repositories.student.StudentRepository
|
import io.github.wulkanowy.data.repositories.student.StudentRepository
|
||||||
@ -43,7 +44,8 @@ class SyncWorker @AssistedInject constructor(
|
|||||||
.toSingleDefault(Result.success())
|
.toSingleDefault(Result.success())
|
||||||
.onErrorReturn {
|
.onErrorReturn {
|
||||||
Timber.e(it, "There was an error during synchronization")
|
Timber.e(it, "There was an error during synchronization")
|
||||||
Result.retry()
|
if (it is FeatureDisabledException) Result.success()
|
||||||
|
else Result.retry()
|
||||||
}
|
}
|
||||||
.doOnSuccess { if (preferencesRepository.isDebugNotificationEnable) notify(it) }
|
.doOnSuccess { if (preferencesRepository.isDebugNotificationEnable) notify(it) }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user