@@ -10,13 +10,17 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
10
10
import app.revanced.patches.shared.misc.settings.preference.TextPreference
11
11
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
12
12
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
13
+ import app.revanced.patches.youtube.misc.playservice.is_19_23_or_greater
14
+ import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
13
15
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
14
16
import app.revanced.patches.youtube.misc.settings.settingsPatch
15
17
import app.revanced.patches.youtube.shared.mainActivityFingerprint
16
18
import app.revanced.util.*
17
19
import com.android.tools.smali.dexlib2.AccessFlags
18
20
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
19
21
22
+ internal const val EXTENSION_CLASS_DESCRIPTOR = " Lapp/revanced/extension/youtube/swipecontrols/SwipeControlsHostActivity;"
23
+
20
24
private val swipeControlsResourcePatch = resourcePatch {
21
25
dependsOn(
22
26
settingsPatch,
@@ -26,6 +30,12 @@ private val swipeControlsResourcePatch = resourcePatch {
26
30
execute {
27
31
addResources(" youtube" , " interaction.swipecontrols.swipeControlsResourcePatch" )
28
32
33
+ if (is_19_25_or_greater) {
34
+ PreferenceScreen .SWIPE_CONTROLS .addPreferences(
35
+ SwitchPreference (" revanced_swipe_change_video" )
36
+ )
37
+ }
38
+
29
39
PreferenceScreen .SWIPE_CONTROLS .addPreferences(
30
40
SwitchPreference (" revanced_swipe_brightness" ),
31
41
SwitchPreference (" revanced_swipe_volume" ),
@@ -101,5 +111,16 @@ val swipeControlsPatch = bytecodePatch(
101
111
).toMutable()
102
112
}
103
113
}
114
+
115
+ // region patch to enable/disable swipe to change video.
116
+
117
+ if (is_19_23_or_greater) {
118
+ swipeChangeVideoFingerprint.method.insertFeatureFlagBooleanOverride(
119
+ SWIPE_CHANGE_VIDEO_FEATURE_FLAG ,
120
+ " $EXTENSION_CLASS_DESCRIPTOR ->allowSwipeChangeVideo(Z)Z"
121
+ )
122
+ }
123
+
124
+ // endregion
104
125
}
105
126
}
0 commit comments