mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
0a879d4d90
commit
aca8075a49
@ -44,6 +44,7 @@ import io.legado.app.utils.getPrefInt
|
||||
import io.legado.app.utils.getPrefString
|
||||
import io.legado.app.utils.getSharedPreferences
|
||||
import io.legado.app.utils.isContentScheme
|
||||
import io.legado.app.utils.isJsonArray
|
||||
import io.legado.app.utils.openInputStream
|
||||
import io.legado.app.utils.postEvent
|
||||
import io.legado.app.utils.toastOnUi
|
||||
@ -160,7 +161,10 @@ object Restore {
|
||||
File(path, "servers.json").takeIf {
|
||||
it.exists()
|
||||
}?.run {
|
||||
val json = aes.decryptStr(readText())
|
||||
var json = readText()
|
||||
if (!json.isJsonArray()) {
|
||||
json = aes.decryptStr(json)
|
||||
}
|
||||
GSON.fromJsonArray<Server>(json).getOrNull()?.let {
|
||||
appDb.serverDao.insert(*it.toTypedArray())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user