build(Needs bump): Bump dependencies (#2946)
Co-authored-by: Ushie <ushiekane@gmail.com> Co-authored-by: aAbed <aabedhkhan@gmail.com> Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
co-authored by
Ushie
aAbed
CnC-Robert
parent
fe3a6fd4a4
commit
8c8dff9078
+25
-18
@@ -1,36 +1,43 @@
|
||||
package app.revanced.patches.youtube.ad.general.bytecode.patch
|
||||
package app.revanced.patches.youtube.ad.general
|
||||
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.extensions.injectHideViewCall
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
|
||||
import app.revanced.patches.youtube.ad.general.annotation.HideAdsCompatibility
|
||||
import app.revanced.patches.youtube.ad.general.resource.patch.HideAdsResourcePatch
|
||||
import app.revanced.patches.youtube.ad.getpremium.bytecode.patch.HideGetPremiumPatch
|
||||
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.misc.fix.verticalscroll.VerticalScrollPatch
|
||||
import app.revanced.patches.youtube.ad.getpremium.HideGetPremiumPatch
|
||||
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.FixBackToExitGesturePatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction31i
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
|
||||
@Patch
|
||||
@DependsOn(
|
||||
[
|
||||
@Patch(
|
||||
name = "Hide ads",
|
||||
description = "Removes general ads.",
|
||||
dependencies = [
|
||||
HideGetPremiumPatch::class,
|
||||
HideAdsResourcePatch::class,
|
||||
VerticalScrollPatch::class,
|
||||
FixBackToExitGesturePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Name("Hide ads")
|
||||
@Description("Removes general ads.")
|
||||
@HideAdsCompatibility
|
||||
class HideAdsPatch : BytecodePatch() {
|
||||
@Suppress("unused")
|
||||
object HideAdsPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
+14
-18
@@ -1,25 +1,28 @@
|
||||
package app.revanced.patches.youtube.ad.general.resource.patch
|
||||
package app.revanced.patches.youtube.ad.general
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.ad.general.annotation.HideAdsCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen
|
||||
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
|
||||
|
||||
@DependsOn(
|
||||
[
|
||||
@Patch(
|
||||
dependencies = [
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
]
|
||||
)
|
||||
@HideAdsCompatibility
|
||||
class HideAdsResourcePatch : ResourcePatch {
|
||||
object HideAdsResourcePatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/AdsFilter;"
|
||||
|
||||
internal var adAttributionId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
PreferenceScreen.ADS.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -70,11 +73,4 @@ class HideAdsResourcePatch : ResourcePatch {
|
||||
|
||||
adAttributionId = ResourceMappingPatch.resourceMappings.single { it.name == "ad_attribution" }.id
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var adAttributionId: Long = -1
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/AdsFilter;"
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.ad.general.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideAdsCompatibility
|
||||
|
||||
+17
-16
@@ -1,24 +1,30 @@
|
||||
package app.revanced.patches.youtube.ad.getpremium.bytecode.patch
|
||||
package app.revanced.patches.youtube.ad.getpremium
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.ad.getpremium.annotations.HideGetPremiumCompatibility
|
||||
import app.revanced.patches.youtube.ad.getpremium.bytecode.fingerprints.GetPremiumViewFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.ad.getpremium.fingerprints.GetPremiumViewFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Hide get premium")
|
||||
@HideGetPremiumCompatibility
|
||||
class HideGetPremiumPatch : BytecodePatch(listOf(GetPremiumViewFingerprint)) {
|
||||
@Patch(
|
||||
name = "Hide get premium",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube", ["18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"])
|
||||
]
|
||||
)
|
||||
object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideGetPremiumPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -64,9 +70,4 @@ class HideGetPremiumPatch : BytecodePatch(listOf(GetPremiumViewFingerprint)) {
|
||||
}
|
||||
} ?: throw GetPremiumViewFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideGetPremiumPatch;"
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.ad.getpremium.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideGetPremiumCompatibility
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.ad.getpremium.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.ad.getpremium.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+29
-17
@@ -1,30 +1,42 @@
|
||||
package app.revanced.patches.youtube.ad.video.patch
|
||||
package app.revanced.patches.youtube.ad.video
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||
import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Video ads")
|
||||
@Description("Removes ads in the video player.")
|
||||
@VideoAdsCompatibility
|
||||
class VideoAdsPatch : BytecodePatch(
|
||||
listOf(
|
||||
LoadVideoAdsFingerprint,
|
||||
)
|
||||
@Patch(
|
||||
name = "Video ads",
|
||||
description = "Removes ads in the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object VideoAdsPatch : BytecodePatch(
|
||||
setOf(LoadVideoAdsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.ADS.addPreferences(
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.ad.video.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class VideoAdsCompatibility
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package app.revanced.patches.youtube.interaction.copyvideourl
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
|
||||
@Patch(
|
||||
name = "Copy video url",
|
||||
description = "Adds buttons in player to copy video links.",
|
||||
dependencies = [
|
||||
CopyVideoUrlResourcePatch::class,
|
||||
PlayerControlsBytecodePatch::class,
|
||||
VideoInformationPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CopyVideoUrlBytecodePatch : BytecodePatch() {
|
||||
private const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/videoplayer"
|
||||
private val BUTTONS_DESCRIPTORS = listOf(
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlButton;",
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlTimestampButton;"
|
||||
)
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Initialize buttons and inject visibility control
|
||||
BUTTONS_DESCRIPTORS.forEach { descriptor ->
|
||||
PlayerControlsBytecodePatch.initializeControl("$descriptor->initializeButton(Landroid/view/View;)V")
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("$descriptor->changeVisibility(Z)V")
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-6
@@ -1,19 +1,24 @@
|
||||
package app.revanced.patches.youtube.interaction.copyvideourl.resource.patch
|
||||
package app.revanced.patches.youtube.interaction.copyvideourl
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
|
||||
class CopyVideoUrlResourcePatch : ResourcePatch {
|
||||
@Patch(
|
||||
dependencies = [
|
||||
BottomControlsResourcePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
object CopyVideoUrlResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
PreferenceScreen(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.copyvideourl.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class CopyVideoUrlCompatibility
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.copyvideourl.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.interaction.copyvideourl.annotation.CopyVideoUrlCompatibility
|
||||
import app.revanced.patches.youtube.interaction.copyvideourl.resource.patch.CopyVideoUrlResourcePatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||
|
||||
@Patch
|
||||
@Name("Copy video url")
|
||||
@Description("Adds buttons in player to copy video links.")
|
||||
@DependsOn([
|
||||
CopyVideoUrlResourcePatch::class,
|
||||
PlayerControlsBytecodePatch::class,
|
||||
VideoInformationPatch::class
|
||||
])
|
||||
@CopyVideoUrlCompatibility
|
||||
class CopyVideoUrlBytecodePatch : BytecodePatch() {
|
||||
private companion object {
|
||||
const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/videoplayer"
|
||||
val BUTTONS_DESCRIPTORS = listOf(
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlButton;",
|
||||
"$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlTimestampButton;"
|
||||
)
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
// Initialize buttons and inject visibility control
|
||||
BUTTONS_DESCRIPTORS.forEach { descriptor ->
|
||||
PlayerControlsBytecodePatch.initializeControl("$descriptor->initializeButton(Landroid/view/View;)V")
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall("$descriptor->changeVisibility(Z)V")
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
|
||||
@Patch(
|
||||
name = "External downloads",
|
||||
description = "Adds support to download and save YouTube videos using an external app.",
|
||||
dependencies = [
|
||||
ExternalDownloadsResourcePatch::class,
|
||||
PlayerControlsBytecodePatch::class,
|
||||
VideoInformationPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
),
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ExternalDownloadsBytecodePatch : BytecodePatch() {
|
||||
private const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/ExternalDownloadButton;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
/*
|
||||
initialize the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.initializeControl(
|
||||
"$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V")
|
||||
|
||||
/*
|
||||
add code to change the visibility of the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall(
|
||||
"$BUTTON_DESCRIPTOR->changeVisibility(Z)V")
|
||||
}
|
||||
}
|
||||
+11
-6
@@ -1,17 +1,22 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.resource.patch
|
||||
package app.revanced.patches.youtube.interaction.downloads
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
|
||||
class ExternalDownloadsResourcePatch : ResourcePatch {
|
||||
@Patch(
|
||||
dependencies = [
|
||||
BottomControlsResourcePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
object ExternalDownloadsResourcePatch : ResourcePatch() {
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class ExternalDownloadsCompatibility
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.downloads.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.interaction.downloads.annotation.ExternalDownloadsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.downloads.resource.patch.ExternalDownloadsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||
|
||||
@Patch
|
||||
@Name("External downloads")
|
||||
@DependsOn([ExternalDownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class])
|
||||
@Description("Adds support to download and save YouTube videos using an external app.")
|
||||
@ExternalDownloadsCompatibility
|
||||
class ExternalDownloadsBytecodePatch : BytecodePatch() {
|
||||
private companion object {
|
||||
const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/ExternalDownloadButton;"
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
/*
|
||||
initialize the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.initializeControl(
|
||||
"$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V")
|
||||
|
||||
/*
|
||||
add code to change the visibility of the control
|
||||
*/
|
||||
|
||||
PlayerControlsBytecodePatch.injectVisibilityCheckCall(
|
||||
"$BUTTON_DESCRIPTOR->changeVisibility(Z)V")
|
||||
}
|
||||
}
|
||||
+32
-18
@@ -1,33 +1,47 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.patch
|
||||
package app.revanced.patches.youtube.interaction.seekbar
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.OnTouchEventHandlerFingerprint
|
||||
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, EnableSeekbarTappingResourcePatch::class])
|
||||
@Name("Seekbar tapping")
|
||||
@Description("Enables tap-to-seek on the seekbar of the video player.")
|
||||
@SeekbarTappingCompatibility
|
||||
class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
listOf(OnTouchEventHandlerFingerprint, SeekbarTappingFingerprint)
|
||||
@Patch(
|
||||
name = "Seekbar tapping",
|
||||
description = "Enables tap-to-seek on the seekbar of the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
EnableSeekbarTappingResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object EnableSeekbarTappingPatch : BytecodePatch(
|
||||
setOf(
|
||||
OnTouchEventHandlerFingerprint,
|
||||
SeekbarTappingFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Find the required methods to tap the seekbar.
|
||||
+7
-5
@@ -1,14 +1,16 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.patch
|
||||
package app.revanced.patches.youtube.interaction.seekbar
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class])
|
||||
class EnableSeekbarTappingResourcePatch : ResourcePatch {
|
||||
@Patch(
|
||||
dependencies = [SettingsPatch::class]
|
||||
)
|
||||
object EnableSeekbarTappingResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
SwitchPreference(
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.seekbar.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class SeekbarTappingCompatibility
|
||||
|
||||
+25
-17
@@ -1,36 +1,44 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.patch.bytecode
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols
|
||||
|
||||
import app.revanced.extensions.transformMethods
|
||||
import app.revanced.extensions.traverseClassHierarchy
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
|
||||
@Patch
|
||||
@Name("Swipe controls")
|
||||
@Description("Adds volume and brightness swipe controls.")
|
||||
@SwipeControlsCompatibility
|
||||
@DependsOn(
|
||||
[
|
||||
@Patch(
|
||||
name = "Swipe controls",
|
||||
description = "Adds volume and brightness swipe controls.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
SwipeControlsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
class SwipeControlsBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
@Suppress("unused")
|
||||
object SwipeControlsBytecodePatch : BytecodePatch(
|
||||
setOf(
|
||||
WatchWhileActivityFingerprint,
|
||||
SwipeControlsHostActivityFingerprint
|
||||
)
|
||||
+7
-5
@@ -1,15 +1,17 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.patch.resource
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
|
||||
@DependsOn([SettingsPatch::class])
|
||||
class SwipeControlsResourcePatch : ResourcePatch {
|
||||
@Patch(
|
||||
dependencies = [SettingsPatch::class]
|
||||
)
|
||||
object SwipeControlsResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
PreferenceScreen(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class SwipeControlsCompatibility
|
||||
+27
-17
@@ -1,31 +1,41 @@
|
||||
package app.revanced.patches.youtube.layout.autocaptions.patch
|
||||
package app.revanced.patches.youtube.layout.autocaptions
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.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.autocaptions.fingerprints.StartVideoInformerFingerprint
|
||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
|
||||
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleTrackFingerprint
|
||||
import app.revanced.patches.youtube.layout.buttons.captions.annotations.HideCaptionsButtonCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Disable auto captions")
|
||||
@Description("Disable forced captions from being automatically enabled.")
|
||||
@HideCaptionsButtonCompatibility
|
||||
class AutoCaptionsPatch : BytecodePatch(
|
||||
listOf(
|
||||
StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint
|
||||
)
|
||||
|
||||
@Patch(
|
||||
name = "Disable auto captions",
|
||||
description = "Disable forced captions from being automatically enabled.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object AutoCaptionsPatch : BytecodePatch(
|
||||
setOf(StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.autocaptions.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class AutoCaptionsCompatibility
|
||||
+29
-33
@@ -1,23 +1,40 @@
|
||||
package app.revanced.patches.youtube.layout.branding.icon.patch
|
||||
package app.revanced.patches.youtube.layout.branding
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@Patch(false)
|
||||
@Name("Custom branding")
|
||||
@Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).")
|
||||
@CustomBrandingCompatibility
|
||||
class CustomBrandingPatch : ResourcePatch {
|
||||
@Patch(
|
||||
name = "Custom branding",
|
||||
description = "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomBrandingPatch : ResourcePatch() {
|
||||
private var appName by stringPatchOption(
|
||||
key = "appName",
|
||||
default = "YouTube ReVanced",
|
||||
title = "Application Name",
|
||||
description = "The name of the application it will show on your home screen.",
|
||||
required = true
|
||||
)
|
||||
|
||||
private var iconPath by stringPatchOption(
|
||||
key = "iconPath",
|
||||
default = null,
|
||||
title = "App Icon Path",
|
||||
description = "A path containing mipmap resource folders with icons."
|
||||
)
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
iconPath?.let { iconPathString ->
|
||||
@@ -65,25 +82,4 @@ class CustomBrandingPatch : ResourcePatch {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
private var appName: String? by option(
|
||||
PatchOption.StringOption(
|
||||
key = "appName",
|
||||
default = "YouTube ReVanced",
|
||||
title = "Application Name",
|
||||
description = "The name of the application it will show on your home screen.",
|
||||
required = true
|
||||
)
|
||||
)
|
||||
|
||||
private var iconPath: String? by option(
|
||||
PatchOption.StringOption(
|
||||
key = "iconPath",
|
||||
default = null,
|
||||
title = "App Icon Path",
|
||||
description = "A path containing mipmap resource folders with icons."
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
+12
-10
@@ -1,21 +1,23 @@
|
||||
package app.revanced.patches.youtube.layout.branding.header.patch
|
||||
package app.revanced.patches.youtube.layout.branding.header
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
import kotlin.io.path.exists
|
||||
|
||||
@Patch
|
||||
@Name("Premium heading")
|
||||
@Description("Shows premium branding on the home screen.")
|
||||
@PremiumHeadingCompatibility
|
||||
class PremiumHeadingPatch : ResourcePatch {
|
||||
@Patch(
|
||||
name = "Premium heading",
|
||||
description = "Shows premium branding on the home screen.",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PremiumHeadingPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
val resDirectory = context["res"]
|
||||
if (!resDirectory.isDirectory) throw PatchException("The res folder can not be found.")
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.branding.header.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class PremiumHeadingCompatibility
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.branding.icon.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class CustomBrandingCompatibility
|
||||
+32
-20
@@ -1,25 +1,42 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.action.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.action
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.buttons.action.annotations.HideButtonsCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Hide video action buttons",
|
||||
description = "Adds the options to hide action buttons under a video.",
|
||||
dependencies = [
|
||||
ResourceMappingPatch::class,
|
||||
LithoFilterPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideButtonsPatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/ButtonsFilter;"
|
||||
|
||||
@Patch
|
||||
@DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class])
|
||||
@Name("Hide video action buttons")
|
||||
@Description("Adds the options to hide action buttons under a video.")
|
||||
@HideButtonsCompatibility
|
||||
class HideButtonsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
@@ -93,9 +110,4 @@ class HideButtonsPatch : ResourcePatch {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/ButtonsFilter;"
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.action.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideButtonsCompatibility
|
||||
+33
-18
@@ -1,35 +1,50 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.autoplay.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.autoplay
|
||||
|
||||
import app.revanced.extensions.findIndexForIdResource
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.extensions.findIndexForIdResource
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.buttons.autoplay.annotations.AutoplayButtonCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
|
||||
@Name("Hide autoplay button")
|
||||
@Description("Hides the autoplay button in the video player.")
|
||||
@AutoplayButtonCompatibility
|
||||
class HideAutoplayButtonPatch : BytecodePatch(
|
||||
listOf(LayoutConstructorFingerprint)
|
||||
@Patch(
|
||||
name = "Hide autoplay button",
|
||||
description = "Hides the autoplay button in the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideAutoplayButtonPatch : BytecodePatch(
|
||||
setOf(LayoutConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.autoplay.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class AutoplayButtonCompatibility
|
||||
+30
-16
@@ -1,28 +1,42 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.captions.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.captions
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.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.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
|
||||
import app.revanced.patches.youtube.layout.buttons.captions.annotations.HideCaptionsButtonCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Hide captions button")
|
||||
@Description("Hides the captions button on video player.")
|
||||
@HideCaptionsButtonCompatibility
|
||||
class HideCaptionsButtonPatch : BytecodePatch(listOf(
|
||||
SubtitleButtonControllerFingerprint,
|
||||
)) {
|
||||
@Patch(
|
||||
name = "Hide captions button",
|
||||
description = "Hides the captions button on video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideCaptionsButtonPatch : BytecodePatch(
|
||||
setOf(SubtitleButtonControllerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.captions.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideCaptionsButtonCompatibility
|
||||
+17
-14
@@ -1,25 +1,28 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.cast.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.cast
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.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.buttons.cast.annotations.CastButtonCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Hide cast button")
|
||||
@Description("Hides the cast button in the video player.")
|
||||
@CastButtonCompatibility
|
||||
class HideCastButtonPatch : BytecodePatch() {
|
||||
@Patch(
|
||||
name = "Hide cast button",
|
||||
description = "Hides the cast button in the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
]
|
||||
)
|
||||
object HideCastButtonPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.cast.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class CastButtonCompatibility
|
||||
+30
-20
@@ -1,39 +1,53 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.annotations.NavigationButtonsCompatibility
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.injectHook
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn(
|
||||
[
|
||||
@Patch(
|
||||
name = "Navigation buttons",
|
||||
description = "Adds options to hide or change navigation buttons.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class,
|
||||
ResolvePivotBarFingerprintsPatch::class,
|
||||
ResolvePivotBarFingerprintsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Name("Navigation buttons")
|
||||
@Description("Adds options to hide or change navigation buttons.")
|
||||
@NavigationButtonsCompatibility
|
||||
class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerprint)) {
|
||||
@Suppress("unused")
|
||||
object NavigationButtonsPatch : BytecodePatch(
|
||||
setOf(AddCreateButtonViewFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/NavigationButtonsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
@@ -179,8 +193,4 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
mutableMethod.injectHook(hook, insertIndex)
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/NavigationButtonsPatch;"
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -1,21 +1,24 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.InitializeButtonsFingerprint
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.PivotBarConstructorFingerprint
|
||||
|
||||
@DependsOn([ResourceMappingPatch::class])
|
||||
@Description("Resolves necessary fingerprints.")
|
||||
class ResolvePivotBarFingerprintsPatch : BytecodePatch(
|
||||
listOf(PivotBarConstructorFingerprint)
|
||||
@Patch(
|
||||
description = "Resolves necessary fingerprints.",
|
||||
dependencies = [ResourceMappingPatch::class]
|
||||
)
|
||||
object ResolvePivotBarFingerprintsPatch : BytecodePatch(
|
||||
setOf(PivotBarConstructorFingerprint)
|
||||
) {
|
||||
internal var imageOnlyTabResourceId: Long = -1
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// imageOnlyTabResourceId is used in InitializeButtonsFingerprint fingerprint
|
||||
ResourceMappingPatch.resourceMappings.find { it.type == "layout" && it.name == "image_only_tab" }
|
||||
@@ -32,7 +35,4 @@ class ResolvePivotBarFingerprintsPatch : BytecodePatch(
|
||||
} ?: throw PivotBarConstructorFingerprint.exception
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var imageOnlyTabResourceId: Long = -1
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class NavigationButtonsCompatibility
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.navigation.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.patch.ResolvePivotBarFingerprintsPatch
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.ResolvePivotBarFingerprintsPatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
@@ -9,5 +9,5 @@ object InitializeButtonsFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf(),
|
||||
literal = ResolvePivotBarFingerprintsPatch.imageOnlyTabResourceId
|
||||
literalSupplier = { ResolvePivotBarFingerprintsPatch.imageOnlyTabResourceId }
|
||||
)
|
||||
+38
-22
@@ -1,35 +1,46 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.player.hide.patch
|
||||
package app.revanced.patches.youtube.layout.buttons.player.hide
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.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.buttons.player.hide.annotations.HidePlayerButtonsCompatibility
|
||||
import app.revanced.patches.youtube.layout.buttons.player.hide.HidePlayerButtonsPatch.ParameterOffsets.HAS_NEXT
|
||||
import app.revanced.patches.youtube.layout.buttons.player.hide.HidePlayerButtonsPatch.ParameterOffsets.HAS_PREVIOUS
|
||||
import app.revanced.patches.youtube.layout.buttons.player.hide.fingerprints.PlayerControlsVisibilityModelFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Hide player buttons")
|
||||
@Description("Adds the option to hide video player previous and next buttons.")
|
||||
@HidePlayerButtonsCompatibility
|
||||
class HidePlayerButtonsPatch : BytecodePatch(
|
||||
listOf(PlayerControlsVisibilityModelFingerprint)
|
||||
@Patch(
|
||||
name = "Hide player buttons",
|
||||
description = "Adds the option to hide video player previous and next buttons.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HidePlayerButtonsPatch : BytecodePatch(
|
||||
setOf(PlayerControlsVisibilityModelFingerprint)
|
||||
) {
|
||||
private object ParameterOffsets {
|
||||
const val HAS_NEXT = 5
|
||||
const val HAS_PREVIOUS = 6
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -54,8 +65,8 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
||||
val callInstruction = mutableMethod.getInstruction<Instruction3rc>(callIndex)
|
||||
|
||||
// overriding this parameter register hides the previous and next buttons
|
||||
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
||||
val hasPreviousParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_PREVIOUS
|
||||
val hasNextParameterRegister = callInstruction.startRegister + HAS_NEXT
|
||||
val hasPreviousParameterRegister = callInstruction.startRegister + HAS_PREVIOUS
|
||||
|
||||
mutableMethod.addInstructions(
|
||||
callIndex,
|
||||
@@ -69,4 +80,9 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
||||
)
|
||||
} ?: throw PlayerControlsVisibilityModelFingerprint.exception
|
||||
}
|
||||
|
||||
private object ParameterOffsets {
|
||||
const val HAS_NEXT = 5
|
||||
const val HAS_PREVIOUS = 6
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.buttons.player.hide.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HidePlayerButtonsCompatibility
|
||||
+29
-18
@@ -1,29 +1,40 @@
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.annotations.AlbumCardsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.bytecode.fingerprints.AlbumCardsFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.resource.patch.AlbumCardsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.fingerprints.AlbumCardsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, AlbumCardsResourcePatch::class])
|
||||
@Name("Hide album cards")
|
||||
@Description("Hides the album cards below the artist description.")
|
||||
@AlbumCardsCompatibility
|
||||
class AlbumCardsPatch : BytecodePatch(
|
||||
listOf(
|
||||
AlbumCardsFingerprint,
|
||||
)
|
||||
@Patch(
|
||||
name = "Hide album cards",
|
||||
description = "Hides the album cards below the artist description.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
AlbumCardsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object AlbumCardsPatch : BytecodePatch(
|
||||
setOf(AlbumCardsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AlbumCardsFingerprint.result?.let {
|
||||
+12
-9
@@ -1,18 +1,21 @@
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class AlbumCardsResourcePatch : ResourcePatch {
|
||||
companion object {
|
||||
internal var albumCardId: Long = -1
|
||||
}
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
)
|
||||
object AlbumCardsResourcePatch : ResourcePatch() {
|
||||
internal var albumCardId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class AlbumCardsCompatibility
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.resource.patch.AlbumCardsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.AlbumCardsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -16,5 +16,5 @@ object AlbumCardsFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
),
|
||||
literal = AlbumCardsResourcePatch.albumCardId
|
||||
literalSupplier = { AlbumCardsResourcePatch.albumCardId }
|
||||
)
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints.BreakingNewsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide breaking news shelf",
|
||||
description = "Hides the breaking news shelf on the homepage tab.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
BreakingNewsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object BreakingNewsPatch : BytecodePatch(
|
||||
setOf(BreakingNewsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
BreakingNewsFingerprint.result?.let {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
val moveResultIndex = insertIndex - 1
|
||||
|
||||
it.mutableMethod.apply {
|
||||
val breakingNewsViewRegister =
|
||||
getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$breakingNewsViewRegister},
|
||||
Lapp/revanced/integrations/patches/HideBreakingNewsPatch;
|
||||
->
|
||||
hideBreakingNews(Landroid/view/View;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
} ?: throw BreakingNewsFingerprint.exception
|
||||
|
||||
}
|
||||
}
|
||||
+12
-9
@@ -1,18 +1,21 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class BreakingNewsResourcePatch : ResourcePatch {
|
||||
companion object {
|
||||
internal var horizontalCardListId: Long = -1
|
||||
}
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
)
|
||||
object BreakingNewsResourcePatch : ResourcePatch() {
|
||||
internal var horizontalCardListId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class BreakingNewsCompatibility
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.annotations.BreakingNewsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.fingerprints.BreakingNewsFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.resource.patch.BreakingNewsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, BreakingNewsResourcePatch::class])
|
||||
@Name("Hide breaking news shelf")
|
||||
@Description("Hides the breaking news shelf on the homepage tab.")
|
||||
@BreakingNewsCompatibility
|
||||
class BreakingNewsPatch : BytecodePatch(
|
||||
listOf(BreakingNewsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
BreakingNewsFingerprint.result?.let {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
val moveResultIndex = insertIndex - 1
|
||||
|
||||
it.mutableMethod.apply {
|
||||
val breakingNewsViewRegister = getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$breakingNewsViewRegister},
|
||||
Lapp/revanced/integrations/patches/HideBreakingNewsPatch;
|
||||
->
|
||||
hideBreakingNews(Landroid/view/View;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
} ?: throw BreakingNewsFingerprint.exception
|
||||
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.resource.patch.BreakingNewsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.BreakingNewsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -16,5 +16,5 @@ object BreakingNewsFingerprint : LiteralValueFingerprint(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT,
|
||||
),
|
||||
literal = BreakingNewsResourcePatch.horizontalCardListId
|
||||
literalSupplier = { BreakingNewsResourcePatch.horizontalCardListId }
|
||||
)
|
||||
+31
-18
@@ -1,24 +1,41 @@
|
||||
package app.revanced.patches.youtube.layout.hide.comments.patch
|
||||
package app.revanced.patches.youtube.layout.hide.comments
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
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.comments.annotations.HideCommentsCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Comments",
|
||||
description = "Hides components related to comments.",
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
LithoFilterPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CommentsPatch : ResourcePatch() {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/CommentsFilter;"
|
||||
|
||||
@Patch
|
||||
@Name("Comments")
|
||||
@Description("Hides components related to comments.")
|
||||
@HideCommentsCompatibility
|
||||
@DependsOn([SettingsPatch::class, LithoFilterPatch::class])
|
||||
class CommentsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
@@ -44,8 +61,4 @@ class CommentsPatch : ResourcePatch {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/CommentsFilter;"
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.comments.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideCommentsCompatibility
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide crowdfunding box",
|
||||
description = "Hides the crowdfunding box between the player and video description.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
CrowdfundingBoxResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CrowdfundingBoxPatch : BytecodePatch(
|
||||
setOf(CrowdfundingBoxFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CrowdfundingBoxFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val objectRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
||||
}
|
||||
} ?: throw CrowdfundingBoxFingerprint.exception
|
||||
}
|
||||
}
|
||||
+12
-9
@@ -1,18 +1,21 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class CrowdfundingBoxResourcePatch : ResourcePatch {
|
||||
companion object {
|
||||
internal var crowdfundingBoxId: Long = -1
|
||||
}
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
)
|
||||
object CrowdfundingBoxResourcePatch : ResourcePatch() {
|
||||
internal var crowdfundingBoxId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class CrowdfundingBoxCompatibility
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.bytecode.fingerprints.CrowdfundingBoxFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.resource.patch.CrowdfundingBoxResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, CrowdfundingBoxResourcePatch::class])
|
||||
@Name("Hide crowdfunding box")
|
||||
@Description("Hides the crowdfunding box between the player and video description.")
|
||||
@CrowdfundingBoxCompatibility
|
||||
class CrowdfundingBoxPatch : BytecodePatch(
|
||||
listOf(
|
||||
CrowdfundingBoxFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CrowdfundingBoxFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val objectRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
||||
}
|
||||
} ?: throw CrowdfundingBoxFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_METHOD_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideCrowdfundingBoxPatch;->hideCrowdfundingBox(Landroid/view/View;)V"
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.resource.patch.CrowdfundingBoxResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.CrowdfundingBoxResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -13,5 +13,5 @@ object CrowdfundingBoxFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
),
|
||||
literal = CrowdfundingBoxResourcePatch.crowdfundingBoxId
|
||||
literalSupplier = { CrowdfundingBoxResourcePatch.crowdfundingBoxId }
|
||||
)
|
||||
+31
-18
@@ -1,30 +1,43 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.annotations.HideEndscreenCardsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints.LayoutCircleFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints.LayoutIconFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints.LayoutVideoFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.LayoutCircleFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.LayoutIconFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints.LayoutVideoFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, HideEndscreenCardsResourcePatch::class])
|
||||
@Name("Hide endscreen cards")
|
||||
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
|
||||
@HideEndscreenCardsCompatibility
|
||||
class HideEndscreenCardsPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
name = "Hide endscreen cards",
|
||||
description = "Hides the suggested video cards at the end of a video in fullscreen.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
HideEndscreenCardsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideEndscreenCardsPatch : BytecodePatch(
|
||||
setOf(
|
||||
LayoutCircleFingerprint,
|
||||
LayoutIconFingerprint,
|
||||
LayoutVideoFingerprint,
|
||||
+14
-11
@@ -1,20 +1,23 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideEndscreenCardsResourcePatch : ResourcePatch {
|
||||
internal companion object {
|
||||
var layoutCircle: Long = -1
|
||||
var layoutIcon: Long = -1
|
||||
var layoutVideo: Long = -1
|
||||
}
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
)
|
||||
object HideEndscreenCardsResourcePatch : ResourcePatch() {
|
||||
internal var layoutCircle: Long = -1
|
||||
internal var layoutIcon: Long = -1
|
||||
internal var layoutVideo: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideEndscreenCardsCompatibility
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -13,5 +13,5 @@ object LayoutCircleFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
),
|
||||
literal = HideEndscreenCardsResourcePatch.layoutCircle
|
||||
literalSupplier = { HideEndscreenCardsResourcePatch.layoutCircle }
|
||||
)
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -13,5 +13,5 @@ object LayoutIconFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
),
|
||||
literal = HideEndscreenCardsResourcePatch.layoutIcon
|
||||
literalSupplier = { HideEndscreenCardsResourcePatch.layoutIcon }
|
||||
)
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.endscreencards.HideEndscreenCardsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -13,5 +13,5 @@ object LayoutVideoFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
),
|
||||
literal = HideEndscreenCardsResourcePatch.layoutVideo
|
||||
literalSupplier = { HideEndscreenCardsResourcePatch.layoutVideo }
|
||||
)
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide filter bar",
|
||||
description = "Hides the filter bar in video feeds.",
|
||||
dependencies = [HideFilterBarResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideFilterBarPatch : BytecodePatch(
|
||||
setOf(
|
||||
RelatedChipCloudFingerprint,
|
||||
SearchResultsChipBarFingerprint,
|
||||
FilterBarHeightFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFilterBarPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
|
||||
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
|
||||
"invoke-static { v$register }, " +
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V"
|
||||
}
|
||||
|
||||
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInSearch(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch a [MethodFingerprint] with a given [instructions].
|
||||
*
|
||||
* @param RegisterInstruction The type of instruction to get the register from.
|
||||
* @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint].
|
||||
* @param hookRegisterOffset The offset to add to the register of the hook.
|
||||
* @param instructions The instructions to add with the register as a parameter.
|
||||
*/
|
||||
private fun <RegisterInstruction : OneRegisterInstruction> MethodFingerprint.patch(
|
||||
insertIndexOffset: Int = 0,
|
||||
hookRegisterOffset: Int = 0,
|
||||
instructions: (Int) -> String
|
||||
) =
|
||||
result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
val insertIndex = endIndex + insertIndexOffset
|
||||
val register =
|
||||
getInstruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
|
||||
|
||||
addInstructions(insertIndex, instructions(register))
|
||||
}
|
||||
} ?: throw exception
|
||||
}
|
||||
+10
-12
@@ -1,16 +1,20 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class])
|
||||
object HideFilterBarResourcePatch : ResourcePatch() {
|
||||
internal var filterBarHeightId = -1L
|
||||
internal var relatedChipCloudMarginId = -1L
|
||||
internal var barContainerHeightId = -1L
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideFilterBarResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
@@ -78,12 +82,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
|
||||
barContainerHeightId = "bar_container_height".layoutResourceId()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var filterBarHeightId = -1L
|
||||
var relatedChipCloudMarginId = -1L
|
||||
var barContainerHeightId = -1L
|
||||
|
||||
private fun String.layoutResourceId(type: String = "dimen") =
|
||||
ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideFilterBar
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -15,5 +15,5 @@ object FilterBarHeightFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IPUT
|
||||
),
|
||||
literal = HideFilterBarResourcePatch.filterBarHeightId
|
||||
literalSupplier = { HideFilterBarResourcePatch.filterBarHeightId }
|
||||
)
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -14,5 +14,5 @@ object RelatedChipCloudFingerprint : LiteralValueFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
literal = HideFilterBarResourcePatch.relatedChipCloudMarginId
|
||||
literalSupplier = { HideFilterBarResourcePatch.relatedChipCloudMarginId }
|
||||
)
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.HideFilterBarResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -16,5 +16,5 @@ object SearchResultsChipBarFingerprint : LiteralValueFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
literal = HideFilterBarResourcePatch.barContainerHeightId
|
||||
literalSupplier = { HideFilterBarResourcePatch.barContainerHeightId }
|
||||
)
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.annotations.HideFilterBar
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Hide filter bar")
|
||||
@Description("Hides the filter bar in video feeds.")
|
||||
@DependsOn([HideFilterBarResourcePatch::class])
|
||||
@HideFilterBar
|
||||
class HideFilterBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
RelatedChipCloudFingerprint,
|
||||
SearchResultsChipBarFingerprint,
|
||||
FilterBarHeightFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
|
||||
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
|
||||
"invoke-static { v$register }, " +
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V"
|
||||
}
|
||||
|
||||
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInSearch(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFilterBarPatch;"
|
||||
|
||||
/**
|
||||
* Patch a [MethodFingerprint] with a given [instructions].
|
||||
*
|
||||
* @param RegisterInstruction The type of instruction to get the register from.
|
||||
* @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint].
|
||||
* @param hookRegisterOffset The offset to add to the register of the hook.
|
||||
* @param instructions The instructions to add with the register as a parameter.
|
||||
*/
|
||||
private fun <RegisterInstruction: OneRegisterInstruction> MethodFingerprint.patch(
|
||||
insertIndexOffset: Int = 0,
|
||||
hookRegisterOffset: Int = 0,
|
||||
instructions: (Int) -> String
|
||||
) =
|
||||
result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
val insertIndex = endIndex + insertIndexOffset
|
||||
val register = getInstruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
|
||||
|
||||
addInstructions(insertIndex, instructions(register))
|
||||
}
|
||||
} ?: throw exception
|
||||
}
|
||||
}
|
||||
+29
-19
@@ -1,31 +1,46 @@
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.floatingmicrophone.annotations.HideFloatingMicrophoneButtonCompatibility
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.floatingmicrophone.fingerprints.ShowFloatingMicrophoneButtonFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Hide floating microphone button")
|
||||
@Description("Hides the floating microphone button which appears in search.")
|
||||
@DependsOn([HideFloatingMicrophoneButtonResourcePatch::class])
|
||||
@HideFloatingMicrophoneButtonCompatibility
|
||||
class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
listOf(ShowFloatingMicrophoneButtonFingerprint)
|
||||
@Patch(
|
||||
name = "Hide floating microphone button",
|
||||
description = "Hides the floating microphone button which appears in search.",
|
||||
dependencies = [HideFloatingMicrophoneButtonResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
setOf(ShowFloatingMicrophoneButtonFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFloatingMicrophoneButtonPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
||||
with(result.mutableMethod) {
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||
val showButtonRegister = getInstruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||
val showButtonRegister =
|
||||
getInstruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex,
|
||||
@@ -37,9 +52,4 @@ class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw ShowFloatingMicrophoneButtonFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideFloatingMicrophoneButtonPatch;"
|
||||
}
|
||||
}
|
||||
+13
-12
@@ -1,18 +1,23 @@
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
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.floatingmicrophone.annotations.HideFloatingMicrophoneButtonCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
]
|
||||
)
|
||||
object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() {
|
||||
internal var fabButtonId: Long = -1
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
@HideFloatingMicrophoneButtonCompatibility
|
||||
class HideFloatingMicrophoneButtonResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -29,8 +34,4 @@ class HideFloatingMicrophoneButtonResourcePatch : ResourcePatch {
|
||||
fabButtonId = ResourceMappingPatch.resourceMappings.find { it.type == "id" && it.name == "fab" }?.id
|
||||
?: throw PatchException("Can not find required fab button resource id")
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var fabButtonId: Long = -1
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideFloatingMicrophoneButtonCompatibility
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.floatingmicrophone.HideFloatingMicrophoneButtonResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch.HideFloatingMicrophoneButtonResourcePatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -15,5 +15,5 @@ object ShowFloatingMicrophoneButtonFingerprint : LiteralValueFingerprint(
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
literal = HideFloatingMicrophoneButtonResourcePatch.fabButtonId
|
||||
literalSupplier = { HideFloatingMicrophoneButtonResourcePatch.fabButtonId }
|
||||
)
|
||||
+21
-21
@@ -1,36 +1,41 @@
|
||||
package app.revanced.patches.youtube.layout.hide.general.patch
|
||||
package app.revanced.patches.youtube.layout.hide.general
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||
import app.revanced.patches.youtube.layout.hide.general.annotations.HideLayoutComponentsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen
|
||||
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
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Hide layout components")
|
||||
@Description("Hides general layout components.")
|
||||
@DependsOn([LithoFilterPatch::class, SettingsPatch::class])
|
||||
@HideLayoutComponentsCompatibility
|
||||
class HideLayoutComponentsPatch : BytecodePatch(
|
||||
listOf(ParseElementFromBufferFingerprint)
|
||||
@Patch(
|
||||
name = "Hide layout components",
|
||||
description = "Hides general layout components.",
|
||||
dependencies = [
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.youtube", ["18.32.39"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideLayoutComponentsPatch : BytecodePatch(
|
||||
setOf(ParseElementFromBufferFingerprint)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/LayoutComponentsFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -270,9 +275,4 @@ class HideLayoutComponentsPatch : BytecodePatch(
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/LayoutComponentsFilter;"
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.general.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideLayoutComponentsCompatibility
|
||||
|
||||
+29
-16
@@ -1,39 +1,52 @@
|
||||
package app.revanced.patches.youtube.layout.hide.infocards.patch
|
||||
package app.revanced.patches.youtube.layout.hide.infocards
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.annotations.HideInfocardsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.InfocardsIncognitoFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.InfocardsIncognitoParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.fingerprints.InfocardsMethodCallFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
|
||||
@Name("Hide info cards")
|
||||
@Description("Hides info cards in videos.")
|
||||
@HideInfocardsCompatibility
|
||||
class HideInfoCardsPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
name = "Hide info cards",
|
||||
description = "Hides info cards in videos.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
HideInfocardsResourcePatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideInfoCardsPatch : BytecodePatch(
|
||||
setOf(
|
||||
InfocardsIncognitoParentFingerprint,
|
||||
InfocardsMethodCallFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||
}.result!!.mutableMethod.apply {
|
||||
val invokeInstructionIndex = implementation!!.instructions.indexOfFirst {
|
||||
+12
-11
@@ -1,20 +1,21 @@
|
||||
package app.revanced.patches.youtube.layout.hide.infocards.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.infocards
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
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.infocards.annotations.HideInfocardsCompatibility
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@HideInfocardsCompatibility
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideInfocardsResourcePatch : ResourcePatch {
|
||||
internal companion object {
|
||||
var drawerResourceId: Long = -1
|
||||
}
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
)
|
||||
object HideInfocardsResourcePatch : ResourcePatch() {
|
||||
internal var drawerResourceId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.infocards.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideInfocardsCompatibility
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.infocards.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.HideInfocardsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.infocards.resource.patch.HideInfocardsResourcePatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object InfocardsMethodCallFingerprint : LiteralValueFingerprint(
|
||||
@@ -11,5 +11,5 @@ object InfocardsMethodCallFingerprint : LiteralValueFingerprint(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
),
|
||||
strings = listOf("Missing ControlsOverlayPresenter for InfoCards to work."),
|
||||
literal = HideInfocardsResourcePatch.drawerResourceId
|
||||
literalSupplier = { HideInfocardsResourcePatch.drawerResourceId }
|
||||
)
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints.HideLoadMoreButtonFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide load more button",
|
||||
description = "Hides the button under videos that loads similar videos.",
|
||||
dependencies = [HideLoadMoreButtonResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideLoadMoreButtonPatch : BytecodePatch(
|
||||
setOf(HideLoadMoreButtonFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideLoadMoreButtonPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
HideLoadMoreButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val viewRegister =
|
||||
getInstruction<OneRegisterInstruction>(moveRegisterIndex).registerA
|
||||
|
||||
val insertIndex = moveRegisterIndex + 1
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$viewRegister }, " +
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw HideLoadMoreButtonFingerprint.exception
|
||||
}
|
||||
}
|
||||
+13
-10
@@ -1,15 +1,22 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ResourceMappingPatch::class
|
||||
]
|
||||
)
|
||||
object HideLoadMoreButtonResourcePatch : ResourcePatch() {
|
||||
internal var expandButtonDownId: Long = -1
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideLoadMoreButtonResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -24,8 +31,4 @@ class HideLoadMoreButtonResourcePatch : ResourcePatch {
|
||||
it.type == "layout" && it.name == "expand_button_down"
|
||||
}.id
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var expandButtonDownId: Long = -1
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideLoadMoreButtonCompatibility
|
||||
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.fingerprints.HideLoadMoreButtonFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch.HideLoadMoreButtonResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.annotations.HideLoadMoreButtonCompatibility
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Hide load more button")
|
||||
@Description("Hides the button under videos that loads similar videos.")
|
||||
@DependsOn([HideLoadMoreButtonResourcePatch::class])
|
||||
@HideLoadMoreButtonCompatibility
|
||||
class HideLoadMoreButtonPatch : BytecodePatch(listOf(HideLoadMoreButtonFingerprint)) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
HideLoadMoreButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val viewRegister = getInstruction<OneRegisterInstruction>(moveRegisterIndex).registerA
|
||||
|
||||
val insertIndex = moveRegisterIndex + 1
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$viewRegister }, " +
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw HideLoadMoreButtonFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/HideLoadMoreButtonPatch;"
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch.HideLoadMoreButtonResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.HideLoadMoreButtonResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -11,5 +11,5 @@ object HideLoadMoreButtonFingerprint : LiteralValueFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
literal = HideLoadMoreButtonResourcePatch.expandButtonDownId
|
||||
literalSupplier = { HideLoadMoreButtonResourcePatch.expandButtonDownId }
|
||||
)
|
||||
+25
-18
@@ -1,29 +1,36 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.annotations.HideEmailAddressCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.resource.patch.HideEmailAddressResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, HideEmailAddressResourcePatch::class])
|
||||
@Name("Hide email address")
|
||||
@Description("Hides the email address in the account switcher.")
|
||||
@HideEmailAddressCompatibility
|
||||
class HideEmailAddressPatch : BytecodePatch(
|
||||
listOf(
|
||||
AccountSwitcherAccessibilityLabelFingerprint
|
||||
)
|
||||
@Patch(
|
||||
name = "Hide email address",
|
||||
description = "Hides the email address in the account switcher.",
|
||||
dependencies = [IntegrationsPatch::class, HideEmailAddressResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideEmailAddressPatch : BytecodePatch(
|
||||
setOf(AccountSwitcherAccessibilityLabelFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||
+8
-9
@@ -1,18 +1,17 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideEmailAddressResourcePatch : ResourcePatch {
|
||||
companion object {
|
||||
internal var accountSwitcherAccessibilityLabelId: Long = -1
|
||||
}
|
||||
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class])
|
||||
@Suppress("unused")
|
||||
object HideEmailAddressResourcePatch : ResourcePatch() {
|
||||
internal var accountSwitcherAccessibilityLabelId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideEmailAddressCompatibility
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.HideEmailAddressResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.resource.patch.HideEmailAddressResourcePatch
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object AccountSwitcherAccessibilityLabelFingerprint : LiteralValueFingerprint(
|
||||
@@ -16,5 +16,5 @@ object AccountSwitcherAccessibilityLabelFingerprint : LiteralValueFingerprint(
|
||||
Opcode.APUT_OBJECT,
|
||||
Opcode.CONST,
|
||||
),
|
||||
literal = HideEmailAddressResourcePatch.accountSwitcherAccessibilityLabelId
|
||||
literalSupplier = { HideEmailAddressResourcePatch.accountSwitcherAccessibilityLabelId }
|
||||
)
|
||||
+30
-21
@@ -1,24 +1,40 @@
|
||||
package app.revanced.patches.youtube.layout.hide.player.flyoutmenupanel.patch
|
||||
package app.revanced.patches.youtube.layout.hide.player.flyoutmenupanel
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
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.player.flyoutmenupanel.annotations.HidePlayerFlyoutMenuItemsCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Player flyout menu",
|
||||
description = "Hides player flyout menu items.",
|
||||
dependencies = [
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
])
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HidePlayerFlyoutMenuPatch : ResourcePatch() {
|
||||
private const val KEY = "revanced_hide_player_flyout"
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlayerFlyoutMenuItemsFilter;"
|
||||
|
||||
@Patch
|
||||
@Name("Player flyout menu")
|
||||
@Description("Hides player flyout menu items.")
|
||||
@DependsOn([LithoFilterPatch::class, SettingsPatch::class])
|
||||
@HidePlayerFlyoutMenuItemsCompatibility
|
||||
class HidePlayerFlyoutMenuPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
@@ -92,11 +108,4 @@ class HidePlayerFlyoutMenuPatch : ResourcePatch {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val KEY = "revanced_hide_player_flyout"
|
||||
|
||||
const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlayerFlyoutMenuItemsFilter;"
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.player.flyoutmenupanel.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HidePlayerFlyoutMenuItemsCompatibility
|
||||
+33
-25
@@ -1,37 +1,45 @@
|
||||
package app.revanced.patches.youtube.layout.hide.seekbar.patch
|
||||
package app.revanced.patches.youtube.layout.hide.seekbar
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.fingerprints.SeekbarFingerprint
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.shared.fingerprints.SeekbarFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
|
||||
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.seekbar.annotations.HideSeekbarCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
||||
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.layout.seekbar.SeekbarColorBytecodePatch
|
||||
import app.revanced.patches.youtube.layout.seekbar.SeekbarPreferencesPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class,
|
||||
// Does not alter the behavior of the seek bar by default.
|
||||
SeekbarColorBytecodePatch::class,
|
||||
// Used to add preferences to the seekbar settings menu.
|
||||
SeekbarPreferencesPatch::class
|
||||
])
|
||||
@Name("Hide seekbar")
|
||||
@Description("Hides the seekbar.")
|
||||
@HideSeekbarCompatibility
|
||||
class HideSeekbarPatch : BytecodePatch(
|
||||
listOf(SeekbarFingerprint)
|
||||
@Patch(
|
||||
name = "Hide seekbar",
|
||||
description = "Hides the seekbar.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class,
|
||||
SeekbarColorBytecodePatch::class,
|
||||
SeekbarPreferencesPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideSeekbarPatch : BytecodePatch(
|
||||
setOf(SeekbarFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SeekbarPreferencesPatch.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.seekbar.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideSeekbarCompatibility
|
||||
+38
-32
@@ -1,42 +1,49 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.hide.shorts
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.findIndexForIdResource
|
||||
import app.revanced.extensions.injectHideViewCall
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.annotations.HideShortsComponentsCompatibility
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.bytecode.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.resource.patch.HideShortsComponentsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn(
|
||||
[
|
||||
@Patch(
|
||||
name = "Hide Shorts components",
|
||||
description = "Hides components from YouTube Shorts.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
LithoFilterPatch::class,
|
||||
HideShortsComponentsResourcePatch::class,
|
||||
ResourceMappingPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Name("Hide Shorts components")
|
||||
@Description("Hides components from YouTube Shorts.")
|
||||
@HideShortsComponentsCompatibility
|
||||
class HideShortsComponentsPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Suppress("unused")
|
||||
object HideShortsComponentsPatch : BytecodePatch(
|
||||
setOf(
|
||||
CreateShortsButtonsFingerprint,
|
||||
ReelConstructorFingerprint,
|
||||
BottomNavigationBarFingerprint,
|
||||
@@ -44,6 +51,8 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
SetPivotBarVisibilityParentFingerprint
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
@@ -122,21 +131,18 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
// endregion
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
|
||||
private enum class ShortsButtons(private val resourceName: String, private val methodName: String) {
|
||||
COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"),
|
||||
REMIX("reel_dyn_remix", "hideShortsRemixButton"),
|
||||
SHARE("reel_dyn_share", "hideShortsShareButton");
|
||||
private enum class ShortsButtons(private val resourceName: String, private val methodName: String) {
|
||||
COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"),
|
||||
REMIX("reel_dyn_remix", "hideShortsRemixButton"),
|
||||
SHARE("reel_dyn_share", "hideShortsShareButton");
|
||||
|
||||
fun injectHideCall(method: MutableMethod) {
|
||||
val referencedIndex = method.findIndexForIdResource(resourceName)
|
||||
fun injectHideCall(method: MutableMethod) {
|
||||
val referencedIndex = method.findIndexForIdResource(resourceName)
|
||||
|
||||
val setIdIndex = referencedIndex + 1
|
||||
val viewRegister = method.getInstruction<FiveRegisterInstruction>(setIdIndex).registerC
|
||||
method.injectHideViewCall(setIdIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, methodName)
|
||||
}
|
||||
val setIdIndex = referencedIndex + 1
|
||||
val viewRegister = method.getInstruction<FiveRegisterInstruction>(setIdIndex).registerC
|
||||
method.injectHideViewCall(setIdIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, methodName)
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-11
@@ -1,16 +1,19 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.resource.patch
|
||||
package app.revanced.patches.youtube.layout.hide.shorts
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class])
|
||||
object HideShortsComponentsResourcePatch : ResourcePatch() {
|
||||
internal var reelMultipleItemShelfId = -1L
|
||||
internal var reelPlayerRightCellButtonHeight = -1L
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideShortsComponentsResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
@@ -93,9 +96,4 @@ class HideShortsComponentsResourcePatch : ResourcePatch {
|
||||
reelMultipleItemShelfId = "reel_multiple_items_shelf".getId()
|
||||
reelPlayerRightCellButtonHeight = "reel_player_right_cell_button_height".getId()
|
||||
}
|
||||
|
||||
companion object {
|
||||
var reelMultipleItemShelfId = -1L
|
||||
var reelPlayerRightCellButtonHeight = -1L
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideShortsComponentsCompatibility
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.resource.patch.HideShortsComponentsResourcePatch
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.HideShortsComponentsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
@@ -9,5 +9,5 @@ object CreateShortsButtonsFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
literal = HideShortsComponentsResourcePatch.reelPlayerRightCellButtonHeight
|
||||
literalSupplier = { HideShortsComponentsResourcePatch.reelPlayerRightCellButtonHeight }
|
||||
)
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.HideShortsComponentsResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import app.revanced.patches.youtube.layout.hide.shorts.resource.patch.HideShortsComponentsResourcePatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ReelConstructorFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(Opcode.INVOKE_VIRTUAL),
|
||||
literal = HideShortsComponentsResourcePatch.reelMultipleItemShelfId
|
||||
literalSupplier = { HideShortsComponentsResourcePatch.reelMultipleItemShelfId }
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user