mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-21 16:57:18 +02:00
fix(Custom branding): Patching fails in some environments when the path entered in the patch options contains uppercase letters
This commit is contained in:
parent
4e85c77d53
commit
e3f5741b06
@ -17,6 +17,7 @@ import app.revanced.util.copyResources
|
|||||||
import app.revanced.util.getAdaptiveIconResourceFile
|
import app.revanced.util.getAdaptiveIconResourceFile
|
||||||
import app.revanced.util.getResourceGroup
|
import app.revanced.util.getResourceGroup
|
||||||
import app.revanced.util.underBarOrThrow
|
import app.revanced.util.underBarOrThrow
|
||||||
|
import app.revanced.util.valueOrThrow
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@ -136,7 +137,7 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
|
|
||||||
execute {
|
execute {
|
||||||
// Check patch options first.
|
// Check patch options first.
|
||||||
val appIcon = appIconOption.underBarOrThrow()
|
var appIcon = appIconOption.underBarOrThrow()
|
||||||
|
|
||||||
val appIconResourcePath = "music/branding/$appIcon"
|
val appIconResourcePath = "music/branding/$appIcon"
|
||||||
val youtubeMusicIconResourcePath = "music/branding/youtube_music"
|
val youtubeMusicIconResourcePath = "music/branding/youtube_music"
|
||||||
@ -145,6 +146,7 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
|
|
||||||
// Check if a custom path is used in the patch options.
|
// Check if a custom path is used in the patch options.
|
||||||
if (!availableIcon.containsValue(appIcon)) {
|
if (!availableIcon.containsValue(appIcon)) {
|
||||||
|
appIcon = appIconOption.valueOrThrow()
|
||||||
launcherIconResourceGroups.let { resourceGroups ->
|
launcherIconResourceGroups.let { resourceGroups ->
|
||||||
try {
|
try {
|
||||||
val path = File(appIcon)
|
val path = File(appIcon)
|
||||||
|
@ -14,6 +14,7 @@ import app.revanced.util.copyFile
|
|||||||
import app.revanced.util.copyResources
|
import app.revanced.util.copyResources
|
||||||
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
||||||
import app.revanced.util.fingerprint.resolvable
|
import app.revanced.util.fingerprint.resolvable
|
||||||
|
import app.revanced.util.underBarOrThrow
|
||||||
import app.revanced.util.valueOrThrow
|
import app.revanced.util.valueOrThrow
|
||||||
|
|
||||||
private const val DEFAULT_HEADER_KEY = "Custom branding icon"
|
private const val DEFAULT_HEADER_KEY = "Custom branding icon"
|
||||||
@ -145,15 +146,17 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
|
|
||||||
execute {
|
execute {
|
||||||
// Check patch options first.
|
// Check patch options first.
|
||||||
val customHeader = customHeaderOption
|
var customHeader = customHeaderOption
|
||||||
.valueOrThrow()
|
.underBarOrThrow()
|
||||||
|
|
||||||
|
val isPath = customHeader != DEFAULT_HEADER_VALUE
|
||||||
val customBrandingIconType = getIconType()
|
val customBrandingIconType = getIconType()
|
||||||
val customBrandingIconIncluded = customBrandingIconType != "default"
|
val customBrandingIconIncluded = customBrandingIconType != "default"
|
||||||
|
customHeader = customHeaderOption.valueOrThrow()
|
||||||
|
|
||||||
val warnings = "WARNING: Invalid header path: $customHeader. Does not apply patches."
|
val warnings = "WARNING: Invalid header path: $customHeader. Does not apply patches."
|
||||||
|
|
||||||
if (customHeader != DEFAULT_HEADER_VALUE) {
|
if (isPath) {
|
||||||
copyFile(
|
copyFile(
|
||||||
headerIconResourceGroups,
|
headerIconResourceGroups,
|
||||||
customHeader,
|
customHeader,
|
||||||
|
@ -18,6 +18,7 @@ import app.revanced.util.copyXmlNode
|
|||||||
import app.revanced.util.getAdaptiveIconResourceFile
|
import app.revanced.util.getAdaptiveIconResourceFile
|
||||||
import app.revanced.util.getResourceGroup
|
import app.revanced.util.getResourceGroup
|
||||||
import app.revanced.util.underBarOrThrow
|
import app.revanced.util.underBarOrThrow
|
||||||
|
import app.revanced.util.valueOrThrow
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.StandardCopyOption
|
import java.nio.file.StandardCopyOption
|
||||||
|
|
||||||
@ -136,13 +137,14 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
|
|
||||||
execute {
|
execute {
|
||||||
// Check patch options first.
|
// Check patch options first.
|
||||||
val appIcon = appIconOption.underBarOrThrow()
|
var appIcon = appIconOption
|
||||||
|
.underBarOrThrow()
|
||||||
|
|
||||||
val appIconResourcePath = "youtube/branding/$appIcon"
|
val appIconResourcePath = "youtube/branding/$appIcon"
|
||||||
|
|
||||||
|
|
||||||
// Check if a custom path is used in the patch options.
|
// Check if a custom path is used in the patch options.
|
||||||
if (!availableIcon.containsValue(appIcon)) {
|
if (!availableIcon.containsValue(appIcon)) {
|
||||||
|
appIcon = appIconOption.valueOrThrow()
|
||||||
val copiedFiles = copyFile(
|
val copiedFiles = copyFile(
|
||||||
launcherIconResourceGroups,
|
launcherIconResourceGroups,
|
||||||
appIcon,
|
appIcon,
|
||||||
@ -192,7 +194,7 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
"resources"
|
"resources"
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
println("WARNING: Restore old splash animation is not supported in this version. Use YouTube 19.16.39 or earlier.")
|
println("WARNING: \"Restore old splash animation\" is not supported in this version. Use YouTube 19.16.39 or earlier.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import app.revanced.util.Utils.trimIndentMultiline
|
|||||||
import app.revanced.util.copyFile
|
import app.revanced.util.copyFile
|
||||||
import app.revanced.util.copyResources
|
import app.revanced.util.copyResources
|
||||||
import app.revanced.util.underBarOrThrow
|
import app.revanced.util.underBarOrThrow
|
||||||
|
import app.revanced.util.valueOrThrow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import kotlin.io.path.copyTo
|
import kotlin.io.path.copyTo
|
||||||
@ -115,16 +116,18 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
|
|
||||||
execute {
|
execute {
|
||||||
// Check patch options first.
|
// Check patch options first.
|
||||||
val customHeader = customHeaderOption
|
var customHeader = customHeaderOption
|
||||||
.underBarOrThrow()
|
.underBarOrThrow()
|
||||||
|
|
||||||
|
val isPath = customHeader != DEFAULT_HEADER_VALUE
|
||||||
val customBrandingIconType = getIconType()
|
val customBrandingIconType = getIconType()
|
||||||
val customBrandingIconIncluded =
|
val customBrandingIconIncluded =
|
||||||
customBrandingIconType != "default" && customBrandingIconType != "custom"
|
customBrandingIconType != "default" && customBrandingIconType != "custom"
|
||||||
|
customHeader = customHeaderOption.valueOrThrow()
|
||||||
|
|
||||||
val warnings = "WARNING: Invalid header path: $customHeader. Does not apply patches."
|
val warnings = "WARNING: Invalid header path: $customHeader. Does not apply patches."
|
||||||
|
|
||||||
if (customHeader != DEFAULT_HEADER_VALUE) {
|
if (isPath) {
|
||||||
copyFile(
|
copyFile(
|
||||||
headerIconResourceGroups,
|
headerIconResourceGroups,
|
||||||
customHeader,
|
customHeader,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user