mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-22 19:09:12 +02:00
feat(YouTube/Hide shorts components): now hiding all shorts toolbar components does not hide the entire shorts toolbar
This commit is contained in:
parent
0a33f8f2ef
commit
bf08799148
@ -2,39 +2,19 @@ package app.revanced.patches.youtube.shorts.shortscomponent
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ToolBarBannerFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.navbarindex.NavBarIndexHookPatch
|
||||
import app.revanced.patches.youtube.utils.navbarindex.NavBarIndexHookPatch.injectIndex
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ToolBarPaddingHome
|
||||
import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
dependencies =
|
||||
[
|
||||
NavBarIndexHookPatch::class,
|
||||
ToolBarHookPatch::class
|
||||
]
|
||||
)
|
||||
@Patch(dependencies = [ToolBarHookPatch::class])
|
||||
object ShortsToolBarPatch : BytecodePatch(
|
||||
setOf(
|
||||
SetToolBarPaddingFingerprint,
|
||||
ShortsCommentFingerprint,
|
||||
ToolBarBannerFingerprint
|
||||
)
|
||||
setOf(ToolBarBannerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ToolBarBannerFingerprint.result?.let {
|
||||
@ -57,26 +37,5 @@ object ShortsToolBarPatch : BytecodePatch(
|
||||
} ?: throw ToolBarBannerFingerprint.exception
|
||||
|
||||
ToolBarHookPatch.injectCall("$SHORTS->hideShortsToolBarButton")
|
||||
|
||||
SetToolBarPaddingFingerprint.result?.let {
|
||||
val targetMethod = context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.mutableMethod.getWideLiteralIndex(ToolBarPaddingHome) + 3, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
||||
targetMethod.apply {
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(0).reference
|
||||
if (!targetParameter.toString().endsWith("Landroid/support/v7/widget/Toolbar;"))
|
||||
throw PatchException("Method signature parameter did not match: $targetParameter")
|
||||
val targetRegister = getInstruction<TwoRegisterInstruction>(0).registerA
|
||||
|
||||
addInstruction(
|
||||
1,
|
||||
"invoke-static {v$targetRegister}, $SHORTS->hideShortsToolBar(Landroid/support/v7/widget/Toolbar;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw SetToolBarPaddingFingerprint.exception
|
||||
|
||||
ShortsCommentFingerprint.injectIndex(1)
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch
|
||||
import app.revanced.patches.youtube.utils.browseid.fingerprints.BrowseIdClassFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.browseid.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.utils.fingerprints
|
||||
package app.revanced.patches.youtube.utils.browseid.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ToolBarPaddingHome
|
@ -701,7 +701,7 @@ Tap and hold to set playback speed to 1.0x."</string>
|
||||
<string name="revanced_share_copy_url_timestamp_success">URL with timestamp copied to clipboard.</string>
|
||||
<string name="revanced_shorts">Shorts</string>
|
||||
<string name="revanced_shorts_player_title">Shorts player</string>
|
||||
<string name="revanced_shorts_toolbar_summary">To hide the shorts toolbar, hide all settings in the shorts toolbar category.</string>
|
||||
<string name="revanced_shorts_toolbar_summary">Back button in the toolbar cannot be hidden.</string>
|
||||
<string name="revanced_shorts_toolbar_title">Shorts toolbar</string>
|
||||
<string name="revanced_show_fullscreen_title_summary">Known issue: Title disappears when clicked.</string>
|
||||
<string name="revanced_show_fullscreen_title_title">Show fullscreen title</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user