From 620aeae9071ae57fe4b97147559a36c1c8696be9 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:20:22 +0900 Subject: [PATCH] feat(YouTube/Spoof app version): enabled by default in YouTube 19.16.39+ --- .../spoofappversion/SpoofAppVersionPatch.kt | 28 ++++++++++++++++++- .../youtube/settings/host/values/strings.xml | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt index 662a2f932d..532671dc24 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt @@ -1,9 +1,14 @@ package app.revanced.patches.youtube.general.spoofappversion import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE +import app.revanced.patches.youtube.utils.integrations.Constants.GENERAL_CLASS_DESCRIPTOR +import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR +import app.revanced.patches.youtube.utils.settings.SettingsBytecodePatch import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.util.appendAppVersion +import app.revanced.util.findMethodOrThrow import app.revanced.util.patch.BaseResourcePatch @Suppress("unused") @@ -13,6 +18,7 @@ object SpoofAppVersionPatch : BaseResourcePatch( "This can be used to restore old UI elements and features.", dependencies = setOf( SettingsPatch::class, + SettingsBytecodePatch::class, SpoofAppVersionBytecodePatch::class ), compatiblePackages = COMPATIBLE_PACKAGE @@ -27,6 +33,27 @@ object SpoofAppVersionPatch : BaseResourcePatch( context.appendAppVersion("18.48.39") if (SettingsPatch.upward1915) { context.appendAppVersion("19.13.37") + + SettingsBytecodePatch.contexts.findMethodOrThrow( + PATCH_STATUS_CLASS_DESCRIPTOR + ) { + name == "SpoofAppVersionDefaultString" + }.replaceInstruction( + 0, + "const-string v0, \"19.13.37\"" + ) + SettingsBytecodePatch.contexts.findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) { + name == "SpoofAppVersionDefaultBoolean" + }.replaceInstruction( + 0, + "const/4 v0, 0x1" + ) + SettingsBytecodePatch.contexts.findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) { + name == "SpoofAppVersionUserDialogMessage" + }.replaceInstruction( + 0, + "const-string v0, \"revanced_spoof_app_version_user_dialog_message_19_16\"" + ) } } } @@ -42,7 +69,6 @@ object SpoofAppVersionPatch : BaseResourcePatch( "SETTINGS: SPOOF_APP_VERSION" ) ) - SettingsPatch.updatePatchStatus(this) } } \ No newline at end of file diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index a556bccf4f..19dacf00a8 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -379,6 +379,7 @@ This does not bypass the age restriction. It just accepts it automatically." + Disabling this setting may result in a YouTube server-side bug that causes rolling number text such as likes, views, and upload dates to be hidden. Edit spoof app version Type the spoof app version target. Spoof app version target