mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 09:04:34 +02:00
feat(music): add hide-flyout-panel
patch
This commit is contained in:
parent
679e11e5d1
commit
bc8338a85a
@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patches.music.flyoutpanel.hide.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object MenuItemFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = emptyList(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ
|
||||||
|
),
|
||||||
|
strings = listOf("toggleMenuItemMutations")
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,133 @@
|
|||||||
|
package app.revanced.patches.music.flyoutpanel.hide.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
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.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.music.flyoutpanel.hide.fingerprints.MenuItemFingerprint
|
||||||
|
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||||
|
import app.revanced.patches.music.utils.flyoutbuttonhook.patch.FlyoutButtonHookPatch
|
||||||
|
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.enum.CategoryType
|
||||||
|
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("Hide flyout panel")
|
||||||
|
@Description("Hides flyout panel components.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
FlyoutButtonHookPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@MusicCompatibility
|
||||||
|
class FlyoutPanelPatch : BytecodePatch(
|
||||||
|
listOf(MenuItemFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
MenuItemFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val freeIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||||
|
instruction.opcode == Opcode.OR_INT_LIT16
|
||||||
|
}
|
||||||
|
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
|
||||||
|
|
||||||
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 3
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
|
val jumpInstruction =
|
||||||
|
getInstruction<Instruction>(implementation!!.instructions.size - 1)
|
||||||
|
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
targetIndex, """
|
||||||
|
invoke-static {v$targetRegister}, $MUSIC_FLYOUT->hideFlyoutPanels(Ljava/lang/Enum;)Z
|
||||||
|
move-result v$freeRegister
|
||||||
|
if-nez v$freeRegister, :hide
|
||||||
|
""", ExternalLabel("hide", jumpInstruction)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw MenuItemFingerprint.exception
|
||||||
|
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_add_to_queue",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_dismiss_queue",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_download",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_go_to_album",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_go_to_artist",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_like_dislike",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_play_next",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_remove_from_library",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_report",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_save_to_library",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_save_to_playlist",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_share",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_start_radio",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
SettingsPatch.addMusicPreferenceWithoutSummary(
|
||||||
|
CategoryType.FLYOUT,
|
||||||
|
"revanced_hide_flyout_panel_view_song_credit",
|
||||||
|
"false"
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -65,6 +65,20 @@
|
|||||||
<string name="revanced_hide_channel_guidelines_title">Hide channel guidelines</string>
|
<string name="revanced_hide_channel_guidelines_title">Hide channel guidelines</string>
|
||||||
<string name="revanced_hide_emoji_picker_summary">Hides emoji picker at the comments box.</string>
|
<string name="revanced_hide_emoji_picker_summary">Hides emoji picker at the comments box.</string>
|
||||||
<string name="revanced_hide_emoji_picker_title">Hide emoji picker</string>
|
<string name="revanced_hide_emoji_picker_title">Hide emoji picker</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_add_to_queue_title">Hide add to queue menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_dismiss_queue_title">Hide dismiss queue menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_download_title">Hide download menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_go_to_album_title">Hide go to album menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_go_to_artist_title">Hide go to artist menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_like_dislike_title">Hide like and dislike button</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_play_next_title">Hide play next menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_remove_from_library_title">Hide remove from library menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_report_title">Hide report menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_save_to_library_title">Hide save to library menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_save_to_playlist_title">Hide save to playlist menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_share_title">Hide share menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_start_radio_title">Hide start radio menu</string>
|
||||||
|
<string name="revanced_hide_flyout_panel_view_song_credit_title">Hide view song credit menu</string>
|
||||||
<string name="revanced_hide_music_ads_summary">Hides ads before playing a music.</string>
|
<string name="revanced_hide_music_ads_summary">Hides ads before playing a music.</string>
|
||||||
<string name="revanced_hide_music_ads_title">Hide music ads</string>
|
<string name="revanced_hide_music_ads_title">Hide music ads</string>
|
||||||
<string name="revanced_hide_navigation_label_summary">Hide labels in navigation bar.</string>
|
<string name="revanced_hide_navigation_label_summary">Hide labels in navigation bar.</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user