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

Commit

Permalink
chore: Merge branch dev to main
Browse files Browse the repository at this point in the history
  • Loading branch information
anddea authored Nov 7, 2024
2 parents 043f7a8 + 6c35749 commit 4a8e266
Show file tree
Hide file tree
Showing 26 changed files with 3,520 additions and 2,493 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# [0.158.0-dev.2](https://github.com/anddea/revanced-integrations/compare/v0.158.0-dev.1...v0.158.0-dev.2) (2024-11-06)


### Bug Fixes

* **YouTube - Return YouTube Dislike:** Height of the separator does not match ([5b30abb](https://github.com/anddea/revanced-integrations/commit/5b30abb0202fa44c1de92f33955c999d04be4004))
* **YouTube - Shorts components:** Shorts are not hidden in Home feed ([2164b67](https://github.com/anddea/revanced-integrations/commit/2164b677465ed76ebce145a32d61890ba177ac59))
* **YouTube - SponsorBlock:** Wrong segment behavior selected ([be37863](https://github.com/anddea/revanced-integrations/commit/be37863d543420150d44587934aa4ef29417f576))


### Features

* **YouTube - Description components:** Add `Hide AI-generated video summary section` setting ([76ffbcb](https://github.com/anddea/revanced-integrations/commit/76ffbcb87c55210337b1abff52f2602f53f3e137))

# [0.158.0-dev.1](https://github.com/anddea/revanced-integrations/compare/v0.157.0...v0.158.0-dev.1) (2024-10-29)


### Bug Fixes

* **YouTube - Hide feed components:** `Hide carousel shelf` setting hides the library shelf ([4be6d9e](https://github.com/anddea/revanced-integrations/commit/4be6d9ef70f7a4728c8d33511b0eb06e08b56fe3))
* **YouTube - Settings:** Restart dialog appears twice when the app is first installed ([050f58e](https://github.com/anddea/revanced-integrations/commit/050f58e5d2a9714b3069f57366915a90b5cabe23))
* **YouTube - Shorts components:** `Hide Shorts shelves` setting sometimes hides shelves in the library tab ([4ad3857](https://github.com/anddea/revanced-integrations/commit/4ad38571002a3912e6a8d2cc964e8b002ce30f23))
* **YouTube - Video playback:** Custom playback speed not working due to A/B tests ([9ad3df4](https://github.com/anddea/revanced-integrations/commit/9ad3df4eb574bb0b56fb822a6e40cd9a54544f44))
* **YouTube Music:** App crashes on Android 5, 6 ([fdab51b](https://github.com/anddea/revanced-integrations/commit/fdab51bc5a03723fabffd6ebca9c2bf365ea32a5))


### Features

* **YouTube - Hide ads:** Add `Hide player shopping shelf` setting ([afe17f6](https://github.com/anddea/revanced-integrations/commit/afe17f68052a7eeeb8388d6937e778ebd3960741))
* **YouTube - Hide feed components:** Add `Hide floating button` setting ([2b27006](https://github.com/anddea/revanced-integrations/commit/2b270064ec048785e8a3fb01477f362c254b1edb))
* **YouTube - Seekbar components:** Add `Enable high quality thumbnails` setting ([13329aa](https://github.com/anddea/revanced-integrations/commit/13329aa49e194b1a5119b25adc04c567e7b1dcfc))

# [0.157.0](https://github.com/anddea/revanced-integrations/compare/v0.156.0...v0.157.0) (2024-10-29)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import java.util.List;

import app.revanced.integrations.shared.settings.BaseSettings;
import app.revanced.integrations.shared.settings.BooleanSetting;
import app.revanced.integrations.shared.utils.Logger;
import app.revanced.integrations.shared.utils.StringTrieSearch;

Expand All @@ -24,6 +26,8 @@ final class DummyFilter extends Filter { }

@SuppressWarnings("unused")
public final class InclusiveSpanPatch {
private static final BooleanSetting ENABLE_DEBUG_LOGGING = BaseSettings.ENABLE_DEBUG_LOGGING;

/**
* Simple wrapper to pass the litho parameters through the prefix search.
*/
Expand Down Expand Up @@ -121,9 +125,11 @@ private static String getSpanType(SpanType spanType, Object span) {
filterUsingCallbacks(filter, filter.callbacks);
}

Logger.printDebug(() -> "Using: "
+ searchTree.numberOfPatterns() + " conversion context filters"
+ " (" + searchTree.getEstimatedMemorySize() + " KB)");
if (ENABLE_DEBUG_LOGGING.get()) {
Logger.printDebug(() -> "Using: "
+ searchTree.numberOfPatterns() + " conversion context filters"
+ " (" + searchTree.getEstimatedMemorySize() + " KB)");
}
}

private static void filterUsingCallbacks(Filter filter, List<StringFilterGroup> groups) {
Expand Down Expand Up @@ -163,7 +169,10 @@ private static boolean returnEarly(SpannableString spannableString, Object span,

LithoFilterParameters parameter =
new LithoFilterParameters(conversionContext, spannableString, span, start, end, flags);
Logger.printDebug(() -> "Searching...\n\u200B\n" + parameter);

if (ENABLE_DEBUG_LOGGING.get()) {
Logger.printDebug(() -> "Searching...\n\u200B\n" + parameter);
}

return searchTree.matches(parameter.conversionContext, parameter);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static RYDVoteData fetchVotes(String videoId) {
handleConnectionError((str("revanced_ryd_failure_generic", ex.getMessage())), ex);
} catch (Exception ex) {
// should never happen
Logger.printException(() -> "Failed to fetch votes", ex);
Logger.printException(() -> "fetchVotes failure", ex);
}

updateRateLimitAndStats(true, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ public class StringRef extends Utils {
*/
@NonNull
public static StringRef sfc(@NonNull String id) {
return strings.computeIfAbsent(id, StringRef::new);
StringRef ref = strings.get(id);
if (ref == null) {
ref = new StringRef(id);
strings.put(id, ref);
}
return ref;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ public static ViewParent getParentView(@NonNull View view, int nthParent) {
return parent;
}

final int currentDepthLog = currentDepth;
final int finalDepthLog = currentDepth;
final ViewParent finalParent = parent;
Logger.printDebug(() -> "Could not find parent view of depth: " + nthParent
+ " and instead found at: " + currentDepthLog + " view: " + view);
+ " and instead found at: " + finalDepthLog + " view: " + finalParent);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package app.revanced.integrations.youtube.patches.components;

import androidx.annotation.Nullable;

import app.revanced.integrations.shared.patches.components.ByteArrayFilterGroup;
import app.revanced.integrations.shared.patches.components.Filter;
import app.revanced.integrations.shared.patches.components.StringFilterGroup;
import app.revanced.integrations.youtube.settings.Settings;
Expand All @@ -20,6 +23,9 @@
@SuppressWarnings("unused")
public final class AdsFilter extends Filter {

private final StringFilterGroup playerShoppingShelf;
private final ByteArrayFilterGroup playerShoppingShelfBuffer;

public AdsFilter() {

// Identifiers.
Expand Down Expand Up @@ -123,9 +129,32 @@ public AdsFilter() {
"watch_metadata_app_promo"
);

playerShoppingShelf = new StringFilterGroup(
null,
"horizontal_shelf.eml"
);

playerShoppingShelfBuffer = new ByteArrayFilterGroup(
Settings.HIDE_PLAYER_STORE_SHELF,
"shopping_item_card_list.eml"
);

addPathCallbacks(
generalAdsPath,
playerShoppingShelf,
viewProducts
);
}

@Override
public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (matchedGroup == playerShoppingShelf) {
if (contentIndex == 0 && playerShoppingShelfBuffer.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
}
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import app.revanced.integrations.shared.patches.components.Filter;
import app.revanced.integrations.shared.patches.components.StringFilterGroup;
import app.revanced.integrations.shared.utils.Logger;
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.youtube.shared.NavigationBar.NavigationButton;
import app.revanced.integrations.youtube.shared.RootView;

@SuppressWarnings("unused")
Expand All @@ -31,50 +33,50 @@ public final class CarouselShelfFilter extends Filter {
BROWSE_ID_NOTIFICATION_INBOX
);

public final StringFilterGroup horizontalShelf;

public CarouselShelfFilter() {
final StringFilterGroup carouselShelf = new StringFilterGroup(
Settings.HIDE_CAROUSEL_SHELF,
"horizontal_shelf_inline.eml",
"horizontal_tile_shelf.eml",
"horizontal_video_shelf.eml"
);

horizontalShelf = new StringFilterGroup(
Settings.HIDE_CAROUSEL_SHELF,
"horizontal_shelf.eml"
);

addIdentifierCallbacks(
carouselShelf,
horizontalShelf
addPathCallbacks(
new StringFilterGroup(
Settings.HIDE_CAROUSEL_SHELF,
"horizontal_video_shelf.eml",
"horizontal_shelf.eml",
"horizontal_shelf_inline.eml",
"horizontal_tile_shelf.eml"
)
);
}

private static boolean hideShelves() {
private static boolean hideShelves(boolean playerActive, boolean searchBarActive, NavigationButton selectedNavButton, String browseId) {
// Must check player type first, as search bar can be active behind the player.
if (RootView.isPlayerActive()) {
if (playerActive) {
return false;
}
// Must check second, as search can be from any tab.
if (RootView.isSearchBarActive()) {
if (searchBarActive) {
return true;
}
String browseId = RootView.getBrowseId();
if (knownBrowseId.get().anyMatch(browseId::equals)) {
// Unknown tab, treat the same as home.
if (selectedNavButton == null) {
return true;
}
return whitelistBrowseId.get().noneMatch(browseId::equals);
return knownBrowseId.get().anyMatch(browseId::equals) || whitelistBrowseId.get().noneMatch(browseId::equals);
}

@Override
public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (matchedGroup == horizontalShelf && !hideShelves()) {
final boolean playerActive = RootView.isPlayerActive();
final boolean searchBarActive = RootView.isSearchBarActive();
final NavigationButton navigationButton = NavigationButton.getSelectedNavigationButton();
final String navigation = navigationButton == null ? "null" : navigationButton.name();
final String browseId = RootView.getBrowseId();
final boolean hideShelves = hideShelves(playerActive, searchBarActive, navigationButton, browseId);
if (contentIndex != 0) {
return false;
}
Logger.printDebug(() -> "hideShelves: " + hideShelves + "\nplayerActive: " + playerActive + "\nsearchBarActive: " + searchBarActive + "\nbrowseId: " + browseId + "\nnavigation: " + navigation);
if (!hideShelves) {
return false;
}

return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ public DescriptionsFilter() {
"transcript_section.eml"
);

final StringFilterGroup videoSummarySection = new StringFilterGroup(
Settings.HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION,
"cell_expandable_metadata.eml-js"
);

addIdentifierCallbacks(
attributesSection,
podcastSection,
transcriptSection
transcriptSection,
videoSummarySection
);

howThisWasMadeSection = new StringFilterGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,41 @@
* Abuse LithoFilter for {@link CustomPlaybackSpeedPatch}.
*/
public final class PlaybackSpeedMenuFilter extends Filter {
// Must be volatile or synchronized, as litho filtering runs off main thread and this field is then access from the main thread.
public static volatile boolean isPlaybackSpeedMenuVisible;
/**
* Old litho based speed selection menu.
*/
public static volatile boolean isOldPlaybackSpeedMenuVisible;

/**
* 0.05x speed selection menu.
*/
public static volatile boolean isPlaybackRateSelectorMenuVisible;

private final StringFilterGroup oldPlaybackMenuGroup;

public PlaybackSpeedMenuFilter() {
addPathCallbacks(
new StringFilterGroup(
Settings.ENABLE_CUSTOM_PLAYBACK_SPEED,
"playback_speed_sheet_content.eml-js"
)
// 0.05x litho speed menu.
final StringFilterGroup playbackRateSelectorGroup = new StringFilterGroup(
Settings.ENABLE_CUSTOM_PLAYBACK_SPEED,
"playback_rate_selector_menu_sheet.eml-js"
);

// Old litho based speed menu.
oldPlaybackMenuGroup = new StringFilterGroup(
Settings.ENABLE_CUSTOM_PLAYBACK_SPEED,
"playback_speed_sheet_content.eml-js");

addPathCallbacks(playbackRateSelectorGroup, oldPlaybackMenuGroup);
}

@Override
public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
isPlaybackSpeedMenuVisible = true;
if (matchedGroup == oldPlaybackMenuGroup) {
isOldPlaybackSpeedMenuVisible = true;
} else {
isPlaybackRateSelectorMenuVisible = true;
}

return false;
}
Expand Down
Loading

0 comments on commit 4a8e266

Please sign in to comment.