fix(Patch options): change all patch options to used by default

This commit is contained in:
inotia00 2023-10-28 11:48:56 +09:00
parent 010b39a05a
commit 253bd970d8
8 changed files with 64 additions and 56 deletions

View File

@ -25,6 +25,33 @@ import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatc
)
@Suppress("unused")
object CustomBrandingNamePatch : ResourcePatch() {
private const val APP_NAME_NOTIFICATION = "ReVanced Extended Music"
private const val APP_NAME_LAUNCHER = "RVX Music"
private val AppNameNotification by stringPatchOption(
key = "AppNameNotification",
default = APP_NAME_NOTIFICATION,
values = mapOf(
"Full name" to APP_NAME_NOTIFICATION,
"Short name" to APP_NAME_LAUNCHER
),
title = "App name in notification panel",
description = "The name of the app as it appears in the notification panel.",
required = true
)
private val AppNameLauncher by stringPatchOption(
key = "AppNameLauncher",
default = APP_NAME_LAUNCHER,
values = mapOf(
"Full name" to APP_NAME_NOTIFICATION,
"Short name" to APP_NAME_LAUNCHER
),
title = "App name in launcher",
description = "The name of the app as it appears in the launcher.",
required = true
)
override fun execute(context: ResourceContext) {
AppNameNotification?.let { notificationName ->
@ -48,29 +75,4 @@ object CustomBrandingNamePatch : ResourcePatch() {
} ?: throw PatchException("Invalid app name.")
} ?: throw PatchException("Invalid app name.")
}
private const val APP_NAME_NOTIFICATION = "ReVanced Extended Music"
private const val APP_NAME_LAUNCHER = "RVX Music"
internal var AppNameNotification by stringPatchOption(
key = "AppNameNotification",
default = APP_NAME_NOTIFICATION,
values = mapOf(
"Full name" to APP_NAME_NOTIFICATION,
"Short name" to APP_NAME_LAUNCHER
),
title = "App name in notification panel",
description = "The name of the app as it appears in the notification panel."
)
internal var AppNameLauncher by stringPatchOption(
key = "AppNameLauncher",
default = APP_NAME_LAUNCHER,
values = mapOf(
"Full name" to APP_NAME_NOTIFICATION,
"Short name" to APP_NAME_LAUNCHER
),
title = "App name in launcher",
description = "The name of the app as it appears in the launcher."
)
}

View File

@ -22,7 +22,7 @@ object PackageNamePatch : ResourcePatch() {
private const val CLONE_PACKAGE_NAME_YOUTUBE_MUSIC = "com.rvx.android.youtube"
private const val DEFAULT_PACKAGE_NAME_YOUTUBE_MUSIC = "app.rvx.android.apps.youtube.music"
internal var PackageNameYouTube by stringPatchOption(
internal val PackageNameYouTube by stringPatchOption(
key = "PackageNameYouTube",
default = DEFAULT_PACKAGE_NAME_YOUTUBE,
values = mapOf(
@ -30,10 +30,11 @@ object PackageNamePatch : ResourcePatch() {
"Default" to DEFAULT_PACKAGE_NAME_YOUTUBE
),
title = "Package name of YouTube",
description = "The name of the package to use in MicroG support"
description = "The name of the package to use in MicroG support",
required = true
)
internal var PackageNameYouTubeMusic by stringPatchOption(
internal val PackageNameYouTubeMusic by stringPatchOption(
key = "PackageNameYouTubeMusic",
default = DEFAULT_PACKAGE_NAME_YOUTUBE_MUSIC,
values = mapOf(
@ -41,7 +42,8 @@ object PackageNamePatch : ResourcePatch() {
"Default" to DEFAULT_PACKAGE_NAME_YOUTUBE_MUSIC
),
title = "Package name of YouTube Music",
description = "The name of the package to use in MicroG support"
description = "The name of the package to use in MicroG support",
required = true
)
override fun execute(context: ResourceContext) {

View File

@ -41,6 +41,20 @@ import app.revanced.util.resources.ResourceHelper.updatePatchStatusLabel
)
@Suppress("unused")
object CustomBrandingNamePatch : ResourcePatch() {
private const val APP_NAME = "ReVanced Extended"
private val AppName by stringPatchOption(
key = "AppName",
default = APP_NAME,
values = mapOf(
"Full name" to APP_NAME,
"Short name" to "RVX"
),
title = "App name",
description = "The name of the app.",
required = true
)
override fun execute(context: ResourceContext) {
AppName?.let {
@ -61,17 +75,4 @@ object CustomBrandingNamePatch : ResourcePatch() {
context.updatePatchStatusLabel(it)
} ?: throw PatchException("Invalid app name.")
}
private const val APP_NAME = "ReVanced Extended"
internal var AppName by stringPatchOption(
key = "AppName",
default = APP_NAME,
values = mapOf(
"Full name" to APP_NAME,
"Short name" to "RVX"
),
title = "App name",
description = "The name of the app."
)
}

View File

@ -40,6 +40,14 @@ import app.revanced.util.resources.ResourceUtils.copyResources
)
@Suppress("unused")
object DoubleTapLengthPatch : ResourcePatch() {
private val DoubleTapLengthArrays by stringPatchOption(
key = "DoubleTapLengthArrays",
default = "3, 5, 10, 15, 20, 30, 60, 120, 180",
title = "Double-tap to seek Values",
description = "A list of custom double-tap to seek lengths. Be sure to separate them with commas (,).",
required = true
)
override fun execute(context: ResourceContext) {
val arrayPath = "res/values-v21/arrays.xml"
val entriesName = "double_tap_length_entries"
@ -70,11 +78,4 @@ object DoubleTapLengthPatch : ResourcePatch() {
SettingsPatch.updatePatchStatus("Custom double tap length")
}
internal var DoubleTapLengthArrays by stringPatchOption(
key = "DoubleTapLengthArrays",
default = "3, 5, 10, 15, 20, 30, 60, 120, 180",
title = "Double-tap to seek Values",
description = "A list of custom double-tap to seek lengths. Be sure to separate them with commas (,)."
)
}

View File

@ -47,7 +47,7 @@ object PremiumHeadingPatch : ResourcePatch() {
default = true,
title = "Use premium heading",
description = "Whether to use the premium heading.",
required = true,
required = true
)
override fun execute(context: ResourceContext) {

View File

@ -52,8 +52,7 @@ object ThemePatch : ResourcePatch() {
private const val DARK_ORANGE_COLOR = "#FF291800"
private const val DARK_RED_COLOR = "#FF290000"
internal var DarkThemeBackgroundColor by stringPatchOption(
private val DarkThemeBackgroundColor by stringPatchOption(
key = "DarkThemeBackgroundColor",
default = AMOLED_BLACK_COLOR,
values = mapOf(
@ -68,6 +67,7 @@ object ThemePatch : ResourcePatch() {
),
title = "Dark theme background color",
description = "Can be a hex color (#AARRGGBB) or a color resource reference.",
required = true
)
private fun getThemeString(darkThemeColor: String) =

View File

@ -60,11 +60,12 @@ import org.w3c.dom.Element
)
@Suppress("unused")
object OverlayButtonsPatch : ResourcePatch() {
internal var OutlineIcon by booleanPatchOption(
private val OutlineIcon by booleanPatchOption(
key = "OutlineIcon",
default = false,
title = "Outline icons",
description = "Apply the outline icon"
description = "Apply the outline icon",
required = true
)
override fun execute(context: ResourceContext) {

View File

@ -42,11 +42,12 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode
)
@Suppress("unused")
object SponsorBlockPatch : ResourcePatch() {
internal var OutlineIcon by booleanPatchOption(
private val OutlineIcon by booleanPatchOption(
key = "OutlineIcon",
default = false,
title = "Outline icons",
description = "Apply the outline icon"
description = "Apply the outline icon",
required = true
)
override fun execute(context: ResourceContext) {