背景同步
This commit is contained in:
@@ -191,9 +191,12 @@ object AppWebDav {
|
|||||||
/**
|
/**
|
||||||
* 下载背景图片
|
* 下载背景图片
|
||||||
*/
|
*/
|
||||||
suspend fun downBgs(fileNames: String) {
|
suspend fun downBgs() {
|
||||||
val authorization = authorization ?: return
|
val authorization = authorization ?: return
|
||||||
if (!NetworkUtils.isAvailable()) return
|
if (!NetworkUtils.isAvailable()) return
|
||||||
|
val bgWebDavFiles = getAllBgWebDavFiles().getOrThrow()
|
||||||
|
.map { it.displayName }
|
||||||
|
.toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun exportWebDav(byteArray: ByteArray, fileName: String) {
|
suspend fun exportWebDav(byteArray: ByteArray, fileName: String) {
|
||||||
|
|||||||
@@ -131,6 +131,22 @@ object ReadBookConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getAllPicBgStr(): ArrayList<String> {
|
||||||
|
val list = arrayListOf<String>()
|
||||||
|
configList.forEach {
|
||||||
|
if (it.bgType == 2) {
|
||||||
|
list.add(it.bgStr)
|
||||||
|
}
|
||||||
|
if (it.bgTypeNight == 2) {
|
||||||
|
list.add(it.bgStrNight)
|
||||||
|
}
|
||||||
|
if (it.bgTypeEInk == 2) {
|
||||||
|
list.add(it.bgStrEInk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteDur(): Boolean {
|
fun deleteDur(): Boolean {
|
||||||
if (configList.size > 5) {
|
if (configList.size > 5) {
|
||||||
configList.removeAt(styleSelect)
|
configList.removeAt(styleSelect)
|
||||||
|
|||||||
@@ -190,8 +190,14 @@ object Backup {
|
|||||||
FileUtils.delete(backupPath)
|
FileUtils.delete(backupPath)
|
||||||
FileUtils.delete(zipFilePath)
|
FileUtils.delete(zipFilePath)
|
||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
appCtx.externalFiles.getFile("bg").listFiles()?.let {
|
ReadBookConfig.getAllPicBgStr().map {
|
||||||
AppWebDav.upBgs(it)
|
if (it.contains(File.separator)) {
|
||||||
|
File(it)
|
||||||
|
} else {
|
||||||
|
appCtx.externalFiles.getFile("bg", it)
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
AppWebDav.upBgs(it.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import io.legado.app.BuildConfig
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.AppConst.androidId
|
import io.legado.app.constant.AppConst.androidId
|
||||||
import io.legado.app.constant.AppLog
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.constant.EventBus
|
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.Book
|
import io.legado.app.data.entities.Book
|
||||||
@@ -25,6 +24,7 @@ import io.legado.app.data.entities.RuleSub
|
|||||||
import io.legado.app.data.entities.SearchKeyword
|
import io.legado.app.data.entities.SearchKeyword
|
||||||
import io.legado.app.data.entities.Server
|
import io.legado.app.data.entities.Server
|
||||||
import io.legado.app.data.entities.TxtTocRule
|
import io.legado.app.data.entities.TxtTocRule
|
||||||
|
import io.legado.app.help.AppWebDav
|
||||||
import io.legado.app.help.DirectLinkUpload
|
import io.legado.app.help.DirectLinkUpload
|
||||||
import io.legado.app.help.LauncherIconHelp
|
import io.legado.app.help.LauncherIconHelp
|
||||||
import io.legado.app.help.book.isLocal
|
import io.legado.app.help.book.isLocal
|
||||||
@@ -46,7 +46,6 @@ import io.legado.app.utils.getSharedPreferences
|
|||||||
import io.legado.app.utils.isContentScheme
|
import io.legado.app.utils.isContentScheme
|
||||||
import io.legado.app.utils.isJsonArray
|
import io.legado.app.utils.isJsonArray
|
||||||
import io.legado.app.utils.openInputStream
|
import io.legado.app.utils.openInputStream
|
||||||
import io.legado.app.utils.postEvent
|
|
||||||
import io.legado.app.utils.toastOnUi
|
import io.legado.app.utils.toastOnUi
|
||||||
import kotlinx.coroutines.Dispatchers.Main
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@@ -213,6 +212,7 @@ object Restore {
|
|||||||
AppLog.put("恢复阅读界面出错\n${it.localizedMessage}", it)
|
AppLog.put("恢复阅读界面出错\n${it.localizedMessage}", it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AppWebDav.downBgs()
|
||||||
appCtx.getSharedPreferences(path, "config")?.all?.let { map ->
|
appCtx.getSharedPreferences(path, "config")?.all?.let { map ->
|
||||||
val edit = appCtx.defaultSharedPreferences.edit()
|
val edit = appCtx.defaultSharedPreferences.edit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user