fix(YouTube - Seekbar): Correctly hide the feed seekbar with target 20.07

This commit is contained in:
LisoUseInAIKyrios
2025-04-02 17:54:17 +02:00
parent 9f0efab3a1
commit ddc6e4c34f
3 changed files with 38 additions and 31 deletions

View File

@ -84,31 +84,14 @@ internal val playerLinearGradientFingerprint = fingerprint {
}
/**
* 19.46 - 19.47
* 19.25 - 19.47
*/
internal val playerLinearGradientLegacy1946Fingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
parameters("I", "I", "I", "I")
internal val playerLinearGradientLegacyFingerprint = fingerprint {
returns("V")
opcodes(
Opcode.FILLED_NEW_ARRAY,
Opcode.MOVE_RESULT_OBJECT
)
custom { method, _ ->
method.name == "setBounds" && method.containsLiteralInstruction(ytYoutubeMagentaColorId)
}
}
/**
* 19.25 - 19.45
*/
internal val playerLinearGradientLegacy1925Fingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameters("Landroid/content/Context;")
opcodes(
Opcode.FILLED_NEW_ARRAY,
Opcode.MOVE_RESULT_OBJECT
)
literal { ytYoutubeMagentaColorId }
}

View File

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.seekbar
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -310,14 +311,15 @@ val seekbarColorPatch = bytecodePatch(
"""
)
val playerFingerprint =
if (is_19_49_or_greater) {
playerLinearGradientFingerprint
} else if (is_19_46_or_greater) {
playerLinearGradientLegacy1946Fingerprint
} else {
playerLinearGradientLegacy1925Fingerprint
}
val playerFingerprint: Fingerprint
val checkGradientCoordinates: Boolean
if (is_19_49_or_greater) {
playerFingerprint = playerLinearGradientFingerprint
checkGradientCoordinates = true
} else {
playerFingerprint = playerLinearGradientLegacyFingerprint
checkGradientCoordinates = false
}
playerFingerprint.let {
it.method.apply {
@ -326,10 +328,17 @@ val seekbarColorPatch = bytecodePatch(
addInstructions(
index + 1,
"""
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([I)[I
move-result-object v$register
"""
if (checkGradientCoordinates) {
"""
invoke-static { v$register, p0, p1 }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([III)[I
move-result-object v$register
"""
} else {
"""
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([I)[I
move-result-object v$register
"""
}
)
}
}