优化
This commit is contained in:
@@ -48,7 +48,6 @@ import io.legado.app.utils.isJsonArray
|
||||
import io.legado.app.utils.openInputStream
|
||||
import io.legado.app.utils.postEvent
|
||||
import io.legado.app.utils.toastOnUi
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.Dispatchers.Main
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
@@ -81,7 +80,6 @@ object Restore {
|
||||
|
||||
suspend fun restore(path: String) {
|
||||
val aes = BackupAES()
|
||||
withContext(IO) {
|
||||
fileToListT<Book>(path, "bookshelf.json")?.let {
|
||||
it.forEach { book ->
|
||||
book.upType()
|
||||
@@ -218,7 +216,12 @@ object Restore {
|
||||
if (BackupConfig.keyIsNotIgnore(key)) {
|
||||
when (key) {
|
||||
PreferKey.webDavPassword -> {
|
||||
edit.putString(key, aes.decryptStr(value.toString()))
|
||||
edit.putString(
|
||||
key,
|
||||
kotlin.runCatching {
|
||||
aes.decryptStr(value.toString())
|
||||
}.getOrDefault(value.toString())
|
||||
)
|
||||
}
|
||||
|
||||
else -> when (value) {
|
||||
@@ -240,7 +243,6 @@ object Restore {
|
||||
hideNavigationBar = appCtx.getPrefBoolean(PreferKey.hideNavigationBar)
|
||||
autoReadSpeed = appCtx.getPrefInt(PreferKey.autoReadSpeed, 46)
|
||||
}
|
||||
}
|
||||
appCtx.toastOnUi(R.string.restore_success)
|
||||
withContext(Main) {
|
||||
delay(100)
|
||||
|
||||
Reference in New Issue
Block a user