mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-12 13:17:38 +02:00
feat(YouTube - Miniplayer): Add option to disable miniplayer (#3961)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:

committed by
GitHub

parent
71af1f86e8
commit
e565cdb583
@ -24,9 +24,20 @@ public final class MiniplayerPatch {
|
||||
* Mini player type. Null fields indicates to use the original un-patched value.
|
||||
*/
|
||||
public enum MiniplayerType {
|
||||
/**
|
||||
* Disabled. When swiped down the miniplayer is immediately closed.
|
||||
* Only available with 19.43+
|
||||
*/
|
||||
DISABLED(false, null),
|
||||
/** Unmodified type, and same as un-patched. */
|
||||
ORIGINAL(null, null),
|
||||
/**
|
||||
* Exactly the same as MINIMAL, and only here for migration of user settings.
|
||||
* Eventually this should be deleted.
|
||||
*/
|
||||
@Deprecated
|
||||
PHONE(false, null),
|
||||
MINIMAL(false, null),
|
||||
TABLET(true, null),
|
||||
MODERN_1(null, 1),
|
||||
MODERN_2(null, 2),
|
||||
@ -164,6 +175,18 @@ public final class MiniplayerPatch {
|
||||
OPACITY_LEVEL = (opacity * 255) / 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* Enables a handler that immediately closes the miniplayer when the video is minimized,
|
||||
* effectively disabling the miniplayer.
|
||||
*/
|
||||
public static boolean getMiniplayerOnCloseHandler(boolean original) {
|
||||
return CURRENT_TYPE == ORIGINAL
|
||||
? original
|
||||
: CURRENT_TYPE == DISABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
|
@ -375,15 +375,20 @@ public class Settings extends BaseSettings {
|
||||
|
||||
migrateOldSettingToNew(DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING, SB_PRIVATE_USER_ID);
|
||||
|
||||
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS);
|
||||
|
||||
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER);
|
||||
|
||||
// Old spoof versions that no longer work reliably.
|
||||
if (SpoofAppVersionPatch.isSpoofingToLessThan(SPOOF_APP_VERSION_TARGET.defaultValue)) {
|
||||
Logger.printInfo(() -> "Resetting spoof app version target");
|
||||
SPOOF_APP_VERSION_TARGET.resetToDefault();
|
||||
}
|
||||
|
||||
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS);
|
||||
|
||||
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER);
|
||||
// Migrate renamed enum type.
|
||||
if (MINIPLAYER_TYPE.get() == PHONE) {
|
||||
MINIPLAYER_TYPE.save(MINIMAL);
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
Reference in New Issue
Block a user