mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Show better error message when empty backup creation is attempted
Co-Authored-By: arkon <4098258+ARKon@users.noreply.github.com>
This commit is contained in:
parent
a3686165c4
commit
13bfca7afc
2 changed files with 6 additions and 0 deletions
|
@ -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.BackupCreateService.Companion.BACKUP_CATEGORY
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_CATEGORY_MASK
|
||||
|
@ -85,6 +86,10 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
|||
?: throw Exception("Couldn't create backup file")
|
||||
|
||||
val byteArray = parser.encodeToByteArray(BackupSerializer, backup!!)
|
||||
if (byteArray.isEmpty()) {
|
||||
throw IllegalStateException(context.getString(R.string.empty_backup_error))
|
||||
}
|
||||
|
||||
file.openOutputStream().sink().gzip().buffer().use { it.write(byteArray) }
|
||||
return file.uri.toString()
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -731,6 +731,7 @@
|
|||
<string name="file_is_missing_data">File is missing data.</string>
|
||||
<string name="backup_has_no_manga">Backup does not contain any manga.</string>
|
||||
<string name="backup_failed">Backup failed</string>
|
||||
<string name="empty_backup_error">No library entries to back up</string>
|
||||
<string name="backup_created">Backup created</string>
|
||||
<string name="restore_completed">Restore completed</string>
|
||||
<string name="restore_error">Failed to restore backup</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue