refactor(YouTube Music): Rename Hide music video ads to Hide video ads and add patch description (#3494)

Co-authored-by: ILoveOpenSourceApplications <ILoveOpenSourceApplications@users.noreply.github.com>
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
ILoveOpenSourceApplications 2024-08-04 13:39:48 +05:30 committed by GitHub
parent b3268ece01
commit becaad4a98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 11 deletions

View File

@ -423,6 +423,12 @@ public final class app/revanced/patches/music/ad/video/HideMusicVideoAds : app/r
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
} }
public final class app/revanced/patches/music/ad/video/HideVideoAds : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/music/ad/video/HideVideoAds;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/music/ad/video/MusicVideoAdsPatch : app/revanced/patcher/patch/BytecodePatch { public final class app/revanced/patches/music/ad/video/MusicVideoAdsPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/music/ad/video/MusicVideoAdsPatch; public static final field INSTANCE Lapp/revanced/patches/music/ad/video/MusicVideoAdsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V

View File

@ -6,11 +6,12 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsParentFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowVideoAdsParentFingerprint
import app.revanced.util.exception import app.revanced.util.exception
@Patch( @Patch(
name = "Hide music video ads", name = "Hide video ads",
description = "Hides ads that appear while listening to or streaming music videos, podcasts, or songs.",
compatiblePackages = [ compatiblePackages = [
CompatiblePackage( CompatiblePackage(
"com.google.android.apps.youtube.music", "com.google.android.apps.youtube.music",
@ -25,24 +26,32 @@ import app.revanced.util.exception
], ],
) )
@Suppress("unused") @Suppress("unused")
object HideMusicVideoAds : BytecodePatch( object HideVideoAds : BytecodePatch(
setOf(ShowMusicVideoAdsParentFingerprint), setOf(ShowVideoAdsParentFingerprint),
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
ShowMusicVideoAdsParentFingerprint.result?.let { ShowVideoAdsParentFingerprint.result?.let {
val showMusicVideoAdsMethod = context val showVideoAdsMethod = context
.toMethodWalker(it.mutableMethod) .toMethodWalker(it.mutableMethod)
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true).getMethod() as MutableMethod .nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true).getMethod() as MutableMethod
showMusicVideoAdsMethod.addInstruction(0, "const/4 p1, 0x0") showVideoAdsMethod.addInstruction(0, "const/4 p1, 0x0")
} ?: throw ShowMusicVideoAdsParentFingerprint.exception } ?: throw ShowVideoAdsParentFingerprint.exception
} }
} }
@Deprecated("This patch class has been renamed to HideMusicVideoAds.") @Deprecated("This patch class has been renamed to HideVideoAds.")
object HideMusicVideoAds : BytecodePatch(
dependencies = setOf(HideVideoAds::class)
) {
override fun execute(context: BytecodeContext) {
}
}
@Deprecated("This patch class has been renamed to HideVideoAds.")
object MusicVideoAdsPatch : BytecodePatch( object MusicVideoAdsPatch : BytecodePatch(
dependencies = setOf(HideMusicVideoAds::class), dependencies = setOf(HideMusicVideoAds::class),
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
} }
} }

View File

@ -3,7 +3,7 @@ package app.revanced.patches.music.ad.video.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
internal object ShowMusicVideoAdsParentFingerprint : MethodFingerprint( internal object ShowVideoAdsParentFingerprint : MethodFingerprint(
opcodes = listOf( opcodes = listOf(
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,