@@ -15,9 +15,9 @@ import java.nio.file.Files
1515 name = " Custom branding" ,
1616 description = " Applies a custom app name and icon. Defaults to \" YouTube ReVanced\" and the ReVanced logo." ,
1717 compatiblePackages = [
18- CompatiblePackage (" com.google.android.youtube" )
18+ CompatiblePackage (" com.google.android.youtube" ),
1919 ],
20- use = false
20+ use = false ,
2121)
2222@Suppress(" unused" )
2323object CustomBrandingPatch : ResourcePatch() {
@@ -28,15 +28,15 @@ object CustomBrandingPatch : ResourcePatch() {
2828 " adaptiveproduct_youtube_background_color_108" ,
2929 " adaptiveproduct_youtube_foreground_color_108" ,
3030 " ic_launcher" ,
31- " ic_launcher_round"
31+ " ic_launcher_round" ,
3232 ).map { " $it .png" }.toTypedArray()
3333
3434 private val mipmapDirectories = arrayOf(
3535 " xxxhdpi" ,
3636 " xxhdpi" ,
3737 " xhdpi" ,
3838 " hdpi" ,
39- " mdpi"
39+ " mdpi" ,
4040 ).map { " mipmap-$it " }
4141
4242 private var appName by stringPatchOption(
@@ -49,7 +49,7 @@ object CustomBrandingPatch : ResourcePatch() {
4949 " YouTube" to " YouTube" ,
5050 ),
5151 title = " App name" ,
52- description = " The name of the app."
52+ description = " The name of the app." ,
5353 )
5454
5555 private var icon by stringPatchOption(
@@ -58,22 +58,25 @@ object CustomBrandingPatch : ResourcePatch() {
5858 values = mapOf (" ReVanced Logo" to REVANCED_ICON ),
5959 title = " App icon" ,
6060 description = """
61- The path to a folder containing the following folders:
61+ The icon to apply to the app.
62+
63+ If a path to a folder is provided, the folder must contain the following folders:
6264
6365 ${mipmapDirectories.joinToString(" \n " ) { " - $it " }}
6466
65- Each of these folders has to have the following files:
67+ Each of these folders must contain the following files:
6668
6769 ${iconResourceFileNames.joinToString(" \n " ) { " - $it " }}
68- """ .trimIndentMultiline()
70+ """ .trimIndentMultiline(),
6971 )
7072
7173 override fun execute (context : ResourceContext ) {
7274 icon?.let { icon ->
7375 // Change the app icon.
7476 mipmapDirectories.map { directory ->
7577 ResourceGroup (
76- directory, * iconResourceFileNames
78+ directory,
79+ * iconResourceFileNames,
7780 )
7881 }.let { resourceGroups ->
7982 if (icon != REVANCED_ICON ) {
@@ -87,11 +90,13 @@ object CustomBrandingPatch : ResourcePatch() {
8790 group.resources.forEach { iconFileName ->
8891 Files .write(
8992 toDirectory.resolve(iconFileName).toPath(),
90- fromDirectory.resolve(iconFileName).readBytes()
93+ fromDirectory.resolve(iconFileName).readBytes(),
9194 )
9295 }
9396 }
94- } else resourceGroups.forEach { context.copyResources(" custom-branding" , it) }
97+ } else {
98+ resourceGroups.forEach { context.copyResources(" custom-branding" , it) }
99+ }
95100 }
96101 }
97102
@@ -102,8 +107,8 @@ object CustomBrandingPatch : ResourcePatch() {
102107 manifest.readText()
103108 .replace(
104109 " android:label=\" @string/application_name" ,
105- " android:label=\" $name "
106- )
110+ " android:label=\" $name " ,
111+ ),
107112 )
108113 }
109114 }
0 commit comments