Skip to content

Commit 313b633

Browse files
committed
YouTub: Updated PlayerType NavigationBarHook to support YT 20.28.35
1 parent 1aa4deb commit 313b633

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

app/src/main/java/io/github/chsbuffer/revancedxposed/youtube/misc/NavigationBarHook.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,4 @@ fun YoutubeHook.NavigationBarHook() {
103103
initializeButtonsFingerprint.hookMethod(ScopedHook(pivotBarButtonsCreateResourceViewFingerprint.toMethod()) {
104104
after { NavigationBar.navigationImageResourceTabLoaded(param.result as View) }
105105
})
106-
107-
// Fix YT bug of notification tab missing the filled icon.
108-
val tabActivityCairo =
109-
navigationEnumClass.toClass().enumConstants?.firstOrNull { (it as? Enum<*>)?.name == "TAB_ACTIVITY_CAIRO" } as? Enum<*>
110-
if (tabActivityCairo != null) {
111-
getDexMethod("setEnumMapFingerprint") {
112-
fingerprint {
113-
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
114-
literal {
115-
Utils.getResourceIdentifier("yt_fill_bell_black_24", "drawable")
116-
}
117-
}
118-
}.hookMethod(object : XC_MethodHook() {
119-
override fun afterHookedMethod(param: MethodHookParam) {
120-
val obj = param.thisObject
121-
param.thisObject.javaClass.declaredFields.forEach {
122-
it.isAccessible = true
123-
val enumMap = it.get(obj) as? EnumMap<*, *>
124-
if (enumMap !is EnumMap<*, *>) return@forEach
125-
// check is valueType int (resource id)
126-
val valueType = enumMap.values.first()::class.java
127-
if (valueType != Int::class.java) return@forEach
128-
NavigationBar.setCairoNotificationFilledIcon(enumMap, tabActivityCairo)
129-
}
130-
}
131-
})
132-
}
133106
}

app/src/main/java/io/github/chsbuffer/revancedxposed/youtube/misc/PlayerType.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import io.github.chsbuffer.revancedxposed.opcodes
1111
import io.github.chsbuffer.revancedxposed.youtube.YoutubeHook
1212
import org.luckypray.dexkit.query.enums.StringMatchType
1313
import org.luckypray.dexkit.result.FieldUsingType
14+
import java.lang.reflect.Modifier
1415

1516
@SuppressLint("NonUniqueDexKitData")
1617
fun YoutubeHook.PlayerTypeHook() {
@@ -22,16 +23,12 @@ fun YoutubeHook.PlayerTypeHook() {
2223
}
2324
}.findMethod {
2425
matcher {
26+
modifiers = Modifier.PUBLIC
2527
returnType = "void"
2628
paramCount = 1
27-
opcodes(
28-
Opcode.IF_NE,
29-
Opcode.RETURN_VOID,
30-
)
3129
}
3230
}.single {
33-
// enum class
34-
it.paramTypes[0].descriptor.length > 1
31+
it.paramTypes[0].superClass?.descriptor == "Ljava/lang/Enum;"
3532
}
3633
}.hookMethod(object : XC_MethodHook() {
3734
override fun beforeHookedMethod(param: MethodHookParam) {

0 commit comments

Comments
 (0)