Skip to content

Commit e3f25a0

Browse files
LisoUseInAIKyriosoSumAtrIX
authored andcommitted
fix(YouTube - SponsorBlock): Show correct segment behavior in settings UI after importing
1 parent c7d9ccd commit e3f25a0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static void loadAllCategoriesFromSettings() {
136136
@NonNull
137137
public final String keyValue;
138138
@NonNull
139-
private final StringSetting behaviorSetting;
139+
public final StringSetting behaviorSetting;
140140
@NonNull
141141
private final StringSetting colorSetting;
142142

extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategoryListPreference.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ public SegmentCategoryListPreference(Context context, SegmentCategory category)
3131
super(context);
3232
final boolean isHighlightCategory = category == SegmentCategory.HIGHLIGHT;
3333
this.category = Objects.requireNonNull(category);
34-
setKey(category.keyValue);
35-
setDefaultValue(category.behaviour.reVancedKeyValue);
34+
35+
// Edit: Using preferences to sync together multiple pieces
36+
// of code together is messy and should be rethought.
37+
setKey(category.behaviorSetting.key);
38+
setDefaultValue(category.behaviorSetting.defaultValue);
3639
setEntries(isHighlightCategory
3740
? CategoryBehaviour.getBehaviorDescriptionsWithoutSkipOnce()
3841
: CategoryBehaviour.getBehaviorDescriptions());
3942
setEntryValues(isHighlightCategory
4043
? CategoryBehaviour.getBehaviorKeyValuesWithoutSkipOnce()
4144
: CategoryBehaviour.getBehaviorKeyValues());
45+
4246
setSummary(category.description.toString());
4347
updateTitle();
4448
}

0 commit comments

Comments
 (0)