fix(YouTube Music/Spoof app version): ListPreference sometimes selects wrong values

This commit is contained in:
inotia00
2024-10-13 01:52:09 +09:00
parent 3c0c2a882a
commit b219e0d026
2 changed files with 13 additions and 0 deletions

View File

@ -1,11 +1,15 @@
package app.revanced.patches.music.general.spoofappversion package app.revanced.patches.music.general.spoofappversion
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibraryShelfPatch import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibraryShelfPatch
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.integrations.Constants.GENERAL_CLASS_DESCRIPTOR
import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsBytecodePatch
import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.appendAppVersion import app.revanced.util.appendAppVersion
import app.revanced.util.findMethodOrThrow
import app.revanced.util.patch.BaseResourcePatch import app.revanced.util.patch.BaseResourcePatch
@Suppress("unused") @Suppress("unused")
@ -24,6 +28,13 @@ object SpoofAppVersionPatch : BaseResourcePatch(
if (SettingsPatch.upward0718) { if (SettingsPatch.upward0718) {
context.appendAppVersion("7.16.53") context.appendAppVersion("7.16.53")
SettingsBytecodePatch.contexts.findMethodOrThrow(GENERAL_CLASS_DESCRIPTOR) {
name == "getSpoofAppVersionDefault"
}.replaceInstruction(
0,
"const-string v0, \"7.16.53\""
)
} }
SettingsPatch.addSwitchPreference( SettingsPatch.addSwitchPreference(

View File

@ -44,8 +44,10 @@ object SettingsBytecodePatch : BytecodePatch(
"$INTEGRATIONS_PATH/settings/preference/ReVancedPreferenceFragment;" "$INTEGRATIONS_PATH/settings/preference/ReVancedPreferenceFragment;"
private const val INTEGRATIONS_INITIALIZATION_CLASS_DESCRIPTOR = private const val INTEGRATIONS_INITIALIZATION_CLASS_DESCRIPTOR =
"$UTILS_PATH/InitializationPatch;" "$UTILS_PATH/InitializationPatch;"
lateinit var contexts: BytecodeContext
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
contexts = context
/** /**
* Set SharedPrefCategory * Set SharedPrefCategory