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.integrations.Constants.NAVIGATION
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.exception
@ -100,22 +99,17 @@ object NavigationButtonsPatch : BytecodePatch(
}
/**
* Create, You Button
* Create 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 = getWideLiteralInstructionIndex(resourceId)
val insertIndex = implementation!!.instructions.let {
val scanStart = getWideLiteralInstructionIndex(ImageOnlyTab)
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL
}
} + 2
injectHook(hook, insertIndex)
}
scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL
}
} + 2
injectHook(CREATE_BUTTON_HOOK, insertIndex)
}
} ?: throw PivotBarCreateButtonViewFingerprint.exception
@ -168,11 +162,6 @@ object NavigationButtonsPatch : BytecodePatch(
"->" +
"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.
* @param hook The hook to insert.

View File

@ -22,7 +22,6 @@ 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,7 +102,6 @@ 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")