refactor: alphabetical ordering for litho componnent blocks.

This commit is contained in:
OxrxL 2022-07-03 15:41:31 +02:00 committed by GitHub
parent 6c42c7588d
commit 2710d50f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,30 @@ public class LithoAdRemoval {
return SharedPrefHelper.getBoolean(Objects.requireNonNull(ReVancedUtils.getContext()), SharedPrefHelper.SharedPrefNames.YOUTUBE, key, _default); return SharedPrefHelper.getBoolean(Objects.requireNonNull(ReVancedUtils.getContext()), SharedPrefHelper.SharedPrefNames.YOUTUBE, key, _default);
} }
private static boolean isCommunityGuidelines() {
return getBoolean("experimental_community_guidelines", true);
}
private static boolean isExperimentalAdRemoval() {
return getBoolean("experimental_ad_removal", true);
}
private static boolean isExperimentalCommentsRemoval() {
return getBoolean("experimental_comments", false);
}
private static boolean isExperimentalCommunityPostRemoval() {
return getBoolean("experimental_community_posts", false);
}
private static boolean isExperimentalCompactBannerRemoval() {
return getBoolean("experimental_compact_banner", false);
}
private static boolean isExperimentalEmergencyBoxRemoval() {
return getBoolean("experimental_emergency_box", true);
}
private static boolean isExperimentalInfoPanelRemoval() { private static boolean isExperimentalInfoPanelRemoval() {
return getBoolean("experimental_info_panel", true); return getBoolean("experimental_info_panel", true);
} }
@ -28,36 +52,20 @@ public class LithoAdRemoval {
return getBoolean("experimental_medical_panel", true); return getBoolean("experimental_medical_panel", true);
} }
private static boolean isExperimentalEmergencyBoxRemoval() {
return getBoolean("experimental_emergency_box", true);
}
private static boolean isExperimentalAdRemoval() {
return getBoolean("experimental_ad_removal", true);
}
private static boolean isExperimentalMerchandiseRemoval() { private static boolean isExperimentalMerchandiseRemoval() {
return getBoolean("experimental_merchandise", true); return getBoolean("experimental_merchandise", true);
} }
private static boolean isExperimentalCommunityPostRemoval() {
return getBoolean("experimental_community_posts", false);
}
private static boolean isExperimentalMovieRemoval() { private static boolean isExperimentalMovieRemoval() {
return getBoolean("experimental_movie", true); return getBoolean("experimental_movie", true);
} }
private static boolean isExperimentalCompactBannerRemoval() {
return getBoolean("experimental_compact_banner", false);
}
private static boolean isExperimentalPaidContentRemoval() { private static boolean isExperimentalPaidContentRemoval() {
return getBoolean("experimental_paid_content", true); return getBoolean("experimental_paid_content", true);
} }
private static boolean isExperimentalCommentsRemoval() { private static boolean isExperimentalSuggestedForYou() {
return getBoolean("experimental_comments", false); return getBoolean("experimental_suggested_for_you", true);
} }
private static boolean isInFeedSurvey() { private static boolean isInFeedSurvey() {
@ -68,14 +76,6 @@ public class LithoAdRemoval {
return getBoolean("experimental_shorts_shelf", true); return getBoolean("experimental_shorts_shelf", true);
} }
private static boolean isCommunityGuidelines() {
return getBoolean("experimental_community_guidelines", true);
}
private static boolean isExperimentalSuggestedForYou() {
return getBoolean("experimental_suggested_for_you", true);
}
@RequiresApi(api = Build.VERSION_CODES.N) @RequiresApi(api = Build.VERSION_CODES.N)
public static boolean containsAd(String value, ByteBuffer buffer) { public static boolean containsAd(String value, ByteBuffer buffer) {
try { try {
@ -100,11 +100,11 @@ public class LithoAdRemoval {
blockList.add("_ad"); blockList.add("_ad");
blockList.add("ad_badge"); blockList.add("ad_badge");
blockList.add("ads_video_with_context"); blockList.add("ads_video_with_context");
blockList.add("text_search_ad_with_description_first");
blockList.add("shelf_header");
blockList.add("cell_divider"); blockList.add("cell_divider");
blockList.add("watch_metadata_app_promo");
blockList.add("reels_player_overlay"); blockList.add("reels_player_overlay");
blockList.add("shelf_header");
blockList.add("text_search_ad_with_description_first");
blockList.add("watch_metadata_app_promo");
bufferBlockList.add("ad_cpn"); bufferBlockList.add("ad_cpn");
} }
@ -112,9 +112,9 @@ public class LithoAdRemoval {
bufferBlockList.add("watch-vrecH"); bufferBlockList.add("watch-vrecH");
} }
if (isExperimentalMovieRemoval()) { if (isExperimentalMovieRemoval()) {
blockList.add("movie_and_show_upsell_card");
blockList.add("compact_movie"); blockList.add("compact_movie");
blockList.add("horizontal_movie_shelf"); blockList.add("horizontal_movie_shelf");
blockList.add("movie_and_show_upsell_card");
bufferBlockList.add("YouTube Movies"); bufferBlockList.add("YouTube Movies");
} }
@ -122,39 +122,39 @@ public class LithoAdRemoval {
bufferBlockList.stream().anyMatch(StandardCharsets.UTF_8.decode(buffer).toString()::contains) bufferBlockList.stream().anyMatch(StandardCharsets.UTF_8.decode(buffer).toString()::contains)
) return true; ) return true;
if (isExperimentalMerchandiseRemoval()) { if (isExperimentalCommentsRemoval()) {
blockList.add("product_carousel"); blockList.add("comments_composite_entry_point");
} }
if (isExperimentalCommunityPostRemoval()) { if (isCommunityGuidelines()) {
blockList.add("post_base_wrapper"); blockList.add("community_guidelines");
}
if (isExperimentalPaidContentRemoval()) {
blockList.add("paid_content_overlay");
}
if (isExperimentalEmergencyBoxRemoval()) {
blockList.add("emergency_onebox");
}
if (isExperimentalMedicalPanelRemoval()) {
blockList.add("medical_panel");
}
if (isExperimentalInfoPanelRemoval()) {
blockList.add("single_item_information_panel");
blockList.add("publisher_transparency_panel");
} }
if (isExperimentalCompactBannerRemoval()) { if (isExperimentalCompactBannerRemoval()) {
blockList.add("compact_banner"); blockList.add("compact_banner");
} }
if (isExperimentalCommentsRemoval()) { if (isExperimentalEmergencyBoxRemoval()) {
blockList.add("comments_composite_entry_point"); blockList.add("emergency_onebox");
} }
if (isInFeedSurvey()) { if (isInFeedSurvey()) {
blockList.add("in_feed_survey"); blockList.add("in_feed_survey");
} }
if (isExperimentalMedicalPanelRemoval()) {
blockList.add("medical_panel");
}
if (isExperimentalPaidContentRemoval()) {
blockList.add("paid_content_overlay");
}
if (isExperimentalCommunityPostRemoval()) {
blockList.add("post_base_wrapper");
}
if (isExperimentalMerchandiseRemoval()) {
blockList.add("product_carousel");
}
if (isShortsShelf()) { if (isShortsShelf()) {
blockList.add("shorts_shelf"); blockList.add("shorts_shelf");
} }
if (isCommunityGuidelines()) { if (isExperimentalInfoPanelRemoval()) {
blockList.add("community_guidelines"); blockList.add("publisher_transparency_panel");
blockList.add("single_item_information_panel");
} }
if (containsAny(value, if (containsAny(value,
@ -185,7 +185,6 @@ public class LithoAdRemoval {
LogHelper.printException(LithoAdRemoval.class, ex.getMessage(), ex); LogHelper.printException(LithoAdRemoval.class, ex.getMessage(), ex);
return false; return false;
} }
} }
private static boolean containsAny(String value, String... targets) { private static boolean containsAny(String value, String... targets) {