mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 11:04:36 +02:00
fix(youtube/old-quality-layout): does not work on tablet devices
Fix the following issues - 'Custom playback speed' patch does not work on tablet devices - 'Old quality layout' patch does not work on tablet devices - when user opens the sharing panel, the custom playback speed panel opens https://github.com/ReVanced/revanced-patches/issues/2824
This commit is contained in:
parent
94a36ed91a
commit
16c34b78f0
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.fingerprints.NewFlyoutPanelBuilderFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@ -32,7 +32,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@YouTubeCompatibility
|
||||
class OldQualityLayoutPatch : BytecodePatch(
|
||||
listOf(
|
||||
NewFlyoutPanelBuilderFingerprint,
|
||||
RecyclerViewTreeObserverFingerprint,
|
||||
QualityMenuViewInflateFingerprint
|
||||
)
|
||||
) {
|
||||
@ -56,17 +56,17 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||
/**
|
||||
* New method
|
||||
*/
|
||||
NewFlyoutPanelBuilderFingerprint.result?.let {
|
||||
RecyclerViewTreeObserverFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = implementation!!.instructions.size - 1
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||
val recyclerViewRegister = 2
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$insertRegister }, $FLYOUT_PANEL->onFlyoutMenuCreate(Landroid/widget/LinearLayout;)V"
|
||||
"invoke-static/range { p$recyclerViewRegister .. p$recyclerViewRegister }, $FLYOUT_PANEL->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw NewFlyoutPanelBuilderFingerprint.exception
|
||||
} ?: throw RecyclerViewTreeObserverFingerprint.exception
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/VideoQualityMenuFilter;")
|
||||
|
||||
|
@ -4,7 +4,6 @@ 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.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -13,21 +12,20 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMut
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.CustomPlaybackSpeedIntegrationsFingerprint
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.PlaybackRateBottomSheetBuilderFingerprint
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.PlaybackRateBottomSheetClassFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.NewFlyoutPanelBuilderFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.RecyclerViewTreeObserverFingerprint
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||
|
||||
@DependsOn([LithoFilterPatch::class])
|
||||
class OldSpeedLayoutPatch : BytecodePatch(
|
||||
listOf(
|
||||
CustomPlaybackSpeedIntegrationsFingerprint,
|
||||
NewFlyoutPanelBuilderFingerprint,
|
||||
PlaybackRateBottomSheetClassFingerprint,
|
||||
PlaybackRateBottomSheetBuilderFingerprint
|
||||
PlaybackRateBottomSheetBuilderFingerprint,
|
||||
RecyclerViewTreeObserverFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
@ -91,17 +89,17 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
/**
|
||||
* New method
|
||||
*/
|
||||
NewFlyoutPanelBuilderFingerprint.result?.let {
|
||||
RecyclerViewTreeObserverFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = implementation!!.instructions.size - 1
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
|
||||
val recyclerViewRegister = 2
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$insertRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->onFlyoutMenuCreate(Landroid/widget/LinearLayout;)V"
|
||||
"invoke-static/range { p$recyclerViewRegister .. p$recyclerViewRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw NewFlyoutPanelBuilderFingerprint.exception
|
||||
} ?: throw RecyclerViewTreeObserverFingerprint.exception
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/PlaybackSpeedMenuFilter;")
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
package app.revanced.patches.youtube.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BottomSheetMargins
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object NewFlyoutPanelBuilderFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
returnType = "Landroid/widget/LinearLayout;",
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BottomSheetMargins) }
|
||||
)
|
@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.youtube.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object RecyclerViewTreeObserverFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_BOOLEAN,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
strings = listOf("LithoRVSLCBinder")
|
||||
)
|
@ -28,7 +28,6 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var Bar: Long = -1
|
||||
var BarContainerHeight: Long = -1
|
||||
var BottomPanelOverlayText: Long = -1
|
||||
var BottomSheetMargins: Long = -1
|
||||
var BottomUiContainerStub: Long = -1
|
||||
var ChannelListSubMenu: Long = -1
|
||||
var CompactLink: Long = -1
|
||||
@ -103,7 +102,6 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
Bar = find(LAYOUT, "bar")
|
||||
BarContainerHeight = find(DIMEN, "bar_container_height")
|
||||
BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text")
|
||||
BottomSheetMargins = find(DIMEN, "bottom_sheet_margins")
|
||||
BottomUiContainerStub = find(ID, "bottom_ui_container_stub")
|
||||
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
||||
CompactLink = find(LAYOUT, "compact_link")
|
||||
|
Loading…
x
Reference in New Issue
Block a user