Skip to content

Commit

Permalink
fix: 通知栏规则组数量显示不正确
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Oct 16, 2023
1 parent 8762d0e commit d31f3ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/li/songe/gkd/service/ManageService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class ManageService : CompositionService({
combine(appIdToRulesFlow, clickCountFlow, storeFlow) { appIdToRules, clickCount, store ->
if (!store.enableService) return@combine "服务已暂停"
val appSize = appIdToRules.keys.size
val groupSize = appIdToRules.values.sumOf { r -> r.size }
val groupSize =
appIdToRules.values.sumOf { rules -> rules.map { r -> r.group.key }.toSet().size }
(if (groupSize > 0) {
"${appSize}应用/${groupSize}规则组"
} else {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/li/songe/gkd/ui/ControlVm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class ControlVm @Inject constructor() : ViewModel() {

val subsStatusFlow = combine(appIdToRulesFlow, clickCountFlow) { appIdToRules, clickCount ->
val appSize = appIdToRules.keys.size
val groupSize = appIdToRules.values.flatten().map { r -> r.group.hashCode() }.toSet().size
val groupSize =
appIdToRules.values.sumOf { rules -> rules.map { r -> r.group.key }.toSet().size }
(if (groupSize > 0) {
"${appSize}应用/${groupSize}规则组"
} else {
Expand Down

0 comments on commit d31f3ae

Please sign in to comment.