fix(YouTube - Hide layout components): Correctly hide Join button

This commit is contained in:
oSumAtrIX 2024-03-26 01:36:13 +01:00
parent bed8f9f640
commit b945e2f44b
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -29,6 +29,8 @@ public final class LayoutComponentsFilter extends Filter {
private final StringFilterGroup expandableMetadata; private final StringFilterGroup expandableMetadata;
private final ByteArrayFilterGroup searchResultRecommendations; private final ByteArrayFilterGroup searchResultRecommendations;
private final StringFilterGroup searchResultVideo; private final StringFilterGroup searchResultVideo;
private final StringFilterGroup compactChannelBarInner;
private final ByteArrayFilterGroup joinMembership;
static { static {
mixPlaylistsExceptions.addPatterns( mixPlaylistsExceptions.addPatterns(
@ -194,9 +196,14 @@ public final class LayoutComponentsFilter extends Filter {
"set_reminder_button" "set_reminder_button"
); );
final var joinMembership = new StringFilterGroup( compactChannelBarInner = new StringFilterGroup(
Settings.HIDE_JOIN_MEMBERSHIP_BUTTON, Settings.HIDE_JOIN_MEMBERSHIP_BUTTON,
"compact_sponsor_button" "compact_channel_bar_inner"
);
joinMembership = new ByteArrayFilterGroup(
Settings.HIDE_JOIN_MEMBERSHIP_BUTTON,
"Join this channel"
); );
final var channelWatermark = new StringFilterGroup( final var channelWatermark = new StringFilterGroup(
@ -233,7 +240,7 @@ public final class LayoutComponentsFilter extends Filter {
quickActions, quickActions,
relatedVideos, relatedVideos,
compactBanner, compactBanner,
joinMembership, compactChannelBarInner,
medicalPanel, medicalPanel,
videoQualityMenuFooter, videoQualityMenuFooter,
infoPanel, infoPanel,
@ -258,6 +265,12 @@ public final class LayoutComponentsFilter extends Filter {
} }
} }
if (matchedGroup == compactChannelBarInner) {
if (joinMembership.check(protobufBufferArray).isFiltered()){
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
}
// The groups are excluded from the filter due to the exceptions list below. // The groups are excluded from the filter due to the exceptions list below.
// Filter them separately here. // Filter them separately here.
if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata) if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata)