Skip to content

Commit

Permalink
feat(YouTube Music - Disable music video in album): Remove `Dismiss q…
Browse files Browse the repository at this point in the history
…ueue` options
  • Loading branch information
inotia00 authored and anddea committed Jan 10, 2025
1 parent 18456b9 commit 5d8ce8e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,9 @@
public class AlbumMusicVideoPatch {

public enum RedirectType {
REDIRECT_DISMISS(true),
REDIRECT(false),
ON_CLICK_DISMISS(true),
ON_CLICK(false),
ON_LONG_CLICK_DISMISS(true),
ON_LONG_CLICK(false);

public final boolean dismissQueue;

RedirectType(boolean dismissQueue) {
this.dismissQueue = dismissQueue;
}
REDIRECT,
ON_CLICK,
ON_LONG_CLICK
}

private static final RedirectType REDIRECT_TYPE =
Expand All @@ -39,17 +30,11 @@ public enum RedirectType {
private static final boolean DISABLE_MUSIC_VIDEO_IN_ALBUM =
Settings.DISABLE_MUSIC_VIDEO_IN_ALBUM.get();

private static final boolean DISMISS_QUEUE =
DISABLE_MUSIC_VIDEO_IN_ALBUM && REDIRECT_TYPE.dismissQueue;
private static final boolean REDIRECT = REDIRECT_TYPE == RedirectType.REDIRECT;

private static final boolean REDIRECT =
REDIRECT_TYPE == RedirectType.REDIRECT || REDIRECT_TYPE == RedirectType.REDIRECT_DISMISS;
private static final boolean ON_CLICK = REDIRECT_TYPE == RedirectType.ON_CLICK;

private static final boolean ON_CLICK =
REDIRECT_TYPE == RedirectType.ON_CLICK || REDIRECT_TYPE == RedirectType.ON_CLICK_DISMISS;

private static final boolean ON_LONG_CLICK =
REDIRECT_TYPE == RedirectType.ON_LONG_CLICK || REDIRECT_TYPE == RedirectType.ON_LONG_CLICK_DISMISS;
private static final boolean ON_LONG_CLICK = REDIRECT_TYPE == RedirectType.ON_LONG_CLICK;

private static final String YOUTUBE_MUSIC_ALBUM_PREFIX = "OLAK";

Expand All @@ -63,7 +48,7 @@ public enum RedirectType {

@GuardedBy("itself")
private static final Map<String, String> lastVideoIds = new LinkedHashMap<>() {
private static final int NUMBER_OF_LAST_VIDEO_IDS_TO_TRACK = 5;
private static final int NUMBER_OF_LAST_VIDEO_IDS_TO_TRACK = 10;

@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
Expand Down Expand Up @@ -153,10 +138,6 @@ public static boolean openMusic() {

private static void openMusic(@NonNull String songId) {
try {
if (DISMISS_QUEUE) {
VideoUtils.dismissQueue();
}

isVideoLaunched.compareAndSet(false, true);

// The newly opened video is not a music video.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting DISABLE_CAIRO_SPLASH_ANIMATION = new BooleanSetting("revanced_disable_cairo_splash_animation", FALSE, true);
public static final BooleanSetting DISABLE_DRC_AUDIO = new BooleanSetting("revanced_disable_drc_audio", FALSE, true);
public static final BooleanSetting DISABLE_MUSIC_VIDEO_IN_ALBUM = new BooleanSetting("revanced_disable_music_video_in_album", FALSE, true);
public static final EnumSetting<RedirectType> DISABLE_MUSIC_VIDEO_IN_ALBUM_REDIRECT_TYPE = new EnumSetting<>("revanced_disable_music_video_in_album_redirect_type", RedirectType.REDIRECT_DISMISS, true);
public static final EnumSetting<RedirectType> DISABLE_MUSIC_VIDEO_IN_ALBUM_REDIRECT_TYPE = new EnumSetting<>("revanced_disable_music_video_in_album_redirect_type", RedirectType.REDIRECT, true);
public static final BooleanSetting ENABLE_OPUS_CODEC = new BooleanSetting("revanced_enable_opus_codec", FALSE, true);
public static final BooleanSetting SETTINGS_IMPORT_EXPORT = new BooleanSetting("revanced_extended_settings_import_export", FALSE, false);
public static final BooleanSetting SPOOF_CLIENT = new BooleanSetting("revanced_spoof_client", FALSE, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.dismiss.dismissQueueHookPatch
import app.revanced.patches.music.utils.extension.Constants.MISC_PATH
import app.revanced.patches.music.utils.patch.PatchList.DISABLE_MUSIC_VIDEO_IN_ALBUM
import app.revanced.patches.music.utils.settings.CategoryType
Expand Down Expand Up @@ -39,7 +38,6 @@ val albumMusicVideoPatch = bytecodePatch(

dependsOn(
settingsPatch,
dismissQueueHookPatch,
videoInformationPatch,
playerResponseMethodHookPatch,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@
<item>FEmusic_library_corpus_artists</item>
</string-array>
<string-array name="revanced_disable_music_video_in_album_redirect_type_entries">
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_redirect_dismiss</item>
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_redirect</item>
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_on_click_dismiss</item>
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_on_click</item>
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_on_long_click_dismiss</item>
<item>@string/revanced_disable_music_video_in_album_redirect_type_entry_on_long_click</item>
</string-array>
<string-array name="revanced_disable_music_video_in_album_redirect_type_entry_values">
<item>REDIRECT_DISMISS</item>
<item>REDIRECT</item>
<item>ON_CLICK_DISMISS</item>
<item>ON_CLICK</item>
<item>ON_LONG_CLICK_DISMISS</item>
<item>ON_LONG_CLICK</item>
</string-array>
<string-array name="revanced_extended_settings_import_export_entries">
Expand Down

0 comments on commit 5d8ce8e

Please sign in to comment.