mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(YouTube Music - Hide action bar components): Add support for setting Override Download action button
on YouTube Music 7.25.53+ https://github.com/inotia00/ReVanced_Extended/issues/2733
This commit is contained in:
@ -23,6 +23,8 @@ import app.revanced.patches.music.utils.settings.settingsPatch
|
||||
import app.revanced.patches.music.video.information.videoInformationPatch
|
||||
import app.revanced.patches.shared.litho.addLithoFilter
|
||||
import app.revanced.patches.shared.litho.lithoFilterPatch
|
||||
import app.revanced.patches.shared.textcomponent.hookSpannableString
|
||||
import app.revanced.patches.shared.textcomponent.textComponentPatch
|
||||
import app.revanced.util.fingerprint.matchOrThrow
|
||||
import app.revanced.util.fingerprint.methodOrThrow
|
||||
import app.revanced.util.getReference
|
||||
@ -50,6 +52,7 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
settingsPatch,
|
||||
lithoFilterPatch,
|
||||
sharedResourceIdPatch,
|
||||
textComponentPatch,
|
||||
videoInformationPatch,
|
||||
versionCheckPatch,
|
||||
)
|
||||
@ -57,6 +60,23 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
execute {
|
||||
if (is_7_17_or_greater) {
|
||||
addLithoFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
hookSpannableString(ACTIONBAR_CLASS_DESCRIPTOR, "onLithoTextLoaded")
|
||||
|
||||
commandResolverFingerprint.methodOrThrow().addInstruction(
|
||||
0,
|
||||
"invoke-static {p2}, $ACTIONBAR_CLASS_DESCRIPTOR->inAppDownloadButtonOnClick(Ljava/util/Map;)Z"
|
||||
)
|
||||
|
||||
offlineVideoEndpointFingerprint.methodOrThrow().addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {p2}, $ACTIONBAR_CLASS_DESCRIPTOR->inAppDownloadButtonOnClick(Ljava/util/Map;)Z
|
||||
move-result v0
|
||||
if-eqz v0, :ignore
|
||||
return-void
|
||||
:ignore
|
||||
nop
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
if (!is_7_25_or_greater) {
|
||||
@ -181,12 +201,12 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_button_share",
|
||||
"revanced_hide_action_button_radio",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_button_radio",
|
||||
"revanced_hide_action_button_share",
|
||||
"false"
|
||||
)
|
||||
if (!is_7_25_or_greater) {
|
||||
@ -195,17 +215,17 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
"revanced_hide_action_button_label",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_external_downloader_action",
|
||||
"false"
|
||||
)
|
||||
addPreferenceWithIntent(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_external_downloader_package_name",
|
||||
"revanced_external_downloader_action"
|
||||
)
|
||||
}
|
||||
addSwitchPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_external_downloader_action",
|
||||
"false"
|
||||
)
|
||||
addPreferenceWithIntent(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_external_downloader_package_name",
|
||||
"revanced_external_downloader_action"
|
||||
)
|
||||
|
||||
updatePatchStatus(HIDE_ACTION_BAR_COMPONENTS)
|
||||
|
||||
|
@ -28,3 +28,19 @@ internal val likeDislikeContainerFingerprint = legacyFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
literals = listOf(likeDislikeContainer)
|
||||
)
|
||||
|
||||
internal val commandResolverFingerprint = legacyFingerprint(
|
||||
name = "commandResolverFingerprint",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
|
||||
returnType = "Z",
|
||||
parameters = listOf("L", "L", "Ljava/util/Map;"),
|
||||
strings = listOf("CommandResolver threw exception during resolution")
|
||||
)
|
||||
|
||||
internal val offlineVideoEndpointFingerprint = legacyFingerprint(
|
||||
name = "offlineVideoEndpointFingerprint",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "V",
|
||||
parameters = listOf("L", "Ljava/util/Map;"),
|
||||
strings = listOf("Object is not an offlineable video: %s")
|
||||
)
|
||||
|
Reference in New Issue
Block a user