Skip to content

Commit

Permalink
fix(YouTube - Copy video URL): Support A/B player layout
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios authored and oSumAtrIX committed Nov 6, 2024
1 parent 15a8848 commit 0f42574
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/api/patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
public static final fun is_19_32_or_greater ()Z
public static final fun is_19_33_or_greater ()Z
public static final fun is_19_34_or_greater ()Z
public static final fun is_19_35_or_greater ()Z
public static final fun is_19_36_or_greater ()Z
public static final fun is_19_41_or_greater ()Z
public static final fun is_19_43_or_greater ()Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ internal val controlsOverlayVisibilityFingerprint = fingerprint {
returns("V")
parameters("Z", "Z")
}

internal val playerControlsExploderFeatureFlagFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z")
parameters()
literal { 45643739L }
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.misc.mapping.get
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
import app.revanced.patches.shared.misc.mapping.resourceMappings
import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater
import app.revanced.util.*
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
Expand Down Expand Up @@ -217,6 +218,7 @@ val playerControlsPatch = bytecodePatch(
val playerTopControlsInflateMatch by playerTopControlsInflateFingerprint()
val overlayViewInflateMatch by overlayViewInflateFingerprint()
val playerControlsExtensionHookMatch by playerControlsExtensionHookFingerprint()
val playerControlsExploderFeatureFlagMatch by playerControlsExploderFeatureFlagFingerprint()

execute { context ->
fun MutableMethod.indexOfFirstViewInflateOrThrow() =
Expand Down Expand Up @@ -269,5 +271,13 @@ val playerControlsPatch = bytecodePatch(
}

visibilityImmediateMethod = playerControlsExtensionHookMatch.mutableMethod

// A/B test for a slightly different overlay controls,
// that uses layout file youtube_video_exploder_controls_bottom_ui_container.xml
// The change to support this is simple and only requires adding buttons to both layout files,
// but for now force this different layout off since it's still an experimental test.
if (is_19_35_or_greater) {
playerControlsExploderFeatureFlagMatch.mutableMethod.returnEarly()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var is_19_33_or_greater = false
private set
var is_19_34_or_greater = false
private set
var is_19_35_or_greater = false
private set
var is_19_36_or_greater = false
private set
var is_19_41_or_greater = false
Expand Down Expand Up @@ -62,6 +64,7 @@ val versionCheckPatch = resourcePatch(
is_19_32_or_greater = 243199000 <= playStoreServicesVersion
is_19_33_or_greater = 243405000 <= playStoreServicesVersion
is_19_34_or_greater = 243499000 <= playStoreServicesVersion
is_19_35_or_greater = 243605000 <= playStoreServicesVersion
is_19_36_or_greater = 243705000 <= playStoreServicesVersion
is_19_41_or_greater = 244305000 <= playStoreServicesVersion
is_19_43_or_greater = 244405000 <= playStoreServicesVersion
Expand Down

0 comments on commit 0f42574

Please sign in to comment.