From 965d05cfa55d7a51f64a11f0219e2867568ba852 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 22 Aug 2022 19:14:17 +0200 Subject: [PATCH] feat: setting for downloader package name --- .../resource/patch/DownloadsResourcePatch.kt | 34 ++++++++++++++----- .../downloads/host/values/strings.xml | 3 +- 2 files changed, 26 insertions(+), 11 deletions(-) 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/DownloadsResourcePatch.kt index 719efbb5b..072ffa158 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/DownloadsResourcePatch.kt @@ -12,8 +12,7 @@ import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCo import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.youtube.misc.settings.framework.components.impl.* import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings import app.revanced.util.resources.ResourceUtils.copyResources @@ -25,13 +24,30 @@ import app.revanced.util.resources.ResourceUtils.copyResources @Version("0.0.1") class DownloadsResourcePatch : ResourcePatch() { override fun execute(data: ResourceData): PatchResult { - SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference( - "revanced_downloads", - StringResource("revanced_downloads_enabled_title", "Show download button"), - true, - StringResource("revanced_downloads_enabled_summary_on", "Download button is visible"), - StringResource("revanced_downloads_enabled_summary_off", "Download button is hidden") - )) + SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( + PreferenceScreen( + "revanced_downloads", + StringResource("revanced_downloads_title", "Download settings"), + listOf( + SwitchPreference( + "revanced_downloads", + StringResource("revanced_downloads_enabled_title", "Show download button"), + true, + StringResource("revanced_downloads_enabled_summary_on", "Download button is visible"), + StringResource("revanced_downloads_enabled_summary_off", "Download button is hidden") + ), + TextPreference( + "revanced_downloads_package_name", + StringResource("revanced_downloads_package_name_title", "Downloader package name"), + InputType.STRING, + "org.schabi.newpipe" /* NewPipe */, + StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s") + ) + ), + StringResource("revanced_downloads_summary", "Settings related to downloads") + ) + ) + /* * Copy strings diff --git a/src/main/resources/downloads/host/values/strings.xml b/src/main/resources/downloads/host/values/strings.xml index afcde12a2..c6ed7b1c5 100644 --- a/src/main/resources/downloads/host/values/strings.xml +++ b/src/main/resources/downloads/host/values/strings.xml @@ -1,5 +1,4 @@ - PowerTube is not installed - Please install PowerTube from https://github.com/razar-dev/PowerTube. + is not installed