diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/CustomBrandingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/CustomBrandingPatch.kt index b5a214327..587e0d4eb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/CustomBrandingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/CustomBrandingPatch.kt @@ -6,6 +6,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption import app.revanced.util.ResourceGroup +import app.revanced.util.Utils.trimIndentMultiline import app.revanced.util.copyResources import java.io.File import java.nio.file.Files @@ -64,10 +65,7 @@ object CustomBrandingPatch : ResourcePatch() { Each of these folders has to have the following files: ${iconResourceFileNames.joinToString("\n") { "- $it" }} - """ - .split("\n") - .joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line. - .trimIndent(), // Remove the leading newline. + """.trimIndentMultiline() ) override fun execute(context: ResourceContext) { diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt index 74ec3f770..6f1e76a07 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt @@ -7,6 +7,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption import app.revanced.util.ResourceGroup +import app.revanced.util.Utils.trimIndentMultiline import app.revanced.util.copyResources import java.io.File @@ -56,7 +57,7 @@ object ChangeHeaderPatch : ResourcePatch() { These folders must contain the following files: ${variants.joinToString("\n") { variant -> "- ${HEADER_NAME}_$variant.png" }} - """.trimIndent(), + """.trimIndentMultiline(), required = true, ) diff --git a/src/main/kotlin/app/revanced/util/Utils.kt b/src/main/kotlin/app/revanced/util/Utils.kt new file mode 100644 index 000000000..57f0edf03 --- /dev/null +++ b/src/main/kotlin/app/revanced/util/Utils.kt @@ -0,0 +1,8 @@ +package app.revanced.util + +internal object Utils { + internal fun String.trimIndentMultiline() = + this.split("\n") + .joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line. + .trimIndent() // Remove the leading newline. +}