diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/DownloadsCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/ExternalDownloadsCompatibility.kt similarity index 83% rename from src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/DownloadsCompatibility.kt rename to src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/ExternalDownloadsCompatibility.kt index 5e8525309..7dc840c61 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/DownloadsCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/annotation/ExternalDownloadsCompatibility.kt @@ -5,5 +5,5 @@ import app.revanced.patcher.annotation.Package @Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))]) @Target(AnnotationTarget.CLASS) -internal annotation class DownloadsCompatibility +internal annotation class ExternalDownloadsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/ExternalDownloadsBytecodePatch.kt similarity index 76% rename from src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/ExternalDownloadsBytecodePatch.kt index d296b396f..5d5f69651 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/ExternalDownloadsBytecodePatch.kt @@ -9,20 +9,20 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility -import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch +import app.revanced.patches.youtube.interaction.downloads.annotation.ExternalDownloadsCompatibility +import app.revanced.patches.youtube.interaction.downloads.resource.patch.ExternalDownloadsResourcePatch import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch @Patch -@Name("downloads") -@DependsOn([DownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class]) -@Description("Adds a download button to the YouTube video player.") -@DownloadsCompatibility +@Name("external-downloads") +@DependsOn([ExternalDownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class]) +@Description("Adds support to download and save YouTube videos using an external app.") +@ExternalDownloadsCompatibility @Version("0.0.1") -class DownloadsBytecodePatch : BytecodePatch() { +class ExternalDownloadsBytecodePatch : BytecodePatch() { private companion object { - const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/DownloadButton;" + const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/ExternalDownloadButton;" } override fun execute(context: BytecodeContext): PatchResult { diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/ExternalDownloadsResourcePatch.kt similarity index 80% rename from src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/ExternalDownloadsResourcePatch.kt index 4ab4a883c..1a0cad41a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/ExternalDownloadsResourcePatch.kt @@ -14,50 +14,42 @@ import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources import app.revanced.util.resources.ResourceUtils.mergeStrings -@Name("downloads-resource-patch") +@Name("external-downloads-resource-patch") @DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class]) @Version("0.0.1") -class DownloadsResourcePatch : ResourcePatch { +class ExternalDownloadsResourcePatch : ResourcePatch { + override fun execute(context: ResourceContext): PatchResult { SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( PreferenceScreen( "revanced_external_downloader_preference_screen", - StringResource("revanced_external_downloader_preference_screen_title", "Download settings"), + StringResource("revanced_external_downloader_preference_screen_title", "External download settings"), listOf( SwitchPreference( "revanced_external_downloader", - StringResource("revanced_external_downloader_title", "Show download button"), - StringResource("revanced_external_downloader_summary_on", "Download button is shown"), - StringResource("revanced_external_downloader_summary_off", "Download button is not shown") + StringResource("revanced_external_downloader_title", "Show external download button"), + StringResource("revanced_external_downloader_summary_on", "Download button shown in player"), + StringResource("revanced_external_downloader_summary_off", "Download button not shown in player") ), TextPreference( "revanced_external_downloader_name", StringResource("revanced_external_downloader_name_title", "Downloader package name"), - StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"), + StringResource("revanced_external_downloader_name_summary", "Package name of your installed external downloader app, such as NewPipe or PowerTube"), InputType.TEXT ) ), - StringResource("revanced_external_downloader_preference_screen_summary", "Settings related to downloads") + StringResource("revanced_external_downloader_preference_screen_summary", "Settings for using an external downloader") ) ) - /* - * Copy strings - */ - + // Copy strings context.mergeStrings("downloads/host/values/strings.xml") - /* - * Copy resources - */ - + // Copy resources context.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml")) - /* - * Add download button node - */ - + // Add download button node BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}") return PatchResultSuccess() diff --git a/src/main/resources/downloads/host/layout/youtube_controls_bottom_ui_container.xml b/src/main/resources/downloads/host/layout/youtube_controls_bottom_ui_container.xml index 23254785a..419845aa9 100644 --- a/src/main/resources/downloads/host/layout/youtube_controls_bottom_ui_container.xml +++ b/src/main/resources/downloads/host/layout/youtube_controls_bottom_ui_container.xml @@ -1,4 +1,4 @@ - + diff --git a/src/main/resources/downloads/host/values/strings.xml b/src/main/resources/downloads/host/values/strings.xml index 957d490fe..dcdfd2753 100644 --- a/src/main/resources/downloads/host/values/strings.xml +++ b/src/main/resources/downloads/host/values/strings.xml @@ -1,4 +1,4 @@ - is not installed. Please install it. + is not installed. Please install it.