Fix backup backward compatibility

This commit is contained in:
Koitharu
2025-06-22 18:35:03 +03:00
parent b4a298ea55
commit 2797ea6a99
2 changed files with 7 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ class BackupRepository @Inject constructor(
private val json = Json { private val json = Json {
allowSpecialFloatingPointValues = true allowSpecialFloatingPointValues = true
coerceInputValues = true coerceInputValues = true
encodeDefaults = true
ignoreUnknownKeys = true ignoreUnknownKeys = true
useAlternativeNames = false useAlternativeNames = false
} }

View File

@@ -6,13 +6,16 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ServiceInfo import android.content.pm.ServiceInfo
import android.net.Uri import android.net.Uri
import android.widget.Toast
import androidx.annotation.CheckResult import androidx.annotation.CheckResult
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.koitharu.kotatsu.R import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.backups.data.BackupRepository import org.koitharu.kotatsu.backups.data.BackupRepository
import org.koitharu.kotatsu.backups.ui.BaseBackupRestoreService import org.koitharu.kotatsu.backups.ui.BaseBackupRestoreService
@@ -64,6 +67,9 @@ class BackupService : BaseBackupRestoreService() {
progressUpdateJob?.cancelAndJoin() progressUpdateJob?.cancelAndJoin()
contentResolver.notifyChange(destination, null) contentResolver.notifyChange(destination, null)
showResultNotification(destination, CompositeResult.success()) showResultNotification(destination, CompositeResult.success())
withContext(Dispatchers.Main) {
Toast.makeText(this@BackupService, R.string.backup_saved, Toast.LENGTH_SHORT).show()
}
} }
} }