1
1
package app.revanced.patches.youtube.layout.hide.general
2
2
3
3
import app.revanced.patcher.data.BytecodeContext
4
+ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4
5
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
5
6
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
6
7
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -17,16 +18,17 @@ import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
17
18
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting
18
19
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
19
20
import app.revanced.patches.shared.misc.settings.preference.TextPreference
21
+ import app.revanced.patches.youtube.layout.hide.general.fingerprints.HideShowMoreButtonFingerprint
20
22
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint
21
23
import app.revanced.patches.youtube.layout.hide.general.fingerprints.PlayerOverlayFingerprint
22
24
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowWatermarkFingerprint
23
25
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
24
26
import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch
25
- import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
26
27
import app.revanced.patches.youtube.misc.settings.SettingsPatch
27
28
import app.revanced.util.resultOrThrow
28
29
import com.android.tools.smali.dexlib2.Opcode
29
30
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
31
+ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
30
32
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
31
33
32
34
@Patch(
@@ -36,8 +38,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
36
38
LithoFilterPatch ::class ,
37
39
SettingsPatch ::class ,
38
40
AddResourcesPatch ::class ,
39
- NavigationBarHookPatch ::class ,
40
- PlayerTypeHookPatch ::class // Used by Keyword Content filter.
41
+ HideLayoutComponentsResourcePatch ::class ,
42
+ NavigationBarHookPatch ::class // Used by Keyword Content filter.
41
43
],
42
44
compatiblePackages = [
43
45
CompatiblePackage (
@@ -66,7 +68,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
66
68
)
67
69
@Suppress(" unused" )
68
70
object HideLayoutComponentsPatch : BytecodePatch(
69
- setOf(ParseElementFromBufferFingerprint , PlayerOverlayFingerprint ),
71
+ setOf(ParseElementFromBufferFingerprint , PlayerOverlayFingerprint , HideShowMoreButtonFingerprint ),
70
72
) {
71
73
private const val LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR =
72
74
" Lapp/revanced/integrations/youtube/patches/components/LayoutComponentsFilter;"
@@ -122,9 +124,7 @@ object HideLayoutComponentsPatch : BytecodePatch(
122
124
SwitchPreference (" revanced_hide_notify_me_button" ),
123
125
SwitchPreference (" revanced_hide_search_result_recommendations" ),
124
126
SwitchPreference (" revanced_hide_search_result_shelf_header" ),
125
- )
126
-
127
- SettingsPatch .PreferenceScreen .FEED .addPreferences(
127
+ SwitchPreference (" revanced_hide_show_more_button" ),
128
128
PreferenceScreen (
129
129
key = " revanced_hide_keyword_content_screen" ,
130
130
sorting = Sorting .UNSORTED ,
@@ -203,5 +203,24 @@ object HideLayoutComponentsPatch : BytecodePatch(
203
203
}
204
204
205
205
// endregion
206
+
207
+ // region Show more button
208
+
209
+ HideShowMoreButtonFingerprint .resultOrThrow().let {
210
+ it.mutableMethod.apply {
211
+ val moveRegisterIndex = it.scanResult.patternScanResult!! .endIndex
212
+ val viewRegister =
213
+ getInstruction<OneRegisterInstruction >(moveRegisterIndex).registerA
214
+
215
+ val insertIndex = moveRegisterIndex + 1
216
+ addInstruction(
217
+ insertIndex,
218
+ " invoke-static { v$viewRegister }, " +
219
+ " $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR ->hideShowMoreButton(Landroid/view/View;)V"
220
+ )
221
+ }
222
+ }
223
+
224
+ // endregion
206
225
}
207
226
}
0 commit comments