mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Fix favorites sync and backup/restore crashing on older devices
This commit is contained in:
@@ -4,6 +4,7 @@ import android.app.Service
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.os.PowerManager
|
||||
import com.elvishew.xlog.XLog
|
||||
@@ -180,13 +181,17 @@ class BackupRestoreService : Service() {
|
||||
subscription = Observable.using(
|
||||
{
|
||||
// Pause auto-gallery-update during restore
|
||||
EHentaiUpdateWorker.cancelBackground(this)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
EHentaiUpdateWorker.cancelBackground(this)
|
||||
}
|
||||
db.lowLevel().beginTransaction()
|
||||
},
|
||||
{ getRestoreObservable(uri).doOnNext { db.lowLevel().setTransactionSuccessful() } },
|
||||
{
|
||||
// Resume auto-gallery-update
|
||||
EHentaiUpdateWorker.scheduleBackground(this)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
EHentaiUpdateWorker.scheduleBackground(this)
|
||||
}
|
||||
executor.execute { db.lowLevel().endTransaction() }
|
||||
})
|
||||
.doAfterTerminate { stopSelf(startId) }
|
||||
|
||||
Reference in New Issue
Block a user