mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Fix favorites sync and backup/restore crashing on older devices
This commit is contained in:
		@@ -249,6 +249,7 @@ class EHentaiUpdateWorker: JobService(), CoroutineScope {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
 | 
			
		||||
    companion object {
 | 
			
		||||
        private const val MAX_UPDATE_FAILURES = 5
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user