mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 09:34:37 +02:00
feat(YouTube/Hide navigation buttons): Open library on app startup
now also works in the You
tab (Open library on app startup
→ Open library(You) on app startup
)
This commit is contained in:
parent
c3645ddb34
commit
a7edf227d1
@ -13,6 +13,7 @@ import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.Pi
|
||||
import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.PivotBarShortsButtonViewFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
|
||||
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.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
@ -94,17 +95,22 @@ object NavigationButtonsPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Button
|
||||
* Create, You Button
|
||||
*/
|
||||
parentResult.mutableMethod.apply {
|
||||
mapOf(
|
||||
CREATE_BUTTON_HOOK to ImageOnlyTab,
|
||||
YOU_BUTTON_HOOK to AvatarImageWithTextTab
|
||||
).forEach { (hook, resourceId) ->
|
||||
val insertIndex = implementation!!.instructions.let {
|
||||
val scanStart = getWideLiteralIndex(ImageOnlyTab)
|
||||
val scanStart = getWideLiteralIndex(resourceId)
|
||||
|
||||
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL
|
||||
}
|
||||
} + 2
|
||||
injectHook(CREATE_BUTTON_HOOK, insertIndex)
|
||||
injectHook(hook, insertIndex)
|
||||
}
|
||||
}
|
||||
|
||||
} ?: throw PivotBarCreateButtonViewFingerprint.exception
|
||||
@ -154,4 +160,9 @@ object NavigationButtonsPatch : BytecodePatch(
|
||||
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
|
||||
"->" +
|
||||
"hideCreateButton(Landroid/view/View;)V"
|
||||
|
||||
private const val YOU_BUTTON_HOOK =
|
||||
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
|
||||
"->" +
|
||||
"hideYouButton(Landroid/view/View;)V"
|
||||
}
|
@ -23,6 +23,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var AppRelatedEndScreenResults: Long = -1
|
||||
var AutoNavPreviewStub: Long = -1
|
||||
var AutoNavToggle: Long = -1
|
||||
var AvatarImageWithTextTab: Long = -1
|
||||
var BackgroundCategory: Long = -1
|
||||
var Bar: Long = -1
|
||||
var BarContainerHeight: Long = -1
|
||||
@ -103,6 +104,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
AppRelatedEndScreenResults = find(LAYOUT, "app_related_endscreen_results")
|
||||
AutoNavPreviewStub = find(ID, "autonav_preview_stub")
|
||||
AutoNavToggle = find(ID, "autonav_toggle")
|
||||
AvatarImageWithTextTab = find(LAYOUT, "avatar_image_with_text_tab")
|
||||
BackgroundCategory = find(STRING, "pref_background_and_offline_category")
|
||||
Bar = find(LAYOUT, "bar")
|
||||
BarContainerHeight = find(DIMEN, "bar_container_height")
|
||||
|
@ -578,9 +578,9 @@ Known issue: Autoplay does not work"</string>
|
||||
<string name="revanced_layout_title">Layout</string>
|
||||
<string name="revanced_misc">Miscellaneous</string>
|
||||
<string name="revanced_navigation">Navigation</string>
|
||||
<string name="revanced_open_library_startup_summary_off">Library is not opened at app startup</string>
|
||||
<string name="revanced_open_library_startup_summary_on">Library is opened at app startup</string>
|
||||
<string name="revanced_open_library_startup_title">Open library on app startup</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_overlay_button">Overlay button</string>
|
||||
<string name="revanced_overlay_button_always_repeat_summary">"Tap to toggle always repeat states
|
||||
|
Loading…
x
Reference in New Issue
Block a user