Skip to content

Commit d46ff98

Browse files
refactor(YouTube): Sort and standardize strings (#5442)
1 parent cc42efb commit d46ff98

File tree

5 files changed

+53
-54
lines changed

5 files changed

+53
-54
lines changed

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/LayoutComponentsFilter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class LayoutComponentsFilter extends Filter {
3232
);
3333

3434
private final StringTrieSearch exceptions = new StringTrieSearch();
35-
private final StringFilterGroup inFeedSurvey;
35+
private final StringFilterGroup surveys;
3636
private final StringFilterGroup notifyMe;
3737
private final StringFilterGroup singleItemInformationPanel;
3838
private final StringFilterGroup expandableMetadata;
@@ -110,8 +110,8 @@ public LayoutComponentsFilter() {
110110
"chip_bar"
111111
);
112112

113-
inFeedSurvey = new StringFilterGroup(
114-
Settings.HIDE_FEED_SURVEY,
113+
surveys = new StringFilterGroup(
114+
Settings.HIDE_SURVEYS,
115115
"in_feed_survey",
116116
"slimline_survey",
117117
"feed_nudge"
@@ -286,7 +286,6 @@ public LayoutComponentsFilter() {
286286
forYouShelf,
287287
horizontalShelves,
288288
imageShelf,
289-
inFeedSurvey,
290289
infoPanel,
291290
latestPosts,
292291
medicalPanel,
@@ -298,6 +297,7 @@ public LayoutComponentsFilter() {
298297
singleItemInformationPanel,
299298
subscribersCommunityGuidelines,
300299
subscriptionsChipBar,
300+
surveys,
301301
timedReactions,
302302
videoRecommendationLabels
303303
);
@@ -317,7 +317,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
317317

318318
// The groups are excluded from the filter due to the exceptions list below.
319319
// Filter them separately here.
320-
if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata) {
320+
if (matchedGroup == notifyMe || matchedGroup == surveys || matchedGroup == expandableMetadata) {
321321
return true;
322322
}
323323

extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public class Settings extends BaseSettings {
100100
public static final BooleanSetting HIDE_CROWDFUNDING_BOX = new BooleanSetting("revanced_hide_crowdfunding_box", FALSE, true);
101101
public static final BooleanSetting HIDE_DOODLES = new BooleanSetting("revanced_hide_doodles", FALSE, true, "revanced_hide_doodles_user_dialog_message");
102102
public static final BooleanSetting HIDE_EXPANDABLE_CARD = new BooleanSetting("revanced_hide_expandable_card", TRUE);
103-
public static final BooleanSetting HIDE_FEED_SURVEY = new BooleanSetting("revanced_hide_feed_survey", TRUE);
104103
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_FEED = new BooleanSetting("revanced_hide_filter_bar_feed_in_feed", FALSE, true);
105104
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_HISTORY = new BooleanSetting("revanced_hide_filter_bar_feed_in_history", FALSE);
106105
public static final BooleanSetting HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS = new BooleanSetting("revanced_hide_filter_bar_feed_in_related_videos", FALSE, true);
@@ -113,6 +112,7 @@ public class Settings extends BaseSettings {
113112
public static final BooleanSetting HIDE_NOTIFY_ME_BUTTON = new BooleanSetting("revanced_hide_notify_me_button", TRUE);
114113
public static final BooleanSetting HIDE_PLAYABLES = new BooleanSetting("revanced_hide_playables", TRUE);
115114
public static final BooleanSetting HIDE_SHOW_MORE_BUTTON = new BooleanSetting("revanced_hide_show_more_button", TRUE, true);
115+
public static final BooleanSetting HIDE_SURVEYS = new BooleanSetting("revanced_hide_surveys", TRUE);
116116
public static final BooleanSetting HIDE_TICKET_SHELF = new BooleanSetting("revanced_hide_ticket_shelf", FALSE);
117117
public static final BooleanSetting HIDE_VIDEO_RECOMMENDATION_LABELS = new BooleanSetting("revanced_hide_video_recommendation_labels", TRUE);
118118

patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ val hideLayoutComponentsPatch = bytecodePatch(
201201
key = "revanced_hide_filter_bar_screen",
202202
preferences = setOf(
203203
SwitchPreference("revanced_hide_filter_bar_feed_in_feed"),
204-
SwitchPreference("revanced_hide_filter_bar_feed_in_history"),
205-
SwitchPreference("revanced_hide_filter_bar_feed_in_search"),
206204
SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"),
205+
SwitchPreference("revanced_hide_filter_bar_feed_in_search"),
206+
SwitchPreference("revanced_hide_filter_bar_feed_in_history"),
207207
),
208208
),
209209
PreferenceScreenPreference(
@@ -223,7 +223,6 @@ val hideLayoutComponentsPatch = bytecodePatch(
223223
SwitchPreference("revanced_hide_crowdfunding_box"),
224224
SwitchPreference("revanced_hide_chips_shelf"),
225225
SwitchPreference("revanced_hide_expandable_card"),
226-
SwitchPreference("revanced_hide_feed_survey"),
227226
SwitchPreference("revanced_hide_floating_microphone_button"),
228227
SwitchPreference("revanced_hide_horizontal_shelves"),
229228
SwitchPreference("revanced_hide_image_shelf"),
@@ -233,6 +232,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
233232
SwitchPreference("revanced_hide_notify_me_button"),
234233
SwitchPreference("revanced_hide_playables"),
235234
SwitchPreference("revanced_hide_show_more_button"),
235+
SwitchPreference("revanced_hide_surveys"),
236236
SwitchPreference("revanced_hide_ticket_shelf"),
237237
SwitchPreference("revanced_hide_video_recommendation_labels"),
238238
SwitchPreference("revanced_hide_doodles"),

patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ private val hideShortsComponentsResourcePatch = resourcePatch {
6666

6767
PreferenceScreen.SHORTS.addPreferences(
6868
SwitchPreference("revanced_hide_shorts_home"),
69-
SwitchPreference("revanced_hide_shorts_subscriptions"),
7069
SwitchPreference("revanced_hide_shorts_search"),
70+
SwitchPreference("revanced_hide_shorts_subscriptions"),
7171
SwitchPreference("revanced_hide_shorts_history"),
7272

7373
PreferenceScreenPreference(

0 commit comments

Comments
 (0)