fix(youtube/minimized-playback): disable when playing shorts

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2023-02-11 01:25:48 +01:00
parent 512d747ec8
commit 1dd84a3785
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 12 additions and 0 deletions

View File

@ -1,9 +1,14 @@
package app.revanced.integrations.patches; package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.shared.PlayerType;
public class MinimizedPlaybackPatch { public class MinimizedPlaybackPatch {
public static boolean isNotPlayingShorts(boolean isPipEnabled) {
return !PlayerType.getCurrent().isNoneOrHidden() && isPipEnabled;
}
public static boolean isMinimizedPlaybackEnabled() { public static boolean isMinimizedPlaybackEnabled() {
return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean(); return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean();
} }

View File

@ -49,4 +49,11 @@ enum class PlayerType {
*/ */
val onChange = Event<PlayerType>() val onChange = Event<PlayerType>()
} }
/**
* Weather Shorts are being played.
*/
fun isNoneOrHidden(): Boolean {
return this == NONE || this == HIDDEN
}
} }