pull/1660/head
kunfei 3 years ago
parent 3b640ff0cb
commit 651d501ff4
  1. 6
      app/src/main/java/io/legado/app/help/RuleComplete.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditViewModel.kt
  3. 5
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditViewModel.kt

@ -36,12 +36,8 @@ object RuleComplete {
fun autoComplete( fun autoComplete(
rule: String?, rule: String?,
preRule: String? = null, preRule: String? = null,
type: Int = 1, type: Int = 1
enable: Boolean
): String? { ): String? {
if (!enable) {
return rule
}
if (rule.isNullOrEmpty() || rule.contains(completeIgnore) if (rule.isNullOrEmpty() || rule.contains(completeIgnore)
|| preRule?.contains(completeIgnorePreRule) == true || preRule?.contains(completeIgnorePreRule) == true
) { ) {

@ -98,7 +98,10 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
} }
fun ruleComplete(rule: String?, preRule: String? = null, type: Int = 1): String? { fun ruleComplete(rule: String?, preRule: String? = null, type: Int = 1): String? {
return RuleComplete.autoComplete(rule, preRule, type, autoComplete) if (autoComplete) {
return RuleComplete.autoComplete(rule, preRule, type)
}
return rule
} }
} }

@ -78,7 +78,10 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati
} }
fun ruleComplete(rule: String?, preRule: String? = null, type: Int = 1): String? { fun ruleComplete(rule: String?, preRule: String? = null, type: Int = 1): String? {
return RuleComplete.autoComplete(rule, preRule, type, autoComplete) if (autoComplete) {
return RuleComplete.autoComplete(rule, preRule, type)
}
return rule
} }
} }
Loading…
Cancel
Save