feat(YouTube/Hide navigation buttons): remove Open library(You) on app startup settings

This commit is contained in:
inotia00 2023-12-12 18:27:31 +09:00
parent 6a4ca210df
commit da03d6563e
4 changed files with 8 additions and 25 deletions

View File

@ -14,7 +14,6 @@ import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.Pi
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.NAVIGATION import app.revanced.patches.youtube.utils.integrations.Constants.NAVIGATION
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.AvatarImageWithTextTab
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ImageOnlyTab import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ImageOnlyTab
import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.exception import app.revanced.util.exception
@ -100,22 +99,17 @@ object NavigationButtonsPatch : BytecodePatch(
} }
/** /**
* Create, You Button * Create Button
*/ */
parentResult.mutableMethod.apply { parentResult.mutableMethod.apply {
mapOf( val insertIndex = implementation!!.instructions.let {
CREATE_BUTTON_HOOK to ImageOnlyTab, val scanStart = getWideLiteralInstructionIndex(ImageOnlyTab)
YOU_BUTTON_HOOK to AvatarImageWithTextTab
).forEach { (hook, resourceId) ->
val insertIndex = implementation!!.instructions.let {
val scanStart = getWideLiteralInstructionIndex(resourceId)
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction -> scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL instruction.opcode == Opcode.INVOKE_VIRTUAL
} }
} + 2 } + 2
injectHook(hook, insertIndex) injectHook(CREATE_BUTTON_HOOK, insertIndex)
}
} }
} ?: throw PivotBarCreateButtonViewFingerprint.exception } ?: throw PivotBarCreateButtonViewFingerprint.exception
@ -168,11 +162,6 @@ object NavigationButtonsPatch : BytecodePatch(
"->" + "->" +
"hideCreateButton(Landroid/view/View;)V" "hideCreateButton(Landroid/view/View;)V"
private const val YOU_BUTTON_HOOK =
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
"->" +
"hideYouButton(Landroid/view/View;)V"
/** /**
* Injects an instruction into insertIndex of the hook. * Injects an instruction into insertIndex of the hook.
* @param hook The hook to insert. * @param hook The hook to insert.

View File

@ -22,7 +22,6 @@ object SharedResourceIdPatch : ResourcePatch() {
var AppRelatedEndScreenResults: Long = -1 var AppRelatedEndScreenResults: Long = -1
var AutoNavPreviewStub: Long = -1 var AutoNavPreviewStub: Long = -1
var AutoNavToggle: Long = -1 var AutoNavToggle: Long = -1
var AvatarImageWithTextTab: Long = -1
var BackgroundCategory: Long = -1 var BackgroundCategory: Long = -1
var Bar: Long = -1 var Bar: Long = -1
var BarContainerHeight: Long = -1 var BarContainerHeight: Long = -1
@ -103,7 +102,6 @@ object SharedResourceIdPatch : ResourcePatch() {
AppRelatedEndScreenResults = find(LAYOUT, "app_related_endscreen_results") AppRelatedEndScreenResults = find(LAYOUT, "app_related_endscreen_results")
AutoNavPreviewStub = find(ID, "autonav_preview_stub") AutoNavPreviewStub = find(ID, "autonav_preview_stub")
AutoNavToggle = find(ID, "autonav_toggle") AutoNavToggle = find(ID, "autonav_toggle")
AvatarImageWithTextTab = find(LAYOUT, "avatar_image_with_text_tab")
BackgroundCategory = find(STRING, "pref_background_and_offline_category") BackgroundCategory = find(STRING, "pref_background_and_offline_category")
Bar = find(LAYOUT, "bar") Bar = find(LAYOUT, "bar")
BarContainerHeight = find(DIMEN, "bar_container_height") BarContainerHeight = find(DIMEN, "bar_container_height")

View File

@ -694,9 +694,6 @@ Some videos, including those from channels you subscribe to, may not be hidden e
<string name="revanced_layout_title">Layout</string> <string name="revanced_layout_title">Layout</string>
<string name="revanced_misc">Miscellaneous</string> <string name="revanced_misc">Miscellaneous</string>
<string name="revanced_navigation">Navigation</string> <string name="revanced_navigation">Navigation</string>
<string name="revanced_open_library_you_startup_summary_off">Library(You) is not opened at app startup.</string>
<string name="revanced_open_library_you_startup_summary_on">Library(You) is opened at app startup.</string>
<string name="revanced_open_library_you_startup_title">Open library(You) on app startup</string>
<string name="revanced_others">Others</string> <string name="revanced_others">Others</string>
<string name="revanced_overlay_button">Overlay button</string> <string name="revanced_overlay_button">Overlay button</string>
<string name="revanced_overlay_button_always_repeat_summary">Tap to toggle always repeat states.</string> <string name="revanced_overlay_button_always_repeat_summary">Tap to toggle always repeat states.</string>

View File

@ -525,7 +525,6 @@
<SwitchPreference android:title="@string/revanced_hide_notifications_button_title" android:key="revanced_hide_notifications_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_notifications_button_summary_on" android:summaryOff="@string/revanced_hide_notifications_button_summary_off" /> <SwitchPreference android:title="@string/revanced_hide_notifications_button_title" android:key="revanced_hide_notifications_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_notifications_button_summary_on" android:summaryOff="@string/revanced_hide_notifications_button_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_shorts_button_title" android:key="revanced_hide_shorts_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_button_summary_off" /> <SwitchPreference android:title="@string/revanced_hide_shorts_button_title" android:key="revanced_hide_shorts_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_button_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_subscriptions_button_title" android:key="revanced_hide_subscriptions_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_subscriptions_button_summary_on" android:summaryOff="@string/revanced_hide_subscriptions_button_summary_off" /> <SwitchPreference android:title="@string/revanced_hide_subscriptions_button_title" android:key="revanced_hide_subscriptions_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_subscriptions_button_summary_on" android:summaryOff="@string/revanced_hide_subscriptions_button_summary_off" />
<SwitchPreference android:title="@string/revanced_open_library_you_startup_title" android:key="revanced_open_library_you_startup" android:defaultValue="false" android:summaryOn="@string/revanced_open_library_you_startup_summary_on" android:summaryOff="@string/revanced_open_library_you_startup_summary_off" />
<SwitchPreference android:title="@string/revanced_switching_create_notification_title" android:key="revanced_switching_create_notification" android:defaultValue="true" android:summary="@string/revanced_switching_create_notification_summary" />SETTINGS: HIDE_NAVIGATION_BUTTONS --> <SwitchPreference android:title="@string/revanced_switching_create_notification_title" android:key="revanced_switching_create_notification" android:defaultValue="true" android:summary="@string/revanced_switching_create_notification_summary" />SETTINGS: HIDE_NAVIGATION_BUTTONS -->
<!-- PREFERENCE: NAVIGATION_SETTINGS <!-- PREFERENCE: NAVIGATION_SETTINGS