diff --git a/app/build.gradle b/app/build.gradle index 511646f4..f0c32158 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { defaultConfig { applicationId "app.revanced.integrations" - minSdkVersion 24 + minSdkVersion 23 targetSdkVersion 32 versionCode 1 versionName "1.0" @@ -34,8 +34,6 @@ android { } dependencies { - //implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.22.1' - compileOnly 'androidx.annotation:annotation:1.4.0' } diff --git a/app/src/main/java/app/revanced/integrations/patches/GeneralBytecodeAdsPatch.java b/app/src/main/java/app/revanced/integrations/patches/GeneralBytecodeAdsPatch.java index ef25d5f8..8c954302 100644 --- a/app/src/main/java/app/revanced/integrations/patches/GeneralBytecodeAdsPatch.java +++ b/app/src/main/java/app/revanced/integrations/patches/GeneralBytecodeAdsPatch.java @@ -1,17 +1,13 @@ package app.revanced.integrations.patches; -import android.os.Build; - -import androidx.annotation.RequiresApi; +import app.revanced.integrations.settings.SettingsEnum; +import app.revanced.integrations.utils.LogHelper; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import app.revanced.integrations.settings.SettingsEnum; -import app.revanced.integrations.utils.LogHelper; - public class GeneralBytecodeAdsPatch { //Used by app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch @@ -59,7 +55,7 @@ public class GeneralBytecodeAdsPatch { bufferBlockList.add("YouTube Movies"); } if (containsAny(value, "home_video_with_context", "related_video_with_context") && - bufferBlockList.stream().anyMatch(new String(buffer.array(), StandardCharsets.UTF_8)::contains) + anyMatch(bufferBlockList, new String(buffer.array(), StandardCharsets.UTF_8)::contains) ) return true; if (SettingsEnum.ADREMOVER_COMMENTS_REMOVAL.getBoolean()) { @@ -117,7 +113,7 @@ public class GeneralBytecodeAdsPatch { "-button" )) return false; - if (blockList.stream().anyMatch(value::contains)) { + if (anyMatch(blockList, value::contains)) { LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking ad: " + value); return true; } @@ -149,4 +145,15 @@ public class GeneralBytecodeAdsPatch { return builder.toString(); } + private static boolean anyMatch(List value, APredicate predicate) { + for (T t : value) { + if (predicate.test(t)) return true; + } + return false; + } + + @FunctionalInterface + public interface APredicate { + boolean test(T t); + } }