feat(YouTube): Add Disable sign in to TV popup patch (#5639)

This commit is contained in:
AndnixSH
2025-08-15 12:00:55 +02:00
committed by GitHub
parent 1bb8c53ed3
commit 56fbd8cce0
6 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package app.revanced.extension.youtube.patches;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class DisableSignInToTvPopupPatch {
/**
* Injection point.
*/
public static boolean disableSignInToTvPopup() {
return Settings.DISABLE_SIGNIN_TO_TV_POPUP.get();
}
}

View File

@@ -256,6 +256,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting GRADIENT_LOADING_SCREEN = new BooleanSetting("revanced_gradient_loading_screen", FALSE, true);
public static final EnumSetting<SplashScreenAnimationStyle> SPLASH_SCREEN_ANIMATION_STYLE = new EnumSetting<>("revanced_splash_screen_animation_style", SplashScreenAnimationStyle.FPS_60_ONE_SECOND, true);
public static final EnumSetting<HeaderLogo> HEADER_LOGO = new EnumSetting<>("revanced_header_logo", HeaderLogo.DEFAULT, true);
public static final BooleanSetting DISABLE_SIGNIN_TO_TV_POPUP = new BooleanSetting("revanced_disable_signin_to_tv_popup", FALSE);
public static final BooleanSetting REMOVE_VIEWER_DISCRETION_DIALOG = new BooleanSetting("revanced_remove_viewer_discretion_dialog", FALSE,
"revanced_remove_viewer_discretion_dialog_user_dialog_message");

View File

@@ -1357,6 +1357,10 @@ public final class app/revanced/patches/youtube/layout/hide/shorts/HideShortsCom
public static final fun getHideShortsComponentsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/layout/hide/signintotvpopup/DisableSignInToTvPatchPopupKt {
public static final fun getDisableSignInToTvPopupPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatchKt {
public static final fun getDisableSuggestedVideoEndScreenPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@@ -0,0 +1,68 @@
package app.revanced.patches.youtube.layout.hide.signintotvpopup
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.mapping.get
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
import app.revanced.patches.shared.misc.mapping.resourceMappings
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
internal var mdx_seamless_tv_sign_in_drawer_fragment_title_id = -1L
private set
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/DisableSignInToTvPopupPatch;"
val disableSignInToTvPopupPatch = bytecodePatch(
name = "Disable sign in to TV popup",
description = "Adds an option to disable the popup asking to sign into a TV on the same local network.",
) {
dependsOn(
settingsPatch,
sharedExtensionPatch,
addResourcesPatch,
resourceMappingPatch
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"19.47.53",
"20.07.39",
"20.12.46",
"20.13.41",
)
)
execute {
addResources("youtube", "layout.hide.signintotv.disableSignInToTvPopupPatch")
PreferenceScreen.MISC.addPreferences(
SwitchPreference("revanced_disable_signin_to_tv_popup"),
)
mdx_seamless_tv_sign_in_drawer_fragment_title_id = resourceMappings[
"string",
"mdx_seamless_tv_sign_in_drawer_fragment_title",
]
signInToTvPopupFingerprint.method.addInstructionsWithLabels(
0,
"""
invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->disableSignInToTvPopup()Z
move-result v0
if-eqz v0, :allow_sign_in_popup
const/4 v0, 0x0
return v0
:allow_sign_in_popup
nop
"""
)
}
}

View File

@@ -0,0 +1,12 @@
package app.revanced.patches.youtube.layout.hide.signintotvpopup
import app.revanced.patcher.fingerprint
import app.revanced.util.literal
internal val signInToTvPopupFingerprint = fingerprint {
returns("Z")
parameters("Ljava/lang/String;", "Z", "L")
literal {
mdx_seamless_tv_sign_in_drawer_fragment_title_id
}
}

View File

@@ -515,6 +515,11 @@ This feature is only available for older devices"</string>
<string name="revanced_remove_viewer_discretion_dialog_summary_off">Dialog will be shown</string>
<string name="revanced_remove_viewer_discretion_dialog_user_dialog_message">This does not bypass the age restriction. It just accepts it automatically.</string>
</patch>
<patch id="layout.hide.signintotv.disableSignInToTvPopupPatch">
<string name="revanced_disable_signin_to_tv_popup_title">Disable Sign in to TV popup</string>
<string name="revanced_disable_signin_to_tv_popup_summary_on">Sign in to TV popup is disabled</string>
<string name="revanced_disable_signin_to_tv_popup_summary_off">Sign in to TV popup is enabled</string>
</patch>
<patch id="interaction.doubletap.disableDoubleTapActionsPatch">
<string name="revanced_disable_chapter_skip_double_tap_title">Disable double tap chapter skip</string>
<string name="revanced_disable_chapter_skip_double_tap_summary_on">Double tap can never trigger a skip to the next/previous chapter</string>