Skip to content

Commit

Permalink
feat(YouTube/Spoof app version): enabled by default in YouTube 19.16.39+
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Oct 18, 2024
1 parent 486a007 commit 620aeae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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
Expand All @@ -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\""
)
}
}
}
Expand All @@ -42,7 +69,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
"SETTINGS: SPOOF_APP_VERSION"
)
)

SettingsPatch.updatePatchStatus(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 620aeae

Please sign in to comment.