restore bookSource fix

pull/1284/head
Jason Yao 3 years ago
parent 4066608c26
commit 57d1df4fe5
  1. 2
      app/src/main/java/io/legado/app/help/storage/ImportOldData.kt
  2. 4
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -92,7 +92,7 @@ object ImportOldData {
return books.size
}
private fun importOldSource(json: String): Int {
fun importOldSource(json: String): Int {
val bookSources = mutableListOf<BookSource>()
val items: List<Map<String, Any>> = Restore.jsonPath.parse(json).read("$")
for (item in items) {

@ -125,6 +125,10 @@ object Restore {
}
fileToListT<BookSource>(path, "bookSource.json")?.let {
appDb.bookSourceDao.insert(*it.toTypedArray())
} ?: run {
val bookSourceFile = FileUtils.createFileIfNotExist(path + File.separator + "bookSource.json")
val json = bookSourceFile.readText()
ImportOldData.importOldSource(json)
}
fileToListT<RssSource>(path, "rssSources.json")?.let {
appDb.rssSourceDao.insert(*it.toTypedArray())

Loading…
Cancel
Save