Skip to content

Commit 84502c3

Browse files
committed
fix: app group enableSize (#1162)
1 parent 8dd2dca commit 84502c3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/src/main/kotlin/li/songe/gkd/ui/SubsAppListVm.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class SubsAppListVm(stateHandle: SavedStateHandle) : BaseViewModel() {
151151
rawApp = it.first,
152152
appInfo = it.second,
153153
appConfig = appConfigs.find { s -> s.appId == it.first.id },
154-
configSize = enableSize,
154+
enableSize = enableSize,
155155
)
156156
}
157157
}.stateInit(emptyList())
@@ -169,7 +169,7 @@ data class SubsAppInfoItem(
169169
val rawApp: RawSubscription.RawApp,
170170
val appInfo: AppInfo?,
171171
val appConfig: AppConfig?,
172-
val configSize: Int,
172+
val enableSize: Int,
173173
) {
174174
val id get() = rawApp.id
175175
}

app/src/main/kotlin/li/songe/gkd/ui/component/SubsAppCard.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import li.songe.gkd.ui.style.appItemPadding
2323
@Composable
2424
fun SubsAppCard(
2525
data: SubsAppInfoItem,
26-
enableSize: Int = data.rawApp.groups.count { g -> g.enable ?: true },
2726
onClick: (() -> Unit),
2827
onValueChange: ((Boolean) -> Unit),
2928
) {
@@ -43,10 +42,10 @@ fun SubsAppCard(
4342
) {
4443
AppNameText(appInfo = data.appInfo, fallbackName = data.rawApp.name)
4544
if (rawApp.groups.isNotEmpty()) {
46-
val enableDesc = when (enableSize) {
45+
val enableDesc = when (data.enableSize) {
4746
0 -> "${rawApp.groups.size}组规则/${rawApp.groups.size}关闭"
4847
rawApp.groups.size -> "${rawApp.groups.size}组规则"
49-
else -> "${rawApp.groups.size}组规则/${enableSize}启用/${rawApp.groups.size - enableSize}关闭"
48+
else -> "${rawApp.groups.size}组规则/${data.enableSize}启用/${rawApp.groups.size - data.enableSize}关闭"
5049
}
5150
Text(
5251
text = enableDesc,

0 commit comments

Comments
 (0)