2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.ad.general
|
2022-11-18 02:24:11 +01:00
|
|
|
|
|
|
|
import app.revanced.patcher.data.ResourceContext
|
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
|
|
|
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
2023-06-14 03:30:15 +02:00
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
|
2022-11-18 02:24:11 +01:00
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
@Patch(
|
|
|
|
dependencies = [
|
2023-01-07 04:03:14 +01:00
|
|
|
LithoFilterPatch::class,
|
|
|
|
SettingsPatch::class,
|
|
|
|
ResourceMappingPatch::class
|
|
|
|
]
|
|
|
|
)
|
2023-09-20 05:33:02 +02:00
|
|
|
object HideAdsResourcePatch : ResourcePatch() {
|
|
|
|
private const val FILTER_CLASS_DESCRIPTOR =
|
2024-01-01 16:33:07 +01:00
|
|
|
"Lapp/revanced/integrations/youtube/patches/components/AdsFilter;"
|
2023-09-20 05:33:02 +02:00
|
|
|
|
|
|
|
internal var adAttributionId: Long = -1
|
|
|
|
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: ResourceContext) {
|
2023-01-07 04:03:14 +01:00
|
|
|
PreferenceScreen.ADS.addPreferences(
|
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_hide_general_ads",
|
|
|
|
StringResource("revanced_hide_general_ads_title", "Hide general ads"),
|
|
|
|
StringResource("revanced_hide_general_ads_summary_on", "General ads are hidden"),
|
|
|
|
StringResource("revanced_hide_general_ads_summary_off", "General ads are shown")
|
2023-01-07 04:03:14 +01:00
|
|
|
),
|
2023-12-24 18:38:34 +01:00
|
|
|
SwitchPreference(
|
|
|
|
"revanced_hide_fullscreen_ads",
|
|
|
|
StringResource("revanced_hide_fullscreen_ads_title", "Hide fullscreen ads"),
|
|
|
|
StringResource("revanced_hide_fullscreen_ads_summary_on", "Fullscreen ads are hidden"),
|
|
|
|
StringResource("revanced_hide_fullscreen_ads_summary_off", "Fullscreen ads are shown")
|
|
|
|
),
|
2023-01-07 04:03:14 +01:00
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_hide_buttoned_ads",
|
|
|
|
StringResource("revanced_hide_buttoned_ads_title", "Hide buttoned ad"),
|
|
|
|
StringResource("revanced_hide_buttoned_ads_summary_on", "Buttoned ads are hidden"),
|
|
|
|
StringResource("revanced_hide_buttoned_ads_summary_off", "Buttoned ads are shown")
|
2023-01-07 04:03:14 +01:00
|
|
|
),
|
2022-11-18 02:24:11 +01:00
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_hide_paid_content_ads",
|
|
|
|
StringResource("revanced_hide_paid_content_ads_title", "Hide paid content"),
|
|
|
|
StringResource("revanced_hide_paid_content_ads_summary_on", "Paid content is hidden"),
|
|
|
|
StringResource("revanced_hide_paid_content_ads_summary_off", "Paid content is shown")
|
2022-11-18 02:24:11 +01:00
|
|
|
),
|
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_hide_self_sponsor_ads",
|
|
|
|
StringResource("revanced_hide_self_sponsor_ads_title", "Hide self sponsored cards"),
|
|
|
|
StringResource("revanced_hide_self_sponsor_ads_summary_on", "Self sponsored cards are hidden"),
|
|
|
|
StringResource("revanced_hide_self_sponsor_ads_summary_off", "Self sponsored cards are shown")
|
2022-11-18 02:24:11 +01:00
|
|
|
),
|
2023-06-14 03:30:15 +02:00
|
|
|
SwitchPreference(
|
|
|
|
"revanced_hide_products_banner",
|
|
|
|
StringResource("revanced_hide_products_banner_title", "Hide banner to view products"),
|
|
|
|
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
|
|
|
|
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
|
|
|
|
),
|
|
|
|
SwitchPreference(
|
2023-11-23 01:17:47 +01:00
|
|
|
"revanced_hide_shopping_links",
|
|
|
|
StringResource("revanced_hide_shopping_links_title", "Hide shopping links in video description"),
|
|
|
|
StringResource("revanced_hide_shopping_links_summary_on", "Shopping links are hidden"),
|
|
|
|
StringResource("revanced_hide_shopping_links_summary_off", "Shopping links are shown")
|
|
|
|
),
|
|
|
|
SwitchPreference(
|
2023-06-14 03:30:15 +02:00
|
|
|
"revanced_hide_web_search_results",
|
|
|
|
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
|
|
|
|
StringResource("revanced_hide_web_search_results_summary_on", "Web search results are hidden"),
|
|
|
|
StringResource("revanced_hide_web_search_results_summary_off", "Web search results are shown")
|
|
|
|
),
|
|
|
|
SwitchPreference(
|
|
|
|
"revanced_hide_merchandise_banners",
|
|
|
|
StringResource("revanced_hide_merchandise_banners_title", "Hide merchandise banners"),
|
|
|
|
StringResource("revanced_hide_merchandise_banners_summary_on", "Merchandise banners are hidden"),
|
|
|
|
StringResource("revanced_hide_merchandise_banners_summary_off", "Merchandise banners are shown")
|
2022-11-18 02:24:11 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-06-14 02:43:46 +02:00
|
|
|
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
|
|
|
|
2023-05-10 01:04:06 +02:00
|
|
|
adAttributionId = ResourceMappingPatch.resourceMappings.single { it.name == "ad_attribution" }.id
|
2022-11-18 02:24:11 +01:00
|
|
|
}
|
|
|
|
}
|