Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
feat(YouTube) - Support version 19.12, 19.13, 19.14, 19.15 an…
Browse files Browse the repository at this point in the history
…d `19.16` (#643)
  • Loading branch information
LisoUseInAIKyrios authored Jun 1, 2024
1 parent a7e9390 commit a60d6b7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

@SuppressWarnings("unused")
public class HideAutoplayButtonPatch {
public static boolean isButtonShown() {
return !Settings.HIDE_AUTOPLAY_BUTTON.get();

private static final Boolean HIDE_AUTOPLAY_BUTTON_ENABLED = Settings.HIDE_AUTOPLAY_BUTTON.get();

/**
* Injection point.
*/
public static boolean hideAutoPlayButton() {
return HIDE_AUTOPLAY_BUTTON_ENABLED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ public final class LayoutComponentsFilter extends Filter {
private static final String VIDEO_ACTION_BAR_PATH_PREFIX = "video_action_bar.eml";
private static final String ANIMATED_VECTOR_TYPE_PATH = "AnimatedVectorType";

private final StringTrieSearch exceptions = new StringTrieSearch();
private static final StringTrieSearch mixPlaylistsExceptions = new StringTrieSearch();
private static final StringTrieSearch mixPlaylistsExceptions = new StringTrieSearch(
"V.ED", // Playlist browse id.
"java.lang.ref.WeakReference"
);
private static final ByteArrayFilterGroup mixPlaylistsExceptions2 = new ByteArrayFilterGroup(
null,
"cell_description_body"
);

private static final ByteArrayFilterGroup mixPlaylists = new ByteArrayFilterGroup(
Settings.HIDE_MIX_PLAYLISTS,
"&list="
);

private final StringTrieSearch exceptions = new StringTrieSearch();
private final StringFilterGroup searchResultShelfHeader;
private final StringFilterGroup inFeedSurvey;
private final StringFilterGroup notifyMe;
Expand All @@ -44,13 +47,6 @@ public final class LayoutComponentsFilter extends Filter {
private final StringFilterGroup likeSubscribeGlow;
private final StringFilterGroup horizontalShelves;

static {
mixPlaylistsExceptions.addPatterns(
"V.ED", // Playlist browse id.
"java.lang.ref.WeakReference"
);
}

@RequiresApi(api = Build.VERSION_CODES.N)
public LayoutComponentsFilter() {
exceptions.addPatterns(
Expand Down Expand Up @@ -353,24 +349,31 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
* Called from a different place then the other filters.
*/
public static boolean filterMixPlaylists(final Object conversionContext, @Nullable final byte[] bytes) {
if (bytes == null) {
Logger.printDebug(() -> "bytes is null");
return false;
}
try {
if (bytes == null) {
Logger.printDebug(() -> "bytes is null");
return false;
}

// Prevent playlist items being hidden, if a mix playlist is present in it.
if (mixPlaylistsExceptions.matches(conversionContext.toString()))
return false;
// Prevent playlist items being hidden, if a mix playlist is present in it.
if (mixPlaylistsExceptions.matches(conversionContext.toString())) {
return false;
}

if (!mixPlaylists.check(bytes).isFiltered())
return false;
// Prevent hiding the description of some videos accidentally.
if (mixPlaylistsExceptions2.check(bytes).isFiltered()) {
return false;
}

// Prevent hiding the description of some videos accidentally.
if (mixPlaylistsExceptions2.check(bytes).isFiltered())
return false;
if (mixPlaylists.check(bytes).isFiltered()) {
Logger.printDebug(() -> "Filtered mix playlist");
return true;
}
} catch (Exception ex) {
Logger.printException(() -> "filterMixPlaylists failure", ex);
}

Logger.printDebug(() -> "Filtered mix playlist");
return true;
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public static void onFlyoutMenuCreate(RecyclerView recyclerView) {
*
* Used to force the creation of the advanced menu item for the Shorts quality flyout.
*/
public static boolean forceAdvancedVideoQualityMenuCreation() {
return Settings.RESTORE_OLD_VIDEO_QUALITY_MENU.get();
public static boolean forceAdvancedVideoQualityMenuCreation(boolean original) {
return Settings.RESTORE_OLD_VIDEO_QUALITY_MENU.get() || original;
}

/**
Expand Down

0 comments on commit a60d6b7

Please sign in to comment.