diff --git a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt index e27eaf708..0e62ca68f 100644 --- a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt +++ b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt @@ -92,7 +92,7 @@ object ImportOldData { return books.size } - private fun importOldSource(json: String): Int { + fun importOldSource(json: String): Int { val bookSources = mutableListOf() val items: List> = Restore.jsonPath.parse(json).read("$") for (item in items) { diff --git a/app/src/main/java/io/legado/app/help/storage/Restore.kt b/app/src/main/java/io/legado/app/help/storage/Restore.kt index 2d797472b..7b0777ee3 100644 --- a/app/src/main/java/io/legado/app/help/storage/Restore.kt +++ b/app/src/main/java/io/legado/app/help/storage/Restore.kt @@ -125,6 +125,10 @@ object Restore { } fileToListT(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(path, "rssSources.json")?.let { appDb.rssSourceDao.insert(*it.toTypedArray())