From 6531273ac08e5caf6246a18a044d7248bd69fd6c Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:19:43 +0400 Subject: [PATCH] refactor(YouTube - Exit fullscreen mode): Improve logging --- .../youtube/patches/ExitFullscreenPatch.java | 14 +++++++++----- .../youtube/patches/PlayerControlsPatch.java | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java index 7a330df0c..dddea1387 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java @@ -28,16 +28,20 @@ public class ExitFullscreenPatch { } if (PlayerType.getCurrent() == PlayerType.WATCH_WHILE_FULLSCREEN) { - if (Utils.isLandscapeOrientation()) { - if (mode == FullscreenMode.PORTRAIT) { + if (mode != FullscreenMode.PORTRAIT_LANDSCAPE) { + if (Utils.isLandscapeOrientation()) { + if (mode == FullscreenMode.PORTRAIT) { + return; + } + } else if (mode == FullscreenMode.LANDSCAPE) { return; } - } else if (mode == FullscreenMode.LANDSCAPE) { - return; } ImageView fullscreenButton = PlayerControlsPatch.fullscreenButtonRef.get(); - if (fullscreenButton != null) { + if (fullscreenButton == null) { + Logger.printDebug(() -> "Fullscreen button is null, cannot click"); + } else { Logger.printDebug(() -> "Clicking fullscreen button"); fullscreenButton.performClick(); } diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/PlayerControlsPatch.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/PlayerControlsPatch.java index 1cd9b508d..a8458310d 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/PlayerControlsPatch.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/PlayerControlsPatch.java @@ -22,6 +22,7 @@ public class PlayerControlsPatch { */ public static void setFullscreenCloseButton(ImageView imageButton) { fullscreenButtonRef = new WeakReference<>(imageButton); + Logger.printDebug(() -> "Fullscreen button set"); if (!fullscreenButtonVisibilityCallbacksExist()) { return;