feat(YouTube - Change header): Change to ReVanced borderless logo header by default (#2512)

Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2024-01-02 15:34:20 +01:00 committed by GitHub
parent a2c4876a81
commit 75f785d1ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 153 additions and 57 deletions

View file

@ -5,6 +5,7 @@ import app.revanced.patcher.util.DomFileEditor
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import org.w3c.dom.Node
import java.io.InputStream
import java.nio.file.Files
import java.nio.file.StandardCopyOption
@ -53,13 +54,18 @@ fun ResourceContext.copyResources(sourceResourceDirectory: String, vararg resour
resourceGroup.resources.forEach { resource ->
val resourceFile = "${resourceGroup.resourceDirectoryName}/$resource"
Files.copy(
classLoader.getResourceAsStream("$sourceResourceDirectory/$resourceFile")!!,
inputStreamFromBundledResource(sourceResourceDirectory, resourceFile)!!,
targetResourceDirectory.resolve(resourceFile).toPath(), StandardCopyOption.REPLACE_EXISTING
)
}
}
}
internal fun inputStreamFromBundledResource(
sourceResourceDirectory: String,
resourceFile: String
): InputStream? = classLoader.getResourceAsStream("$sourceResourceDirectory/$resourceFile")
/**
* Resource names mapped to their corresponding resource data.
* @param resourceDirectoryName The name of the directory of the resource.