feat(YouTube - Custom branding icon): Restrict the version that can use the patch option Restore old splash animation to 19.16.39 (deprecated)

This commit is contained in:
inotia00
2024-12-15 14:44:06 +09:00
parent 9e50e0d874
commit b20240aa5d
2 changed files with 18 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import app.revanced.patcher.patch.resourcePatch
import app.revanced.patcher.patch.stringOption
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.patch.PatchList.CUSTOM_BRANDING_ICON_FOR_YOUTUBE
import app.revanced.patches.youtube.utils.playservice.is_19_17_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_34_or_greater
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
import app.revanced.patches.youtube.utils.settings.ResourceUtils.updatePatchStatusIcon
@ -129,7 +130,7 @@ val customBrandingIconPatch = resourcePatch(
key = "restoreOldSplashAnimation",
default = true,
title = "Restore old splash animation",
description = "Restore the old style splash animation.",
description = "Restore the old style splash animation. Supports from YouTube 18.29.38 to YouTube 19.16.39.",
required = true,
)
@ -178,17 +179,21 @@ val customBrandingIconPatch = resourcePatch(
// Change splash screen.
if (restoreOldSplashAnimationOption == true) {
oldSplashAnimationResourceGroups.let { resourceGroups ->
resourceGroups.forEach {
copyResources("$appIconResourcePath/splash", it)
if (!is_19_17_or_greater) {
oldSplashAnimationResourceGroups.let { resourceGroups ->
resourceGroups.forEach {
copyResources("$appIconResourcePath/splash", it)
}
}
}
copyXmlNode(
"$appIconResourcePath/splash",
"values-v31/styles.xml",
"resources"
)
copyXmlNode(
"$appIconResourcePath/splash",
"values-v31/styles.xml",
"resources"
)
} else {
println("WARNING: Restore old splash animation is not supported in this version. Use YouTube 19.16.39 or earlier.")
}
}
updatePatchStatusIcon(appIcon)

View File

@ -19,6 +19,8 @@ var is_19_02_or_greater = false
private set
var is_19_15_or_greater = false
private set
var is_19_17_or_greater = false
private set
var is_19_23_or_greater = false
private set
var is_19_25_or_greater = false
@ -67,6 +69,7 @@ val versionCheckPatch = resourcePatch(
is_18_49_or_greater = 235000000 <= playStoreServicesVersion
is_19_02_or_greater = 240204000 < playStoreServicesVersion
is_19_15_or_greater = 241602000 <= playStoreServicesVersion
is_19_17_or_greater = 241802000 <= playStoreServicesVersion
is_19_23_or_greater = 242402000 <= playStoreServicesVersion
is_19_25_or_greater = 242599000 <= playStoreServicesVersion
is_19_26_or_greater = 242705000 <= playStoreServicesVersion