pull/433/head
gedoor 4 years ago
parent b55d511ce0
commit 027fc778ac
  1. 19
      app/src/main/java/io/legado/app/help/BookHelp.kt

@ -11,7 +11,6 @@ import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -307,17 +306,13 @@ object BookHelp {
private var replaceRules: List<ReplaceRule> = arrayListOf() private var replaceRules: List<ReplaceRule> = arrayListOf()
@Synchronized @Synchronized
suspend fun upReplaceRules() { fun upReplaceRules() {
withContext(IO) { val o = bookOrigin
synchronized(this) { bookName?.let {
val o = bookOrigin replaceRules = if (o.isNullOrEmpty()) {
bookName?.let { App.db.replaceRuleDao().findEnabledByScope(it)
replaceRules = if (o.isNullOrEmpty()) { } else {
App.db.replaceRuleDao().findEnabledByScope(it) App.db.replaceRuleDao().findEnabledByScope(it, o)
} else {
App.db.replaceRuleDao().findEnabledByScope(it, o)
}
}
} }
} }
} }

Loading…
Cancel
Save