|
|
@ -40,12 +40,11 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
val content = getAllContents(book) |
|
|
|
val content = getAllContents(book) |
|
|
|
DocumentUtils.createFileIfNotExist(doc, filename) |
|
|
|
DocumentUtils.createFileIfNotExist(doc, filename) |
|
|
|
?.writeText(context, content) |
|
|
|
?.writeText(context, content) |
|
|
|
if(App.INSTANCE.getPrefBoolean(PreferKey.webDavExport,false)) { |
|
|
|
if(App.INSTANCE.getPrefBoolean(PreferKey.webDavCacheBackup,false)) { |
|
|
|
//写出文件到cache目录 |
|
|
|
|
|
|
|
FileUtils.createFileIfNotExist( |
|
|
|
FileUtils.createFileIfNotExist( |
|
|
|
File(FileUtils.getCachePath()), |
|
|
|
File(FileUtils.getCachePath()), |
|
|
|
filename |
|
|
|
filename |
|
|
|
).writeText(content) |
|
|
|
).writeText(content) // 写出文件到cache目录 |
|
|
|
// 导出到webdav |
|
|
|
// 导出到webdav |
|
|
|
WebDavHelp.exportWebDav(FileUtils.getCachePath(), filename) |
|
|
|
WebDavHelp.exportWebDav(FileUtils.getCachePath(), filename) |
|
|
|
// 上传完删除cache文件 |
|
|
|
// 上传完删除cache文件 |
|
|
@ -79,7 +78,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
val filename = "${book.name} by ${book.author}.txt" |
|
|
|
val filename = "${book.name} by ${book.author}.txt" |
|
|
|
FileUtils.createFileIfNotExist(file, filename) |
|
|
|
FileUtils.createFileIfNotExist(file, filename) |
|
|
|
.writeText(getAllContents(book)) |
|
|
|
.writeText(getAllContents(book)) |
|
|
|
if(App.INSTANCE.getPrefBoolean(PreferKey.webDavExport,false)) { |
|
|
|
if(App.INSTANCE.getPrefBoolean(PreferKey.webDavCacheBackup,false)) { |
|
|
|
WebDavHelp.exportWebDav(file.absolutePath, filename) // 导出到webdav |
|
|
|
WebDavHelp.exportWebDav(file.absolutePath, filename) // 导出到webdav |
|
|
|
} |
|
|
|
} |
|
|
|
App.db.bookChapterDao().getChapterList(book.bookUrl).forEach { chapter -> |
|
|
|
App.db.bookChapterDao().getChapterList(book.bookUrl).forEach { chapter -> |
|
|
|