mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(youtube): add hide-seek-message
patch
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.seekmessage.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SeekEduContainerFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation?.instructions?.any {
|
||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourceIdPatch.easySeekEduContainerId
|
||||
} == true
|
||||
}
|
||||
)
|
@ -0,0 +1,64 @@
|
||||
package app.revanced.patches.youtube.layout.fullscreen.seekmessage.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.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.fullscreen.seekmessage.fingerprints.SeekEduContainerFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
|
||||
@Patch
|
||||
@Name("hide-seek-message")
|
||||
@Description("Hides the 'Slide left or right to seek' message container.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekMessagePatch : BytecodePatch(
|
||||
listOf(
|
||||
SeekEduContainerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
SeekEduContainerFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $FULLSCREEN->hideSeekMessage()Z
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", listOf(ExternalLabel("default", it.instruction(0)))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: FULLSCREEN_SETTINGS",
|
||||
"SETTINGS: HIDE_SEEK_MESSAGE"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-seek-message")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -31,6 +31,8 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var controlsLayoutStubResourceId: Long = -1
|
||||
var dislikeButtonLabelId: Long = -1
|
||||
var donationCompanionResourceId: Long = -1
|
||||
var easySeekEduContainerId: Long = -1
|
||||
var expandButtonId: Long = -1
|
||||
var fabLabelId: Long = -1
|
||||
var filterBarHeightLabelId: Long = -1
|
||||
var floatyBarTopMarginLabelId: Long = -1
|
||||
@ -77,6 +79,8 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
controlsLayoutStubResourceId = find(ID, "controls_layout_stub")
|
||||
dislikeButtonLabelId = find(ID, "dislike_button")
|
||||
donationCompanionResourceId = find(LAYOUT, "donation_companion")
|
||||
easySeekEduContainerId = find(ID, "easy_seek_edu_container")
|
||||
expandButtonId = find(LAYOUT, "expand_button_down")
|
||||
fabLabelId = find(ID, "fab")
|
||||
filterBarHeightLabelId = find(DIMEN, "filter_bar_height")
|
||||
floatyBarTopMarginLabelId = find(DIMEN, "floaty_bar_button_top_margin")
|
||||
|
Reference in New Issue
Block a user