mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +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:
@ -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 {
|
||||
val insertIndex = implementation!!.instructions.let {
|
||||
val scanStart = getWideLiteralIndex(ImageOnlyTab)
|
||||
mapOf(
|
||||
CREATE_BUTTON_HOOK to ImageOnlyTab,
|
||||
YOU_BUTTON_HOOK to AvatarImageWithTextTab
|
||||
).forEach { (hook, resourceId) ->
|
||||
val insertIndex = implementation!!.instructions.let {
|
||||
val scanStart = getWideLiteralIndex(resourceId)
|
||||
|
||||
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL
|
||||
}
|
||||
} + 2
|
||||
injectHook(CREATE_BUTTON_HOOK, insertIndex)
|
||||
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL
|
||||
}
|
||||
} + 2
|
||||
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")
|
||||
|
Reference in New Issue
Block a user