Compare commits

...

4 Commits

Author SHA1 Message Date
semantic-release-bot
6cde702854 chore: Release v5.9.1-dev.3 [skip ci]
## [5.9.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.9.1-dev.2...v5.9.1-dev.3) (2025-01-22)

### Bug Fixes

* **YouTube - Hide seekbar:** Do not hide player seekbar if hide feed seekbar is enabled ([#4333](https://github.com/ReVanced/revanced-patches/issues/4333)) ([7c8efca](7c8efcaf41))
2025-01-22 12:01:57 +00:00
LisoUseInAIKyrios
7c8efcaf41 fix(YouTube - Hide seekbar): Do not hide player seekbar if hide feed seekbar is enabled (#4333) 2025-01-22 12:57:53 +01:00
semantic-release-bot
350ee02e3b chore: Release v5.9.1-dev.2 [skip ci]
## [5.9.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.9.1-dev.1...v5.9.1-dev.2) (2025-01-22)

### Bug Fixes

* **YouTube - Theme:** Fix 19.25 - 19.45 patch error ([df2d070](df2d070a43))
2025-01-22 08:26:21 +00:00
LisoUseInAIKyrios
df2d070a43 fix(YouTube - Theme): Fix 19.25 - 19.45 patch error 2025-01-22 09:23:31 +01:00
9 changed files with 134 additions and 31 deletions

View File

@@ -1,3 +1,17 @@
## [5.9.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.9.1-dev.2...v5.9.1-dev.3) (2025-01-22)
### Bug Fixes
* **YouTube - Hide seekbar:** Do not hide player seekbar if hide feed seekbar is enabled ([#4333](https://github.com/ReVanced/revanced-patches/issues/4333)) ([f5cf6f2](https://github.com/ReVanced/revanced-patches/commit/f5cf6f2a445492d33815a9772f49deac2d70eba9))
## [5.9.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.9.1-dev.1...v5.9.1-dev.2) (2025-01-22)
### Bug Fixes
* **YouTube - Theme:** Fix 19.25 - 19.45 patch error ([5b47a5f](https://github.com/ReVanced/revanced-patches/commit/5b47a5f0f6299daaae209341064fd85f16ca18a6))
## [5.9.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.9.0...v5.9.1-dev.1) (2025-01-21) ## [5.9.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.9.0...v5.9.1-dev.1) (2025-01-21)

View File

@@ -18,6 +18,8 @@ public final class SeekbarColorPatch {
private static final boolean SEEKBAR_CUSTOM_COLOR_ENABLED = Settings.SEEKBAR_CUSTOM_COLOR.get(); private static final boolean SEEKBAR_CUSTOM_COLOR_ENABLED = Settings.SEEKBAR_CUSTOM_COLOR.get();
private static final boolean HIDE_SEEKBAR_THUMBNAIL_ENABLED = Settings.HIDE_SEEKBAR_THUMBNAIL.get();
/** /**
* Default color of the litho seekbar. * Default color of the litho seekbar.
* Differs slightly from the default custom seekbar color setting. * Differs slightly from the default custom seekbar color setting.
@@ -39,11 +41,6 @@ public final class SeekbarColorPatch {
*/ */
private static final float ORIGINAL_SEEKBAR_COLOR_BRIGHTNESS; private static final float ORIGINAL_SEEKBAR_COLOR_BRIGHTNESS;
/**
* Empty seekbar gradient, if hide seekbar in feed is enabled.
*/
private static final int[] HIDDEN_SEEKBAR_GRADIENT_COLORS = { 0x00000000, 0x00000000 };
/** /**
* If {@link Settings#SEEKBAR_CUSTOM_COLOR} is enabled, * If {@link Settings#SEEKBAR_CUSTOM_COLOR} is enabled,
* this is the color value of {@link Settings#SEEKBAR_CUSTOM_COLOR_VALUE}. * this is the color value of {@link Settings#SEEKBAR_CUSTOM_COLOR_VALUE}.
@@ -149,6 +146,22 @@ public final class SeekbarColorPatch {
} }
} }
/**
* Injection point.
*/
public static boolean showWatchHistoryProgressDrawable(boolean original) {
return !HIDE_SEEKBAR_THUMBNAIL_ENABLED && original;
}
/**
* Injection point.
*/
public static int getSeekbarScrubHandleColor(int colorValue) {
return SEEKBAR_CUSTOM_COLOR_ENABLED
? seekbarColor
: colorValue;
}
/** /**
* Injection point. * Injection point.
* *
@@ -159,7 +172,7 @@ public final class SeekbarColorPatch {
*/ */
public static int getLithoColor(int colorValue) { public static int getLithoColor(int colorValue) {
if (colorValue == ORIGINAL_SEEKBAR_COLOR) { if (colorValue == ORIGINAL_SEEKBAR_COLOR) {
if (Settings.HIDE_SEEKBAR_THUMBNAIL.get()) { if (HIDE_SEEKBAR_THUMBNAIL_ENABLED) {
return 0x00000000; return 0x00000000;
} }
@@ -172,10 +185,6 @@ public final class SeekbarColorPatch {
* Injection point. * Injection point.
*/ */
public static int[] getLinearGradient(int[] original) { public static int[] getLinearGradient(int[] original) {
if (Settings.HIDE_SEEKBAR_THUMBNAIL.get()) {
return HIDDEN_SEEKBAR_GRADIENT_COLORS;
}
return SEEKBAR_CUSTOM_COLOR_ENABLED return SEEKBAR_CUSTOM_COLOR_ENABLED
? customSeekbarColorInt ? customSeekbarColorInt
: original; : original;
@@ -183,7 +192,7 @@ public final class SeekbarColorPatch {
private static String colorArrayToHex(int[] colors) { private static String colorArrayToHex(int[] colors) {
final int length = colors.length; final int length = colors.length;
StringBuilder builder = new StringBuilder(length * 10); StringBuilder builder = new StringBuilder(length * 12);
builder.append("["); builder.append("[");
int i = 0; int i = 0;
@@ -202,14 +211,12 @@ public final class SeekbarColorPatch {
* Injection point. * Injection point.
*/ */
public static void setLinearGradient(int[] colors, float[] positions) { public static void setLinearGradient(int[] colors, float[] positions) {
final boolean hideSeekbar = Settings.HIDE_SEEKBAR_THUMBNAIL.get(); if (SEEKBAR_CUSTOM_COLOR_ENABLED || HIDE_SEEKBAR_THUMBNAIL_ENABLED) {
if (SEEKBAR_CUSTOM_COLOR_ENABLED || hideSeekbar) {
// Most litho usage of linear gradients is hooked here, // Most litho usage of linear gradients is hooked here,
// so must only change if the values are those for the seekbar. // so must only change if the values are those for the seekbar.
if ((Arrays.equals(FEED_ORIGINAL_SEEKBAR_GRADIENT_COLORS, colors) if ((Arrays.equals(FEED_ORIGINAL_SEEKBAR_GRADIENT_COLORS, colors)
&& Arrays.equals(FEED_ORIGINAL_SEEKBAR_GRADIENT_POSITIONS, positions))) { && Arrays.equals(FEED_ORIGINAL_SEEKBAR_GRADIENT_POSITIONS, positions))) {
Arrays.fill(colors, hideSeekbar Arrays.fill(colors, HIDE_SEEKBAR_THUMBNAIL_ENABLED
? 0x00000000 ? 0x00000000
: seekbarColor); : seekbarColor);
return; return;

View File

@@ -270,7 +270,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting DISABLE_PRECISE_SEEKING_GESTURE = new BooleanSetting("revanced_disable_precise_seeking_gesture", TRUE); public static final BooleanSetting DISABLE_PRECISE_SEEKING_GESTURE = new BooleanSetting("revanced_disable_precise_seeking_gesture", TRUE);
public static final BooleanSetting HIDE_SEEKBAR = new BooleanSetting("revanced_hide_seekbar", FALSE, true); public static final BooleanSetting HIDE_SEEKBAR = new BooleanSetting("revanced_hide_seekbar", FALSE, true);
public static final BooleanSetting HIDE_SEEKBAR_THUMBNAIL = new BooleanSetting("revanced_hide_seekbar_thumbnail", FALSE); public static final BooleanSetting HIDE_SEEKBAR_THUMBNAIL = new BooleanSetting("revanced_hide_seekbar_thumbnail", FALSE, true);
public static final BooleanSetting HIDE_TIMESTAMP = new BooleanSetting("revanced_hide_timestamp", FALSE); public static final BooleanSetting HIDE_TIMESTAMP = new BooleanSetting("revanced_hide_timestamp", FALSE);
public static final BooleanSetting RESTORE_OLD_SEEKBAR_THUMBNAILS = new BooleanSetting("revanced_restore_old_seekbar_thumbnails", TRUE); public static final BooleanSetting RESTORE_OLD_SEEKBAR_THUMBNAILS = new BooleanSetting("revanced_restore_old_seekbar_thumbnails", TRUE);
public static final BooleanSetting SEEKBAR_CUSTOM_COLOR = new BooleanSetting("revanced_seekbar_custom_color", FALSE, true); public static final BooleanSetting SEEKBAR_CUSTOM_COLOR = new BooleanSetting("revanced_seekbar_custom_color", FALSE, true);

View File

@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
org.gradle.parallel = true org.gradle.parallel = true
android.useAndroidX = true android.useAndroidX = true
kotlin.code.style = official kotlin.code.style = official
version = 5.9.1-dev.1 version = 5.9.1-dev.3

View File

@@ -1365,6 +1365,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
public static final fun is_19_43_or_greater ()Z public static final fun is_19_43_or_greater ()Z
public static final fun is_19_46_or_greater ()Z public static final fun is_19_46_or_greater ()Z
public static final fun is_19_47_or_greater ()Z public static final fun is_19_47_or_greater ()Z
public static final fun is_19_49_or_greater ()Z
} }
public final class app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatchKt { public final class app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatchKt {

View File

@@ -10,8 +10,7 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.TextPreference import app.revanced.patches.shared.misc.settings.preference.TextPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
import app.revanced.patches.youtube.misc.playservice.is_19_23_or_greater import app.revanced.patches.youtube.misc.playservice.is_19_43_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
import app.revanced.patches.youtube.misc.settings.PreferenceScreen import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.patches.youtube.shared.mainActivityFingerprint import app.revanced.patches.youtube.shared.mainActivityFingerprint
@@ -30,7 +29,7 @@ private val swipeControlsResourcePatch = resourcePatch {
execute { execute {
addResources("youtube", "interaction.swipecontrols.swipeControlsResourcePatch") addResources("youtube", "interaction.swipecontrols.swipeControlsResourcePatch")
if (is_19_25_or_greater) { if (is_19_43_or_greater) {
PreferenceScreen.SWIPE_CONTROLS.addPreferences( PreferenceScreen.SWIPE_CONTROLS.addPreferences(
SwitchPreference("revanced_swipe_change_video") SwitchPreference("revanced_swipe_change_video")
) )
@@ -114,7 +113,7 @@ val swipeControlsPatch = bytecodePatch(
// region patch to enable/disable swipe to change video. // region patch to enable/disable swipe to change video.
if (is_19_23_or_greater) { if (is_19_43_or_greater) {
swipeChangeVideoFingerprint.method.insertFeatureFlagBooleanOverride( swipeChangeVideoFingerprint.method.insertFeatureFlagBooleanOverride(
SWIPE_CHANGE_VIDEO_FEATURE_FLAG, SWIPE_CHANGE_VIDEO_FEATURE_FLAG,
"$EXTENSION_CLASS_DESCRIPTOR->allowSwipeChangeVideo(Z)Z" "$EXTENSION_CLASS_DESCRIPTOR->allowSwipeChangeVideo(Z)Z"

View File

@@ -34,6 +34,19 @@ internal val shortsSeekbarColorFingerprint = fingerprint {
literal { reelTimeBarPlayedColorId } literal { reelTimeBarPlayedColorId }
} }
internal val playerSeekbarHandleColorFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameters("Landroid/content/Context;")
literal { ytStaticBrandRedId }
}
internal val watchHistoryMenuUseProgressDrawableFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
parameters("L")
literal { -1712394514 }
}
internal val lithoLinearGradientFingerprint = fingerprint { internal val lithoLinearGradientFingerprint = fingerprint {
accessFlags(AccessFlags.STATIC) accessFlags(AccessFlags.STATIC)
returns("Landroid/graphics/LinearGradient;") returns("Landroid/graphics/LinearGradient;")
@@ -41,9 +54,23 @@ internal val lithoLinearGradientFingerprint = fingerprint {
} }
/** /**
* 29.25 - 19.50 * 19.49+
*/ */
internal val playerLinearGradientLegacyFingerprint = fingerprint { internal val playerLinearGradientFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
parameters("I", "I", "I", "I", "Landroid/content/Context;", "I")
returns("Landroid/graphics/LinearGradient;")
opcodes(
Opcode.FILLED_NEW_ARRAY,
Opcode.MOVE_RESULT_OBJECT
)
literal { ytYoutubeMagentaColorId }
}
/**
* 19.46 - 19.47
*/
internal val playerLinearGradientLegacy1946Fingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
parameters("I", "I", "I", "I") parameters("I", "I", "I", "I")
returns("V") returns("V")
@@ -57,12 +84,11 @@ internal val playerLinearGradientLegacyFingerprint = fingerprint {
} }
/** /**
* 20.03+ * 19.25 - 19.45
*/ */
internal val playerLinearGradientFingerprint = fingerprint { internal val playerLinearGradientLegacy1925Fingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC) accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameters("I", "I", "I", "I", "Landroid/content/Context;", "I") parameters("Landroid/content/Context;")
returns("Landroid/graphics/LinearGradient;")
opcodes( opcodes(
Opcode.FILLED_NEW_ARRAY, Opcode.FILLED_NEW_ARRAY,
Opcode.MOVE_RESULT_OBJECT Opcode.MOVE_RESULT_OBJECT

View File

@@ -14,7 +14,9 @@ import app.revanced.patches.youtube.layout.theme.lithoColorHookPatch
import app.revanced.patches.youtube.layout.theme.lithoColorOverrideHook import app.revanced.patches.youtube.layout.theme.lithoColorOverrideHook
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_46_or_greater import app.revanced.patches.youtube.misc.playservice.is_19_46_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_49_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.patches.youtube.misc.settings.settingsPatch import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.patches.youtube.shared.mainActivityOnCreateFingerprint import app.revanced.patches.youtube.shared.mainActivityOnCreateFingerprint
@@ -41,6 +43,8 @@ internal var inlineTimeBarPlayedNotHighlightedColorId = -1L
private set private set
internal var ytYoutubeMagentaColorId = -1L internal var ytYoutubeMagentaColorId = -1L
private set private set
internal var ytStaticBrandRedId = -1L
private set
internal const val splashSeekbarColorAttributeName = "splash_custom_seekbar_color" internal const val splashSeekbarColorAttributeName = "splash_custom_seekbar_color"
@@ -68,6 +72,10 @@ private val seekbarColorResourcePatch = resourcePatch {
"color", "color",
"yt_youtube_magenta", "yt_youtube_magenta",
] ]
ytStaticBrandRedId = resourceMappings[
"attr",
"ytStaticBrandRed",
]
// Modify the resume playback drawable and replace the progress bar with a custom drawable. // Modify the resume playback drawable and replace the progress bar with a custom drawable.
document("res/drawable/resume_playback_progressbar_drawable.xml").use { document -> document("res/drawable/resume_playback_progressbar_drawable.xml").use { document ->
@@ -188,6 +196,7 @@ val seekbarColorPatch = bytecodePatch(
sharedExtensionPatch, sharedExtensionPatch,
lithoColorHookPatch, lithoColorHookPatch,
seekbarColorResourcePatch, seekbarColorResourcePatch,
versionCheckPatch
) )
execute { execute {
@@ -235,13 +244,57 @@ val seekbarColorPatch = bytecodePatch(
// 19.25+ changes // 19.25+ changes
playerSeekbarHandleColorFingerprint.method.apply {
val index = indexOfFirstLiteralInstructionOrThrow(ytStaticBrandRedId)
val insertIndex = indexOfFirstInstructionOrThrow(index, Opcode.MOVE_RESULT)
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex + 1,
"""
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getSeekbarScrubHandleColor(I)I
move-result v$register
"""
)
}
// If hiding feed seekbar thumbnails, then turn off the cairo gradient
// of the watch history menu items as they use the same gradient as the
// player and there is no easy way to distinguish which to use a transparent color.
if (is_19_34_or_greater) {
watchHistoryMenuUseProgressDrawableFingerprint.method.apply {
val progressIndex = indexOfFirstInstructionOrThrow {
val reference = getReference<MethodReference>()
reference?.definingClass == "Landroid/widget/ProgressBar;" && reference.name == "setMax"
}
val index = indexOfFirstInstructionOrThrow(progressIndex, Opcode.MOVE_RESULT)
val register = getInstruction<OneRegisterInstruction>(index).registerA
addInstructions(
index + 1,
"""
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->showWatchHistoryProgressDrawable(Z)Z
move-result v$register
"""
)
}
}
lithoLinearGradientFingerprint.method.addInstruction( lithoLinearGradientFingerprint.method.addInstruction(
0, 0,
"invoke-static/range { p4 .. p5 }, $EXTENSION_CLASS_DESCRIPTOR->setLinearGradient([I[F)V" "invoke-static/range { p4 .. p5 }, $EXTENSION_CLASS_DESCRIPTOR->setLinearGradient([I[F)V"
) )
// TODO: add 20.03 support val playerFingerprint =
playerLinearGradientLegacyFingerprint.let { if (is_19_49_or_greater) {
playerLinearGradientFingerprint
} else if (is_19_46_or_greater) {
playerLinearGradientLegacy1946Fingerprint
} else {
playerLinearGradientLegacy1925Fingerprint
}
playerFingerprint.let {
it.method.apply { it.method.apply {
val index = it.patternMatch!!.endIndex val index = it.patternMatch!!.endIndex
val register = getInstruction<OneRegisterInstruction>(index).registerA val register = getInstruction<OneRegisterInstruction>(index).registerA
@@ -249,7 +302,7 @@ val seekbarColorPatch = bytecodePatch(
addInstructions( addInstructions(
index + 1, index + 1,
""" """
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getLinearGradient([I)[I invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getLinearGradient([I)[I
move-result-object v$register move-result-object v$register
""" """
) )

View File

@@ -41,6 +41,8 @@ var is_19_46_or_greater = false
private set private set
var is_19_47_or_greater = false var is_19_47_or_greater = false
private set private set
var is_19_49_or_greater = false
private set
val versionCheckPatch = resourcePatch( val versionCheckPatch = resourcePatch(
description = "Uses the Play Store service version to find the major/minor version of the YouTube target app.", description = "Uses the Play Store service version to find the major/minor version of the YouTube target app.",
@@ -74,5 +76,6 @@ val versionCheckPatch = resourcePatch(
is_19_43_or_greater = 244405000 <= playStoreServicesVersion is_19_43_or_greater = 244405000 <= playStoreServicesVersion
is_19_46_or_greater = 244705000 <= playStoreServicesVersion is_19_46_or_greater = 244705000 <= playStoreServicesVersion
is_19_47_or_greater = 244799000 <= playStoreServicesVersion is_19_47_or_greater = 244799000 <= playStoreServicesVersion
is_19_49_or_greater = 245005000 <= playStoreServicesVersion
} }
} }