mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-01 06:40:17 +02:00
feat(YouTube/Hide feed components): Hide carousel shelf
setting no longer checks browserId
This commit is contained in:
parent
26829aceca
commit
844c295904
@ -19,8 +19,8 @@ abstract class BaseMainActivityResolvePatch(
|
|||||||
setOf(mainActivityOnCreateFingerprint)
|
setOf(mainActivityOnCreateFingerprint)
|
||||||
) {
|
) {
|
||||||
lateinit var mainActivityMutableClass: MutableClass
|
lateinit var mainActivityMutableClass: MutableClass
|
||||||
|
lateinit var onBackPressedMethod: MutableMethod
|
||||||
private lateinit var constructorMethod: MutableMethod
|
private lateinit var constructorMethod: MutableMethod
|
||||||
private lateinit var onBackPressedMethod: MutableMethod
|
|
||||||
private lateinit var onCreateMethod: MutableMethod
|
private lateinit var onCreateMethod: MutableMethod
|
||||||
private var constructorMethodIndex by Delegates.notNull<Int>()
|
private var constructorMethodIndex by Delegates.notNull<Int>()
|
||||||
private var onBackPressedMethodIndex by Delegates.notNull<Int>()
|
private var onBackPressedMethodIndex by Delegates.notNull<Int>()
|
||||||
|
@ -19,7 +19,6 @@ import app.revanced.patches.youtube.feed.components.fingerprints.LatestVideosBut
|
|||||||
import app.revanced.patches.youtube.feed.components.fingerprints.RelatedChipCloudFingerprint
|
import app.revanced.patches.youtube.feed.components.fingerprints.RelatedChipCloudFingerprint
|
||||||
import app.revanced.patches.youtube.feed.components.fingerprints.SearchResultsChipBarFingerprint
|
import app.revanced.patches.youtube.feed.components.fingerprints.SearchResultsChipBarFingerprint
|
||||||
import app.revanced.patches.youtube.feed.components.fingerprints.ShowMoreButtonFingerprint
|
import app.revanced.patches.youtube.feed.components.fingerprints.ShowMoreButtonFingerprint
|
||||||
import app.revanced.patches.youtube.utils.browseid.BrowseIdHookPatch
|
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPATIBLE_PACKAGE
|
import app.revanced.patches.youtube.utils.integrations.Constants.COMPATIBLE_PACKAGE
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_CLASS_DESCRIPTOR
|
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_CLASS_DESCRIPTOR
|
||||||
@ -43,7 +42,6 @@ object FeedComponentsPatch : BaseBytecodePatch(
|
|||||||
name = "Hide feed components",
|
name = "Hide feed components",
|
||||||
description = "Adds options to hide components related to feed.",
|
description = "Adds options to hide components related to feed.",
|
||||||
dependencies = setOf(
|
dependencies = setOf(
|
||||||
BrowseIdHookPatch::class,
|
|
||||||
LithoFilterPatch::class,
|
LithoFilterPatch::class,
|
||||||
NavigationBarHookPatch::class,
|
NavigationBarHookPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
|
@ -10,7 +10,9 @@ import app.revanced.patcher.patch.annotation.Patch
|
|||||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||||
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
|
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
|
||||||
import app.revanced.patches.youtube.utils.browseid.fingerprints.BrowseIdClassFingerprint
|
import app.revanced.patches.youtube.utils.browseid.fingerprints.BrowseIdClassFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.browseid.fingerprints.MobileTopBarDialogFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.SHARED_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.SHARED_PATH
|
||||||
|
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||||
import app.revanced.util.getStringInstructionIndex
|
import app.revanced.util.getStringInstructionIndex
|
||||||
import app.revanced.util.getTargetIndex
|
import app.revanced.util.getTargetIndex
|
||||||
@ -22,18 +24,24 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|||||||
@Patch(
|
@Patch(
|
||||||
dependencies = [
|
dependencies = [
|
||||||
LithoFilterPatch::class,
|
LithoFilterPatch::class,
|
||||||
|
MainActivityResolvePatch::class,
|
||||||
SharedResourceIdPatch::class
|
SharedResourceIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@Deprecated("This patch will be removed in the future.")
|
||||||
object BrowseIdHookPatch : BytecodePatch(
|
object BrowseIdHookPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
BrowseIdClassFingerprint,
|
BrowseIdClassFingerprint,
|
||||||
|
MobileTopBarDialogFingerprint,
|
||||||
PathBuilderFingerprint
|
PathBuilderFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
"$SHARED_PATH/BrowseId;"
|
"$SHARED_PATH/BrowseId;"
|
||||||
|
|
||||||
|
private const val SETTINGS_ACTIVITY_CLASS_DESCRIPTOR =
|
||||||
|
"Lcom/google/android/apps/youtube/app/settings/SettingsActivity;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,16 +70,40 @@ object BrowseIdHookPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val mobileTopBarDialogClass =
|
||||||
|
MobileTopBarDialogFingerprint.resultOrThrow().mutableClass
|
||||||
|
|
||||||
|
val mobileTopBarDialogOnBackPressedMethod =
|
||||||
|
mobileTopBarDialogClass.methods.single { method ->
|
||||||
|
method.name == "onBackPressed"
|
||||||
|
}
|
||||||
|
|
||||||
|
val mobileTopBarDialogOnStopMethod =
|
||||||
|
mobileTopBarDialogClass.methods.single { method ->
|
||||||
|
method.name == "onStop"
|
||||||
|
}
|
||||||
|
|
||||||
|
val pathBuilderMethod = PathBuilderFingerprint.resultOrThrow().mutableMethod
|
||||||
|
|
||||||
|
val settingsActivityOnBackPressedMethod =
|
||||||
|
context.findClass(SETTINGS_ACTIVITY_CLASS_DESCRIPTOR)!!.mutableClass.methods.single { method ->
|
||||||
|
method.name == "onBackPressed"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set BrowseId to integrations.
|
* Set BrowseId to integrations.
|
||||||
*/
|
*/
|
||||||
PathBuilderFingerprint.resultOrThrow().let {
|
listOf(
|
||||||
it.mutableMethod.apply {
|
MainActivityResolvePatch.onBackPressedMethod,
|
||||||
addInstruction(
|
mobileTopBarDialogOnBackPressedMethod,
|
||||||
0,
|
mobileTopBarDialogOnStopMethod,
|
||||||
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->setBrowseIdFromField()V"
|
pathBuilderMethod,
|
||||||
)
|
settingsActivityOnBackPressedMethod
|
||||||
}
|
).forEach { method ->
|
||||||
|
method.addInstruction(
|
||||||
|
0,
|
||||||
|
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->setBrowseIdFromField()V"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.browseid.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object MobileTopBarDialogFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "setContentView" &&
|
||||||
|
classDef.superclass == "Landroid/app/Dialog;"
|
||||||
|
}
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user