feat: setting for downloader package name

This commit is contained in:
oSumAtrIX 2022-08-22 19:14:17 +02:00
parent 834c4add71
commit 965d05cfa5
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 26 additions and 11 deletions

View File

@ -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

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="powertube_not_installed_warning">PowerTube is not installed</string>
<string name="powertube_not_installed_notice">Please install PowerTube from https://github.com/razar-dev/PowerTube.</string>
<string name="downloader_not_installed_warning">is not installed</string>
</resources>