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,
"setActivity"
)
}
}
private const val DEFAULT_LABEL = "ReVanced Extended"
private lateinit var customName: String
private const val DEFAULT_LABEL = "RVX"
private lateinit var settingsLabel: String
val settingsPatch = resourcePatch(
SETTINGS_FOR_YOUTUBE_MUSIC.title,
@ -140,9 +139,13 @@ val settingsPatch = resourcePatch(
settingsBytecodePatch,
)
val settingsLabel = stringOption(
key = "settingsLabel",
val rvxSettingsLabel = stringOption(
key = "rvxSettingsLabel",
default = DEFAULT_LABEL,
values = mapOf(
"ReVanced Extended" to "ReVanced Extended",
"RVX" to DEFAULT_LABEL,
),
title = "RVX settings label",
description = "The name of the RVX settings menu.",
required = true,
@ -152,7 +155,7 @@ val settingsPatch = resourcePatch(
/**
* check patch options
*/
customName = settingsLabel
settingsLabel = rvxSettingsLabel
.valueOrThrow()
/**
@ -220,13 +223,13 @@ val settingsPatch = resourcePatch(
* change RVX settings menu name
* 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(
arrayOf("revanced_extended_settings_title")
)
document("res/values/strings.xml").use { document ->
mapOf(
"revanced_extended_settings_title" to customName
"revanced_extended_settings_title" to settingsLabel
).forEach { (k, v) ->
val stringElement = document.createElement("string")

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 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>
<!-- 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>
<!-- 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_reset_to_default_toast">Reset to default values.</string>