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 (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios authored Jul 11, 2024
2 parents 8fe73b2 + 6fef1b2 commit 1aba976
Show file tree
Hide file tree
Showing 15 changed files with 239 additions and 72 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## [1.11.1-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v1.11.1-dev.3...v1.11.1-dev.4) (2024-07-10)


### Bug Fixes

* **YouTube - SponsorBlock:** Skip segments when casting ([#655](https://github.com/ReVanced/revanced-integrations/issues/655)) ([5ce16ee](https://github.com/ReVanced/revanced-integrations/commit/5ce16eedc6e27560b97ab982408ac697146105e9))

## [1.11.1-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v1.11.1-dev.2...v1.11.1-dev.3) (2024-07-05)


### Bug Fixes

* **YouTube - Hide ads:** Hide new types of home feed button ads ([#662](https://github.com/ReVanced/revanced-integrations/issues/662)) ([ff2637c](https://github.com/ReVanced/revanced-integrations/commit/ff2637cb4c9c396f626cd7ee912953b22525baef))
* **YouTube - Settings:** Move some settings to different menus, adjust default setting values ([#661](https://github.com/ReVanced/revanced-integrations/issues/661)) ([77533cf](https://github.com/ReVanced/revanced-integrations/commit/77533cf3d68b9c748e1d4f3a85cd0544afc7ce48))

## [1.11.1-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.11.1-dev.1...v1.11.1-dev.2) (2024-06-30)


### Bug Fixes

* **YouTube - Hide layout components:** Hide new kind of community post ([#659](https://github.com/ReVanced/revanced-integrations/issues/659)) ([c237e3c](https://github.com/ReVanced/revanced-integrations/commit/c237e3c02c971fb1801663cb662096d319c04928))

## [1.11.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.11.0...v1.11.1-dev.1) (2024-06-23)


### Bug Fixes

* **YouTube - Hide layout components:** Detect if a keyword filter hides all videos ([#657](https://github.com/ReVanced/revanced-integrations/issues/657)) ([3a3ceec](https://github.com/ReVanced/revanced-integrations/commit/3a3ceec4b596354dcccbf3516ef1634bd8819b90))

# [1.11.0](https://github.com/ReVanced/revanced-integrations/compare/v1.10.0...v1.11.0) (2024-06-23)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private Utils() {
*
* @return The manifest 'Version' entry of the patches.jar used during patching.
*/
@SuppressWarnings("SameReturnValue")
public static String getPatchesReleaseVersion() {
return ""; // Value is replaced during patching.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static void setActivityTheme(Activity activity) {
/**
* Injection point.
*/
@SuppressWarnings("SameReturnValue")
private static String darkThemeResourceName() {
// Value is changed by Theme patch, if included.
return "@color/yt_black3";
Expand All @@ -58,6 +59,7 @@ public static int getDarkThemeColor() {
/**
* Injection point.
*/
@SuppressWarnings("SameReturnValue")
private static String lightThemeResourceName() {
// Value is changed by Theme patch, if included.
return "@color/yt_white1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private boolean matches(@NonNull T textToSearch, int textToSearchLength, int sta
throw new IllegalArgumentException("endIndex: " + endIndex
+ " is greater than texToSearchLength: " + textToSearchLength);
}
if (patterns.size() == 0) {
if (patterns.isEmpty()) {
return false; // No patterns were added.
}
for (int i = startIndex; i < endIndex; i++) {
Expand All @@ -393,7 +393,7 @@ private boolean matches(@NonNull T textToSearch, int textToSearchLength, int sta
* @return Estimated memory size (in kilobytes) of this instance.
*/
public int getEstimatedMemorySize() {
if (patterns.size() == 0) {
if (patterns.isEmpty()) {
return 0;
}
// Assume the device has less than 32GB of ram (and can use pointer compression),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package app.revanced.integrations.youtube.patches;

import android.annotation.SuppressLint;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.youtube.settings.Settings;

/** @noinspection unused*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import android.view.ViewGroup;

import androidx.annotation.Nullable;

import app.revanced.integrations.youtube.shared.PlayerOverlays;

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public final class VideoInformation {
private static final String SHORTS_PLAYER_PARAMETERS = "8AEB";

private static WeakReference<Object> playerControllerRef;
private static WeakReference<Object> mdxPlayerDirectorRef;
private static Method seekMethod;
private static Method mdxSeekMethod;

@NonNull
private static String videoId = "";
Expand Down Expand Up @@ -59,6 +61,22 @@ public static void initialize(@NonNull Object playerController) {
}
}

/**
* Injection point.
*
* @param mdxPlayerDirector MDX player director object (casting mode).
*/
public static void initializeMdx(@NonNull Object mdxPlayerDirector) {
try {
mdxPlayerDirectorRef = new WeakReference<>(Objects.requireNonNull(mdxPlayerDirector));

mdxSeekMethod = mdxPlayerDirector.getClass().getMethod(SEEK_METHOD_NAME, Long.TYPE);
mdxSeekMethod.setAccessible(true);
} catch (Exception ex) {
Logger.printException(() -> "Failed to initialize MDX", ex);
}
}

/**
* Injection point.
*
Expand Down Expand Up @@ -178,8 +196,32 @@ public static boolean seekTo(final long seekTime) {
}

Logger.printDebug(() -> "Seeking to " + adjustedSeekTime);
//noinspection DataFlowIssue
return (Boolean) seekMethod.invoke(playerControllerRef.get(), adjustedSeekTime);

try {
//noinspection DataFlowIssue
if ((Boolean) seekMethod.invoke(playerControllerRef.get(), adjustedSeekTime)) {
return true;
} // Else the video is loading or changing videos, or video is casting to a different device.
} catch (Exception ex) {
Logger.printInfo(() -> "seekTo method call failed", ex);
}

// Try calling the seekTo method of the MDX player director (called when casting).
// The difference has to be a different second mark in order to avoid infinite skip loops
// as the Lounge API only supports seconds.
if ((adjustedSeekTime / 1000) == (videoTime / 1000)) {
Logger.printDebug(() -> "Skipping seekTo for MDX because seek time is too small ("
+ (adjustedSeekTime - videoTime) + "ms)");
return false;
}
try {
//noinspection DataFlowIssue
return (Boolean) mdxSeekMethod.invoke(mdxPlayerDirectorRef.get(), adjustedSeekTime);
} catch (Exception ex) {
Logger.printInfo(() -> "seekTo (MDX) method call failed", ex);
return false;
}

} catch (Exception ex) {
Logger.printException(() -> "Failed to seek", ex);
return false;
Expand Down Expand Up @@ -278,6 +320,7 @@ public static long getVideoTime() {
*
* @see VideoState
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean isAtEndOfVideo() {
return videoTime >= videoLength && videoLength > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ public AdsFilter() {

final var buttonedAd = new StringFilterGroup(
Settings.HIDE_BUTTONED_ADS,
"_ad_with",
"_buttoned_layout",
// text_image_button_group_layout, landscape_image_button_group_layout, full_width_square_image_button_group_layout
"image_button_group_layout",
"full_width_square_image_layout",
"_ad_with",
"text_image_button_group_layout",
"video_display_button_group_layout",
"landscape_image_wide_button_layout",
"video_display_carousel_button_group_layout"
Expand Down
Loading

0 comments on commit 1aba976

Please sign in to comment.