diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java index dc0d15d18f..aeca9ddfdb 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -9,6 +9,7 @@ import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType; import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType.*; import static app.revanced.extension.youtube.patches.SeekbarThumbnailsPatch.SeekbarThumbnailsHighQualityAvailability; +import static app.revanced.extension.youtube.patches.VersionCheckPatch.IS_19_17_OR_GREATER; import static app.revanced.extension.youtube.sponsorblock.objects.CategoryBehaviour.*; import app.revanced.extension.shared.Logger; @@ -23,7 +24,6 @@ import app.revanced.extension.youtube.patches.spoof.SpoofVideoStreamsPatch; import app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings; -@SuppressWarnings("deprecation") public class Settings extends BaseSettings { // Video 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 { public static final BooleanSetting HIDE_AUTOPLAY_BUTTON = new BooleanSetting("revanced_hide_autoplay_button", TRUE, true); public static final BooleanSetting HIDE_CAST_BUTTON = new BooleanSetting("revanced_hide_cast_button", TRUE, true); public static final BooleanSetting HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS = new BooleanSetting("revanced_hide_player_previous_next_buttons", FALSE, true); - @Deprecated - public static final BooleanSetting HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE, true); + private static final BooleanSetting DEPRECATED_HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE, true); public static final BooleanSetting COPY_VIDEO_URL = new BooleanSetting("revanced_copy_video_url", FALSE); public static final BooleanSetting COPY_VIDEO_URL_TIMESTAMP = new BooleanSetting("revanced_copy_video_url_timestamp", TRUE); 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 { public static final BooleanSetting HIDE_PLAYER_FLYOUT_SLEEP_TIMER = new BooleanSetting("revanced_hide_player_flyout_sleep_timer", FALSE); public static final BooleanSetting HIDE_PLAYER_FLYOUT_STABLE_VOLUME = new BooleanSetting("revanced_hide_player_flyout_stable_volume", FALSE); public static final BooleanSetting HIDE_PLAYER_FLYOUT_WATCH_IN_VR = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE); - @Deprecated private static final BooleanSetting DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_video_quality_menu_footer", FALSE); public static final BooleanSetting HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_player_flyout_video_quality_footer", FALSE); // General layout public static final EnumSetting CHANGE_START_PAGE = new EnumSetting<>("revanced_change_start_page", StartPage.ORIGINAL, true); public static final BooleanSetting SPOOF_APP_VERSION = new BooleanSetting("revanced_spoof_app_version", FALSE, true, "revanced_spoof_app_version_user_dialog_message"); - public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", "17.41.37", true, parent(SPOOF_APP_VERSION)); + 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)); public static final BooleanSetting TABLET_LAYOUT = new BooleanSetting("revanced_tablet_layout", FALSE, true, "revanced_tablet_layout_user_dialog_message"); public static final BooleanSetting WIDE_SEARCHBAR = new BooleanSetting("revanced_wide_searchbar", FALSE, true); 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 { migrateOldSettingToNew(DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING, SB_PRIVATE_USER_ID); // Old spoof versions that no longer work reliably. - if (SpoofAppVersionPatch.isSpoofingToLessThan("17.33.00")) { + if (SpoofAppVersionPatch.isSpoofingToLessThan(SPOOF_APP_VERSION_TARGET.defaultValue)) { Logger.printInfo(() -> "Resetting spoof app version target"); - Settings.SPOOF_APP_VERSION_TARGET.resetToDefault(); + SPOOF_APP_VERSION_TARGET.resetToDefault(); } - migrateOldSettingToNew(HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS); + migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS); migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER); diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index 60f84dd72a..0602859f4f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -8,6 +8,8 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch import app.revanced.patches.shared.misc.settings.preference.ListPreference import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch +import app.revanced.patches.youtube.misc.playservice.is_19_17_or_greater +import app.revanced.patches.youtube.misc.playservice.versionCheckPatch import app.revanced.patches.youtube.misc.settings.PreferenceScreen import app.revanced.patches.youtube.misc.settings.settingsPatch import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @@ -19,12 +21,14 @@ private const val EXTENSION_CLASS_DESCRIPTOR = val spoofAppVersionPatch = bytecodePatch( name = "Spoof app version", description = "Adds an option to trick YouTube into thinking you are running an older version of the app. " + - "This can be used to restore old UI elements and features.", + "This can be used to restore old UI elements and features. " + + "Patching 19.16.39 or lower includes additional older spoofing targets.", ) { dependsOn( sharedExtensionPatch, settingsPatch, addResourcesPatch, + versionCheckPatch ) compatibleWith( @@ -43,10 +47,19 @@ val spoofAppVersionPatch = bytecodePatch( PreferenceScreen.GENERAL_LAYOUT.addPreferences( SwitchPreference("revanced_spoof_app_version"), - ListPreference( - key = "revanced_spoof_app_version_target", - summaryKey = null, - ), + if (is_19_17_or_greater) { + ListPreference( + key = "revanced_spoof_app_version_target", + summaryKey = null, + ) + } else { + ListPreference( + key = "revanced_spoof_app_version_target", + summaryKey = null, + entriesKey = "revanced_spoof_app_version_target_legacy_entries", + entryValuesKey = "revanced_spoof_app_version_target_legacy_entry_values" + ) + } ) val insertIndex = spoofAppVersionFingerprint.patternMatch!!.startIndex + 1 diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index 42caa99ad1..d2402d2bab 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -9,7 +9,7 @@ import app.revanced.patches.youtube.video.speed.remember.rememberPlaybackSpeedPa val playbackSpeedPatch = bytecodePatch( name = "Playback speed", description = "Adds options to customize available playback speeds, remember the last playback speed selected " + - "and show a speed dialog button to the video player.", + "and show a speed dialog button in the video player.", ) { dependsOn( playbackSpeedButtonPatch, diff --git a/patches/src/main/resources/addresources/values/arrays.xml b/patches/src/main/resources/addresources/values/arrays.xml index 7c3207d72e..5ecbef043d 100644 --- a/patches/src/main/resources/addresources/values/arrays.xml +++ b/patches/src/main/resources/addresources/values/arrays.xml @@ -15,11 +15,17 @@ @string/revanced_spoof_app_version_target_entry_1 - @string/revanced_spoof_app_version_target_entry_2 - @string/revanced_spoof_app_version_target_entry_3 - @string/revanced_spoof_app_version_target_entry_4 + 18.38.44 + + + @string/revanced_spoof_app_version_target_legacy_entry_1 + @string/revanced_spoof_app_version_target_legacy_entry_2 + @string/revanced_spoof_app_version_target_legacy_entry_3 + @string/revanced_spoof_app_version_target_legacy_entry_4 + + 18.33.40 18.20.39 18.09.39 diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index d6950433bc..b933029cf7 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -973,11 +973,12 @@ This is because Crowdin requires temporarily flattening this file and removing t Spoof app version target + 18.38.44 - Restore old Shorts player icons - 18.33.40 - Restore RYD on Shorts incognito mode - 18.20.39 - Restore wide video speed & quality menu - 18.09.39 - Restore library tab - 17.41.37 - Restore old playlist shelf + 18.33.40 - Restore RYD on Shorts incognito mode + 18.20.39 - Restore wide video speed & quality menu + 18.09.39 - Restore library tab + 17.41.37 - Restore old playlist shelf Set start page