mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 22:37:17 +02:00
feat(YouTube/Hide channel profile components): add Hide store tab
settings
This commit is contained in:
parent
a439c9ac93
commit
23e1d44052
@ -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")
|
||||
|
@ -594,6 +594,9 @@ Known issue: Official headers in search results are hidden."</string>
|
||||
<string name="revanced_hide_start_trial_button_summary_off">Start trial button is shown.</string>
|
||||
<string name="revanced_hide_start_trial_button_summary_on">Start trial button is hidden.</string>
|
||||
<string name="revanced_hide_start_trial_button_title">Hide start trial button</string>
|
||||
<string name="revanced_hide_store_tab_summary_off">Store tab is shown.</string>
|
||||
<string name="revanced_hide_store_tab_summary_on">Store tab is hidden.</string>
|
||||
<string name="revanced_hide_store_tab_title">Hide store tab</string>
|
||||
<string name="revanced_hide_subscriptions_button_summary_off">Subscriptions button in navigation bar is shown.</string>
|
||||
<string name="revanced_hide_subscriptions_button_summary_on">Subscriptions button in navigation bar is hidden.</string>
|
||||
<string name="revanced_hide_subscriptions_button_title">Hide subscriptions button</string>
|
||||
|
@ -264,7 +264,8 @@
|
||||
<SwitchPreference android:title="@string/revanced_hide_browse_store_button_title" android:key="revanced_hide_browse_store_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_browse_store_button_summary_on" android:summaryOff="@string/revanced_hide_browse_store_button_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_channel_member_shelf_title" android:key="revanced_hide_channel_member_shelf" android:defaultValue="true" android:summaryOn="@string/revanced_hide_channel_member_shelf_summary_on" android:summaryOff="@string/revanced_hide_channel_member_shelf_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_channel_profile_links_title" android:key="revanced_hide_channel_profile_links" android:defaultValue="true" android:summaryOn="@string/revanced_hide_channel_profile_links_summary_on" android:summaryOff="@string/revanced_hide_channel_profile_links_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_for_you_shelf_title" android:key="revanced_hide_for_you_shelf" android:defaultValue="true" android:summaryOn="@string/revanced_hide_for_you_shelf_summary_on" android:summaryOff="@string/revanced_hide_for_you_shelf_summary_off" />SETTINGS: HIDE_CHANNEL_PROFILE_COMPONENTS -->
|
||||
<SwitchPreference android:title="@string/revanced_hide_for_you_shelf_title" android:key="revanced_hide_for_you_shelf" android:defaultValue="true" android:summaryOn="@string/revanced_hide_for_you_shelf_summary_on" android:summaryOff="@string/revanced_hide_for_you_shelf_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_store_tab_title" android:key="revanced_hide_store_tab" android:defaultValue="true" android:summaryOn="@string/revanced_hide_store_tab_summary_on" android:summaryOff="@string/revanced_hide_store_tab_summary_off" />SETTINGS: HIDE_CHANNEL_PROFILE_COMPONENTS -->
|
||||
|
||||
<!-- SETTINGS: HIDE_DESCRIPTION_COMPONENTS
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_description_title" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user