diff --git a/app/src/main/java/io/legado/app/help/storage/Backup.kt b/app/src/main/java/io/legado/app/help/storage/Backup.kt
index fac7826be..6bd8cd01c 100644
--- a/app/src/main/java/io/legado/app/help/storage/Backup.kt
+++ b/app/src/main/java/io/legado/app/help/storage/Backup.kt
@@ -3,6 +3,7 @@ package io.legado.app.help.storage
import android.content.Context
import android.net.Uri
import androidx.documentfile.provider.DocumentFile
+import io.legado.app.R
import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.help.DefaultData
@@ -49,6 +50,8 @@ object Backup {
if (lastBackup + TimeUnit.DAYS.toMillis(1) < System.currentTimeMillis()) {
Coroutine.async {
backup(context, context.getPrefString(PreferKey.backupPath) ?: "", true)
+ }.onError {
+ appCtx.toastOnUi(R.string.autobackup_fail)
}
}
}
diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
index 1b6c8ba45..18c274561 100644
--- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
@@ -52,6 +52,8 @@ class BackupConfigFragment : BasePreferenceFragment(),
Backup.backup(appCtx, uri.toString())
}.onSuccess {
appCtx.toastOnUi(R.string.backup_success)
+ }.onError {
+ appCtx.toastOnUi(R.string.backup_fail)
}
} else {
uri.path?.let { path ->
@@ -60,6 +62,8 @@ class BackupConfigFragment : BasePreferenceFragment(),
Backup.backup(appCtx, path)
}.onSuccess {
appCtx.toastOnUi(R.string.backup_success)
+ }.onError {
+ appCtx.toastOnUi(R.string.backup_fail)
}
}
}
@@ -231,6 +235,8 @@ class BackupConfigFragment : BasePreferenceFragment(),
Backup.backup(requireContext(), backupPath)
}.onSuccess {
toastOnUi(R.string.backup_success)
+ }.onError {
+ toastOnUi(R.string.backup_fail)
}
} else {
backupDir.launch(null)
@@ -251,6 +257,8 @@ class BackupConfigFragment : BasePreferenceFragment(),
Backup.backup(requireContext(), path)
}.onSuccess {
toastOnUi(R.string.backup_success)
+ }.onError {
+ toastOnUi(R.string.backup_fail)
}
}
.request()
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 502e9f89d..910663504 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -846,5 +846,6 @@
url为空
字典
未知错误
+ 自动备份失败
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 89624f0ec..92954b0a0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -848,5 +848,6 @@
Null url
字典
未知错误
+ Autobackup failed