mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 07:04:30 +02:00
fix(YouTube - Toolbar components): Hide voice search button
setting does not work https://github.com/inotia00/ReVanced_Extended/issues/2580
This commit is contained in:
parent
1e13c4e83e
commit
a253e5edce
@ -155,6 +155,27 @@ internal val searchBarParentFingerprint = legacyFingerprint(
|
||||
literals = listOf(voiceSearch),
|
||||
)
|
||||
|
||||
internal val voiceInputControllerParentFingerprint = legacyFingerprint(
|
||||
name = "voiceInputControllerParentFingerprint",
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("[B", "Z"),
|
||||
strings = listOf("VoiceInputController"),
|
||||
)
|
||||
|
||||
internal val voiceInputControllerFingerprint = legacyFingerprint(
|
||||
name = "voiceInputControllerFingerprint",
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { method, _ ->
|
||||
method.indexOfFirstInstruction {
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
getReference<MethodReference>()?.name == "resolveActivity"
|
||||
} >= 0
|
||||
},
|
||||
)
|
||||
|
||||
internal val searchResultFingerprint = legacyFingerprint(
|
||||
name = "searchResultFingerprint",
|
||||
returnType = "Landroid/view/View;",
|
||||
|
@ -18,7 +18,6 @@ import app.revanced.patches.youtube.utils.patch.PatchList.TOOLBAR_COMPONENTS
|
||||
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.actionBarRingoBackground
|
||||
import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.voiceSearch
|
||||
import app.revanced.patches.youtube.utils.resourceid.ytOutlineVideoCamera
|
||||
import app.revanced.patches.youtube.utils.resourceid.ytPremiumWordMarkHeader
|
||||
import app.revanced.patches.youtube.utils.resourceid.ytWordMarkHeader
|
||||
@ -32,6 +31,7 @@ import app.revanced.util.doRecursively
|
||||
import app.revanced.util.findInstructionIndicesReversedOrThrow
|
||||
import app.revanced.util.findMethodOrThrow
|
||||
import app.revanced.util.fingerprint.matchOrThrow
|
||||
import app.revanced.util.fingerprint.methodCall
|
||||
import app.revanced.util.fingerprint.methodOrThrow
|
||||
import app.revanced.util.fingerprint.mutableClassOrThrow
|
||||
import app.revanced.util.getReference
|
||||
@ -332,8 +332,17 @@ val toolBarComponentsPatch = bytecodePatch(
|
||||
|
||||
searchResultFingerprint.matchOrThrow().let {
|
||||
it.method.apply {
|
||||
val startIndex = indexOfFirstLiteralInstructionOrThrow(voiceSearch)
|
||||
val setOnClickListenerIndex = indexOfFirstInstructionOrThrow(startIndex) {
|
||||
val voiceInputControllerActivityMethodCall =
|
||||
voiceInputControllerFingerprint
|
||||
.methodOrThrow(voiceInputControllerParentFingerprint)
|
||||
.methodCall()
|
||||
|
||||
val voiceInputControllerActivityIndex =
|
||||
indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
getReference<MethodReference>()?.toString() == voiceInputControllerActivityMethodCall
|
||||
}
|
||||
val setOnClickListenerIndex = indexOfFirstInstructionOrThrow(voiceInputControllerActivityIndex) {
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
getReference<MethodReference>()?.name == "setOnClickListener"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user