mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
fix(YouTube/Hide shorts components): toolbar buttons in shorts are not hidden unless you include the Hide toolbar button
patch
This commit is contained in:
@ -1,12 +1,9 @@
|
||||
package app.revanced.patches.youtube.general.toolbar
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
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.utils.fingerprints.ToolBarPatchFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch
|
||||
import app.revanced.util.integrations.Constants.GENERAL
|
||||
@ -42,19 +39,10 @@ import app.revanced.util.integrations.Constants.GENERAL
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ToolBarButtonPatch : BytecodePatch(
|
||||
setOf(ToolBarPatchFingerprint)
|
||||
) {
|
||||
object ToolBarButtonPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ToolBarPatchFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-static {p0, p1}, $GENERAL->hideToolBarButton(Ljava/lang/String;Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ToolBarPatchFingerprint.exception
|
||||
ToolBarHookPatch.injectCall("$GENERAL->hideToolBarButton")
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
|
@ -2,21 +2,19 @@ package app.revanced.patches.youtube.shorts.shortscomponent
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
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.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ToolBarBannerFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.ToolBarPatchFingerprint
|
||||
import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
|
||||
@Patch(dependencies = [ToolBarHookPatch::class])
|
||||
object ShortsToolBarPatch : BytecodePatch(
|
||||
setOf(
|
||||
ToolBarBannerFingerprint,
|
||||
ToolBarPatchFingerprint
|
||||
)
|
||||
setOf(ToolBarBannerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ToolBarBannerFingerprint.result?.let {
|
||||
@ -38,13 +36,6 @@ object ShortsToolBarPatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw ToolBarBannerFingerprint.exception
|
||||
|
||||
ToolBarPatchFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-static {p0, p1}, $SHORTS->hideShortsToolBarButton(Ljava/lang/String;Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ToolBarPatchFingerprint.exception
|
||||
ToolBarHookPatch.injectCall("$SHORTS->hideShortsToolBarButton")
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ 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.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.toolbar.fingerprints.ToolBarButtonFingerprint
|
||||
import app.revanced.patches.youtube.utils.toolbar.fingerprints.ToolBarPatchFingerprint
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -15,11 +17,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(dependencies = [SharedResourceIdPatch::class])
|
||||
object ToolBarHookPatch : BytecodePatch(
|
||||
setOf(ToolBarButtonFingerprint)
|
||||
setOf(
|
||||
ToolBarButtonFingerprint,
|
||||
ToolBarPatchFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$UTILS_PATH/ToolBarPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ToolBarButtonFingerprint.result?.let {
|
||||
@ -41,5 +43,22 @@ object ToolBarHookPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
} ?: throw ToolBarButtonFingerprint.exception
|
||||
|
||||
insertMethod = ToolBarPatchFingerprint.result?.mutableMethod
|
||||
?: throw ToolBarPatchFingerprint.exception
|
||||
}
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$UTILS_PATH/ToolBarPatch;"
|
||||
|
||||
private lateinit var insertMethod: MutableMethod
|
||||
|
||||
internal fun injectCall(
|
||||
descriptor: String
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
0,
|
||||
"invoke-static {p0, p1}, $descriptor(Ljava/lang/String;Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.utils.fingerprints
|
||||
package app.revanced.patches.youtube.utils.toolbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
Reference in New Issue
Block a user