mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(youtube/settings): moved some settings to the appropriate category
This commit is contained in:
@ -36,7 +36,6 @@ class CommentComponentPatch : ResourcePatch {
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: BOTTOM_PLAYER_SETTINGS",
|
||||
"SETTINGS: COMMENT_COMPONENT_PARENT",
|
||||
"SETTINGS: COMMENT_COMPONENTS"
|
||||
)
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
@Version("0.0.1")
|
||||
class QuickActionsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/QuickActionButtonsFilter;")
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/QuickActionFilter;")
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
|
@ -35,15 +35,11 @@ class LayoutComponentsPatch : ResourcePatch {
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: BOTTOM_PLAYER_SETTINGS",
|
||||
"PREFERENCE: GENERAL_SETTINGS",
|
||||
"PREFERENCE: PLAYER",
|
||||
|
||||
"SETTINGS: COMMENT_COMPONENT_PARENT",
|
||||
"PREFERENCE: PLAYER_SETTINGS",
|
||||
|
||||
"SETTINGS: HIDE_AUDIO_TRACK_BUTTON",
|
||||
"SETTINGS: HIDE_LAYOUT_COMPONENTS",
|
||||
"SETTINGS: HIDE_VIEW_PRODUCT"
|
||||
"SETTINGS: HIDE_LAYOUT_COMPONENTS"
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object NavigationEndpointFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
opcodes = listOf(
|
||||
Opcode.RETURN_VOID,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
strings = listOf("r_pfvc", "navigation_endpoint_interaction_logging_extension")
|
||||
)
|
@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object ReelWatchEndpointFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ -> methodDef.name == "<init>" }
|
||||
)
|
@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object ReelWatchEndpointParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
strings = listOf("Error parsing bytes for updated ReelWatchEndpoint.", "r_aoc")
|
||||
)
|
@ -1,126 +0,0 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.NavigationEndpointFingerprint
|
||||
import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchBundleFingerprint
|
||||
import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchEndpointFingerprint
|
||||
import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.ReelWatchEndpointParentFingerprint
|
||||
import app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints.SetPivotBarFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.NAVIGATION
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch
|
||||
@Name("hide-shorts-navbar")
|
||||
@Description("Hide navigation bar when playing shorts.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsNavBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
NavigationEndpointFingerprint,
|
||||
PivotBarCreateButtonViewFingerprint,
|
||||
ReelWatchBundleFingerprint,
|
||||
ReelWatchEndpointParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
|
||||
SetPivotBarFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
startIndex + 1,
|
||||
"sput-object v$register, $NAVIGATION->pivotBar:Ljava/lang/Object;"
|
||||
)
|
||||
}
|
||||
} ?: return SetPivotBarFingerprint.toErrorResult()
|
||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||
|
||||
ReelWatchBundleFingerprint.result?.let {
|
||||
(context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
).apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-static {}, $NAVIGATION->hideShortsPlayerNavBar()V"
|
||||
)
|
||||
}
|
||||
} ?: return ReelWatchBundleFingerprint.toErrorResult()
|
||||
|
||||
ReelWatchEndpointParentFingerprint.result?.let { parentResult ->
|
||||
ReelWatchEndpointFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"sput-object p1, $NAVIGATION->shortsContext:Landroid/content/Context;"
|
||||
) ?: return ReelWatchEndpointFingerprint.toErrorResult()
|
||||
} ?: return ReelWatchEndpointParentFingerprint.toErrorResult()
|
||||
|
||||
NavigationEndpointFingerprint.result?.let { result ->
|
||||
val navigationEndpointMethod = result.mutableMethod
|
||||
|
||||
with(navigationEndpointMethod.implementation!!.instructions) {
|
||||
filter { instruction ->
|
||||
val fieldReference =
|
||||
(instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||
fieldReference?.let { it.type == "Lcom/google/android/apps/youtube/app/extensions/reel/watch/player/ReelObscuredPlaybackSuspender;" } == true
|
||||
}.forEach { instruction ->
|
||||
val insertIndex = indexOf(instruction) + 4
|
||||
val targetRegister =
|
||||
navigationEndpointMethod.getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
navigationEndpointMethod.addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$targetRegister}, $NAVIGATION->hideShortsPlayerNavBar(Landroid/view/View;)Landroid/view/View;
|
||||
move-result-object v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
} ?: return NavigationEndpointFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: NAVIGATION_SETTINGS",
|
||||
"SETTINGS: HIDE_SHORTS_NAVIGATION_BAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-shorts-navbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -5,5 +5,7 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ShortsCommentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(RightComment) }
|
||||
)
|
@ -5,5 +5,7 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object ShortsRemixFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Z", "Z", "L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ReelDynRemix) }
|
||||
)
|
@ -9,6 +9,7 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.shorts.shortsnavigationbar.patch.ShortsNavigationBarPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
@ -26,6 +27,7 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
SharedResourceIdPatch::class,
|
||||
ShortsCommentButtonPatch::class,
|
||||
ShortsInfoPanelPatch::class,
|
||||
ShortsNavigationBarPatch::class,
|
||||
ShortsPaidContentBannerPatch::class,
|
||||
ShortsRemixButtonPatch::class,
|
||||
ShortsSubscriptionsButtonPatch::class
|
||||
|
@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object BottomNavigationBarFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_EQZ
|
||||
),
|
||||
strings = listOf("r_pfvc", "navigation_endpoint_interaction_logging_extension")
|
||||
)
|
@ -1,9 +1,9 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints
|
||||
package app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object ReelWatchBundleFingerprint : MethodFingerprint(
|
||||
object RenderBottomNavigationBarFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
opcodes = listOf(
|
||||
Opcode.CHECK_CAST,
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.navigation.shortsnavbar.fingerprints
|
||||
package app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -0,0 +1,81 @@
|
||||
package app.revanced.patches.youtube.shorts.shortsnavigationbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints.BottomNavigationBarFingerprint
|
||||
import app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints.RenderBottomNavigationBarFingerprint
|
||||
import app.revanced.patches.youtube.shorts.shortsnavigationbar.fingerprints.SetPivotBarFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("hide-shorts-navigation-bar")
|
||||
@Description("Hide navigation bar when playing shorts.")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsNavigationBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
BottomNavigationBarFingerprint,
|
||||
PivotBarCreateButtonViewFingerprint,
|
||||
RenderBottomNavigationBarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
|
||||
SetPivotBarFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
startIndex + 1,
|
||||
"sput-object v$register, $SHORTS->pivotBar:Ljava/lang/Object;"
|
||||
)
|
||||
}
|
||||
} ?: return SetPivotBarFingerprint.toErrorResult()
|
||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||
|
||||
RenderBottomNavigationBarFingerprint.result?.let {
|
||||
(context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
).apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-static {}, $SHORTS->hideShortsPlayerNavigationBar()V"
|
||||
)
|
||||
}
|
||||
} ?: return RenderBottomNavigationBarFingerprint.toErrorResult()
|
||||
|
||||
BottomNavigationBarFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerNavigationBar(Landroid/view/View;)Landroid/view/View;
|
||||
move-result-object v$insertRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return BottomNavigationBarFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user