备份阅读记录

pull/328/head
gedoor 4 years ago
parent 37eaf4fa38
commit 7bd41b0d1c
  1. 2
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  2. 3
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -31,6 +31,7 @@ object Backup {
"rssStar.json",
"replaceRule.json",
"txtTocRule.json",
"readRecord.json",
ReadBookConfig.readConfigFileName,
"config.xml"
)
@ -57,6 +58,7 @@ object Backup {
writeListToJson(App.db.rssStarDao().all, "rssStar.json", backupPath)
writeListToJson(App.db.replaceRuleDao().all, "replaceRule.json", backupPath)
writeListToJson(App.db.txtTocRule().all, "txtTocRule.json", backupPath)
writeListToJson(App.db.readRecordDao().all, "readRecord.json", backupPath)
GSON.toJson(ReadBookConfig.configList)?.let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.readConfigFileName)
.writeText(it)

@ -134,6 +134,9 @@ object Restore {
fileToListT<TxtTocRule>(path, "txtTocRule.json")?.let {
App.db.txtTocRule().insert(*it.toTypedArray())
}
fileToListT<ReadRecord>(path, "readRecord.json")?.let {
App.db.readRecordDao().insert(*it.toTypedArray())
}
}
}

Loading…
Cancel
Save