feat(music) add hook-download-button patch

This commit is contained in:
inotia00 2023-09-05 11:16:57 +09:00
parent 3c306ebcca
commit a25d4be63e
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,43 @@
package app.revanced.patches.music.buttoncontainer.downloadbuttonhook.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.buttoncontainerhook.patch.ButtonContainerHookPatch
import app.revanced.patches.music.utils.intenthook.patch.IntentHookPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.videoid.patch.VideoIdPatch
import app.revanced.util.enum.CategoryType
@Patch
@Name("Hook download button")
@Description("Replaces the offline download button in the button container with an external download button.")
@DependsOn(
[
ButtonContainerHookPatch::class,
IntentHookPatch::class,
SettingsPatch::class,
VideoIdPatch::class
]
)
@MusicCompatibility
class DownloadButtonHookPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.BUTTON_CONTAINER,
"revanced_hook_button_container_download",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.BUTTON_CONTAINER,
"revanced_external_downloader_package_name",
"revanced_hook_button_container_download"
)
}
}

View File

@ -71,6 +71,8 @@
<string name="revanced_hide_playlist_card_title">Hide playlist card</string>
<string name="revanced_hide_sample_button_summary">Hides the sample button in navigation bar.</string>
<string name="revanced_hide_sample_button_title">Hide sample button</string>
<string name="revanced_hook_button_container_download_summary">Replaces the offline download button in the button container with an external download button.</string>
<string name="revanced_hook_button_container_download_title">Hook download button</string>
<string name="revanced_reboot_message">Refresh and restart</string>
<string name="revanced_reset">Reset</string>
<string name="revanced_save_video_quality_mobile">Changing default mobile data quality to:</string>