mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-24 02:42:11 +02:00
chore(YouTube): replace with a fingerprint that supports a wider range of versions
This commit is contained in:
parent
d776786867
commit
0f0a48b1d4
@ -7,7 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver
|
import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver
|
||||||
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_CLASS_DESCRIPTOR
|
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_CLASS_DESCRIPTOR
|
||||||
import app.revanced.util.resultOrThrow
|
import app.revanced.util.deprecatedOrResultOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
@ -53,7 +53,7 @@ abstract class BaseIntegrationsPatch(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun invoke(integrationsDescriptor: String) {
|
fun invoke(integrationsDescriptor: String) {
|
||||||
resultOrThrow().mutableMethod.let { method ->
|
deprecatedOrResultOrThrow()?.mutableMethod?.let { method ->
|
||||||
val insertIndex = insertIndexResolver(method)
|
val insertIndex = insertIndexResolver(method)
|
||||||
val contextRegister = contextRegisterResolver(method)
|
val contextRegister = contextRegisterResolver(method)
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ import com.android.tools.smali.dexlib2.Opcode
|
|||||||
internal object ShortsToolBarFingerprint : MethodFingerprint(
|
internal object ShortsToolBarFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
parameters = listOf("Z", "L", "L"),
|
|
||||||
opcodes = listOf(Opcode.IPUT_BOOLEAN),
|
opcodes = listOf(Opcode.IPUT_BOOLEAN),
|
||||||
strings = listOf("Null topBarButtons")
|
strings = listOf("Null topBarButtons"),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.parameterTypes.firstOrNull() == "Z"
|
||||||
|
}
|
||||||
)
|
)
|
@ -8,7 +8,10 @@ import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.Integratio
|
|||||||
* In 2023 supported was ended and is no longer available,
|
* In 2023 supported was ended and is no longer available,
|
||||||
* but this may still be used by older apps:
|
* but this may still be used by older apps:
|
||||||
* https://developers.google.com/youtube/android/player
|
* https://developers.google.com/youtube/android/player
|
||||||
|
*
|
||||||
|
* Deprecated in YouTube v19.38.xx+.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Fingerprint is obsolete and will be deleted soon")
|
||||||
internal object StandalonePlayerActivityFingerprint : IntegrationsFingerprint(
|
internal object StandalonePlayerActivityFingerprint : IntegrationsFingerprint(
|
||||||
customFingerprint = { methodDef, _ ->
|
customFingerprint = { methodDef, _ ->
|
||||||
methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;"
|
methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;"
|
||||||
|
@ -33,6 +33,9 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
|
|||||||
|
|
||||||
const val REGISTER_TEMPLATE_REPLACEMENT: String = "REGISTER_INDEX"
|
const val REGISTER_TEMPLATE_REPLACEMENT: String = "REGISTER_INDEX"
|
||||||
|
|
||||||
|
fun MethodFingerprint.deprecatedOrResultOrThrow() =
|
||||||
|
if (javaClass.annotations[0].toString().contains("Deprecated")) result else resultOrThrow()
|
||||||
|
|
||||||
fun MethodFingerprint.resultOrThrow() = result ?: throw exception
|
fun MethodFingerprint.resultOrThrow() = result ?: throw exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user