aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-02 14:05:41 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-02 14:05:41 +0200
commitca92e104ae88717e307593b777f4d360612c08fc (patch)
tree0af476f990193cb93770b06f70d379c1ced9463d /src/main
parente246c086141740668923f5b8c6d3b0ca5b0ea042 (diff)
downloadskyhanni-ca92e104ae88717e307593b777f4d360612c08fc.tar.gz
skyhanni-ca92e104ae88717e307593b777f4d360612c08fc.tar.bz2
skyhanni-ca92e104ae88717e307593b777f4d360612c08fc.zip
Fixed display name for new features if they are just the main toggle to a category
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt
index fc8c4bd92..b3d3f74b7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt
@@ -11,8 +11,9 @@ import java.util.*
class FeatureToggleProcessor : ConfigStructureReader {
- var latestCategory: Category? = null
- val pathStack = Stack<String>()
+ private var latestCategory: Category? = null
+ private val pathStack = Stack<String>()
+ private val accordionStack = Stack<String>()
val allOptions = mutableListOf<FeatureToggleableOption>()
val orderedOptions by lazy {
@@ -26,10 +27,13 @@ class FeatureToggleProcessor : ConfigStructureReader {
override fun endCategory() {
}
- override fun beginAccordion(baseObject: Any?, field: Field?, option: ConfigOption?, id: Int) {
+ override fun beginAccordion(baseObject: Any?, field: Field?, o: ConfigOption?, id: Int) {
+ val option = o ?: return
+ accordionStack.push(option.name)
}
override fun endAccordion() {
+ accordionStack.pop()
}
override fun pushPath(fieldPath: String) {
@@ -63,9 +67,15 @@ class FeatureToggleProcessor : ConfigStructureReader {
else -> error("Invalid FeatureToggle type: $field")
}
+
+ var name = option.name
+ if ((name == "Enable" || name == "Enabled") && !accordionStack.empty()) {
+ name = accordionStack.peek()
+ }
+
allOptions.add(
FeatureToggleableOption(
- option.name,
+ name,
option.desc,
value,
featureToggle.trueIsEnabled,