Skip to content

Commit

Permalink
fix(YouTube Music - Spoof app version): ListPreference sometimes sele…
Browse files Browse the repository at this point in the history
…cts wrong values
  • Loading branch information
anddea committed Oct 15, 2024
1 parent 819189e commit ca3dba2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package app.revanced.patches.music.general.spoofappversion

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.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.SettingsBytecodePatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.appendAppVersion
import app.revanced.util.findMethodOrThrow
import app.revanced.util.patch.BaseResourcePatch

@Suppress("unused")
Expand All @@ -24,6 +28,13 @@ object SpoofAppVersionPatch : BaseResourcePatch(

if (SettingsPatch.upward0718) {
context.appendAppVersion("7.16.53")

SettingsBytecodePatch.contexts.findMethodOrThrow(GENERAL_CLASS_DESCRIPTOR) {
name == "getSpoofAppVersionDefault"
}.replaceInstruction(
0,
"const-string v0, \"7.16.53\""
)
}

SettingsPatch.addSwitchPreference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ object SettingsBytecodePatch : BytecodePatch(
"$INTEGRATIONS_PATH/settings/preference/ReVancedPreferenceFragment;"
private const val INTEGRATIONS_INITIALIZATION_CLASS_DESCRIPTOR =
"$UTILS_PATH/InitializationPatch;"
lateinit var contexts: BytecodeContext

override fun execute(context: BytecodeContext) {
contexts = context

/**
* Set SharedPrefCategory
Expand Down

0 comments on commit ca3dba2

Please sign in to comment.