diff --git a/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/HideTapToUpdateButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/HideTapToUpdateButtonPatch.kt new file mode 100644 index 000000000..05828d7d9 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/HideTapToUpdateButtonPatch.kt @@ -0,0 +1,65 @@ +package app.revanced.patches.music.general.taptoupdate + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels +import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.music.general.taptoupdate.fingerprints.ContentPillInFingerprint +import app.revanced.patches.music.utils.integrations.Constants.GENERAL +import app.revanced.patches.music.utils.settings.CategoryType +import app.revanced.patches.music.utils.settings.SettingsPatch +import app.revanced.util.exception + +@Patch( + name = "Hide tap to update button", + description = "Adds an option to hide the tap to update button.", + dependencies = [SettingsPatch::class], + compatiblePackages = [ + CompatiblePackage( + "com.google.android.apps.youtube.music", + [ + "6.21.52", + "6.22.52", + "6.23.56", + "6.25.53", + "6.26.51", + "6.27.54", + "6.28.53", + "6.29.58", + "6.31.55", + "6.33.52" + ] + ) + ] +) +@Suppress("unused") +object HideTapToUpdateButtonPatch : BytecodePatch( + setOf(ContentPillInFingerprint) +) { + override fun execute(context: BytecodeContext) { + + ContentPillInFingerprint.result?.let { + it.mutableMethod.apply { + addInstructionsWithLabels( + 0, + """ + invoke-static {}, $GENERAL->hideTapToUpdateButton()Z + move-result v0 + if-eqz v0, :show + return-void + """, ExternalLabel("show", getInstruction(0)) + ) + } + } ?: throw ContentPillInFingerprint.exception + + SettingsPatch.addMusicPreference( + CategoryType.GENERAL, + "revanced_hide_tap_to_update_button", + "false" + ) + + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/fingerprints/ContentPillInFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/fingerprints/ContentPillInFingerprint.kt new file mode 100644 index 000000000..aa6efcd66 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/general/taptoupdate/fingerprints/ContentPillInFingerprint.kt @@ -0,0 +1,8 @@ +package app.revanced.patches.music.general.taptoupdate.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +object ContentPillInFingerprint : MethodFingerprint( + returnType = "V", + strings = listOf("Content pill VE is null") +) \ No newline at end of file diff --git a/src/main/resources/music/settings/host/values/strings.xml b/src/main/resources/music/settings/host/values/strings.xml index 066f40342..bafcfc57c 100644 --- a/src/main/resources/music/settings/host/values/strings.xml +++ b/src/main/resources/music/settings/host/values/strings.xml @@ -182,6 +182,8 @@ Some features may not work properly in the old player layout." Hide samples button Hides the samples shelf from the homepage. Hide samples shelf + Hides the \"Tap to update\" button. + Hide \"Tap to update\" button Hides terms of service container. Hide terms container Hides the upgrade button.