mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-30 06:34:37 +02:00
fix(YouTube - Shorts components): Shorts player automatically goes to next Short (Closes https://github.com/inotia00/ReVanced_Extended/issues/2873)
This commit is contained in:
parent
cf90f7b94e
commit
0bfabbc384
@ -30,8 +30,8 @@ public class ShortsRepeatStatePatch {
|
|||||||
END_SCREEN;
|
END_SCREEN;
|
||||||
|
|
||||||
static void setYTEnumValue(Enum<?> ytBehavior) {
|
static void setYTEnumValue(Enum<?> ytBehavior) {
|
||||||
String ytName = ytBehavior.name();
|
|
||||||
for (ShortsLoopBehavior rvBehavior : values()) {
|
for (ShortsLoopBehavior rvBehavior : values()) {
|
||||||
|
String ytName = ytBehavior.name();
|
||||||
if (ytName.endsWith(rvBehavior.name())) {
|
if (ytName.endsWith(rvBehavior.name())) {
|
||||||
if (rvBehavior.ytEnumValue != null) {
|
if (rvBehavior.ytEnumValue != null) {
|
||||||
Logger.printException(() -> "Conflicting behavior names: " + rvBehavior
|
Logger.printException(() -> "Conflicting behavior names: " + rvBehavior
|
||||||
@ -87,22 +87,19 @@ public class ShortsRepeatStatePatch {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static Enum<?> changeShortsRepeatBehavior(@Nullable Enum<?> original) {
|
public static Enum<?> changeShortsRepeatBehavior(@Nullable Enum<?> original) {
|
||||||
try {
|
try {
|
||||||
if (original == null) {
|
|
||||||
Logger.printDebug(() -> "Original is null, returning null");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortsLoopBehavior behavior = ExtendedUtils.IS_19_34_OR_GREATER &&
|
ShortsLoopBehavior behavior = ExtendedUtils.IS_19_34_OR_GREATER &&
|
||||||
isAppInBackgroundPiPMode()
|
isAppInBackgroundPiPMode()
|
||||||
? Settings.CHANGE_SHORTS_BACKGROUND_REPEAT_STATE.get()
|
? Settings.CHANGE_SHORTS_BACKGROUND_REPEAT_STATE.get()
|
||||||
: Settings.CHANGE_SHORTS_REPEAT_STATE.get();
|
: Settings.CHANGE_SHORTS_REPEAT_STATE.get();
|
||||||
Enum<?> overrideBehavior = behavior.ytEnumValue;
|
Enum<?> overrideBehavior = behavior.ytEnumValue;
|
||||||
|
|
||||||
if (overrideBehavior != null) {
|
if (behavior != ShortsLoopBehavior.UNKNOWN && overrideBehavior != null) {
|
||||||
Logger.printDebug(() -> overrideBehavior == original
|
Logger.printDebug(() -> {
|
||||||
? "Behavior setting is same as original. Using original: " + original.name()
|
String name = original == null ? "unknown (null)" : original.name();
|
||||||
: "Changing Shorts repeat behavior from: " + original.name() + " to: " + overrideBehavior.name()
|
return overrideBehavior == original
|
||||||
);
|
? "Behavior setting is same as original. Using original: " + name
|
||||||
|
: "Changing Shorts repeat behavior from: " + name + " to: " + overrideBehavior.name();
|
||||||
|
});
|
||||||
|
|
||||||
return overrideBehavior;
|
return overrideBehavior;
|
||||||
}
|
}
|
||||||
@ -117,6 +114,6 @@ public class ShortsRepeatStatePatch {
|
|||||||
* Injection point.
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
public static boolean isAutoPlay(@Nullable Enum<?> original) {
|
public static boolean isAutoPlay(@Nullable Enum<?> original) {
|
||||||
return original != null && ShortsLoopBehavior.SINGLE_PLAY.ytEnumValue == original;
|
return ShortsLoopBehavior.SINGLE_PLAY.ytEnumValue == original;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,6 @@ private val shortsRepeatPatch = bytecodePatch(
|
|||||||
// As of YouTube 20.09, Google has removed the code for 'Autoplay' and 'Pause' from this method.
|
// As of YouTube 20.09, Google has removed the code for 'Autoplay' and 'Pause' from this method.
|
||||||
// Manually add the 'Autoplay' code that Google removed.
|
// Manually add the 'Autoplay' code that Google removed.
|
||||||
// Tested on YouTube 20.10.
|
// Tested on YouTube 20.10.
|
||||||
// TODO: add the 'Pause' code that Google removed.
|
|
||||||
if (is_20_09_or_greater) {
|
if (is_20_09_or_greater) {
|
||||||
val (directReference, virtualReference) = with (reelPlaybackFingerprint.methodOrThrow(videoIdFingerprintShorts)) {
|
val (directReference, virtualReference) = with (reelPlaybackFingerprint.methodOrThrow(videoIdFingerprintShorts)) {
|
||||||
val directIndex = indexOfInitializationInstruction(this)
|
val directIndex = indexOfInitializationInstruction(this)
|
||||||
@ -537,17 +536,6 @@ private val shortsRepeatPatch = bytecodePatch(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
getContext().apply {
|
|
||||||
addEntryValues(
|
|
||||||
"revanced_change_shorts_repeat_state_entries",
|
|
||||||
"@string/revanced_change_shorts_repeat_state_entry_pause",
|
|
||||||
)
|
|
||||||
addEntryValues(
|
|
||||||
"revanced_change_shorts_repeat_state_entry_values",
|
|
||||||
"END_SCREEN",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_19_34_or_greater) {
|
if (is_19_34_or_greater) {
|
||||||
|
@ -98,11 +98,13 @@
|
|||||||
<item>@string/revanced_change_shorts_repeat_state_entry_default</item>
|
<item>@string/revanced_change_shorts_repeat_state_entry_default</item>
|
||||||
<item>@string/revanced_change_shorts_repeat_state_entry_repeat</item>
|
<item>@string/revanced_change_shorts_repeat_state_entry_repeat</item>
|
||||||
<item>@string/revanced_change_shorts_repeat_state_entry_auto_play</item>
|
<item>@string/revanced_change_shorts_repeat_state_entry_auto_play</item>
|
||||||
|
<item>@string/revanced_change_shorts_repeat_state_entry_pause</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="revanced_change_shorts_repeat_state_entry_values">
|
<string-array name="revanced_change_shorts_repeat_state_entry_values">
|
||||||
<item>UNKNOWN</item>
|
<item>UNKNOWN</item>
|
||||||
<item>REPEAT</item>
|
<item>REPEAT</item>
|
||||||
<item>SINGLE_PLAY</item>
|
<item>SINGLE_PLAY</item>
|
||||||
|
<item>END_SCREEN</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="revanced_default_video_quality_entries">
|
<string-array name="revanced_default_video_quality_entries">
|
||||||
<item>@string/quality_auto</item>
|
<item>@string/quality_auto</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user