refactor: fix naming inconsistency

This commit is contained in:
oSumAtrIX 2023-08-23 05:28:57 +02:00
parent 33e3c6b061
commit 7510c0632f
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
9 changed files with 24 additions and 34 deletions

View File

@ -86,7 +86,7 @@ public final class AdsFilter extends Filter {
"cta_shelf_card"
);
this.pathFilterGroups.addAll(
this.pathFilterGroupList.addAll(
generalAds,
buttonedAd,
merchandise,
@ -95,7 +95,7 @@ public final class AdsFilter extends Filter {
webLinkPanel,
movieAds
);
this.identifierFilterGroups.addAll(carouselAd);
this.identifierFilterGroupList.addAll(carouselAd);
}
@Override

View File

@ -20,14 +20,14 @@ final class ButtonsFilter extends Filter {
null,
VIDEO_ACTION_BAR_PATH
);
identifierFilterGroups.addAll(actionBarGroup);
identifierFilterGroupList.addAll(actionBarGroup);
bufferFilterPathGroup = new StringFilterGroup(
null,
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
);
pathFilterGroups.addAll(
pathFilterGroupList.addAll(
new StringFilterGroup(
SettingsEnum.HIDE_LIKE_DISLIKE_BUTTON,
"|segmented_like_dislike_button"
@ -82,7 +82,7 @@ final class ButtonsFilter extends Filter {
}
private boolean isEveryFilterGroupEnabled() {
for (var group : pathFilterGroups)
for (var group : pathFilterGroupList)
if (!group.isEnabled()) return false;
for (var group : bufferButtonsGroupList)

View File

@ -18,7 +18,7 @@ final class CommentsFilter extends Filter {
"comments_entry_point_simplebox"
);
this.pathFilterGroups.addAll(
this.pathFilterGroupList.addAll(
comments,
previewComment
);

View File

@ -142,7 +142,7 @@ public final class LayoutComponentsFilter extends Filter {
"chips_shelf"
);
this.pathFilterGroups.addAll(
this.pathFilterGroupList.addAll(
channelBar,
communityPosts,
paidContent,
@ -165,7 +165,7 @@ public final class LayoutComponentsFilter extends Filter {
custom
);
this.identifierFilterGroups.addAll(
this.identifierFilterGroupList.addAll(
graySeparator,
chipsShelf
);

View File

@ -1,26 +1,16 @@
package app.revanced.integrations.patches.components;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.*;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.*;
import java.util.function.Consumer;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.ByteTrieSearch;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.StringTrieSearch;
import app.revanced.integrations.utils.TrieSearch;
abstract class FilterGroup<T> {
final static class FilterGroupResult {
SettingsEnum setting;
@ -283,8 +273,8 @@ abstract class Filter {
* will never be called for any matches.
*/
protected final StringFilterGroupList pathFilterGroups = new StringFilterGroupList();
protected final StringFilterGroupList identifierFilterGroups = new StringFilterGroupList();
protected final StringFilterGroupList pathFilterGroupList = new StringFilterGroupList();
protected final StringFilterGroupList identifierFilterGroupList = new StringFilterGroupList();
/**
* Called after an enabled filter has been matched.
@ -302,9 +292,9 @@ abstract class Filter {
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
if (SettingsEnum.DEBUG.getBoolean()) {
if (pathFilterGroups == matchedList) {
if (pathFilterGroupList == matchedList) {
LogHelper.printDebug(() -> getClass().getSimpleName() + " Filtered path: " + path);
} else if (identifierFilterGroups == matchedList) {
} else if (identifierFilterGroupList == matchedList) {
LogHelper.printDebug(() -> getClass().getSimpleName() + " Filtered identifier: " + identifier);
}
}
@ -391,8 +381,8 @@ public final class LithoFilterPatch {
static {
for (Filter filter : filters) {
filterGroupLists(pathSearchTree, filter, filter.pathFilterGroups);
filterGroupLists(identifierSearchTree, filter, filter.identifierFilterGroups);
filterGroupLists(pathSearchTree, filter, filter.pathFilterGroupList);
filterGroupLists(identifierSearchTree, filter, filter.identifierFilterGroupList);
}
LogHelper.printDebug(() -> "Using: "

View File

@ -8,7 +8,7 @@ public final class PlaybackSpeedMenuFilterPatch extends Filter {
public static volatile boolean isPlaybackSpeedMenuVisible;
public PlaybackSpeedMenuFilterPatch() {
pathFilterGroups.addAll(new StringFilterGroup(
pathFilterGroupList.addAll(new StringFilterGroup(
null,
"playback_speed_sheet_content.eml-js"
));

View File

@ -15,7 +15,7 @@ public class PlayerFlyoutMenuItemsFilter extends Filter {
@RequiresApi(api = Build.VERSION_CODES.N)
public PlayerFlyoutMenuItemsFilter() {
identifierFilterGroups.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
identifierFilterGroupList.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
flyoutFilterGroupList.addAll(
new ByteArrayAsStringFilterGroup(

View File

@ -59,8 +59,8 @@ public final class ShortsFilter extends Filter {
"shorts_pivot_item"
);
pathFilterGroups.addAll(joinButton, subscribeButton, channelBar, soundButton, infoPanel);
identifierFilterGroups.addAll(shorts, thanksButton);
pathFilterGroupList.addAll(joinButton, subscribeButton, channelBar, soundButton, infoPanel);
identifierFilterGroupList.addAll(shorts, thanksButton);
}
@Override
@ -69,11 +69,11 @@ public final class ShortsFilter extends Filter {
if (matchedGroup == soundButton || matchedGroup == infoPanel || matchedGroup == channelBar) return true;
// Filter the path only when reelChannelBar is visible.
if (pathFilterGroups == matchedList) {
if (pathFilterGroupList == matchedList) {
return path.contains(REEL_CHANNEL_BAR_PATH);
}
return identifierFilterGroups == matchedList;
return identifierFilterGroupList == matchedList;
}
public static void hideShortsShelf(final View shortsShelfView) {

View File

@ -10,7 +10,7 @@ public final class VideoQualityMenuFilterPatch extends Filter {
public static volatile boolean isVideoQualityMenuVisible;
public VideoQualityMenuFilterPatch() {
pathFilterGroups.addAll(new StringFilterGroup(
pathFilterGroupList.addAll(new StringFilterGroup(
SettingsEnum.SHOW_OLD_VIDEO_QUALITY_MENU,
"quick_quality_sheet_content.eml-js"
));