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

Commit

Permalink
chore: Merge branch dev to main (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX authored Nov 4, 2023
2 parents 650a5e0 + 8d534f0 commit 3344375
Show file tree
Hide file tree
Showing 19 changed files with 304 additions and 173 deletions.
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
# [0.121.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.6...v0.121.0-dev.7) (2023-11-03)


### Bug Fixes

* **YouTube - Player flyout menu:** Restore functionality ([#502](https://github.com/ReVanced/revanced-integrations/issues/502)) ([c048527](https://github.com/ReVanced/revanced-integrations/commit/c048527dc0bc6b1b3de9c451ca909aab7ad93d0f))

# [0.121.0-dev.6](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.5...v0.121.0-dev.6) (2023-10-25)


### Bug Fixes

* **YouTube - Client spoof:** Set the client version correctly ([f203731](https://github.com/ReVanced/revanced-integrations/commit/f2037316d36f99ef79ae5792e34d8616ecd31c80))

# [0.121.0-dev.5](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.4...v0.121.0-dev.5) (2023-10-25)


### Bug Fixes

* **YouTube - Disable suggested video end screen:** Hide the view once possible ([df27822](https://github.com/ReVanced/revanced-integrations/commit/df278222e8814612797e55e616d4ebc075cafb92))


### Features

* **YouTube - Disable precise seeking gesture:** Use better patch name ([2453d30](https://github.com/ReVanced/revanced-integrations/commit/2453d30970ac59d78647386f4fe5d904dbc145e4))
* **YouTube:** Add `Enable old seekbar thumbnails` patch ([75297a5](https://github.com/ReVanced/revanced-integrations/commit/75297a52c1c5f7c2b928964d08b055380f4a08fe))

# [0.121.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.3...v0.121.0-dev.4) (2023-10-25)


### Bug Fixes

* **YouTube - ReturnYouTubeDislike:** Use API back off if client connection fails for any reason ([#509](https://github.com/ReVanced/revanced-integrations/issues/509)) ([40cfa1e](https://github.com/ReVanced/revanced-integrations/commit/40cfa1e9af2b064b464c4d03d5c28b5932621d62))

# [0.121.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.2...v0.121.0-dev.3) (2023-10-24)


### Features

* **YouTube:** Add `Disable fullscreen ambient mode` patch ([bf50711](https://github.com/ReVanced/revanced-integrations/commit/bf5071107b8bc88ac6562d45bfa28bdab8e566c7))
* **YouTube:** Add `Disable suggested video end screen` patch ([6bd5aae](https://github.com/ReVanced/revanced-integrations/commit/6bd5aae9772e80809dbee9f8fffc1247364a9a13))

# [0.121.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v0.121.0-dev.1...v0.121.0-dev.2) (2023-10-24)


### Bug Fixes

* **YouTube - ReturnYouTubeDislike:** Fix RYD prefetching home feed Shorts ([#508](https://github.com/ReVanced/revanced-integrations/issues/508)) ([98c91af](https://github.com/ReVanced/revanced-integrations/commit/98c91af130b57322aa98a3e66ec0acad26bfc7d6))

# [0.121.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.120.1-dev.3...v0.121.0-dev.1) (2023-10-23)


### Features

* **YouTube - Hide layout components:** Hide video quality menu footer ([04608d3](https://github.com/ReVanced/revanced-integrations/commit/04608d32e88d184e4662a71498d7a49c1fbbdb25))

## [0.120.1-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v0.120.1-dev.2...v0.120.1-dev.3) (2023-10-21)


### Bug Fixes

* **YouTube - Custom filter:** Fix app crash if invalid character is used in custom filter ([#506](https://github.com/ReVanced/revanced-integrations/issues/506)) ([debd0a2](https://github.com/ReVanced/revanced-integrations/commit/debd0a2e1101e543161390fd3ced6bda19030155))

## [0.120.1-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v0.120.1-dev.1...v0.120.1-dev.2) (2023-10-20)


### Reverts

* Revert "fix(YouTube - Minimized playback): Fix pip incorrectly showing for Short playback (#504)" ([c1c7e3b](https://github.com/ReVanced/revanced-integrations/commit/c1c7e3b5964394de6af39f6fb83d667eba174f0a)), closes [#504](https://github.com/ReVanced/revanced-integrations/issues/504)
* Revert "chore(release): 0.120.1-dev.1 [skip ci]" ([e68f558](https://github.com/ReVanced/revanced-integrations/commit/e68f558e9ccac4c6e0d9113b3f134e89edd2233f))

# [0.120.0](https://github.com/ReVanced/revanced-integrations/compare/v0.119.2...v0.120.0) (2023-10-20)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package app.revanced.integrations.patches;

import app.revanced.integrations.settings.SettingsEnum;

/** @noinspection unused*/
public final class DisableFullscreenAmbientModePatch {
public static boolean enableFullScreenAmbientMode() {
return !SettingsEnum.DISABLE_FULLSCREEN_AMBIENT_MODE.getBoolean();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import android.view.VelocityTracker;
import app.revanced.integrations.settings.SettingsEnum;

public final class DisableFineScrubbingGesturePatch {
public final class DisablePreciseSeekingGesturePatch {
/**
* Disables the fine scrubbing gesture.
* Disables the gesture that is used to seek precisely.
* @param tracker The velocity tracker that is used to determine the gesture.
* @param event The motion event that is used to determine the gesture.
*/
public static void disableGesture(VelocityTracker tracker, MotionEvent event) {
if (SettingsEnum.DISABLE_FINE_SCRUBBING_GESTURE.getBoolean()) return;
if (SettingsEnum.DISABLE_PRECISE_SEEKING_GESTURE.getBoolean()) return;

tracker.addMovement(event);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package app.revanced.integrations.patches;

import android.annotation.SuppressLint;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import app.revanced.integrations.settings.SettingsEnum;

/** @noinspection unused*/
public final class DisableSuggestedVideoEndScreenPatch {
@SuppressLint("StaticFieldLeak")
private static View lastView;

public static void closeEndScreen(final ImageView imageView) {
if (!SettingsEnum.DISABLE_SUGGESTED_VIDEO_END_SCREEN.getBoolean()) return;

// Get the view which can be listened to for layout changes.
final var parent = imageView.getParent().getParent();

// Prevent adding the listener multiple times.
if (lastView == parent) return;

lastView = (ViewGroup)parent;
lastView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) -> imageView.performClick());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.revanced.integrations.patches;

import app.revanced.integrations.settings.SettingsEnum;

public final class EnableOldSeekbarThumbnailsPatch {
public static boolean enableOldSeekbarThumbnails() {
return !SettingsEnum.ENABLE_OLD_SEEKBAR_THUMBNAILS.getBoolean();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,14 @@ private static boolean isShortTextViewOnScreen(@NonNull View view) {
/**
* Injection point. Uses 'playback response' video id hook to preload RYD.
*/
public static void preloadVideoId(@NonNull String videoId) {
if (!SettingsEnum.RYD_ENABLED.getBoolean()) {
public static void preloadVideoId(@NonNull String videoId, boolean videoIsOpeningOrPlaying) {
// Shorts shelf in home and subscription feed causes player response hook to be called,
// and the 'is opening/playing' parameter will be false.
// This hook will be called again when the Short is actually opened.
if (!videoIsOpeningOrPlaying || !SettingsEnum.RYD_ENABLED.getBoolean()) {
return;
}
if (!SettingsEnum.RYD_SHORTS.getBoolean() && PlayerType.getCurrent().isNoneOrHidden()) {
if (!SettingsEnum.RYD_SHORTS.getBoolean() && PlayerType.getCurrent().isNoneHiddenOrSlidingMinimized()) {
return;
}
if (videoId.equals(lastPrefetchedVideoId)) {
Expand Down Expand Up @@ -471,12 +474,13 @@ public static void newVideoLoaded(@Nullable String videoId, boolean isShortsLith
if (videoIdIsSame(currentVideoData, videoId)) {
return;
}
currentVideoData = ReturnYouTubeDislike.getFetchForVideoId(videoId);
ReturnYouTubeDislike data = ReturnYouTubeDislike.getFetchForVideoId(videoId);
// Pre-emptively set the data to short status.
// Required to prevent Shorts data from being used on a minimized video in incognito mode.
if (isNoneHiddenOrSlidingMinimized) {
currentVideoData.setVideoIdIsShort(true);
data.setVideoIdIsShort(true);
}
currentVideoData = data;
}

LogHelper.printDebug(() -> "New video id: " + videoId + " playerType: " + currentPlayerType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void setVideoId(@NonNull String newlyLoadedVideoId) {
*
* @param videoId The id of the last video loaded.
*/
public static void setPlayerResponseVideoId(@NonNull String videoId) {
public static void setPlayerResponseVideoId(@NonNull String videoId, boolean videoIsOpeningOrPlaying) {
if (!playerResponseVideoId.equals(videoId)) {
LogHelper.printDebug(() -> "New player response video id: " + videoId);
playerResponseVideoId = videoId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public LayoutComponentsFilter() {
"inline_expander"
);

final var videoQualityMenuFooter = new StringFilterGroup(
SettingsEnum.HIDE_VIDEO_QUALITY_MENU_FOOTER,
"quality_sheet_footer"
);

final var chapters = new StringFilterGroup(
SettingsEnum.HIDE_CHAPTERS,
"macro_markers_carousel"
Expand Down Expand Up @@ -196,6 +201,7 @@ public LayoutComponentsFilter() {
joinMembership,
medicalPanel,
notifyMe,
videoQualityMenuFooter,
infoPanel,
subscribersCommunityGuidelines,
channelGuidelines,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,20 @@ public FilterGroupResult check(final String string) {

final class CustomFilterGroup extends StringFilterGroup {

public CustomFilterGroup(final SettingsEnum setting, final SettingsEnum filter) {
super(setting, filter.getString().split("\\s+"));
private static String[] getFilterPatterns(SettingsEnum setting) {
String[] patterns = setting.getString().split("\\s+");
for (String pattern : patterns) {
if (!StringTrieSearch.isValidPattern(pattern)) {
ReVancedUtils.showToastLong("Invalid custom filter, resetting to default");
setting.saveValue(setting.defaultValue);
return getFilterPatterns(setting);
}
}
return patterns;
}

public CustomFilterGroup(SettingsEnum setting, SettingsEnum filter) {
super(setting, getFilterPatterns(filter));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,38 @@
import androidx.annotation.RequiresApi;

import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.shared.PlayerType;

public class PlayerFlyoutMenuItemsFilter extends Filter {

// Search the buffer only if the flyout menu identifier is found.
// Search the buffer only if the flyout menu path is found.
// Handle the searching in this class instead of adding to the global filter group (which searches all the time)
private final ByteArrayFilterGroupList flyoutFilterGroupList = new ByteArrayFilterGroupList();

private final ByteArrayFilterGroup exception;

@RequiresApi(api = Build.VERSION_CODES.N)
public PlayerFlyoutMenuItemsFilter() {
identifierFilterGroupList.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
exception = new ByteArrayAsStringFilterGroup(
// Whitelist Quality menu item when "Hide Additional settings menu" is enabled
SettingsEnum.HIDE_ADDITIONAL_SETTINGS_MENU,
"quality_sheet"
);

// Using pathFilterGroupList due to new flyout panel(A/B)
pathFilterGroupList.addAll(
new StringFilterGroup(null, "overflow_menu_item.eml|")
);

flyoutFilterGroupList.addAll(
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_QUALITY_MENU,
"yt_outline_gear"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_CAPTIONS_MENU,
"closed_caption"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_ADDITIONAL_SETTINGS_MENU,
"yt_outline_gear"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_LOOP_VIDEO_MENU,
"yt_outline_arrow_repeat_1_"
Expand Down Expand Up @@ -64,6 +76,10 @@ public PlayerFlyoutMenuItemsFilter() {
@Override
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
// Shorts also use this player flyout panel
if (PlayerType.getCurrent().isNoneOrHidden() || exception.check(protobufBufferArray).isFiltered())
return false;

// Only 1 group is added to the parent class, so the matched group must be the overflow menu.
if (matchedIndex == 0 && flyoutFilterGroupList.check(protobufBufferArray).isFiltered()) {
// Super class handles logging.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ protected boolean removeEldestEntry(Map.Entry eldest) {
/**
* Injection point.
*/
public static void newPlayerResponseVideoId(String videoId) {
public static void newPlayerResponseVideoId(String videoId, boolean videoIsOpeningOrPlaying) {
try {
if (!SettingsEnum.RYD_SHORTS.getBoolean()) {
if (!videoIsOpeningOrPlaying || !SettingsEnum.RYD_SHORTS.getBoolean()) {
return;
}
synchronized (lastVideoIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class PlayerRoutes {

JSONObject client = new JSONObject();
client.put("clientName", "ANDROID");
client.put("clientVersion", "18.37.36");
client.put("clientVersion", ReVancedUtils.getVersionName());
client.put("androidSdkVersion", 34);

context.put("client", client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public enum Vote {
* How long to retain unsuccessful RYD fetches,
* and also the minimum time before retrying again.
*/
private static final long CACHE_TIMEOUT_FAILURE_MILLISECONDS = 2 * 60 * 1000; // 2 Minutes
private static final long CACHE_TIMEOUT_FAILURE_MILLISECONDS = 3 * 60 * 1000; // 3 Minutes

/**
* Unique placeholder character, used to detect if a segmented span already has dislikes added to it.
Expand Down
Loading

0 comments on commit 3344375

Please sign in to comment.