feat(YouTube/Hide suggestions shelf): remove Select method to hide shelves settings (also, this setting is no longer an Experimental Flags)

This commit is contained in:
inotia00
2024-03-25 08:01:10 +09:00
parent 83e201e96e
commit a0c71d7593
4 changed files with 6 additions and 21 deletions

View File

@ -7,7 +7,6 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.youtube.general.suggestions.fingerprints.BreakingNewsFingerprint
import app.revanced.patches.youtube.utils.browseid.BrowseIdHookPatch
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
import app.revanced.patches.youtube.utils.navbarindex.NavBarIndexHookPatch
@ -19,7 +18,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
name = "Hide suggestions shelf",
description = "Adds an option to hide the suggestions shelf in feed.",
dependencies = [
BrowseIdHookPatch::class,
LithoFilterPatch::class,
NavBarIndexHookPatch::class,
SettingsPatch::class
@ -64,7 +62,7 @@ object SuggestionsShelfPatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
/**
* Only used to tablet layout and the old UI components.
* Only used to tablet layout.
*/
BreakingNewsFingerprint.result?.let {
it.mutableMethod.apply {
@ -87,7 +85,6 @@ object SuggestionsShelfPatch : BytecodePatch(
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: GENERAL_EXPERIMENTAL_FLAGS",
"SETTINGS: HIDE_SUGGESTIONS_SHELF"
)
)

View File

@ -14,6 +14,7 @@ import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.util.exception
import app.revanced.util.getStringInstructionIndex
import app.revanced.util.getTargetIndex
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
@ -44,9 +45,7 @@ object BrowseIdHookPatch : BytecodePatch(
targetClass.methods.find { method -> method.name == "<init>" }
?.apply {
val browseIdFieldIndex = implementation!!.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.IPUT_OBJECT
}
val browseIdFieldIndex = getTargetIndex(Opcode.IPUT_OBJECT)
val browseIdFieldName =
(getInstruction<ReferenceInstruction>(browseIdFieldIndex).reference as FieldReference).name