remove hide-fullscreen-buttoncontainer patch

This commit is contained in:
inotia00 2023-04-23 02:25:28 +09:00
parent 27025d50ba
commit 1a6ca7a88d
5 changed files with 2 additions and 114 deletions

View File

@ -1,60 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenbuttoncontainer.bytecode.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
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-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenButtonContainerBytecodePatch : BytecodePatch() {
private val resourceIds = arrayOf(
"quick_actions_element_container"
).map { name ->
ResourceMappingPatch.resourceMappings.single { it.name == name }.id
}
private var patchSuccessArray = Array(resourceIds.size) {false}
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
with(method.implementation) {
this?.instructions?.forEachIndexed { index, instruction ->
when (instruction.opcode) {
Opcode.CONST -> {
when ((instruction as Instruction31i).wideLiteral) {
resourceIds[0] -> { // fullscreen panel
val insertIndex = index + 3
val invokeInstruction = instructions.elementAt(insertIndex)
if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
val viewRegister = (invokeInstruction as Instruction21c).registerA
mutableMethod.implementation!!.injectHideCall(insertIndex, viewRegister, "layout/FullscreenPatch", "hideFullscreenButtonContainer")
patchSuccessArray[0] = true
}
}
}
else -> return@forEachIndexed
}
}
}
}
}
return toResult(patchSuccessArray.indexOf(false))
}
}

View File

@ -1,45 +0,0 @@
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: FULLSCREEN_SETTINGS",
"SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER"
)
)
SettingsPatch.updatePatchStatus("hide-fullscreen-buttoncontainer")
return PatchResultSuccess()
}
}

View File

@ -16,8 +16,8 @@ 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.layout.fullscreen.quickactions.patch.QuickActionsPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN
import org.jf.dexlib2.Opcode
@ -31,7 +31,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
HideFullscreenButtonContainerBytecodePatch::class,
QuickActionsPatch::class,
SettingsPatch::class
]
)

View File

@ -276,9 +276,6 @@ Please do not report any issues you encounter while using this feature."</string
<string name="revanced_hide_floating_microphone_summary_off">Floating microphone button is shown</string>
<string name="revanced_hide_floating_microphone_summary_on">Floating microphone button is hidden</string>
<string name="revanced_hide_floating_microphone_title">Hide floating microphone button</string>
<string name="revanced_hide_fullscreen_button_container_summary_off">Fullscreen button container is shown</string>
<string name="revanced_hide_fullscreen_button_container_summary_on">Fullscreen button container is hidden</string>
<string name="revanced_hide_fullscreen_button_container_title">Hide fullscreen button container</string>
<string name="revanced_hide_fullscreen_panels_summary_off">Fullscreen panels are shown</string>
<string name="revanced_hide_fullscreen_panels_summary_on">Fullscreen panels are hidden</string>
<string name="revanced_hide_fullscreen_panels_title">Hide fullscreen panels</string>

View File

@ -207,9 +207,6 @@
<SwitchPreference android:title="@string/revanced_hide_fullscreen_panels_title" android:key="revanced_hide_fullscreen_panels" android:defaultValue="false" android:summaryOn="@string/revanced_hide_fullscreen_panels_summary_on" android:summaryOff="@string/revanced_hide_fullscreen_panels_summary_off" />
<SwitchPreference android:title="@string/revanced_show_fullscreen_title_title" android:key="revanced_show_fullscreen_title" android:defaultValue="true" android:summary="@string/revanced_show_fullscreen_title_summary" android:dependency="revanced_hide_fullscreen_panels" />SETTINGS: HIDE_FULLSCREEN_PANELS -->
<!-- SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER
<SwitchPreference android:title="@string/revanced_hide_fullscreen_button_container_title" android:key="revanced_hide_fullscreen_button_container" android:defaultValue="false" android:summaryOn="@string/revanced_hide_fullscreen_button_container_summary_on" android:summaryOff="@string/revanced_hide_fullscreen_button_container_summary_off" />SETTINGS: HIDE_FULLSCREEN_BUTTON_CONTAINER -->
<!-- SETTINGS: HIDE_AUTOPLAY_PREVIEW
<SwitchPreference android:title="@string/revanced_hide_autoplay_preview_title" android:key="revanced_hide_autoplay_preview" android:defaultValue="false" android:summaryOn="@string/revanced_hide_autoplay_preview_summary_on" android:summaryOff="@string/revanced_hide_autoplay_preview_summary_off" />SETTINGS: HIDE_AUTOPLAY_PREVIEW -->
@ -498,7 +495,6 @@
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_fullscreen" />
<Preference android:title="hide-fullscreen-panels" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-fullscreen-buttoncontainer" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-autoplay-preview" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-endscreen-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-filmstrip-overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>