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
|
2024-01-27 02:34:01 +01:00
|
|
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
|
|
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
|
|
|
|
import app.revanced.patches.shared.misc.settings.preference.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
|
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,
|
2024-01-27 02:34:01 +01:00
|
|
|
ResourceMappingPatch::class,
|
|
|
|
AddResourcesPatch::class
|
2023-01-07 04:03:14 +01:00
|
|
|
]
|
|
|
|
)
|
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) {
|
2024-01-27 02:34:01 +01:00
|
|
|
AddResourcesPatch(this::class)
|
|
|
|
|
2024-03-02 08:27:05 +01:00
|
|
|
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
2024-01-27 02:34:01 +01:00
|
|
|
SwitchPreference("revanced_hide_general_ads"),
|
|
|
|
SwitchPreference("revanced_hide_fullscreen_ads"),
|
|
|
|
SwitchPreference("revanced_hide_buttoned_ads"),
|
|
|
|
SwitchPreference("revanced_hide_paid_content_ads"),
|
|
|
|
SwitchPreference("revanced_hide_self_sponsor_ads"),
|
|
|
|
SwitchPreference("revanced_hide_products_banner"),
|
|
|
|
SwitchPreference("revanced_hide_shopping_links"),
|
|
|
|
SwitchPreference("revanced_hide_web_search_results"),
|
|
|
|
SwitchPreference("revanced_hide_merchandise_banners")
|
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
|
|
|
}
|
|
|
|
}
|