Skip to content

Commit

Permalink
feat(YouTube - Custom branding icon): Restrict the version that can u…
Browse files Browse the repository at this point in the history
…se the patch option `Restore old splash animation` to 19.16.39 (deprecated)
  • Loading branch information
inotia00 authored and anddea committed Dec 17, 2024
1 parent 4fc44b2 commit 8589c5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -139,7 +140,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,
)

Expand Down Expand Up @@ -188,17 +189,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8589c5a

Please sign in to comment.