add hide-fullscreen-buttoncontainer patch

This commit is contained in:
inotia00 2023-02-18 14:26:04 +09:00
parent 78f844f091
commit e7e3836c09
3 changed files with 52 additions and 5 deletions

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
@ -15,11 +15,11 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-fullscreen-buttoncontainer")
@Name("hide-fullscreen-buttoncontainer-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenButtonContainerPatch : BytecodePatch() {
class HideFullscreenButtonContainerBytecodePatch : BytecodePatch() {
private val resourceIds = arrayOf(
"quick_actions_element_container"
).map { name ->
@ -43,7 +43,7 @@ class HideFullscreenButtonContainerPatch : BytecodePatch() {
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
val viewRegister = (invokeInstruction as Instruction21c).registerA
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/FullscreenLayoutPatch", "hideFullscreenPanels")
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/FullscreenLayoutPatch", "hideFullscreenButtonContainer")
patchSuccessArray[0] = true;
}

View File

@ -0,0 +1,46 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.HideFullscreenButtonContainerBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-fullscreen-buttoncontainer")
@Description("Hides the button containers in fullscreen.")
@DependsOn(
[
HideFullscreenButtonContainerBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenButtonContainerPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
* Add ReVanced Settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: OTHER_LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER"
)
)
SettingsPatch.updatePatchStatus("hide-fullscreen-buttoncontainer")
return PatchResultSuccess()
}
}

View File

@ -16,6 +16,7 @@ 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.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch.HideFullscreenButtonContainerBytecodePatch
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
@ -30,7 +31,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
HideFullscreenButtonContainerPatch::class,
HideFullscreenButtonContainerBytecodePatch::class,
SettingsPatch::class
]
)