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

Commit

Permalink
feat: Merge v1.13.1-dev.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco146 authored Sep 1, 2024
2 parents 0966733 + 48a8a87 commit ea2ce99
Show file tree
Hide file tree
Showing 44 changed files with 2,490 additions and 2,312 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import androidx.annotation.Nullable;

import app.revanced.integrations.shared.patches.components.Filter;
import app.revanced.integrations.shared.patches.components.StringFilterGroup;
import app.revanced.integrations.music.patches.misc.ShareSheetPatch;
import app.revanced.integrations.music.settings.Settings;
import app.revanced.integrations.shared.patches.components.Filter;
import app.revanced.integrations.shared.patches.components.StringFilterGroup;

/**
* Abuse LithoFilter for {@link ShareSheetPatch}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public static void userSelectedPlaybackSpeed(final float playbackSpeed) {
return;

Settings.DEFAULT_PLAYBACK_SPEED.save(playbackSpeed);

if (!Settings.REMEMBER_PLAYBACK_SPEED_LAST_SELECTED_TOAST.get())
return;

showToastShort(str("revanced_remember_playback_speed_toast", playbackSpeed + "x"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ private static void userSelectedVideoQuality(final int defaultQuality) {
default -> wifiQualitySetting.save(defaultQuality);
}

if (!Settings.REMEMBER_VIDEO_QUALITY_LAST_SELECTED_TOAST.get())
return;

Utils.showToastShort(str("revanced_remember_video_quality_" + networkType.getName(), defaultQuality + "p"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ public class ReturnYouTubeDislike {
@NonNull
private static SpannableString createDislikeSpan(@NonNull Spanned oldSpannable,
@NonNull RYDVoteData voteData) {
// Note: Some locales use right to left layout (Arabic, Hebrew, etc).
// If making changes to this code, change device settings to a RTL language and verify layout is correct.
String oldLikesString = oldSpannable.toString();

// YouTube creators can hide the like count on a video,
Expand Down Expand Up @@ -191,8 +189,8 @@ private static SpannableString createDislikeSpan(@NonNull Spanned oldSpannable,

// middle separator
String middleSeparatorString = compactLayout
? " " + MIDDLE_SEPARATOR_CHARACTER + " "
: " \u2009" + MIDDLE_SEPARATOR_CHARACTER + "\u2009 "; // u2009 = 'narrow space' character
? "\u200E " + MIDDLE_SEPARATOR_CHARACTER + " "
: "\u200E \u2009" + MIDDLE_SEPARATOR_CHARACTER + "\u2009 "; // u2009 = 'narrow space' character
final int shapeInsertionIndex = middleSeparatorString.length() / 2;
Spannable middleSeparatorSpan = new SpannableString(middleSeparatorString);
ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ public class Settings extends BaseSettings {
// PreferenceScreen: Video
public static final StringSetting CUSTOM_PLAYBACK_SPEEDS = new StringSetting("revanced_custom_playback_speeds", "0.5\n0.8\n1.0\n1.2\n1.5\n1.8\n2.0", true);
public static final BooleanSetting REMEMBER_PLAYBACK_SPEED_LAST_SELECTED = new BooleanSetting("revanced_remember_playback_speed_last_selected", TRUE);
public static final BooleanSetting REMEMBER_PLAYBACK_SPEED_LAST_SELECTED_TOAST = new BooleanSetting("revanced_remember_playback_speed_last_selected_toast", TRUE);
public static final BooleanSetting REMEMBER_VIDEO_QUALITY_LAST_SELECTED = new BooleanSetting("revanced_remember_video_quality_last_selected", TRUE);
public static final BooleanSetting REMEMBER_VIDEO_QUALITY_LAST_SELECTED_TOAST = new BooleanSetting("revanced_remember_video_quality_last_selected_toast", TRUE);
public static final FloatSetting DEFAULT_PLAYBACK_SPEED = new FloatSetting("revanced_default_playback_speed", 1.0f);
public static final IntegerSetting DEFAULT_VIDEO_QUALITY_MOBILE = new IntegerSetting("revanced_default_video_quality_mobile", -2);
public static final IntegerSetting DEFAULT_VIDEO_QUALITY_WIFI = new IntegerSetting("revanced_default_video_quality_wifi", -2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ private static ThumbnailOption optionSettingForCurrentNavigation() {
// Unknown tab, treat as the home tab;
return homeOption;
}
if (selectedNavButton == NavigationButton.HOME) {
if (selectedNavButton.isHomeTab()) {
return homeOption;
}
if (selectedNavButton == NavigationButton.SUBSCRIPTIONS || selectedNavButton == NavigationButton.NOTIFICATIONS) {
if (selectedNavButton.isSubscriptionsTab() || selectedNavButton.isNotificationTab()) {
return subscriptionsOption;
}
// A library tab variant is active.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public final class FeedComponentsFilter extends Filter {
"horizontalCollectionSwipeProtector=null";
private static final String CONVERSATION_CONTEXT_SUBSCRIPTIONS_IDENTIFIER =
"heightConstraint=null";

private static final ByteArrayFilterGroup expansion =
new ByteArrayFilterGroup(
null,
"inline_expansion"
);

private static final ByteArrayFilterGroup mixPlaylists =
new ByteArrayFilterGroup(
Settings.HIDE_MIX_PLAYLISTS,
Expand All @@ -35,6 +42,7 @@ public final class FeedComponentsFilter extends Filter {
private final StringFilterGroup channelProfile;
private final StringFilterGroup communityPosts;
private final StringFilterGroup libraryShelf;
private final StringFilterGroup newExpansion;
private final ByteArrayFilterGroup visitStoreButton;

private static final StringTrieSearch communityPostsFeedGroupSearch = new StringTrieSearch();
Expand Down Expand Up @@ -70,6 +78,7 @@ public FeedComponentsFilter() {
null,
"post_base_wrapper",
"image_post_root",
"images_post_root",
"text_post_root"
);

Expand Down Expand Up @@ -104,6 +113,19 @@ public FeedComponentsFilter() {
"page_header.eml" // new layout
);

// The path for the new type of 'Expandable chip under videos' is as follows:
//
// CellType|CellType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|CellType|CellType|ContainerType|ContainerType|CollectionType|CellType|CellType|ContainerType|
//
// Unlike other litho elements, this one does not contain any words that can identify this layout.
// Since 'CellType' and 'ContainerType' are already used in several layouts, this filter alone has some limitations in identifying the layout.
//
// Related issues: https://github.com/inotia00/ReVanced_Extended/issues/2173
newExpansion = new StringFilterGroup(
Settings.HIDE_EXPANDABLE_CHIP,
"CellType|CellType|ContainerType|ContainerType|ContainerType|"
);

visitStoreButton = new ByteArrayFilterGroup(
null,
"header_store_button"
Expand Down Expand Up @@ -187,6 +209,7 @@ public FeedComponentsFilter() {
imageShelf,
latestPosts,
movieShelf,
newExpansion,
notifyMe,
playables,
subscriptionsChannelBar,
Expand Down Expand Up @@ -264,6 +287,11 @@ public boolean isFiltered(String path, @Nullable String identifier, String allVa
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
} else if (matchedGroup == newExpansion) {
if (contentIndex == 0 && expansion.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
} else if (matchedGroup == channelProfile) {
if (contentIndex == 0 && visitStoreButton.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
Expand Down
Loading

0 comments on commit ea2ce99

Please sign in to comment.