mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-09 06:08:38 +01:00
fix(youtube/theme): colore the comment action bar (#762)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
f0d2f3e01b
commit
4b3abe0d45
@ -0,0 +1,32 @@
|
||||
package app.revanced.patches.youtube.layout.theme.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("comment-actionbar-fingerprint")
|
||||
@ThemeCompatibility
|
||||
@Version("0.0.1")
|
||||
object CommentsFilterBarFingerprint : MethodFingerprint(
|
||||
"V", AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L"), listOf(
|
||||
Opcode.APUT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.IGET,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID
|
||||
)
|
||||
)
|
@ -0,0 +1,42 @@
|
||||
package app.revanced.patches.youtube.layout.theme.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import app.revanced.patches.youtube.layout.theme.fingerprints.CommentsFilterBarFingerprint
|
||||
|
||||
@Name("comment-filter-bar-theme")
|
||||
@Description("Applies custom theming to comments filter action bar.")
|
||||
@ThemeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CommentsFilterBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
CommentsFilterBarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val result = CommentsFilterBarFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val patchIndex = result.scanResult.patternScanResult!!.endIndex - 1
|
||||
|
||||
method.addInstructions(
|
||||
patchIndex, """
|
||||
const v1, -0x1
|
||||
if-ne v1, p1, :comments_filter_white
|
||||
const v1, -0xdededf
|
||||
if-ne v1, p1, :comments_filter_dark
|
||||
const/4 p1, 0x0
|
||||
:comments_filter_white
|
||||
""", listOf(ExternalLabel("comments_filter_dark", method.instruction(patchIndex)))
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||
@DependsOn([CommentsFilterBarPatch::class, FixLocaleConfigErrorPatch::class])
|
||||
@Name("theme")
|
||||
@Description("Applies a custom theme.")
|
||||
@ThemeCompatibility
|
||||
|
Loading…
Reference in New Issue
Block a user