mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-01 14:47:32 +01:00
feat: app promo banner removal setting
This commit is contained in:
parent
4fd2abc409
commit
a96bbe6469
@ -14,24 +14,12 @@ public class LithoAdRemoval {
|
|||||||
private static final byte[] endRelatedPageAd = {112, 97, 103, 101, 97, 100};
|
private static final byte[] endRelatedPageAd = {112, 97, 103, 101, 97, 100};
|
||||||
private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
|
private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
|
||||||
|
|
||||||
private static boolean isExperimentalInfoPanelRemoval() {
|
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_info_panel", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isExperimentalMedicalPanelRemoval() {
|
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_medical_panel", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isExperimentalEmergencyBoxRemoval() {
|
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_emergency_box", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isExperimentalAdRemoval() {
|
public static boolean isExperimentalAdRemoval() {
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_ad_removal", true);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_ad_removal", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExperimentalMerchandiseRemoval() {
|
public static boolean isExperimentalMerchandiseRemoval() {
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_merchandise", true);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_merchandise", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExperimentalCommunityPostRemoval() {
|
public static boolean isExperimentalCommunityPostRemoval() {
|
||||||
@ -46,8 +34,8 @@ public class LithoAdRemoval {
|
|||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_compact_banner", false);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_compact_banner", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExperimentalPaidContentRemoval() {
|
public static boolean isExperimentalAppPromoBannerRemoval() {
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_paid_content", true);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_app_promo_banner", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExperimentalCommentsRemoval() {
|
public static boolean isExperimentalCommentsRemoval() {
|
||||||
@ -67,27 +55,21 @@ public class LithoAdRemoval {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isShortsShelf() {
|
public static boolean isShortsShelf() {
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_shorts_shelf", true);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_shorts_shelf", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCommunityGuidelines() {
|
public static boolean isCommunityGuidelines() {
|
||||||
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_community_guidelines", true);
|
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_community_guidelines", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean containsAd(String value, ByteBuffer buffer) {
|
public static boolean containsAd(String value) {
|
||||||
try {
|
if (!(isExperimentalAdRemoval() || isExperimentalMerchandiseRemoval() || isExperimentalAppPromoBannerRemoval() || isExperimentalCommunityPostRemoval() || isExperimentalMovieUpsellRemoval() || isExperimentalCompactBannerRemoval() || isExperimentalCommentsRemoval() || isExperimentalCompactMovieRemoval() || isExperimentalHorizontalMovieShelfRemoval() || isInFeedSurvey() || isShortsShelf() || isCommunityGuidelines()) || value == null || value.isEmpty()) {
|
||||||
if (!(isExperimentalAdRemoval() || isExperimentalMerchandiseRemoval() || isExperimentalPaidContentRemoval() || isExperimentalCommunityPostRemoval() || isExperimentalMovieUpsellRemoval() || isExperimentalCompactBannerRemoval() || isExperimentalCommentsRemoval() || isExperimentalCompactMovieRemoval() || isExperimentalHorizontalMovieShelfRemoval() || isInFeedSurvey() || isShortsShelf() || isCommunityGuidelines()) || value == null || value.isEmpty()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<String> blockList = new ArrayList<>();
|
List<String> blockList = new ArrayList<>();
|
||||||
if (isExperimentalAdRemoval()) {
|
if (isExperimentalAdRemoval()) {
|
||||||
blockList.add("_ad");
|
blockList.add("_ad");
|
||||||
blockList.add("ad_badge");
|
blockList.add("ad_badge");
|
||||||
blockList.add("ads_video_with_context");
|
|
||||||
blockList.add("text_search_ad_with_description_first");
|
|
||||||
blockList.add("shelf_header");
|
|
||||||
blockList.add("cell_divider");
|
|
||||||
blockList.add("watch_metadata_app_promo");
|
|
||||||
}
|
}
|
||||||
if (isExperimentalMerchandiseRemoval()) {
|
if (isExperimentalMerchandiseRemoval()) {
|
||||||
blockList.add("product_carousel");
|
blockList.add("product_carousel");
|
||||||
@ -98,17 +80,67 @@ public class LithoAdRemoval {
|
|||||||
if (isExperimentalMovieUpsellRemoval()) {
|
if (isExperimentalMovieUpsellRemoval()) {
|
||||||
blockList.add("movie_and_show_upsell_card");
|
blockList.add("movie_and_show_upsell_card");
|
||||||
}
|
}
|
||||||
if (isExperimentalPaidContentRemoval()) {
|
if (isExperimentalAppPromoBannerRemoval()) {
|
||||||
blockList.add("paid_content_overlay");
|
blockList.add("watch_metadata_app_promo");
|
||||||
}
|
}
|
||||||
if (isExperimentalEmergencyBoxRemoval()) {
|
if (isExperimentalCompactBannerRemoval()) {
|
||||||
blockList.add("emergency_onebox");
|
blockList.add("compact_banner");
|
||||||
}
|
}
|
||||||
if (isExperimentalMedicalPanelRemoval()) {
|
if (isExperimentalCommentsRemoval()) {
|
||||||
blockList.add("medical_panel");
|
blockList.add("comments_composite_entry_point");
|
||||||
}
|
}
|
||||||
if (isExperimentalInfoPanelRemoval()) {
|
if (isExperimentalCompactMovieRemoval()) {
|
||||||
blockList.add("single_item_information_panel");
|
blockList.add("compact_movie");
|
||||||
|
}
|
||||||
|
if (isExperimentalHorizontalMovieShelfRemoval()) {
|
||||||
|
blockList.add("horizontal_movie_shelf");
|
||||||
|
}
|
||||||
|
if (isInFeedSurvey()) {
|
||||||
|
blockList.add("in_feed_survey");
|
||||||
|
}
|
||||||
|
if (isShortsShelf()) {
|
||||||
|
blockList.add("shorts_shelf");
|
||||||
|
}
|
||||||
|
if (isCommunityGuidelines()) {
|
||||||
|
blockList.add("community_guidelines");
|
||||||
|
}
|
||||||
|
for (String s : blockList) {
|
||||||
|
if (value.contains(s)) {
|
||||||
|
if (XGlobals.debug) {
|
||||||
|
Log.d("TemplateBlocked", value);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!XGlobals.debug) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Log.d("Template", value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean containsAd(String value, ByteBuffer buffer) {
|
||||||
|
try {
|
||||||
|
if (!(isExperimentalAdRemoval() || isExperimentalMerchandiseRemoval() || isExperimentalAppPromoBannerRemoval() || isExperimentalCommunityPostRemoval() || isExperimentalMovieUpsellRemoval() || isExperimentalCompactBannerRemoval() || isExperimentalCommentsRemoval() || isExperimentalCompactMovieRemoval() || isExperimentalHorizontalMovieShelfRemoval() || isInFeedSurvey() || isShortsShelf() || isCommunityGuidelines()) || value == null || value.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> blockList = new ArrayList<>();
|
||||||
|
if (isExperimentalAdRemoval()) {
|
||||||
|
blockList.add("_ad");
|
||||||
|
blockList.add("ad_badge");
|
||||||
|
blockList.add("ads_video_with_context");
|
||||||
|
}
|
||||||
|
if (isExperimentalMerchandiseRemoval()) {
|
||||||
|
blockList.add("product_carousel");
|
||||||
|
}
|
||||||
|
if (isExperimentalCommunityPostRemoval()) {
|
||||||
|
blockList.add("post_base_wrapper");
|
||||||
|
}
|
||||||
|
if (isExperimentalMovieUpsellRemoval()) {
|
||||||
|
blockList.add("movie_and_show_upsell_card");
|
||||||
|
}
|
||||||
|
if (isExperimentalAppPromoBannerRemoval()) {
|
||||||
|
blockList.add("watch_metadata_app_promo");
|
||||||
}
|
}
|
||||||
if (isExperimentalCompactBannerRemoval()) {
|
if (isExperimentalCompactBannerRemoval()) {
|
||||||
blockList.add("compact_banner");
|
blockList.add("compact_banner");
|
||||||
@ -160,6 +192,7 @@ public class LithoAdRemoval {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int indexOf(byte[] array, byte[] target) {
|
public static int indexOf(byte[] array, byte[] target) {
|
||||||
if (target.length == 0) {
|
if (target.length == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user