chore(Settings): Change the default value of the patch option RVX settings label to RVX

This commit is contained in:
inotia00 2025-01-31 20:38:40 +09:00
parent 6283f2a922
commit e72ff471ae
5 changed files with 31 additions and 20 deletions

View File

@ -123,12 +123,11 @@ private val settingsBytecodePatch = bytecodePatch(
EXTENSION_UTILS_CLASS_DESCRIPTOR, EXTENSION_UTILS_CLASS_DESCRIPTOR,
"setActivity" "setActivity"
) )
} }
} }
private const val DEFAULT_LABEL = "ReVanced Extended" private const val DEFAULT_LABEL = "RVX"
private lateinit var customName: String private lateinit var settingsLabel: String
val settingsPatch = resourcePatch( val settingsPatch = resourcePatch(
SETTINGS_FOR_YOUTUBE_MUSIC.title, SETTINGS_FOR_YOUTUBE_MUSIC.title,
@ -140,9 +139,13 @@ val settingsPatch = resourcePatch(
settingsBytecodePatch, settingsBytecodePatch,
) )
val settingsLabel = stringOption( val rvxSettingsLabel = stringOption(
key = "settingsLabel", key = "rvxSettingsLabel",
default = DEFAULT_LABEL, default = DEFAULT_LABEL,
values = mapOf(
"ReVanced Extended" to "ReVanced Extended",
"RVX" to DEFAULT_LABEL,
),
title = "RVX settings label", title = "RVX settings label",
description = "The name of the RVX settings menu.", description = "The name of the RVX settings menu.",
required = true, required = true,
@ -152,7 +155,7 @@ val settingsPatch = resourcePatch(
/** /**
* check patch options * check patch options
*/ */
customName = settingsLabel settingsLabel = rvxSettingsLabel
.valueOrThrow() .valueOrThrow()
/** /**
@ -220,13 +223,13 @@ val settingsPatch = resourcePatch(
* change RVX settings menu name * change RVX settings menu name
* since it must be invoked after the Translations patch, it must be the last in the order. * since it must be invoked after the Translations patch, it must be the last in the order.
*/ */
if (customName != DEFAULT_LABEL) { if (settingsLabel != DEFAULT_LABEL) {
removeStringsElements( removeStringsElements(
arrayOf("revanced_extended_settings_title") arrayOf("revanced_extended_settings_title")
) )
document("res/values/strings.xml").use { document -> document("res/values/strings.xml").use { document ->
mapOf( mapOf(
"revanced_extended_settings_title" to customName "revanced_extended_settings_title" to settingsLabel
).forEach { (k, v) -> ).forEach { (k, v) ->
val stringElement = document.createElement("string") val stringElement = document.createElement("string")

View File

@ -137,7 +137,7 @@ internal fun updatePatchStatus(
updatePatchStatus(patch) updatePatchStatus(patch)
} }
private const val DEFAULT_LABEL = "ReVanced Extended" private const val DEFAULT_LABEL = "RVX"
val settingsPatch = resourcePatch( val settingsPatch = resourcePatch(
SETTINGS_FOR_REDDIT.title, SETTINGS_FOR_REDDIT.title,
@ -150,9 +150,13 @@ val settingsPatch = resourcePatch(
settingsBytecodePatch settingsBytecodePatch
) )
val settingsLabelOption = stringOption( val rvxSettingsLabel = stringOption(
key = "settingsLabel", key = "settingsLabel",
default = DEFAULT_LABEL, default = DEFAULT_LABEL,
values = mapOf(
"ReVanced Extended" to "ReVanced Extended",
"RVX" to DEFAULT_LABEL,
),
title = "RVX settings menu name", title = "RVX settings menu name",
description = "The name of the RVX settings menu.", description = "The name of the RVX settings menu.",
required = true required = true
@ -162,7 +166,7 @@ val settingsPatch = resourcePatch(
/** /**
* Replace settings icon and label * Replace settings icon and label
*/ */
val settingsLabel = settingsLabelOption val settingsLabel = rvxSettingsLabel
.valueOrThrow() .valueOrThrow()
arrayOf( arrayOf(

View File

@ -79,7 +79,7 @@ private val settingsBytecodePatch = bytecodePatch(
} }
private const val DEFAULT_ELEMENT = "@string/about_key" private const val DEFAULT_ELEMENT = "@string/about_key"
private const val DEFAULT_LABEL = "ReVanced Extended" private const val DEFAULT_LABEL = "RVX"
private val SETTINGS_ELEMENTS_MAP = mapOf( private val SETTINGS_ELEMENTS_MAP = mapOf(
"Parent settings" to "@string/parent_tools_key", "Parent settings" to "@string/parent_tools_key",
@ -106,7 +106,7 @@ private val SETTINGS_ELEMENTS_MAP = mapOf(
"About" to DEFAULT_ELEMENT "About" to DEFAULT_ELEMENT
) )
private lateinit var customName: String private lateinit var settingsLabel: String
val settingsPatch = resourcePatch( val settingsPatch = resourcePatch(
SETTINGS_FOR_YOUTUBE.title, SETTINGS_FOR_YOUTUBE.title,
@ -131,9 +131,13 @@ val settingsPatch = resourcePatch(
required = true, required = true,
) )
val settingsLabel = stringOption( val rvxSettingsLabel = stringOption(
key = "settingsLabel", key = "rvxSettingsLabel",
default = DEFAULT_LABEL, default = DEFAULT_LABEL,
values = mapOf(
"ReVanced Extended" to "ReVanced Extended",
"RVX" to DEFAULT_LABEL,
),
title = "RVX settings label", title = "RVX settings label",
description = "The name of the RVX settings menu.", description = "The name of the RVX settings menu.",
required = true, required = true,
@ -143,7 +147,7 @@ val settingsPatch = resourcePatch(
/** /**
* check patch options * check patch options
*/ */
customName = settingsLabel settingsLabel = rvxSettingsLabel
.valueOrThrow() .valueOrThrow()
val insertKey = insertPosition val insertKey = insertPosition
@ -258,13 +262,13 @@ val settingsPatch = resourcePatch(
* change RVX settings menu name * change RVX settings menu name
* since it must be invoked after the Translations patch, it must be the last in the order. * since it must be invoked after the Translations patch, it must be the last in the order.
*/ */
if (customName != DEFAULT_LABEL) { if (settingsLabel != DEFAULT_LABEL) {
removeStringsElements( removeStringsElements(
arrayOf("revanced_extended_settings_title") arrayOf("revanced_extended_settings_title")
) )
document("res/values/strings.xml").use { document -> document("res/values/strings.xml").use { document ->
mapOf( mapOf(
"revanced_extended_settings_title" to customName "revanced_extended_settings_title" to settingsLabel
).forEach { (k, v) -> ).forEach { (k, v) ->
val stringElement = document.createElement("string") val stringElement = document.createElement("string")

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Shared --> <!-- Shared -->
<string name="revanced_extended_settings_title">ReVanced Extended</string> <string name="revanced_extended_settings_title">RVX</string>
<string name="revanced_extended_reset_to_default_toast">Reset to default values.</string> <string name="revanced_extended_reset_to_default_toast">Reset to default values.</string>
<!-- Shared Category --> <!-- Shared Category -->

View File

@ -5,7 +5,7 @@
<string name="accessibility_settings_edu_opt_out_text">Your controls are modified because an accessibility service is on.</string> <string name="accessibility_settings_edu_opt_out_text">Your controls are modified because an accessibility service is on.</string>
<!-- Shared --> <!-- Shared -->
<string name="revanced_extended_settings_title">ReVanced Extended</string> <string name="revanced_extended_settings_title">RVX</string>
<string name="revanced_extended_settings_search_title">Search %s</string> <string name="revanced_extended_settings_search_title">Search %s</string>
<string name="revanced_extended_reset_to_default_toast">Reset to default values.</string> <string name="revanced_extended_reset_to_default_toast">Reset to default values.</string>