Skip to content

Commit d7c9dd0

Browse files
author
LisoUseInAIKyrios
committed
fix(Wide search bar): Fix patching 19.16.39
1 parent a0eb6d5 commit d7c9dd0

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/Fingerprints.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ internal val setWordmarkHeaderFingerprint = fingerprint {
1111
returns("V")
1212
parameters("Landroid/widget/ImageView;")
1313
custom { methodDef, _ ->
14-
methodDef.containsLiteralInstruction(ytWordmarkHeaderId) &&
15-
methodDef.containsLiteralInstruction(ytPremiumWordmarkHeaderId)
14+
methodDef.containsLiteralInstruction(ytPremiumWordmarkHeaderId) &&
15+
methodDef.containsLiteralInstruction(ytWordmarkHeaderId)
1616
}
1717
}
1818

patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import app.revanced.util.addInstructionsAtControlFlowLabel
1717
import app.revanced.util.findInstructionIndicesReversedOrThrow
1818
import app.revanced.util.getReference
1919
import app.revanced.util.indexOfFirstInstructionOrThrow
20-
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
2120
import com.android.tools.smali.dexlib2.Opcode
2221
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
2322
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@@ -48,7 +47,7 @@ private val wideSearchbarResourcePatch = resourcePatch {
4847

4948
actionBarRingoId = resourceMappings[
5049
"layout",
51-
"action_bar_ringo_background",
50+
"action_bar_ringo",
5251
]
5352
}
5453
}
@@ -111,18 +110,18 @@ val wideSearchbarPatch = bytecodePatch(
111110

112111
// Fix missing left padding when using wide searchbar.
113112
wideSearchbarLayoutFingerprint.method.apply {
114-
val layoutIndex = indexOfFirstLiteralInstructionOrThrow(actionBarRingoId)
115-
val inflateIndex = indexOfFirstInstructionOrThrow(layoutIndex) {
113+
findInstructionIndicesReversedOrThrow {
116114
val reference = getReference<MethodReference>()
117115
reference?.definingClass == "Landroid/view/LayoutInflater;"
118116
&& reference.name == "inflate"
119-
}
120-
val register = getInstruction<OneRegisterInstruction>(inflateIndex + 1).registerA
117+
}.forEach { inflateIndex ->
118+
val register = getInstruction<OneRegisterInstruction>(inflateIndex + 1).registerA
121119

122-
addInstruction(
123-
inflateIndex + 2,
124-
"invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->setActionBar(Landroid/view/View;)V"
125-
)
120+
addInstruction(
121+
inflateIndex + 2,
122+
"invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->setActionBar(Landroid/view/View;)V"
123+
)
124+
}
126125
}
127126
}
128127
}

0 commit comments

Comments
 (0)