mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
feat(YouTube/Hide channel profile components): add Hide store tab
settings
This commit is contained in:
@ -1,19 +1,28 @@
|
||||
package app.revanced.patches.youtube.general.descriptions
|
||||
package app.revanced.patches.youtube.general.channelprofile
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
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.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.general.channelprofile.fingerprints.DefaultsTabsBarFingerprint
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TabsBarTextTabView
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Hide channel profile components",
|
||||
description = "Hides channel profile components.",
|
||||
dependencies = [
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
@ -43,9 +52,27 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ChannelProfileComponentsPatch : BytecodePatch(emptySet()) {
|
||||
object ChannelProfileComponentsPatch : BytecodePatch(
|
||||
setOf(DefaultsTabsBarFingerprint)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$COMPONENTS_PATH/ChannelProfileFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter("$COMPONENTS_PATH/ChannelProfileFilter;")
|
||||
|
||||
DefaultsTabsBarFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val viewIndex = getWideLiteralInstructionIndex(TabsBarTextTabView) + 2
|
||||
val viewRegister = getInstruction<OneRegisterInstruction>(viewIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
viewIndex + 1,
|
||||
"sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->channelTabView:Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
} ?: throw DefaultsTabsBarFingerprint.exception
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
|
@ -0,0 +1,10 @@
|
||||
package app.revanced.patches.youtube.general.channelprofile.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.TabsBarTextTabView
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object DefaultsTabsBarFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Landroid/view/View;",
|
||||
parameters = listOf("Ljava/lang/CharSequence;", "Ljava/lang/CharSequence;", "Z"),
|
||||
literalSupplier = { TabsBarTextTabView }
|
||||
)
|
@ -77,6 +77,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var SettingsBooleanTimeRangeDialog: Long = -1
|
||||
var SubtitleMenuSettingsFooterInfo: Long = -1
|
||||
var SuggestedAction: Long = -1
|
||||
var TabsBarTextTabView: Long = -1
|
||||
var ToolBarPaddingHome: Long = -1
|
||||
var ToolTipContentView: Long = -1
|
||||
var TotalTime: Long = -1
|
||||
@ -159,6 +160,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
SettingsBooleanTimeRangeDialog = find(LAYOUT, "setting_boolean_time_range_dialog")
|
||||
SubtitleMenuSettingsFooterInfo = find(STRING, "subtitle_menu_settings_footer_info")
|
||||
SuggestedAction = find(LAYOUT, "suggested_action")
|
||||
TabsBarTextTabView = find(ID, "tabs_bar_text_tab_view")
|
||||
ToolBarPaddingHome = find(DIMEN, "toolbar_padding_home_action_up")
|
||||
ToolTipContentView = find(LAYOUT, "tooltip_content_view")
|
||||
TotalTime = find(STRING, "total_time")
|
||||
|
Reference in New Issue
Block a user