mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 00:39:17 +01:00
Show better error message when empty backup creation is attempted (closes #6941)
This commit is contained in:
parent
cdd4ec6233
commit
189f92d7e8
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.backup.full
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import com.hippo.unifile.UniFile
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.backup.AbstractBackupManager
|
||||
import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY
|
||||
import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY_MASK
|
||||
@ -90,6 +91,10 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
}
|
||||
|
||||
val byteArray = parser.encodeToByteArray(BackupSerializer, backup!!)
|
||||
if (byteArray.isEmpty()) {
|
||||
throw IllegalStateException(context.getString(R.string.empty_backup_error))
|
||||
}
|
||||
|
||||
file.openOutputStream().also {
|
||||
// Force overwrite old file
|
||||
(it as? FileOutputStream)?.channel?.truncate(0)
|
||||
|
@ -451,6 +451,7 @@
|
||||
<string name="backup_choice">What do you want to backup?</string>
|
||||
<string name="creating_backup">Creating backup</string>
|
||||
<string name="creating_backup_error">Backup failed</string>
|
||||
<string name="empty_backup_error">No library entries to back up</string>
|
||||
<string name="restore_miui_warning">Backup/restore may not function properly if MIUI Optimization is disabled.</string>
|
||||
<string name="restore_in_progress">Restore is already in progress</string>
|
||||
<string name="restoring_backup">Restoring backup</string>
|
||||
|
Loading…
Reference in New Issue
Block a user