Skip to content

Commit 0f42574

Browse files
LisoUseInAIKyriosoSumAtrIX
authored andcommitted
fix(YouTube - Copy video URL): Support A/B player layout
1 parent 15a8848 commit 0f42574

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

patches/api/patches.api

+1
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
13481348
public static final fun is_19_32_or_greater ()Z
13491349
public static final fun is_19_33_or_greater ()Z
13501350
public static final fun is_19_34_or_greater ()Z
1351+
public static final fun is_19_35_or_greater ()Z
13511352
public static final fun is_19_36_or_greater ()Z
13521353
public static final fun is_19_41_or_greater ()Z
13531354
public static final fun is_19_43_or_greater ()Z

patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/Fingerprints.kt

+8
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,11 @@ internal val controlsOverlayVisibilityFingerprint = fingerprint {
4646
returns("V")
4747
parameters("Z", "Z")
4848
}
49+
50+
internal val playerControlsExploderFeatureFlagFingerprint = fingerprint {
51+
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
52+
returns("Z")
53+
parameters()
54+
literal { 45643739L }
55+
}
56+

patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
1010
import app.revanced.patches.shared.misc.mapping.get
1111
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
1212
import app.revanced.patches.shared.misc.mapping.resourceMappings
13+
import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater
1314
import app.revanced.util.*
1415
import com.android.tools.smali.dexlib2.Opcode
1516
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@@ -217,6 +218,7 @@ val playerControlsPatch = bytecodePatch(
217218
val playerTopControlsInflateMatch by playerTopControlsInflateFingerprint()
218219
val overlayViewInflateMatch by overlayViewInflateFingerprint()
219220
val playerControlsExtensionHookMatch by playerControlsExtensionHookFingerprint()
221+
val playerControlsExploderFeatureFlagMatch by playerControlsExploderFeatureFlagFingerprint()
220222

221223
execute { context ->
222224
fun MutableMethod.indexOfFirstViewInflateOrThrow() =
@@ -269,5 +271,13 @@ val playerControlsPatch = bytecodePatch(
269271
}
270272

271273
visibilityImmediateMethod = playerControlsExtensionHookMatch.mutableMethod
274+
275+
// A/B test for a slightly different overlay controls,
276+
// that uses layout file youtube_video_exploder_controls_bottom_ui_container.xml
277+
// The change to support this is simple and only requires adding buttons to both layout files,
278+
// but for now force this different layout off since it's still an experimental test.
279+
if (is_19_35_or_greater) {
280+
playerControlsExploderFeatureFlagMatch.mutableMethod.returnEarly()
281+
}
272282
}
273283
}

patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var is_19_33_or_greater = false
2929
private set
3030
var is_19_34_or_greater = false
3131
private set
32+
var is_19_35_or_greater = false
33+
private set
3234
var is_19_36_or_greater = false
3335
private set
3436
var is_19_41_or_greater = false
@@ -62,6 +64,7 @@ val versionCheckPatch = resourcePatch(
6264
is_19_32_or_greater = 243199000 <= playStoreServicesVersion
6365
is_19_33_or_greater = 243405000 <= playStoreServicesVersion
6466
is_19_34_or_greater = 243499000 <= playStoreServicesVersion
67+
is_19_35_or_greater = 243605000 <= playStoreServicesVersion
6568
is_19_36_or_greater = 243705000 <= playStoreServicesVersion
6669
is_19_41_or_greater = 244305000 <= playStoreServicesVersion
6770
is_19_43_or_greater = 244405000 <= playStoreServicesVersion

0 commit comments

Comments
 (0)