mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
fix(YouTube Music/Hide history button): Hide history button
does not work on the download tab
This commit is contained in:
parent
bc48e3c447
commit
0915debd29
@ -7,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.music.general.historybutton.fingerprints.HistoryMenuItemFingerprint
|
import app.revanced.patches.music.general.historybutton.fingerprints.HistoryMenuItemFingerprint
|
||||||
|
import app.revanced.patches.music.general.historybutton.fingerprints.HistoryMenuItemOfflineTabFingerprint
|
||||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||||
import app.revanced.patches.music.utils.settings.CategoryType
|
import app.revanced.patches.music.utils.settings.CategoryType
|
||||||
@ -25,23 +26,31 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
|||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object HideHistoryButtonPatch : BytecodePatch(
|
object HideHistoryButtonPatch : BytecodePatch(
|
||||||
setOf(HistoryMenuItemFingerprint)
|
setOf(
|
||||||
|
HistoryMenuItemFingerprint,
|
||||||
|
HistoryMenuItemOfflineTabFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
HistoryMenuItemFingerprint.result?.let {
|
arrayOf(
|
||||||
it.mutableMethod.apply {
|
HistoryMenuItemFingerprint,
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
HistoryMenuItemOfflineTabFingerprint
|
||||||
val insertRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
val insertRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {v$insertRegister}, $GENERAL->hideHistoryButton(Z)Z
|
invoke-static {v$insertRegister}, $GENERAL->hideHistoryButton(Z)Z
|
||||||
move-result v$insertRegister
|
move-result v$insertRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw HistoryMenuItemFingerprint.exception
|
} ?: throw fingerprint.exception
|
||||||
|
}
|
||||||
|
|
||||||
SettingsPatch.addMusicPreference(
|
SettingsPatch.addMusicPreference(
|
||||||
CategoryType.GENERAL,
|
CategoryType.GENERAL,
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.music.general.historybutton.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.HistoryMenuItem
|
||||||
|
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.OfflineSettingsMenuItem
|
||||||
|
import app.revanced.util.containsWideLiteralInstructionIndex
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object HistoryMenuItemOfflineTabFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Landroid/view/Menu;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.containsWideLiteralInstructionIndex(HistoryMenuItem)
|
||||||
|
&& methodDef.containsWideLiteralInstructionIndex(OfflineSettingsMenuItem)
|
||||||
|
}
|
||||||
|
)
|
@ -32,6 +32,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var MusicMenuLikeButtons: Long = -1
|
var MusicMenuLikeButtons: Long = -1
|
||||||
var MusicNotifierShelf: Long = -1
|
var MusicNotifierShelf: Long = -1
|
||||||
var NamesInactiveAccountThumbnailSize: Long = -1
|
var NamesInactiveAccountThumbnailSize: Long = -1
|
||||||
|
var OfflineSettingsMenuItem: Long = -1
|
||||||
var PlayerCastMediaRouteButton: Long = -1
|
var PlayerCastMediaRouteButton: Long = -1
|
||||||
var PlayerOverlayChip: Long = -1
|
var PlayerOverlayChip: Long = -1
|
||||||
var PrivacyTosFooter: Long = -1
|
var PrivacyTosFooter: Long = -1
|
||||||
@ -65,6 +66,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons")
|
MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons")
|
||||||
MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf")
|
MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf")
|
||||||
NamesInactiveAccountThumbnailSize = find(DIMEN, "names_inactive_account_thumbnail_size")
|
NamesInactiveAccountThumbnailSize = find(DIMEN, "names_inactive_account_thumbnail_size")
|
||||||
|
OfflineSettingsMenuItem = find(ID, "offline_settings_menu_item")
|
||||||
PlayerCastMediaRouteButton = find(LAYOUT, "player_cast_media_route_button")
|
PlayerCastMediaRouteButton = find(LAYOUT, "player_cast_media_route_button")
|
||||||
PlayerOverlayChip = find(ID, "player_overlay_chip")
|
PlayerOverlayChip = find(ID, "player_overlay_chip")
|
||||||
PrivacyTosFooter = find(ID, "privacy_tos_footer")
|
PrivacyTosFooter = find(ID, "privacy_tos_footer")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user