mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-20 01:23:57 +00:00
Compare commits
4 Commits
v5.0.2-dev
...
v5.0.3-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f23b7fffc8 | ||
|
|
69c504ca2f | ||
|
|
fc4b0d7c39 | ||
|
|
02e66b3d43 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,3 +1,19 @@
|
|||||||
|
## [5.0.3-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.0.2...v5.0.3-dev.1) (2024-11-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Change header:** Apply header changes to A/B layout ([#3907](https://github.com/ReVanced/revanced-patches/issues/3907)) ([6ccf114](https://github.com/ReVanced/revanced-patches/commit/6ccf11426ec9e9cd9c8e89a2443f0d0645cc78b1))
|
||||||
|
|
||||||
|
## [5.0.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.1...v5.0.2) (2024-11-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Sync for Reddit - Fix /s/ links:** Fix patch by using correct fingerprints ([a0ad07e](https://github.com/ReVanced/revanced-patches/commit/a0ad07ef3170dbe1d91ebd40f11d97b63d1c63d0))
|
||||||
|
* **Sync for Reddit - Spoof client:** Fix patch by using correct fingerprints ([5776de3](https://github.com/ReVanced/revanced-patches/commit/5776de3cfbfa62360267eb6026525d2da8c45654))
|
||||||
|
* **YouTube - Player controls:** Show player control buttons with A/B layout ([#3901](https://github.com/ReVanced/revanced-patches/issues/3901)) ([bb526bc](https://github.com/ReVanced/revanced-patches/commit/bb526bc00a384eb808f46267e5802c8e5beaa7d5))
|
||||||
|
|
||||||
## [5.0.2-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.2-dev.1...v5.0.2-dev.2) (2024-11-12)
|
## [5.0.2-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.2-dev.1...v5.0.2-dev.2) (2024-11-12)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
android.useAndroidX = true
|
android.useAndroidX = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 5.0.2-dev.2
|
version = 5.0.3-dev.1
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ package app.revanced.patches.youtube.layout.branding.header
|
|||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
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_25_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
|
||||||
|
import app.revanced.util.findElementByAttributeValueOrThrow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private const val HEADER_FILE_NAME = "yt_wordmark_header"
|
private const val HEADER_FILE_NAME = "yt_wordmark_header"
|
||||||
@@ -34,6 +37,8 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
description = "Applies a custom header in the top left corner within the app. Defaults to the ReVanced header.",
|
description = "Applies a custom header in the top left corner within the app. Defaults to the ReVanced header.",
|
||||||
use = false,
|
use = false,
|
||||||
) {
|
) {
|
||||||
|
dependsOn(versionCheckPatch)
|
||||||
|
|
||||||
compatibleWith("com.google.android.youtube")
|
compatibleWith("com.google.android.youtube")
|
||||||
|
|
||||||
val header by stringOption(
|
val header by stringOption(
|
||||||
@@ -79,7 +84,7 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
/**
|
/**
|
||||||
* A function that overwrites both header variants in the target resource directories.
|
* A function that overwrites both header variants in the target resource directories.
|
||||||
*/
|
*/
|
||||||
val overwriteFromTo: (String, String) -> Unit = { from: String, to: String ->
|
fun overwriteFromTo(from: String, to: String) {
|
||||||
targetResourceDirectories.forEach { directory ->
|
targetResourceDirectories.forEach { directory ->
|
||||||
variants.forEach { variant ->
|
variants.forEach { variant ->
|
||||||
val fromPath = directory.resolve("${from}_$variant.png")
|
val fromPath = directory.resolve("${from}_$variant.png")
|
||||||
@@ -91,23 +96,28 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Functions to overwrite the header to the different variants.
|
// Functions to overwrite the header to the different variants.
|
||||||
val toPremium = { overwriteFromTo(PREMIUM_HEADER_FILE_NAME, HEADER_FILE_NAME) }
|
fun toPremium() { overwriteFromTo(PREMIUM_HEADER_FILE_NAME, HEADER_FILE_NAME) }
|
||||||
val toHeader = { overwriteFromTo(HEADER_FILE_NAME, PREMIUM_HEADER_FILE_NAME) }
|
fun toHeader() { overwriteFromTo(HEADER_FILE_NAME, PREMIUM_HEADER_FILE_NAME) }
|
||||||
val toReVanced = {
|
fun toReVanced() {
|
||||||
// Copy the ReVanced header to the resource directories.
|
// Copy the ReVanced header to the resource directories.
|
||||||
targetResourceFiles.forEach { copyResources("change-header/revanced", it) }
|
targetResourceFiles.forEach { copyResources("change-header/revanced", it) }
|
||||||
|
|
||||||
// Overwrite the premium with the custom header as well.
|
// Overwrite the premium with the custom header as well.
|
||||||
toHeader()
|
toHeader()
|
||||||
}
|
}
|
||||||
val toReVancedBorderless = {
|
fun toReVancedBorderless() {
|
||||||
// Copy the ReVanced borderless header to the resource directories.
|
// Copy the ReVanced borderless header to the resource directories.
|
||||||
targetResourceFiles.forEach { copyResources("change-header/revanced-borderless", it) }
|
targetResourceFiles.forEach {
|
||||||
|
copyResources(
|
||||||
|
"change-header/revanced-borderless",
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Overwrite the premium with the custom header as well.
|
// Overwrite the premium with the custom header as well.
|
||||||
toHeader()
|
toHeader()
|
||||||
}
|
}
|
||||||
val toCustom = {
|
fun toCustom() {
|
||||||
val sourceFolders = File(header!!).listFiles { file -> file.isDirectory }
|
val sourceFolders = File(header!!).listFiles { file -> file.isDirectory }
|
||||||
?: throw PatchException("The provided path is not a directory: $header")
|
?: throw PatchException("The provided path is not a directory: $header")
|
||||||
|
|
||||||
@@ -136,11 +146,42 @@ val changeHeaderPatch = resourcePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (header) {
|
when (header) {
|
||||||
HEADER_OPTION -> toHeader
|
HEADER_OPTION -> toHeader()
|
||||||
PREMIUM_HEADER_OPTION -> toPremium
|
PREMIUM_HEADER_OPTION -> toPremium()
|
||||||
REVANCED_HEADER_OPTION -> toReVanced
|
REVANCED_HEADER_OPTION -> toReVanced()
|
||||||
REVANCED_BORDERLESS_HEADER_OPTION -> toReVancedBorderless
|
REVANCED_BORDERLESS_HEADER_OPTION -> toReVancedBorderless()
|
||||||
else -> toCustom
|
else -> toCustom()
|
||||||
}()
|
}
|
||||||
|
|
||||||
|
// Fix 19.25+ A/B layout with different header icons:
|
||||||
|
// yt_ringo2_wordmark_header, yt_ringo2_premium_wordmark_header
|
||||||
|
//
|
||||||
|
// These images are webp and not png, so overwriting them is not so simple.
|
||||||
|
// Instead change styles.xml to use the old drawable resources.
|
||||||
|
if (is_19_25_or_greater) {
|
||||||
|
document("res/values/styles.xml").use { document ->
|
||||||
|
arrayOf(
|
||||||
|
"CairoLightThemeRingo2Updates" to variants[0],
|
||||||
|
"CairoDarkThemeRingo2Updates" to variants[1]
|
||||||
|
).forEach { (styleName, theme) ->
|
||||||
|
val style = document.childNodes.findElementByAttributeValueOrThrow(
|
||||||
|
"name",
|
||||||
|
styleName,
|
||||||
|
)
|
||||||
|
|
||||||
|
val drawable = "@drawable/${HEADER_FILE_NAME}_${theme}"
|
||||||
|
|
||||||
|
arrayOf(
|
||||||
|
"ytWordmarkHeader",
|
||||||
|
"ytPremiumWordmarkHeader"
|
||||||
|
).forEach { itemName ->
|
||||||
|
style.childNodes.findElementByAttributeValueOrThrow(
|
||||||
|
"name",
|
||||||
|
itemName,
|
||||||
|
).textContent = drawable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user