fix(YouTube - Spoof app version): Remove broken spoof targets when patching 19.25+ (#3915)

This commit is contained in:
LisoUseInAIKyrios
2024-11-15 07:44:28 +04:00
committed by GitHub
parent 31af587943
commit 9e18ecab18
5 changed files with 39 additions and 21 deletions

View File

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

View File

@ -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,