Skip to content

Commit

Permalink
fix(youtube/hide-player-buttons): fix previous/next button showing if…
Browse files Browse the repository at this point in the history
… previous video exists (#2261)
  • Loading branch information
LisoUseInAIKyrios committed May 25, 2023
1 parent 47580a0 commit 91d1aab
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class HidePlayerButtonsPatch : BytecodePatch(
) {
private object ParameterOffsets {
const val HAS_NEXT = 5
const val HAS_PREVIOUS = 6
}

override fun execute(context: BytecodeContext): PatchResult {
Expand Down Expand Up @@ -58,13 +59,16 @@ class HidePlayerButtonsPatch : BytecodePatch(

// overriding this parameter register hides the previous and next buttons
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
val hasPreviousParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_PREVIOUS

mutableMethod.addInstructions(
callIndex,
"""
invoke-static { }, Lapp/revanced/integrations/patches/HidePlayerButtonsPatch;->hideButtons()Z
invoke-static { v$hasNextParameterRegister }, Lapp/revanced/integrations/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
move-result v$hasNextParameterRegister
xor-int/lit8 v$hasNextParameterRegister, v$hasNextParameterRegister, 1
invoke-static { v$hasPreviousParameterRegister }, Lapp/revanced/integrations/patches/HidePlayerButtonsPatch;->previousOrNextButtonIsVisible(Z)Z
move-result v$hasPreviousParameterRegister
"""
)
} ?: return PlayerControlsVisibilityModelFingerprint.toErrorResult()
Expand Down

0 comments on commit 91d1aab

Please sign in to comment.