Skip to content

Commit

Permalink
fix(YouTube): Correctly show channel page on tablet devices (ReVanced…
Browse files Browse the repository at this point in the history
…#2656)

Co-authored-by: oSumAtrIX <[email protected]>
  • Loading branch information
LisoUseInAIKyrios and oSumAtrIX authored Jan 28, 2024
1 parent 3be749e commit c7c9700
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app.revanced.patches.youtube.layout.searchbar

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.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
Expand All @@ -14,6 +15,7 @@ import app.revanced.patches.youtube.layout.searchbar.fingerprints.SetWordmarkHea
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction

@Patch(
name = "Wide searchbar",
Expand Down Expand Up @@ -43,6 +45,10 @@ object WideSearchbarPatch : BytecodePatch(
CreateSearchSuggestionsFingerprint
)
) {

private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/youtube/patches/WideSearchbarPatch;"

override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

Expand Down Expand Up @@ -76,12 +82,14 @@ object WideSearchbarPatch : BytecodePatch(
* Injects instructions required for certain methods.
*/
private fun MutableMethod.injectSearchBarHook() {
val insertIndex = implementation!!.instructions.size - 1
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA

addInstructions(
implementation!!.instructions.size - 1,
"""
invoke-static {}, Lapp/revanced/integrations/youtube/patches/WideSearchbarPatch;->enableWideSearchbar()Z
move-result p0
"""
invoke-static {v$insertRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->enableWideSearchbar(Z)Z
move-result v$insertRegister
"""
)
}
}

0 comments on commit c7c9700

Please sign in to comment.