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 6ea0ffe24..4042cdf78 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 @@ -28,6 +28,8 @@ import app.revanced.extension.shared.settings.LongSetting; import app.revanced.extension.shared.settings.Setting; import app.revanced.extension.shared.settings.StringSetting; import app.revanced.extension.shared.settings.preference.SharedPrefCategory; +import app.revanced.extension.shared.utils.Logger; +import app.revanced.extension.shared.utils.Utils; import app.revanced.extension.youtube.patches.alternativethumbnails.AlternativeThumbnailsPatch.DeArrowAvailability; import app.revanced.extension.youtube.patches.alternativethumbnails.AlternativeThumbnailsPatch.StillImagesAvailability; import app.revanced.extension.youtube.patches.alternativethumbnails.AlternativeThumbnailsPatch.ThumbnailOption; @@ -637,6 +639,16 @@ public class Settings extends BaseSettings { static { // region Migration initialized + + // Old spoof versions that no longer work reliably. + String spoofAppVersionTarget = SPOOF_APP_VERSION_TARGET.get(); + if (spoofAppVersionTarget.compareTo(SPOOF_APP_VERSION_TARGET.defaultValue) < 0) { + Utils.showToastShort(str("revanced_spoof_app_version_target_invalid_toast", spoofAppVersionTarget)); + Utils.showToastShort(str("revanced_extended_reset_to_default_toast")); + Logger.printInfo(() -> "Resetting spoof app version target"); + SPOOF_APP_VERSION_TARGET.resetToDefault(); + } + // Categories were previously saved without a 'sb_' key prefix, so they need an additional adjustment. Set> sbCategories = new HashSet<>(Arrays.asList( SB_CATEGORY_SPONSOR, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt index 5177e36c7..ae0259731 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt @@ -16,7 +16,7 @@ import app.revanced.patches.youtube.utils.patch.PatchList.SPOOF_APP_VERSION import app.revanced.patches.youtube.utils.playservice.is_18_34_or_greater import app.revanced.patches.youtube.utils.playservice.is_18_39_or_greater import app.revanced.patches.youtube.utils.playservice.is_18_49_or_greater -import app.revanced.patches.youtube.utils.playservice.is_19_17_or_greater +import app.revanced.patches.youtube.utils.playservice.is_19_01_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_23_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_34_or_greater @@ -45,6 +45,15 @@ private val spoofAppVersionBytecodePatch = bytecodePatch( dependsOn(versionCheckPatch) execute { + if (is_19_01_or_greater) { + findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) { + name == "SpoofAppVersionDefaultString" + }.replaceInstruction( + 0, + "const-string v0, \"19.01.34\"" + ) + } + if (!is_19_23_or_greater) { return@execute } @@ -72,13 +81,6 @@ private val spoofAppVersionBytecodePatch = bytecodePatch( """, ExternalLabel("ignore", getInstruction(jumpIndex)) ) } - - findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) { - name == "SpoofAppVersionDefaultString" - }.replaceInstruction( - 0, - "const-string v0, \"18.38.45\"" - ) } } @@ -108,35 +110,43 @@ val spoofAppVersionPatch = resourcePatch( SPOOF_APP_VERSION ) - if (!is_19_17_or_greater) { + // TODO: Remove this when the legacy code for YouTube 18.xx is cleaned up. + if (!is_19_01_or_greater) { appendAppVersion("17.41.37") appendAppVersion("18.05.40") appendAppVersion("18.17.43") - if (!is_18_34_or_greater) { + + if (is_18_34_or_greater) { + appendAppVersion("18.33.40") + } else { return@execute } - appendAppVersion("18.33.40") - } - if (!is_18_39_or_greater) { + if (is_18_39_or_greater) { + appendAppVersion("18.38.45") + } else { + return@execute + } + + if (is_18_49_or_greater) { + appendAppVersion("18.48.39") + } + return@execute } - appendAppVersion("18.38.45") - if (!is_18_49_or_greater) { + appendAppVersion("19.01.34") + + if (is_19_28_or_greater) { + appendAppVersion("19.26.42") + } else { return@execute } - appendAppVersion("18.48.39") - if (!is_19_28_or_greater) { + if (is_19_34_or_greater) { + appendAppVersion("19.33.37") + } else { return@execute } - appendAppVersion("19.26.42") - - if (!is_19_34_or_greater) { - return@execute - } - appendAppVersion("19.33.37") - } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt index 12be08c50..ac753a6fe 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt @@ -15,7 +15,7 @@ import app.revanced.patches.youtube.utils.extension.Constants.PLAYER_CLASS_DESCR import app.revanced.patches.youtube.utils.patch.PatchList.DESCRIPTION_COMPONENTS import app.revanced.patches.youtube.utils.playertype.playerTypeHookPatch import app.revanced.patches.youtube.utils.playservice.is_18_49_or_greater -import app.revanced.patches.youtube.utils.playservice.is_19_02_or_greater +import app.revanced.patches.youtube.utils.playservice.is_19_05_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverHook import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch @@ -93,8 +93,7 @@ val descriptionComponentsPatch = bytecodePatch( // region patch for disable video description interaction and expand video description - // since these patches are still A/B tested, they are classified as 'Experimental flags'. - if (is_19_02_or_greater) { + if (is_19_05_or_greater) { textViewComponentFingerprint.methodOrThrow().apply { val insertIndex = indexOfTextIsSelectableInstruction(this) val insertInstruction = getInstruction(insertIndex) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/Fingerprints.kt index 0fccda3a4..dd98d2908 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/Fingerprints.kt @@ -9,7 +9,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference /** * This fingerprint is compatible with YouTube v18.35.xx~ - * Nonetheless, the patch works in YouTube v19.02.xx~ + * Nonetheless, the patch works in YouTube v19.05.xx~ */ internal val textViewComponentFingerprint = legacyFingerprint( name = "textViewComponentFingerprint", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt index 0ac2b447c..81fe49258 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt @@ -9,10 +9,6 @@ internal object Constants { val COMPATIBLE_PACKAGE: Pair?> = Pair( YOUTUBE_PACKAGE_NAME, setOf( - "18.29.38", // This is the last version where the 'Zoomed to fill' setting works. - "18.33.40", // This is the last version that do not use litho components in Shorts. - "18.38.44", // This is the last version with no delay in applying video quality on the server side. - "18.48.39", // This is the last version that do not use Rolling Number. "19.05.36", // This is the last version with the least YouTube experimental flag. "19.16.39", // This is the last version where the 'Restore old seekbar thumbnails' setting works. "19.44.39", // This is the latest version supported by the RVX patch. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playservice/VersionCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playservice/VersionCheckPatch.kt index ef0ca18fa..bdbf30c72 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playservice/VersionCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playservice/VersionCheckPatch.kt @@ -15,10 +15,14 @@ var is_18_42_or_greater = false private set var is_18_49_or_greater = false private set +var is_19_01_or_greater = false + private set var is_19_02_or_greater = false private set var is_19_04_or_greater = false private set +var is_19_05_or_greater = false + private set var is_19_09_or_greater = false private set var is_19_15_or_greater = false @@ -83,8 +87,10 @@ val versionCheckPatch = resourcePatch( is_18_39_or_greater = 234000000 <= playStoreServicesVersion is_18_42_or_greater = 234302000 <= playStoreServicesVersion is_18_49_or_greater = 235000000 <= playStoreServicesVersion - is_19_02_or_greater = 240204000 < playStoreServicesVersion + is_19_01_or_greater = 240204000 < playStoreServicesVersion + is_19_02_or_greater = 240299000 < playStoreServicesVersion is_19_04_or_greater = 240502000 <= playStoreServicesVersion + is_19_05_or_greater = 240602000 <= playStoreServicesVersion is_19_09_or_greater = 241002000 <= playStoreServicesVersion is_19_15_or_greater = 241602000 <= playStoreServicesVersion is_19_16_or_greater = 241702000 <= playStoreServicesVersion diff --git a/patches/src/main/resources/youtube/settings/host/values/strings.xml b/patches/src/main/resources/youtube/settings/host/values/strings.xml index b174045f1..7809e27e0 100644 --- a/patches/src/main/resources/youtube/settings/host/values/strings.xml +++ b/patches/src/main/resources/youtube/settings/host/values/strings.xml @@ -477,8 +477,10 @@ If later turned off, it is recommended to clear the app data to prevent UI bugs. 18.33.40 - Restore old Shorts action bar 18.38.45 - Restore old default video quality behavior 18.48.39 - Disable views and likes from being updated in real time + 19.01.34 - Disable video description interaction 19.26.42 - Disable Cairo icon in navigation and toolbar 19.33.37 - Restore old playback speed flyout panel + Invalid spoof app version: %s. Account menu @@ -1510,7 +1512,6 @@ Info: "Custom actions are enabled in flyout menu. Limitations: -• Does not work if app version is spoofed to 18.49.37 or earlier. • Does not work with live stream." Custom actions are disabled in flyout menu. Enable custom actions in toolbar