From 428c6b18fe8f20f1cf0d9a1e7a5f119fecf12bd1 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:32:57 +0900 Subject: [PATCH] fix: patch options are not required in the RVX Manager --- .../music/general/components/LayoutComponentsPatch.kt | 3 ++- .../layout/branding/icon/CustomBrandingIconPatch.kt | 7 +++++-- .../layout/branding/name/CustomBrandingNamePatch.kt | 2 ++ .../music/layout/translations/TranslationsPatch.kt | 9 ++++++--- .../layout/branding/name/CustomBrandingNamePatch.kt | 3 ++- .../branding/packagename/ChangePackageNamePatch.kt | 3 ++- .../youtube/general/toolbar/ToolBarComponentsPatch.kt | 3 ++- .../layout/actionbuttons/ShortsActionButtonsPatch.kt | 3 ++- .../layout/branding/icon/CustomBrandingIconPatch.kt | 11 ++++++++--- .../layout/branding/name/CustomBrandingNamePatch.kt | 3 ++- .../patches/youtube/layout/theme/ThemePatch.kt | 1 + .../youtube/layout/translations/TranslationsPatch.kt | 9 ++++++--- .../layout/visual/VisualPreferencesIconsPatch.kt | 3 ++- .../player/overlaybuttons/OverlayButtonsPatch.kt | 6 ++++-- .../patches/youtube/utils/settings/SettingsPatch.kt | 6 ++++-- 15 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/general/components/LayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/music/general/components/LayoutComponentsPatch.kt index 09f100afb..1da58db9b 100644 --- a/src/main/kotlin/app/revanced/patches/music/general/components/LayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/general/components/LayoutComponentsPatch.kt @@ -78,7 +78,8 @@ object LayoutComponentsPatch : BaseBytecodePatch( key = "ForceHideVoiceSearchButton", default = false, title = "Force hide voice search button", - description = "Permanently hide the voice search button with the legacy method." + description = "Permanently hide the voice search button with the legacy method.", + required = true ) override fun execute(context: BytecodeContext) { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/CustomBrandingIconPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/CustomBrandingIconPatch.kt index 0531eac4c..71c8a8458 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/CustomBrandingIconPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/CustomBrandingIconPatch.kt @@ -109,20 +109,23 @@ object CustomBrandingIconPatch : BaseResourcePatch( ${launcherIconResourceFileNames.joinToString("\n") { "- $it" }} """.trimIndentMultiline(), + required = true ) private val ChangeHeader by booleanPatchOption( key = "ChangeHeader", default = false, title = "Change header", - description = "Apply the custom branding icon to the header." + description = "Apply the custom branding icon to the header.", + required = true ) private val ChangeSplashIcon by booleanPatchOption( key = "ChangeSplashIcon", default = true, title = "Change splash icons", - description = "Apply the custom branding icon to the splash screen." + description = "Apply the custom branding icon to the splash screen.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/name/CustomBrandingNamePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/name/CustomBrandingNamePatch.kt index 3831f41da..021f8c65e 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/name/CustomBrandingNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/name/CustomBrandingNamePatch.kt @@ -27,6 +27,7 @@ object CustomBrandingNamePatch : BaseResourcePatch( ), 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( @@ -40,6 +41,7 @@ object CustomBrandingNamePatch : BaseResourcePatch( ), title = "App name in launcher", description = "The name of the app as it appears in the launcher.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/translations/TranslationsPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/translations/TranslationsPatch.kt index ee61078f9..15631c200 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/translations/TranslationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/translations/TranslationsPatch.kt @@ -29,14 +29,16 @@ object TranslationsPatch : BaseResourcePatch( description = """ The path to the 'strings.xml' file. Please note that applying the 'strings.xml' file will overwrite all existing language translations. - """.trimIndent() + """.trimIndent(), + required = true ) private var SelectedTranslations by stringPatchOption( key = "SelectedTranslations", default = TRANSLATIONS.joinToString(", "), title = "Translations to add", - description = "A list of translations to be added for the RVX settings, separated by commas." + description = "A list of translations to be added for the RVX settings, separated by commas.", + required = true ) private var SelectedStringResources by stringPatchOption( @@ -48,7 +50,8 @@ object TranslationsPatch : BaseResourcePatch( String resources not in the list will be removed from the app. Default string resource, English, is not removed. - """.trimIndent() + """.trimIndent(), + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/branding/name/CustomBrandingNamePatch.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/branding/name/CustomBrandingNamePatch.kt index dcb71b903..95c609ca5 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/branding/name/CustomBrandingNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/branding/name/CustomBrandingNamePatch.kt @@ -25,7 +25,8 @@ object CustomBrandingNamePatch : BaseResourcePatch( "Original" to ORIGINAL_APP_NAME, ), title = "App name", - description = "The name of the app." + description = "The name of the app.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/reddit/layout/branding/packagename/ChangePackageNamePatch.kt b/src/main/kotlin/app/revanced/patches/reddit/layout/branding/packagename/ChangePackageNamePatch.kt index f87b22a5f..f33af78a1 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/layout/branding/packagename/ChangePackageNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/layout/branding/packagename/ChangePackageNamePatch.kt @@ -30,7 +30,8 @@ object ChangePackageNamePatch : BaseResourcePatch( "Original" to PACKAGE_NAME_REDDIT, ), title = "Package name of Reddit", - description = "The name of the package to rename the app to." + description = "The name of the package to rename the app to.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt index 1aa9ab362..3d90b05c5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt @@ -86,7 +86,8 @@ object ToolBarComponentsPatch : BaseBytecodePatch( key = "ForceHideVoiceSearchButton", default = false, title = "Force hide voice search button", - description = "Permanently hide the voice search button with the legacy method." + description = "Permanently hide the voice search button with the legacy method.", + required = true ) override fun execute(context: BytecodeContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt index e212d508d..9f3272f70 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt @@ -27,7 +27,8 @@ object ShortsActionButtonsPatch : BaseResourcePatch( DEFAULT_ICON_KEY to "round" ), title = "Shorts icon style ", - description = "The style of the icons for the action buttons in the Shorts player." + description = "The style of the icons for the action buttons in the Shorts player.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt index 1cd6d3459..ab6c75943 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt @@ -125,13 +125,15 @@ object CustomBrandingIconPatch : BaseResourcePatch( ${launcherIconResourceFileNames.joinToString("\n") { "- $it" }} """.trimIndentMultiline(), + required = true ) private val ChangeHeader by booleanPatchOption( key = "ChangeHeader", default = false, title = "Change header", - description = "Apply the custom branding icon to the header." + description = "Apply the custom branding icon to the header.", + required = true ) private val CustomHeader by stringPatchOption( @@ -152,20 +154,23 @@ object CustomBrandingIconPatch : BaseResourcePatch( The image dimensions must be as follows: ${headerResourceDirectoryNames.map { (dpi, dim) -> "- $dpi: $dim" }.joinToString("\n")} """.trimIndentMultiline(), + required = true ) private val ChangeSplashIcon by booleanPatchOption( key = "ChangeSplashIcon", default = true, title = "Change splash icons", - description = "Apply the custom branding icon to the splash screen." + description = "Apply the custom branding icon to the splash screen.", + required = true ) private val RestoreOldSplashAnimation by booleanPatchOption( key = "RestoreOldSplashAnimation", default = false, title = "Restore old splash animation", - description = "Restores old style splash animation." + description = "Restores old style splash animation.", + required = true ) // endregion diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/name/CustomBrandingNamePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/name/CustomBrandingNamePatch.kt index 5b0240aa0..01e0e79c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/name/CustomBrandingNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/name/CustomBrandingNamePatch.kt @@ -28,7 +28,8 @@ object CustomBrandingNamePatch : BaseResourcePatch( "YouTube" to "YouTube", ), title = "App name", - description = "The name of the app." + description = "The name of the app.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt index a998fb2e4..32f74d47e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt @@ -71,6 +71,7 @@ object ThemePatch : BaseResourcePatch( ), title = "Light theme background color", description = "Can be a hex color (#AARRGGBB) or a color resource reference.", + required = true ) private fun getThemeString( diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/translations/TranslationsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/translations/TranslationsPatch.kt index a62d5cd14..40e78d392 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/translations/TranslationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/translations/TranslationsPatch.kt @@ -28,14 +28,16 @@ object TranslationsPatch : BaseResourcePatch( description = """ The path to the 'strings.xml' file. Please note that applying the 'strings.xml' file will overwrite all existing translations. - """.trimIndent() + """.trimIndent(), + required = true ) private var SelectedTranslations by stringPatchOption( key = "SelectedTranslations", default = TRANSLATIONS.joinToString(", "), title = "Translations to add", - description = "A list of translations to be added for the RVX settings, separated by commas." + description = "A list of translations to be added for the RVX settings, separated by commas.", + required = true ) private var SelectedStringResources by stringPatchOption( @@ -47,7 +49,8 @@ object TranslationsPatch : BaseResourcePatch( String resources not in the list will be removed from the app. Default string resource, English, is not removed. - """.trimIndent() + """.trimIndent(), + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch.kt index 2d1a2ade2..44783280d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/visual/VisualPreferencesIconsPatch.kt @@ -32,7 +32,8 @@ object VisualPreferencesIconsPatch : BaseResourcePatch( "ReVanced Colored" to "revanced_colored", ), title = "RVX settings menu icon", - description = "Apply different icons for RVX settings menu." + description = "Apply different icons for RVX settings menu.", + required = true ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt index f47f0cd7b..992e87210 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt @@ -52,7 +52,8 @@ object OverlayButtonsPatch : BaseResourcePatch( default = DEFAULT_ICON_KEY, values = iconTypes, title = "Icon type", - description = "The icon type." + description = "The icon type.", + required = true ) // Option to set bottom margin @@ -64,7 +65,8 @@ object OverlayButtonsPatch : BaseResourcePatch( "Default" to DEFAULT_MARGIN ), title = "Bottom margin", - description = "The bottom margin for the overlay buttons and timestamp." + description = "The bottom margin for the overlay buttons and timestamp.", + required = true ) /** diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/SettingsPatch.kt index 0b1cc6a94..76b91779e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/settings/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/settings/SettingsPatch.kt @@ -71,14 +71,16 @@ object SettingsPatch : BaseResourcePatch( default = DEFAULT_ELEMENT, values = SETTINGS_ELEMENTS_MAP, title = "Insert position", - description = "The settings menu name that the RVX settings menu should be above." + description = "The settings menu name that the RVX settings menu should be above.", + required = true ) private val RVXSettingsMenuName by stringPatchOption( key = "RVXSettingsMenuName", default = DEFAULT_NAME, title = "RVX settings menu name", - description = "The name of the RVX settings menu." + description = "The name of the RVX settings menu.", + required = true ) internal lateinit var contexts: ResourceContext