mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-30 13:50:21 +02:00
feat(youtube/hide-shorts-component): hide toolbar in shorts player
This commit is contained in:
parent
d32d1d340d
commit
7f5be6241a
@ -15,7 +15,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetActionBarRingoFingerprint
|
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetActionBarRingoFingerprint
|
||||||
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetToolBarPaddingFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
|
@ -12,6 +12,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.shorts.shortsnavigationbar.patch.ShortsNavigationBarPatch
|
import app.revanced.patches.youtube.shorts.shortsnavigationbar.patch.ShortsNavigationBarPatch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||||
|
import app.revanced.patches.youtube.utils.navbarindex.patch.NavBarIndexHookPatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
@ -23,6 +24,7 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
|||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LithoFilterPatch::class,
|
LithoFilterPatch::class,
|
||||||
|
NavBarIndexHookPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class,
|
SharedResourceIdPatch::class,
|
||||||
ShortsCommentButtonPatch::class,
|
ShortsCommentButtonPatch::class,
|
||||||
@ -33,7 +35,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
|||||||
ShortsPaidContentBannerPatch::class,
|
ShortsPaidContentBannerPatch::class,
|
||||||
ShortsRemixButtonPatch::class,
|
ShortsRemixButtonPatch::class,
|
||||||
ShortsShareButtonPatch::class,
|
ShortsShareButtonPatch::class,
|
||||||
ShortsSubscriptionsButtonPatch::class
|
ShortsSubscriptionsButtonPatch::class,
|
||||||
|
ShortsToolBarPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package app.revanced.patches.youtube.shorts.shortscomponent.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.navbarindex.patch.NavBarIndexHookPatch.Companion.injectIndex
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ToolBarPaddingHome
|
||||||
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
|
import app.revanced.util.integrations.Constants.SHORTS
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Name("hide-shorts-toolbar")
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ShortsToolBarPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
SetToolBarPaddingFingerprint,
|
||||||
|
ShortsCommentFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
SetToolBarPaddingFingerprint.result?.let {
|
||||||
|
val targetIndex = it.mutableMethod.getWideLiteralIndex(ToolBarPaddingHome) + 3
|
||||||
|
(context.toMethodWalker(it.method)
|
||||||
|
.nextMethod(targetIndex, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
).apply {
|
||||||
|
val targetParameter = getInstruction<ReferenceInstruction>(0).reference
|
||||||
|
if (!targetParameter.toString().endsWith("Landroid/support/v7/widget/Toolbar;"))
|
||||||
|
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||||
|
val targetRegister = getInstruction<TwoRegisterInstruction>(0).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
1,
|
||||||
|
"invoke-static {v$targetRegister}, $SHORTS->hideShortsPlayerToolBar(Landroid/support/v7/widget/Toolbar;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
} ?: return SetToolBarPaddingFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
ShortsCommentFingerprint.injectIndex(1)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.general.widesearchbar.fingerprints
|
package app.revanced.patches.youtube.utils.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ToolBarPaddingHome
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ToolBarPaddingHome
|
@ -432,6 +432,9 @@
|
|||||||
<string name="revanced_hide_shorts_player_subscriptions_button_summary_off">Subscriptions button is shown</string>
|
<string name="revanced_hide_shorts_player_subscriptions_button_summary_off">Subscriptions button is shown</string>
|
||||||
<string name="revanced_hide_shorts_player_subscriptions_button_summary_on">Subscriptions button is hidden</string>
|
<string name="revanced_hide_shorts_player_subscriptions_button_summary_on">Subscriptions button is hidden</string>
|
||||||
<string name="revanced_hide_shorts_player_subscriptions_button_title">Hide subscriptions button</string>
|
<string name="revanced_hide_shorts_player_subscriptions_button_title">Hide subscriptions button</string>
|
||||||
|
<string name="revanced_hide_shorts_player_toolbar_summary_off">Toolbar is shown</string>
|
||||||
|
<string name="revanced_hide_shorts_player_toolbar_summary_on">Toolbar is hidden</string>
|
||||||
|
<string name="revanced_hide_shorts_player_toolbar_title">Hide toolbar</string>
|
||||||
<string name="revanced_hide_shorts_shelf_summary_off">Shorts shelves are shown</string>
|
<string name="revanced_hide_shorts_shelf_summary_off">Shorts shelves are shown</string>
|
||||||
<string name="revanced_hide_shorts_shelf_summary_on">Shorts shelves are hidden</string>
|
<string name="revanced_hide_shorts_shelf_summary_on">Shorts shelves are hidden</string>
|
||||||
<string name="revanced_hide_shorts_shelf_title">Hide shorts shelf</string>
|
<string name="revanced_hide_shorts_shelf_title">Hide shorts shelf</string>
|
||||||
|
@ -552,7 +552,8 @@
|
|||||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_subscriptions_button_title" android:key="revanced_hide_shorts_player_subscriptions_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_subscriptions_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_subscriptions_button_summary_off" />
|
<SwitchPreference android:title="@string/revanced_hide_shorts_player_subscriptions_button_title" android:key="revanced_hide_shorts_player_subscriptions_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_subscriptions_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_subscriptions_button_summary_off" />
|
||||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_thanks_button_title" android:key="revanced_hide_shorts_player_thanks_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_thanks_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_thanks_button_summary_off" />
|
<SwitchPreference android:title="@string/revanced_hide_shorts_player_thanks_button_title" android:key="revanced_hide_shorts_player_thanks_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_shorts_player_thanks_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_thanks_button_summary_off" />
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
||||||
<SwitchPreference android:title="@string/revanced_hide_shorts_player_navigation_bar_title" android:key="revanced_hide_shorts_player_navigation_bar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_navigation_bar_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_navigation_bar_summary_off" />SETTINGS: HIDE_SHORTS_COMPONENTS -->
|
<SwitchPreference android:title="@string/revanced_hide_shorts_player_navigation_bar_title" android:key="revanced_hide_shorts_player_navigation_bar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_navigation_bar_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_navigation_bar_summary_off" />
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_shorts_player_toolbar_title" android:key="revanced_hide_shorts_player_toolbar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_toolbar_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_toolbar_summary_off" />SETTINGS: HIDE_SHORTS_COMPONENTS -->
|
||||||
|
|
||||||
<!-- PREFERENCE: SHORTS_SETTINGS
|
<!-- PREFERENCE: SHORTS_SETTINGS
|
||||||
</PreferenceScreen>PREFERENCE: SHORTS_SETTINGS -->
|
</PreferenceScreen>PREFERENCE: SHORTS_SETTINGS -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user