This commit is contained in:
kunfei 2022-02-28 15:34:55 +08:00
parent 3b640ff0cb
commit 651d501ff4
3 changed files with 9 additions and 7 deletions

View File

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

View File

@ -98,7 +98,10 @@ class BookSourceEditViewModel(application: Application) : BaseViewModel(applicat
}
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
}
}

View File

@ -78,7 +78,10 @@ class RssSourceEditViewModel(application: Application) : BaseViewModel(applicati
}
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
}
}