mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(hide-video-ads): change to abstract patch
This commit is contained in:
@ -4,37 +4,30 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
|
||||
import app.revanced.patches.shared.patch.videoads.AbstractVideoAdsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
|
||||
@Patch
|
||||
@Name("hide-video-ads")
|
||||
@Description("Removes ads in the video player.")
|
||||
@DependsOn(
|
||||
[
|
||||
GeneralVideoAdsPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoAdsPatch : BytecodePatch() {
|
||||
class VideoAdsPatch : AbstractVideoAdsPatch(
|
||||
"$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
super.execute(context)
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: ADS_SETTINGS",
|
||||
@ -46,8 +39,4 @@ class VideoAdsPatch : BytecodePatch() {
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user