Merge pull request #1588 from Xwite/master

BookSource.kt:移除添加分组支持多个;修复在没有分组的情况下无法添加分组的bug
pull/1592/head
kunfei 3 years ago committed by GitHub
commit b97430f93a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/src/main/java/io/legado/app/data/entities/BookSource.kt

@ -118,17 +118,18 @@ data class BookSource(
fun getContentRule() = ruleContent ?: ContentRule()
fun addGroup(group: String): BookSource {
fun addGroup(groups: String): BookSource {
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
it.add(group)
it.addAll(groups.splitNotBlank(AppPattern.splitGroupRegex))
bookSourceGroup = TextUtils.join(",", it)
}
if (bookSourceGroup.isNullOrBlank()) bookSourceGroup = groups
return this
}
fun removeGroup(group: String): BookSource {
fun removeGroup(groups: String): BookSource {
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
it.remove(group)
it.removeAll(groups.splitNotBlank(AppPattern.splitGroupRegex))
bookSourceGroup = TextUtils.join(",", it)
}
return this

Loading…
Cancel
Save