From df41f035b6cea49e5394d59b7ea8443e63e0d703 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Wed, 26 Mar 2025 15:00:26 +0900 Subject: [PATCH] fix(YouTube - Theme): Change method to fix dark theme in YouTube 19.32+ --- .../fix/splash/DarkModeSplashScreenPatch.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/splash/DarkModeSplashScreenPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/splash/DarkModeSplashScreenPatch.kt index 5a193d9e6..845e676be 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/splash/DarkModeSplashScreenPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/splash/DarkModeSplashScreenPatch.kt @@ -1,9 +1,12 @@ package app.revanced.patches.youtube.utils.fix.splash import app.revanced.patcher.patch.resourcePatch +import app.revanced.patches.youtube.utils.compatibility.Constants.YOUTUBE_PACKAGE_NAME import app.revanced.patches.youtube.utils.playservice.is_19_32_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch import app.revanced.patches.youtube.utils.settings.ResourceUtils.restoreOldSplashAnimationIncluded +import app.revanced.patches.youtube.utils.settings.ResourceUtils.youtubePackageName +import app.revanced.util.findElementByAttributeValueOrThrow import org.w3c.dom.Element /** @@ -25,6 +28,19 @@ val darkModeSplashScreenPatch = resourcePatch( return@finalize } + // GmsCore support included + if (youtubePackageName != YOUTUBE_PACKAGE_NAME) { + document("AndroidManifest.xml").use { document -> + val mainActivityElement = document.childNodes.findElementByAttributeValueOrThrow( + "android:name", + "com.google.android.apps.youtube.app.watchwhile.MainActivity", + ) + + mainActivityElement.setAttribute("android:launchMode", "singleTask") + } + return@finalize + } + if (restoreOldSplashAnimationIncluded) { document("res/values-night/styles.xml").use { document -> val resourcesNode = document.getElementsByTagName("resources").item(0) as Element