Skip to content

Commit 9e18eca

Browse files
fix(YouTube - Spoof app version): Remove broken spoof targets when patching 19.25+ (ReVanced#3915)
1 parent 31af587 commit 9e18eca

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType;
1010
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType.*;
1111
import static app.revanced.extension.youtube.patches.SeekbarThumbnailsPatch.SeekbarThumbnailsHighQualityAvailability;
12+
import static app.revanced.extension.youtube.patches.VersionCheckPatch.IS_19_17_OR_GREATER;
1213
import static app.revanced.extension.youtube.sponsorblock.objects.CategoryBehaviour.*;
1314

1415
import app.revanced.extension.shared.Logger;
@@ -23,7 +24,6 @@
2324
import app.revanced.extension.youtube.patches.spoof.SpoofVideoStreamsPatch;
2425
import app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings;
2526

26-
@SuppressWarnings("deprecation")
2727
public class Settings extends BaseSettings {
2828
// Video
2929
public static final BooleanSetting RESTORE_OLD_VIDEO_QUALITY_MENU = new BooleanSetting("revanced_restore_old_video_quality_menu", TRUE);
@@ -128,8 +128,7 @@ public class Settings extends BaseSettings {
128128
public static final BooleanSetting HIDE_AUTOPLAY_BUTTON = new BooleanSetting("revanced_hide_autoplay_button", TRUE, true);
129129
public static final BooleanSetting HIDE_CAST_BUTTON = new BooleanSetting("revanced_hide_cast_button", TRUE, true);
130130
public static final BooleanSetting HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS = new BooleanSetting("revanced_hide_player_previous_next_buttons", FALSE, true);
131-
@Deprecated
132-
public static final BooleanSetting HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE, true);
131+
private static final BooleanSetting DEPRECATED_HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE, true);
133132
public static final BooleanSetting COPY_VIDEO_URL = new BooleanSetting("revanced_copy_video_url", FALSE);
134133
public static final BooleanSetting COPY_VIDEO_URL_TIMESTAMP = new BooleanSetting("revanced_copy_video_url_timestamp", TRUE);
135134
public static final BooleanSetting PLAYBACK_SPEED_DIALOG_BUTTON = new BooleanSetting("revanced_playback_speed_dialog_button", FALSE);
@@ -192,14 +191,13 @@ public class Settings extends BaseSettings {
192191
public static final BooleanSetting HIDE_PLAYER_FLYOUT_SLEEP_TIMER = new BooleanSetting("revanced_hide_player_flyout_sleep_timer", FALSE);
193192
public static final BooleanSetting HIDE_PLAYER_FLYOUT_STABLE_VOLUME = new BooleanSetting("revanced_hide_player_flyout_stable_volume", FALSE);
194193
public static final BooleanSetting HIDE_PLAYER_FLYOUT_WATCH_IN_VR = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE);
195-
@Deprecated
196194
private static final BooleanSetting DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_video_quality_menu_footer", FALSE);
197195
public static final BooleanSetting HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_player_flyout_video_quality_footer", FALSE);
198196

199197
// General layout
200198
public static final EnumSetting<StartPage> CHANGE_START_PAGE = new EnumSetting<>("revanced_change_start_page", StartPage.ORIGINAL, true);
201199
public static final BooleanSetting SPOOF_APP_VERSION = new BooleanSetting("revanced_spoof_app_version", FALSE, true, "revanced_spoof_app_version_user_dialog_message");
202-
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", "17.41.37", true, parent(SPOOF_APP_VERSION));
200+
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", IS_19_17_OR_GREATER ? "18.38.44" : "17.41.37", true, parent(SPOOF_APP_VERSION));
203201
public static final BooleanSetting TABLET_LAYOUT = new BooleanSetting("revanced_tablet_layout", FALSE, true, "revanced_tablet_layout_user_dialog_message");
204202
public static final BooleanSetting WIDE_SEARCHBAR = new BooleanSetting("revanced_wide_searchbar", FALSE, true);
205203
public static final BooleanSetting BYPASS_IMAGE_REGION_RESTRICTIONS = new BooleanSetting("revanced_bypass_image_region_restrictions", FALSE, true);
@@ -378,12 +376,12 @@ public class Settings extends BaseSettings {
378376
migrateOldSettingToNew(DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING, SB_PRIVATE_USER_ID);
379377

380378
// Old spoof versions that no longer work reliably.
381-
if (SpoofAppVersionPatch.isSpoofingToLessThan("17.33.00")) {
379+
if (SpoofAppVersionPatch.isSpoofingToLessThan(SPOOF_APP_VERSION_TARGET.defaultValue)) {
382380
Logger.printInfo(() -> "Resetting spoof app version target");
383-
Settings.SPOOF_APP_VERSION_TARGET.resetToDefault();
381+
SPOOF_APP_VERSION_TARGET.resetToDefault();
384382
}
385383

386-
migrateOldSettingToNew(HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS);
384+
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS);
387385

388386
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER);
389387

patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt

+18-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch
88
import app.revanced.patches.shared.misc.settings.preference.ListPreference
99
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
1010
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
11+
import app.revanced.patches.youtube.misc.playservice.is_19_17_or_greater
12+
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
1113
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
1214
import app.revanced.patches.youtube.misc.settings.settingsPatch
1315
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@@ -19,12 +21,14 @@ private const val EXTENSION_CLASS_DESCRIPTOR =
1921
val spoofAppVersionPatch = bytecodePatch(
2022
name = "Spoof app version",
2123
description = "Adds an option to trick YouTube into thinking you are running an older version of the app. " +
22-
"This can be used to restore old UI elements and features.",
24+
"This can be used to restore old UI elements and features. " +
25+
"Patching 19.16.39 or lower includes additional older spoofing targets.",
2326
) {
2427
dependsOn(
2528
sharedExtensionPatch,
2629
settingsPatch,
2730
addResourcesPatch,
31+
versionCheckPatch
2832
)
2933

3034
compatibleWith(
@@ -43,10 +47,19 @@ val spoofAppVersionPatch = bytecodePatch(
4347

4448
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
4549
SwitchPreference("revanced_spoof_app_version"),
46-
ListPreference(
47-
key = "revanced_spoof_app_version_target",
48-
summaryKey = null,
49-
),
50+
if (is_19_17_or_greater) {
51+
ListPreference(
52+
key = "revanced_spoof_app_version_target",
53+
summaryKey = null,
54+
)
55+
} else {
56+
ListPreference(
57+
key = "revanced_spoof_app_version_target",
58+
summaryKey = null,
59+
entriesKey = "revanced_spoof_app_version_target_legacy_entries",
60+
entryValuesKey = "revanced_spoof_app_version_target_legacy_entry_values"
61+
)
62+
}
5063
)
5164

5265
val insertIndex = spoofAppVersionFingerprint.patternMatch!!.startIndex + 1

patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import app.revanced.patches.youtube.video.speed.remember.rememberPlaybackSpeedPa
99
val playbackSpeedPatch = bytecodePatch(
1010
name = "Playback speed",
1111
description = "Adds options to customize available playback speeds, remember the last playback speed selected " +
12-
"and show a speed dialog button to the video player.",
12+
"and show a speed dialog button in the video player.",
1313
) {
1414
dependsOn(
1515
playbackSpeedButtonPatch,

patches/src/main/resources/addresources/values/arrays.xml

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515
<patch id="layout.spoofappversion.spoofAppVersionPatch">
1616
<string-array name="revanced_spoof_app_version_target_entries">
1717
<item>@string/revanced_spoof_app_version_target_entry_1</item>
18-
<item>@string/revanced_spoof_app_version_target_entry_2</item>
19-
<item>@string/revanced_spoof_app_version_target_entry_3</item>
20-
<item>@string/revanced_spoof_app_version_target_entry_4</item>
2118
</string-array>
2219
<string-array name="revanced_spoof_app_version_target_entry_values">
20+
<item>18.38.44</item>
21+
</string-array>
22+
<string-array name="revanced_spoof_app_version_target_legacy_entries">
23+
<item>@string/revanced_spoof_app_version_target_legacy_entry_1</item>
24+
<item>@string/revanced_spoof_app_version_target_legacy_entry_2</item>
25+
<item>@string/revanced_spoof_app_version_target_legacy_entry_3</item>
26+
<item>@string/revanced_spoof_app_version_target_legacy_entry_4</item>
27+
</string-array>
28+
<string-array name="revanced_spoof_app_version_target_legacy_entry_values">
2329
<item>18.33.40</item>
2430
<item>18.20.39</item>
2531
<item>18.09.39</item>

patches/src/main/resources/addresources/values/strings.xml

+5-4
Original file line numberDiff line numberDiff line change
@@ -973,11 +973,12 @@ This is because Crowdin requires temporarily flattening this file and removing t
973973
<!-- It is ideal, but not required, if the text here appears is alphabetically after the text used for 'revanced_spoof_app_version_title'.
974974
This is because the 'General layout' menu uses alphabetic sorting, and it functionally works better if the spoof target selector appears below the 'Spoof app version' UI switch -->
975975
<string name="revanced_spoof_app_version_target_title">Spoof app version target</string>
976+
<string name="revanced_spoof_app_version_target_entry_1">18.38.44 - Restore old Shorts player icons</string>
976977
<!-- 'RYD' is 'Return YouTube Dislike' -->
977-
<string name="revanced_spoof_app_version_target_entry_1">18.33.40 - Restore RYD on Shorts incognito mode</string>
978-
<string name="revanced_spoof_app_version_target_entry_2">18.20.39 - Restore wide video speed &amp; quality menu</string>
979-
<string name="revanced_spoof_app_version_target_entry_3">18.09.39 - Restore library tab</string>
980-
<string name="revanced_spoof_app_version_target_entry_4">17.41.37 - Restore old playlist shelf</string>
978+
<string name="revanced_spoof_app_version_target_legacy_entry_1">18.33.40 - Restore RYD on Shorts incognito mode</string>
979+
<string name="revanced_spoof_app_version_target_legacy_entry_2">18.20.39 - Restore wide video speed &amp; quality menu</string>
980+
<string name="revanced_spoof_app_version_target_legacy_entry_3">18.09.39 - Restore library tab</string>
981+
<string name="revanced_spoof_app_version_target_legacy_entry_4">17.41.37 - Restore old playlist shelf</string>
981982
</patch>
982983
<patch id="layout.startpage.changeStartPagePatch">
983984
<string name="revanced_change_start_page_title">Set start page</string>

0 commit comments

Comments
 (0)