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