Fix favorites sync and backup/restore crashing on older devices

This commit is contained in:
NerdNumber9
2019-04-20 14:01:18 -04:00
parent b06f253f83
commit 895191814e
3 changed files with 15 additions and 4 deletions

View File

@ -249,6 +249,7 @@ class EHentaiUpdateWorker: JobService(), CoroutineScope {
}
}
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
companion object {
private const val MAX_UPDATE_FAILURES = 5

View File

@ -2,6 +2,7 @@ package exh.favorites
import android.content.Context
import android.net.wifi.WifiManager
import android.os.Build
import android.os.PowerManager
import com.elvishew.xlog.XLog
import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -114,7 +115,9 @@ class FavoritesSyncHelper(val context: Context) {
}
// Do not update galleries while syncing favorites
EHentaiUpdateWorker.cancelBackground(context)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
EHentaiUpdateWorker.cancelBackground(context)
}
storage.getRealm().use { realm ->
realm.trans {
@ -167,7 +170,9 @@ class FavoritesSyncHelper(val context: Context) {
}
// Update galleries again!
EHentaiUpdateWorker.scheduleBackground(context)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
EHentaiUpdateWorker.scheduleBackground(context)
}
}
if(errorList.isEmpty())