diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index 44ace544bb..45bcb84ce0 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -238,6 +238,16 @@ public ShortsFilter() { ); } + private boolean isEverySuggestedActionFilterEnabled() { + for (ByteArrayFilterGroup group : suggestedActionsGroupList) { + if (!group.isEnabled()) { + return false; + } + } + + return true; + } + @Override boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray, StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) { @@ -270,7 +280,13 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff } if (matchedGroup == suggestedAction) { - // Suggested actions can be at the start or in the middle of a path. + // Skip searching the buffer if all suggested actions are set to hidden. + // This has a secondary effect of hiding all new un-identified actions + // under the assumption that the user wants all actions hidden. + if (isEverySuggestedActionFilterEnabled()) { + return super.isFiltered(path, identifier, protobufBufferArray, matchedGroup, contentType, contentIndex); + } + if (suggestedActionsGroupList.check(protobufBufferArray).isFiltered()) { return super.isFiltered( identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex