diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/annotations/MixPlaylistsPatchCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/annotations/MixPlaylistsPatchCompatibility.kt deleted file mode 100644 index 08237e9c..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/annotations/MixPlaylistsPatchCompatibility.kt +++ /dev/null @@ -1,22 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.mixplaylists.annotations - -import app.revanced.patcher.annotation.Compatibility -import app.revanced.patcher.annotation.Package - -@Compatibility( - [Package( - "com.google.android.youtube", arrayOf( - "17.49.37", - "18.03.36", - "18.03.42", - "18.04.35", - "18.04.41", - "18.05.32", - "18.05.35", - "18.05.40", - "18.08.37" - ) - )] -) -@Target(AnnotationTarget.CLASS) -internal annotation class MixPlaylistsPatchCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/CreateMixPlaylistFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/CreateMixPlaylistFingerprint.kt deleted file mode 100644 index d0182ef8..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/CreateMixPlaylistFingerprint.kt +++ /dev/null @@ -1,24 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object CreateMixPlaylistFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L", "L"), listOf( - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.INVOKE_VIRTUAL, - ) -) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/SecondCreateMixPlaylistFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/SecondCreateMixPlaylistFingerprint.kt deleted file mode 100644 index 3e454663..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/fingerprints/SecondCreateMixPlaylistFingerprint.kt +++ /dev/null @@ -1,24 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.AccessFlags -import org.jf.dexlib2.Opcode - -object SecondCreateMixPlaylistFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L"), listOf( - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.NEW_INSTANCE, - Opcode.INVOKE_DIRECT, - Opcode.IPUT_OBJECT, - Opcode.IPUT_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID - ) -) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/patch/MixPlaylistsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/patch/MixPlaylistsPatch.kt deleted file mode 100644 index a8373325..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/mixplaylists/patch/MixPlaylistsPatch.kt +++ /dev/null @@ -1,64 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.mixplaylists.patch - -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.extensions.addInstruction -import app.revanced.patcher.extensions.instruction -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -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.settings.preference.impl.StringResource -import app.revanced.patches.shared.settings.preference.impl.SwitchPreference -import app.revanced.patches.youtube.layout.hide.mixplaylists.annotations.MixPlaylistsPatchCompatibility -import app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints.CreateMixPlaylistFingerprint -import app.revanced.patches.youtube.layout.hide.mixplaylists.fingerprints.SecondCreateMixPlaylistFingerprint -import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import org.jf.dexlib2.iface.instruction.OneRegisterInstruction - -@Patch -@DependsOn([IntegrationsPatch::class]) -@Name("hide-my-mix") -@Description("Hides mix playlists.") -@MixPlaylistsPatchCompatibility -@Version("0.0.1") -class MixPlaylistsPatch : BytecodePatch( - listOf( - CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( - SwitchPreference( - "revanced_hide_mix_playlists", - StringResource("revanced_hide_mix_playlists_title", "Hide mix playlists"), - false, - StringResource("revanced_hide_mix_playlists_summary_on", "Mix playlists are hidden"), - StringResource("revanced_hide_mix_playlists_summary_off", "Mix playlists are shown") - ) - ) - - arrayOf(CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint).forEach(::addHook) - - return PatchResultSuccess() - } - - private fun addHook(fingerprint: MethodFingerprint) { - with (fingerprint.result!!) { - val insertIndex = scanResult.patternScanResult!!.endIndex - 3 - - val register = (mutableMethod.instruction(insertIndex - 2) as OneRegisterInstruction).registerA - - mutableMethod.addInstruction( - insertIndex, - "invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V" - ) - } - - } -}