Skip to content

Commit

Permalink
feat(YouTube Music/Spoof app version): app crashes when first installed
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Oct 18, 2024
1 parent f29fbae commit 4387c55
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.integrations.Constants.PATCH_STATUS_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
Expand All @@ -26,21 +26,30 @@ object SpoofAppVersionPatch : BaseResourcePatch(
) {
override fun execute(context: ResourceContext) {

var defaultValue = "false"

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

SettingsBytecodePatch.contexts.findMethodOrThrow(GENERAL_CLASS_DESCRIPTOR) {
name == "getSpoofAppVersionDefault"
SettingsBytecodePatch.contexts.findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) {
name == "SpoofAppVersionDefaultString"
}.replaceInstruction(
0,
"const-string v0, \"7.16.53\""
)
SettingsBytecodePatch.contexts.findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) {
name == "SpoofAppVersionDefaultBoolean"
}.replaceInstruction(
0,
"const/4 v0, 0x1"
)
defaultValue = "true"
}

SettingsPatch.addSwitchPreference(
CategoryType.GENERAL,
"revanced_spoof_app_version",
"false"
defaultValue
)
SettingsPatch.addPreferenceWithIntent(
CategoryType.GENERAL,
Expand Down

0 comments on commit 4387c55

Please sign in to comment.