feat(YouTube/Spoof app version): enabled by default in YouTube 19.16.39+

This commit is contained in:
inotia00 2024-10-18 21:20:22 +09:00
parent 486a0074b7
commit 620aeae907
2 changed files with 28 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -379,6 +379,7 @@ This does not bypass the age restriction. It just accepts it automatically."</st
This will change the appearance and features of the app, but unknown side effects may occur.
If later turned off, it is recommended to clear the app data to prevent UI bugs."</string>
<string name="revanced_spoof_app_version_user_dialog_message_19_16">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.</string>
<string name="revanced_spoof_app_version_target_title">Edit spoof app version</string>
<string name="revanced_spoof_app_version_target_summary">Type the spoof app version target.</string>
<string name="revanced_spoof_app_version_target_entry_title">Spoof app version target</string>