mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 13:08:21 +01:00
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.AssistedInject
|
||||
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.semester.SemesterRepository
|
||||
import io.github.wulkanowy.data.repositories.student.StudentRepository
|
||||
@ -43,7 +44,8 @@ class SyncWorker @AssistedInject constructor(
|
||||
.toSingleDefault(Result.success())
|
||||
.onErrorReturn {
|
||||
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) }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user