mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-05-02 23:54:34 +02:00
fix(YouTube - Custom branding): Change icon correctly on 19.34+ (#3866)
This commit is contained in:
parent
b0ac6ce7c9
commit
2e47903825
@ -2,6 +2,8 @@ package app.revanced.patches.youtube.layout.branding
|
|||||||
|
|
||||||
import app.revanced.patcher.patch.resourcePatch
|
import app.revanced.patcher.patch.resourcePatch
|
||||||
import app.revanced.patcher.patch.stringOption
|
import app.revanced.patcher.patch.stringOption
|
||||||
|
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
|
||||||
|
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||||
import app.revanced.util.ResourceGroup
|
import app.revanced.util.ResourceGroup
|
||||||
import app.revanced.util.Utils.trimIndentMultiline
|
import app.revanced.util.Utils.trimIndentMultiline
|
||||||
import app.revanced.util.copyResources
|
import app.revanced.util.copyResources
|
||||||
@ -18,6 +20,11 @@ private val iconResourceFileNames = arrayOf(
|
|||||||
"ic_launcher_round",
|
"ic_launcher_round",
|
||||||
).map { "$it.png" }.toTypedArray()
|
).map { "$it.png" }.toTypedArray()
|
||||||
|
|
||||||
|
private val iconResourceFileNamesNew = mapOf(
|
||||||
|
"adaptiveproduct_youtube_foreground_color_108" to "adaptiveproduct_youtube_2024_q4_foreground_color_108",
|
||||||
|
"adaptiveproduct_youtube_background_color_108" to "adaptiveproduct_youtube_2024_q4_background_color_108",
|
||||||
|
)
|
||||||
|
|
||||||
private val mipmapDirectories = arrayOf(
|
private val mipmapDirectories = arrayOf(
|
||||||
"xxxhdpi",
|
"xxxhdpi",
|
||||||
"xxhdpi",
|
"xxhdpi",
|
||||||
@ -32,6 +39,8 @@ val customBrandingPatch = resourcePatch(
|
|||||||
description = "Applies a custom app name and icon. Defaults to \"YouTube ReVanced\" and the ReVanced logo.",
|
description = "Applies a custom app name and icon. Defaults to \"YouTube ReVanced\" and the ReVanced logo.",
|
||||||
use = false,
|
use = false,
|
||||||
) {
|
) {
|
||||||
|
dependsOn(versionCheckPatch)
|
||||||
|
|
||||||
compatibleWith("com.google.android.youtube")
|
compatibleWith("com.google.android.youtube")
|
||||||
|
|
||||||
val appName by stringOption(
|
val appName by stringOption(
|
||||||
@ -93,6 +102,21 @@ val customBrandingPatch = resourcePatch(
|
|||||||
resourceGroups.forEach { copyResources("custom-branding", it) }
|
resourceGroups.forEach { copyResources("custom-branding", it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_19_34_or_greater) {
|
||||||
|
val resourceDirectory = get("res")
|
||||||
|
|
||||||
|
mipmapDirectories.forEach { directory ->
|
||||||
|
val targetDirectory = resourceDirectory.resolve(directory)
|
||||||
|
|
||||||
|
iconResourceFileNamesNew.forEach { (old, new) ->
|
||||||
|
val oldFile = targetDirectory.resolve("$old.png")
|
||||||
|
val newFile = targetDirectory.resolve("$new.png")
|
||||||
|
|
||||||
|
Files.write(newFile.toPath(), oldFile.readBytes())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appName?.let { name ->
|
appName?.let { name ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user