1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-01-31 15:28:20 +01:00

Remove retry sync work when completed lessons is disabled (#294)

This commit is contained in:
Rafał Borcz 2019-03-22 23:41:41 +01:00 committed by Mikołaj Pich
parent 20d0abba29
commit 4b78862486

View File

@ -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) }
}