feat(YouTube Music): add Hide tap to update button patch

This commit is contained in:
inotia00 2024-03-23 19:13:14 +09:00
parent 0f7ddf8afe
commit 600367bb1c
3 changed files with 75 additions and 0 deletions

View File

@ -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"
)
}
}

View File

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

View File

@ -182,6 +182,8 @@ Some features may not work properly in the old player layout."</string>
<string name="revanced_hide_samples_button_title">Hide samples button</string>
<string name="revanced_hide_samples_shelf_summary">Hides the samples shelf from the homepage.</string>
<string name="revanced_hide_samples_shelf_title">Hide samples shelf</string>
<string name="revanced_hide_tap_to_update_button_summary">Hides the \"Tap to update\" button.</string>
<string name="revanced_hide_tap_to_update_button_title">Hide \"Tap to update\" button</string>
<string name="revanced_hide_terms_container_summary">Hides terms of service container.</string>
<string name="revanced_hide_terms_container_title">Hide terms container</string>
<string name="revanced_hide_upgrade_button_summary">Hides the upgrade button.</string>