fix(YouTube/Hide feed components): Hide subscriptions channel section setting does not support tablet layout

This commit is contained in:
inotia00
2024-04-25 02:34:38 +09:00
parent 5817981c90
commit 61516f9287
4 changed files with 50 additions and 0 deletions

View File

@ -11,6 +11,8 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.litho.LithoFilterPatch
import app.revanced.patches.youtube.feed.components.fingerprints.BreakingNewsFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.ChannelListSubMenuFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.ChannelListSubMenuTabletFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.ChannelListSubMenuTabletSyntheticFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.DefaultsTabsBarFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.ElementParserFingerprint
import app.revanced.patches.youtube.feed.components.fingerprints.ElementParserParentFingerprint
@ -51,6 +53,8 @@ object FeedComponentsPatch : BaseBytecodePatch(
fingerprints = setOf(
BreakingNewsFingerprint,
ChannelListSubMenuFingerprint,
ChannelListSubMenuTabletFingerprint,
ChannelListSubMenuTabletSyntheticFingerprint,
DefaultsTabsBarFingerprint,
ElementParserParentFingerprint,
FilterBarHeightFingerprint,
@ -93,6 +97,26 @@ object FeedComponentsPatch : BaseBytecodePatch(
// endregion
// region patch for hide subscriptions channel section for tablet
arrayOf(
ChannelListSubMenuTabletFingerprint,
ChannelListSubMenuTabletSyntheticFingerprint
).forEach { fingerprint ->
fingerprint.resultOrThrow().mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $FEED_CLASS_DESCRIPTOR->hideSubscriptionsChannelSection()Z
move-result v0
if-eqz v0, :show
return-void
""", ExternalLabel("show", getInstruction(0))
)
}
}
// endregion
// region patch for hide category bar
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->

View File

@ -0,0 +1,13 @@
package app.revanced.patches.youtube.feed.components.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DrawerResults
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal object ChannelListSubMenuTabletFingerprint : LiteralValueFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(),
returnType = "V",
literalSupplier = { DrawerResults }
)

View File

@ -0,0 +1,11 @@
package app.revanced.patches.youtube.feed.components.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal object ChannelListSubMenuTabletSyntheticFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
strings = listOf("is_horizontal_drawer_context")
)

View File

@ -35,6 +35,7 @@ object SharedResourceIdPatch : ResourcePatch() {
var ControlsLayoutStub = -1L
var DarkSplashAnimation = -1L
var DonationCompanion = -1L
var DrawerResults = -1L
var EasySeekEduContainer = -1L
var EditSettingsAction = -1L
var EndScreenElementLayoutCircle = -1L
@ -107,6 +108,7 @@ object SharedResourceIdPatch : ResourcePatch() {
ControlsLayoutStub = getId(ID, "controls_layout_stub")
DarkSplashAnimation = getId(ID, "dark_splash_animation")
DonationCompanion = getId(LAYOUT, "donation_companion")
DrawerResults = getId(ID, "drawer_results")
EasySeekEduContainer = getId(ID, "easy_seek_edu_container")
EditSettingsAction = getId(STRING, "edit_settings_action")
EndScreenElementLayoutCircle = getId(LAYOUT, "endscreen_element_layout_circle")