You've already forked revanced-integrations
mirror of
https://github.com/revanced/revanced-integrations
synced 2025-11-21 18:35:37 +01:00
Compare commits
15 Commits
v0.116.0-d
...
v0.116.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61e961a9e3 | ||
|
|
420b9263b6 | ||
|
|
fbc6855c4a | ||
|
|
ebd425b7ff | ||
|
|
13afac906a | ||
|
|
7510c0632f | ||
|
|
33e3c6b061 | ||
|
|
842f5f7616 | ||
|
|
d354356b2d | ||
|
|
95dae4896e | ||
|
|
2188607340 | ||
|
|
efa60dc64a | ||
|
|
2ba44526d5 | ||
|
|
8648434f99 | ||
|
|
97880eaf72 |
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
||||
# [0.116.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.6...v0.116.0-dev.7) (2023-08-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use correct logging tags ([420b926](https://github.com/ReVanced/revanced-integrations/commit/420b9263b6e1cbb81aeb4985cf454b51912b51f8))
|
||||
|
||||
# [0.116.0-dev.6](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.5...v0.116.0-dev.6) (2023-08-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide Shorts components:** Hide `shorts header` ([#455](https://github.com/ReVanced/revanced-integrations/issues/455)) ([13afac9](https://github.com/ReVanced/revanced-integrations/commit/13afac906a0087ea7bc888c80e293f7b05c0a46e))
|
||||
|
||||
# [0.116.0-dev.5](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.4...v0.116.0-dev.5) (2023-08-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Add `Alternative thumbnails` patch ([#462](https://github.com/ReVanced/revanced-integrations/issues/462)) ([d354356](https://github.com/ReVanced/revanced-integrations/commit/d354356b2d9052bc0d388633ed9eb0206f7c2058))
|
||||
|
||||
# [0.116.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.3...v0.116.0-dev.4) (2023-08-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Litho Filter:** Don't remove the buffer until the thread stops ([#461](https://github.com/ReVanced/revanced-integrations/issues/461)) ([2188607](https://github.com/ReVanced/revanced-integrations/commit/218860734021ef89699de110ec2dcf63412761b9))
|
||||
|
||||
# [0.116.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.2...v0.116.0-dev.3) (2023-08-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Player Flyout Menu:** Change 'audio track flyout menu' to show up by default ([#458](https://github.com/ReVanced/revanced-integrations/issues/458)) ([97880ea](https://github.com/ReVanced/revanced-integrations/commit/97880eaf72b0ae746ae3851d51e36039244b01c0))
|
||||
|
||||
# [0.116.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.1...v0.116.0-dev.2) (2023-08-07)
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ plugins {
|
||||
|
||||
android {
|
||||
compileSdk = 33
|
||||
buildToolsVersion = "33.0.1"
|
||||
namespace = "app.revanced.integrations"
|
||||
|
||||
defaultConfig {
|
||||
@@ -44,7 +43,7 @@ android {
|
||||
dependencies {
|
||||
compileOnly(project(mapOf("path" to ":dummy")))
|
||||
compileOnly("androidx.annotation:annotation:1.6.0")
|
||||
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha02")
|
||||
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha03")
|
||||
compileOnly("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
|
||||
compileOnly("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,7 +86,7 @@ public final class AdsFilter extends Filter {
|
||||
"cta_shelf_card"
|
||||
);
|
||||
|
||||
this.pathFilterGroups.addAll(
|
||||
this.pathFilterGroupList.addAll(
|
||||
generalAds,
|
||||
buttonedAd,
|
||||
merchandise,
|
||||
@@ -95,7 +95,7 @@ public final class AdsFilter extends Filter {
|
||||
webLinkPanel,
|
||||
movieAds
|
||||
);
|
||||
this.identifierFilterGroups.addAll(carouselAd);
|
||||
this.identifierFilterGroupList.addAll(carouselAd);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,26 +9,25 @@ import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
final class ButtonsFilter extends Filter {
|
||||
|
||||
private static final String VIDEO_ACTION_BAR_PATH = "video_action_bar.eml";
|
||||
|
||||
private final StringFilterGroup actionBarRule;
|
||||
private final StringFilterGroup bufferFilterPathRule;
|
||||
private final StringFilterGroup actionBarGroup;
|
||||
private final StringFilterGroup bufferFilterPathGroup;
|
||||
private final ByteArrayFilterGroupList bufferButtonsGroupList = new ByteArrayFilterGroupList();
|
||||
|
||||
public ButtonsFilter() {
|
||||
actionBarRule = new StringFilterGroup(
|
||||
actionBarGroup = new StringFilterGroup(
|
||||
null,
|
||||
VIDEO_ACTION_BAR_PATH
|
||||
);
|
||||
identifierFilterGroups.addAll(actionBarRule);
|
||||
identifierFilterGroupList.addAll(actionBarGroup);
|
||||
|
||||
|
||||
bufferFilterPathRule = new StringFilterGroup(
|
||||
bufferFilterPathGroup = new StringFilterGroup(
|
||||
null,
|
||||
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
|
||||
);
|
||||
pathFilterGroups.addAll(
|
||||
pathFilterGroupList.addAll(
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_LIKE_DISLIKE_BUTTON,
|
||||
"|segmented_like_dislike_button"
|
||||
@@ -45,7 +44,7 @@ final class ButtonsFilter extends Filter {
|
||||
SettingsEnum.HIDE_CLIP_BUTTON,
|
||||
"|clip_button.eml|"
|
||||
),
|
||||
bufferFilterPathRule
|
||||
bufferFilterPathGroup
|
||||
);
|
||||
|
||||
bufferButtonsGroupList.addAll(
|
||||
@@ -83,11 +82,11 @@ final class ButtonsFilter extends Filter {
|
||||
}
|
||||
|
||||
private boolean isEveryFilterGroupEnabled() {
|
||||
for (FilterGroup rule : pathFilterGroups)
|
||||
if (!rule.isEnabled()) return false;
|
||||
for (var group : pathFilterGroupList)
|
||||
if (!group.isEnabled()) return false;
|
||||
|
||||
for (FilterGroup rule : bufferButtonsGroupList)
|
||||
if (!rule.isEnabled()) return false;
|
||||
for (var group : bufferButtonsGroupList)
|
||||
if (!group.isEnabled()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -95,17 +94,19 @@ final class ButtonsFilter extends Filter {
|
||||
@Override
|
||||
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
if (matchedGroup == actionBarRule) {
|
||||
// If the current matched group is the action bar group,
|
||||
// in case every filter group is enabled, hide the action bar.
|
||||
if (matchedGroup == actionBarGroup) {
|
||||
if (!isEveryFilterGroupEnabled()) {
|
||||
return false;
|
||||
}
|
||||
} else if (matchedGroup == bufferFilterPathRule) {
|
||||
if (!path.startsWith(VIDEO_ACTION_BAR_PATH)) {
|
||||
return false; // Some other unknown button and not part of the player action buttons.
|
||||
}
|
||||
if (!bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) {
|
||||
return false; // Action button is not set to hide.
|
||||
}
|
||||
} else if (matchedGroup == bufferFilterPathGroup) {
|
||||
// Make sure the current path is the right one
|
||||
// to avoid false positives.
|
||||
if (!path.startsWith(VIDEO_ACTION_BAR_PATH)) return false;
|
||||
|
||||
// In case the group list has no match, return false.
|
||||
if (!bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) return false;
|
||||
}
|
||||
|
||||
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
|
||||
@@ -18,7 +18,7 @@ final class CommentsFilter extends Filter {
|
||||
"comments_entry_point_simplebox"
|
||||
);
|
||||
|
||||
this.pathFilterGroups.addAll(
|
||||
this.pathFilterGroupList.addAll(
|
||||
comments,
|
||||
previewComment
|
||||
);
|
||||
|
||||
@@ -142,7 +142,7 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
"chips_shelf"
|
||||
);
|
||||
|
||||
this.pathFilterGroups.addAll(
|
||||
this.pathFilterGroupList.addAll(
|
||||
channelBar,
|
||||
communityPosts,
|
||||
paidContent,
|
||||
@@ -165,7 +165,7 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
custom
|
||||
);
|
||||
|
||||
this.identifierFilterGroups.addAll(
|
||||
this.identifierFilterGroupList.addAll(
|
||||
graySeparator,
|
||||
chipsShelf
|
||||
);
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Spliterator;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.ByteTrieSearch;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.StringTrieSearch;
|
||||
import app.revanced.integrations.utils.TrieSearch;
|
||||
|
||||
abstract class FilterGroup<T> {
|
||||
final static class FilterGroupResult {
|
||||
SettingsEnum setting;
|
||||
@@ -283,8 +273,8 @@ abstract class Filter {
|
||||
* will never be called for any matches.
|
||||
*/
|
||||
|
||||
protected final StringFilterGroupList pathFilterGroups = new StringFilterGroupList();
|
||||
protected final StringFilterGroupList identifierFilterGroups = new StringFilterGroupList();
|
||||
protected final StringFilterGroupList pathFilterGroupList = new StringFilterGroupList();
|
||||
protected final StringFilterGroupList identifierFilterGroupList = new StringFilterGroupList();
|
||||
|
||||
/**
|
||||
* Called after an enabled filter has been matched.
|
||||
@@ -302,9 +292,9 @@ abstract class Filter {
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
if (SettingsEnum.DEBUG.getBoolean()) {
|
||||
if (pathFilterGroups == matchedList) {
|
||||
if (pathFilterGroupList == matchedList) {
|
||||
LogHelper.printDebug(() -> getClass().getSimpleName() + " Filtered path: " + path);
|
||||
} else if (identifierFilterGroups == matchedList) {
|
||||
} else if (identifierFilterGroupList == matchedList) {
|
||||
LogHelper.printDebug(() -> getClass().getSimpleName() + " Filtered identifier: " + identifier);
|
||||
}
|
||||
}
|
||||
@@ -391,8 +381,8 @@ public final class LithoFilterPatch {
|
||||
|
||||
static {
|
||||
for (Filter filter : filters) {
|
||||
filterGroupLists(pathSearchTree, filter, filter.pathFilterGroups);
|
||||
filterGroupLists(identifierSearchTree, filter, filter.identifierFilterGroups);
|
||||
filterGroupLists(pathSearchTree, filter, filter.pathFilterGroupList);
|
||||
filterGroupLists(identifierSearchTree, filter, filter.identifierFilterGroupList);
|
||||
}
|
||||
|
||||
LogHelper.printDebug(() -> "Using: "
|
||||
@@ -425,6 +415,10 @@ public final class LithoFilterPatch {
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static void setProtoBuffer(@NonNull ByteBuffer protobufBuffer) {
|
||||
// Set the buffer to a thread local. The buffer will remain in memory, even after the call to #filter completes.
|
||||
// This is intentional, as it appears the buffer can be set once and then filtered multiple times.
|
||||
// The buffer will be cleared from memory after a new buffer is set by the same thread,
|
||||
// or when the calling thread eventually dies.
|
||||
bufferThreadLocal.set(protobufBuffer);
|
||||
}
|
||||
|
||||
@@ -452,8 +446,6 @@ public final class LithoFilterPatch {
|
||||
if (pathSearchTree.matches(parameter.path, parameter)) return true;
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "Litho filter failure", ex);
|
||||
} finally {
|
||||
bufferThreadLocal.remove(); // Cleanup and remove the buffer.
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -8,7 +8,7 @@ public final class PlaybackSpeedMenuFilterPatch extends Filter {
|
||||
public static volatile boolean isPlaybackSpeedMenuVisible;
|
||||
|
||||
public PlaybackSpeedMenuFilterPatch() {
|
||||
pathFilterGroups.addAll(new StringFilterGroup(
|
||||
pathFilterGroupList.addAll(new StringFilterGroup(
|
||||
null,
|
||||
"playback_speed_sheet_content.eml-js"
|
||||
));
|
||||
|
||||
@@ -15,7 +15,7 @@ public class PlayerFlyoutMenuItemsFilter extends Filter {
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public PlayerFlyoutMenuItemsFilter() {
|
||||
identifierFilterGroups.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
|
||||
identifierFilterGroupList.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
|
||||
|
||||
flyoutFilterGroupList.addAll(
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
|
||||
@@ -12,45 +12,21 @@ import com.google.android.libraries.youtube.rendering.ui.pivotbar.PivotBar;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public final class ShortsFilter extends Filter {
|
||||
private static final String REEL_CHANNEL_BAR_PATH = "reel_channel_bar";
|
||||
private static final String REEL_CHANNEL_BAR_PATH = "reel_channel_bar.eml";
|
||||
public static PivotBar pivotBar; // Set by patch.
|
||||
|
||||
private final StringFilterGroup channelBar;
|
||||
private final StringFilterGroup soundButton;
|
||||
private final StringFilterGroup infoPanel;
|
||||
private final StringFilterGroup shortsShelfHeader;
|
||||
|
||||
public ShortsFilter() {
|
||||
channelBar = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_CHANNEL_BAR,
|
||||
REEL_CHANNEL_BAR_PATH
|
||||
);
|
||||
|
||||
soundButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_SOUND_BUTTON,
|
||||
"reel_pivot_button"
|
||||
);
|
||||
|
||||
infoPanel = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_INFO_PANEL,
|
||||
"shorts_info_panel_overview"
|
||||
);
|
||||
|
||||
final var thanksButton = new StringFilterGroup(
|
||||
// Home / subscription feed components.
|
||||
var thanksButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_THANKS_BUTTON,
|
||||
"suggested_action"
|
||||
);
|
||||
|
||||
final var subscribeButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_SUBSCRIBE_BUTTON,
|
||||
"subscribe_button"
|
||||
);
|
||||
|
||||
final var joinButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_JOIN_BUTTON,
|
||||
"sponsor_button"
|
||||
);
|
||||
|
||||
final var shorts = new StringFilterGroup(
|
||||
var shorts = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS,
|
||||
"shorts_shelf",
|
||||
"inline_shorts",
|
||||
@@ -58,22 +34,58 @@ public final class ShortsFilter extends Filter {
|
||||
"shorts_video_cell",
|
||||
"shorts_pivot_item"
|
||||
);
|
||||
// Use a different filter group for this pattern, as it requires an additional check after matching.
|
||||
shortsShelfHeader = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS,
|
||||
"shelf_header.eml"
|
||||
);
|
||||
identifierFilterGroupList.addAll(shorts, shortsShelfHeader, thanksButton);
|
||||
|
||||
pathFilterGroups.addAll(joinButton, subscribeButton, channelBar, soundButton, infoPanel);
|
||||
identifierFilterGroups.addAll(shorts, thanksButton);
|
||||
|
||||
// Shorts player components.
|
||||
var joinButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_JOIN_BUTTON,
|
||||
"sponsor_button"
|
||||
);
|
||||
var subscribeButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_SUBSCRIBE_BUTTON,
|
||||
"subscribe_button"
|
||||
);
|
||||
channelBar = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_CHANNEL_BAR,
|
||||
REEL_CHANNEL_BAR_PATH
|
||||
);
|
||||
soundButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_SOUND_BUTTON,
|
||||
"reel_pivot_button"
|
||||
);
|
||||
infoPanel = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_INFO_PANEL,
|
||||
"shorts_info_panel_overview"
|
||||
);
|
||||
pathFilterGroupList.addAll(joinButton, subscribeButton, channelBar, soundButton, infoPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
if (matchedGroup == soundButton || matchedGroup == infoPanel || matchedGroup == channelBar) return true;
|
||||
if (matchedList == pathFilterGroupList) {
|
||||
// Always filter if matched.
|
||||
if (matchedGroup == soundButton || matchedGroup == infoPanel || matchedGroup == channelBar)
|
||||
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
|
||||
// Filter the path only when reelChannelBar is visible.
|
||||
if (pathFilterGroups == matchedList) {
|
||||
return path.contains(REEL_CHANNEL_BAR_PATH);
|
||||
// Filter other path groups from pathFilterGroupList, only when reelChannelBar is visible
|
||||
// to avoid false positives.
|
||||
if (!path.startsWith(REEL_CHANNEL_BAR_PATH))
|
||||
return false;
|
||||
} else if (matchedGroup == shortsShelfHeader) {
|
||||
// Because the header is used in watch history and possibly other places, check for the index,
|
||||
// which is 0 when the shelf header is used for Shorts.
|
||||
if (matchedIndex != 0) return false;
|
||||
}
|
||||
|
||||
return identifierFilterGroups == matchedList;
|
||||
// Super class handles logging.
|
||||
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
}
|
||||
|
||||
public static void hideShortsShelf(final View shortsShelfView) {
|
||||
|
||||
@@ -10,7 +10,7 @@ public final class VideoQualityMenuFilterPatch extends Filter {
|
||||
public static volatile boolean isVideoQualityMenuVisible;
|
||||
|
||||
public VideoQualityMenuFilterPatch() {
|
||||
pathFilterGroups.addAll(new StringFilterGroup(
|
||||
pathFilterGroupList.addAll(new StringFilterGroup(
|
||||
SettingsEnum.SHOW_OLD_VIDEO_QUALITY_MENU,
|
||||
"quick_quality_sheet_content.eml-js"
|
||||
));
|
||||
|
||||
@@ -154,6 +154,10 @@ public enum SettingsEnum {
|
||||
HIDE_SHORTS_NAVIGATION_BAR("revanced_hide_shorts_navigation_bar", BOOLEAN, TRUE, true),
|
||||
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),
|
||||
|
||||
ALT_THUMBNAIL("revanced_alt_thumbnail", BOOLEAN, FALSE),
|
||||
ALT_THUMBNAIL_TYPE("revanced_alt_thumbnail_type", INTEGER, 2, parents(ALT_THUMBNAIL)),
|
||||
ALT_THUMBNAIL_FAST_QUALITY("revanced_alt_thumbnail_fast_quality", BOOLEAN, FALSE, parents(ALT_THUMBNAIL)),
|
||||
|
||||
//Player flyout menu items
|
||||
HIDE_QUALITY_MENU("revanced_hide_player_flyout_quality", BOOLEAN, FALSE),
|
||||
HIDE_CAPTIONS_MENU("revanced_hide_player_flyout_captions", BOOLEAN, FALSE),
|
||||
@@ -163,7 +167,7 @@ public enum SettingsEnum {
|
||||
HIDE_HELP_MENU("revanced_hide_player_flyout_help", BOOLEAN, TRUE),
|
||||
HIDE_SPEED_MENU("revanced_hide_player_flyout_speed", BOOLEAN, FALSE),
|
||||
HIDE_MORE_INFO_MENU("revanced_hide_player_flyout_more_info", BOOLEAN, TRUE),
|
||||
HIDE_AUDIO_TRACK_MENU("revanced_hide_player_flyout_audio_track", BOOLEAN, TRUE),
|
||||
HIDE_AUDIO_TRACK_MENU("revanced_hide_player_flyout_audio_track", BOOLEAN, FALSE),
|
||||
HIDE_WATCH_IN_VR_MENU("revanced_hide_player_flyout_watch_in_vr", BOOLEAN, TRUE),
|
||||
|
||||
// Misc
|
||||
|
||||
@@ -80,12 +80,24 @@ public enum SharedPrefCategory {
|
||||
@NonNull
|
||||
public String getString(@NonNull String key, @NonNull String _default) {
|
||||
Objects.requireNonNull(_default);
|
||||
return preferences.getString(key, _default);
|
||||
try {
|
||||
return preferences.getString(key, _default);
|
||||
} catch (ClassCastException ex) {
|
||||
// Value stored is a completely different type (should never happen).
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean getBoolean(@NonNull String key, boolean _default) {
|
||||
return preferences.getBoolean(key, _default);
|
||||
try {
|
||||
return preferences.getBoolean(key, _default);
|
||||
} catch (ClassCastException ex) {
|
||||
// Value stored is a completely different type (should never happen).
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -30,9 +30,19 @@ public final class ByteTrieSearch extends TrieSearch<byte[]> {
|
||||
super.addPattern(pattern, pattern.length, Objects.requireNonNull(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull byte[] textToSearch, int startIndex, int endIndex, @Nullable Object callbackParameter) {
|
||||
return super.matches(textToSearch, textToSearch.length, startIndex, endIndex, callbackParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull byte[] textToSearch, int startIndex) {
|
||||
return matches(textToSearch, startIndex, textToSearch.length, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull byte[] textToSearch, @Nullable Object callbackParameter) {
|
||||
return super.matches(textToSearch, textToSearch.length, callbackParameter);
|
||||
return matches(textToSearch,0, textToSearch.length, callbackParameter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,8 +33,18 @@ public final class StringTrieSearch extends TrieSearch<String> {
|
||||
super.addPattern(pattern, pattern.length(), Objects.requireNonNull(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull String textToSearch, int startIndex, int endIndex, @Nullable Object callbackParameter) {
|
||||
return super.matches(textToSearch, textToSearch.length(), startIndex, endIndex, callbackParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull String textToSearch, @Nullable Object callbackParameter) {
|
||||
return super.matches(textToSearch, textToSearch.length(), callbackParameter);
|
||||
return matches(textToSearch, 0, textToSearch.length(), callbackParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull String textToSearch, int startIndex) {
|
||||
return matches(textToSearch, startIndex, textToSearch.length(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,12 +243,17 @@ public abstract class TrieSearch<T> {
|
||||
root.addPattern(pattern, patternLength, 0, callback);
|
||||
}
|
||||
|
||||
boolean matches(@NonNull T textToSearch, int textToSearchLength, @Nullable Object callbackParameter) {
|
||||
final boolean matches(@NonNull T textToSearch, int textToSearchLength, int startIndex, int endIndex,
|
||||
@Nullable Object callbackParameter) {
|
||||
if (endIndex > textToSearchLength) {
|
||||
throw new IllegalArgumentException("endIndex: " + endIndex
|
||||
+ " is greater than texToSearchLength: " + textToSearchLength);
|
||||
}
|
||||
if (patterns.size() == 0) {
|
||||
return false; // No patterns were added.
|
||||
}
|
||||
for (int i = 0; i < textToSearchLength; i++) {
|
||||
if (root.matches(textToSearch, textToSearchLength, i, 0, callbackParameter)) return true;
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
if (root.matches(textToSearch, endIndex, i, 0, callbackParameter)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -287,19 +292,27 @@ public abstract class TrieSearch<T> {
|
||||
*/
|
||||
public abstract void addPattern(@NonNull T pattern, @NonNull TriePatternMatchedCallback<T> callback);
|
||||
|
||||
|
||||
/**
|
||||
* Searches through text, looking for any substring that matches any pattern in this tree.
|
||||
*
|
||||
* @param textToSearch Text to search through.
|
||||
* @param startIndex Index to start searching, inclusive value.
|
||||
* @param endIndex Index to stop matching, exclusive value.
|
||||
* @param callbackParameter Optional parameter passed to the callbacks.
|
||||
* @return If any pattern matched, and it's callback halted searching.
|
||||
*/
|
||||
public abstract boolean matches(@NonNull T textToSearch, int startIndex, int endIndex, @Nullable Object callbackParameter);
|
||||
|
||||
public abstract boolean matches(@NonNull T textToSearch, int startIndex);
|
||||
|
||||
public abstract boolean matches(@NonNull T textToSearch, @Nullable Object callbackParameter);
|
||||
|
||||
/**
|
||||
* Identical to {@link #matches(Object, Object)} but with a null callback parameter.
|
||||
*/
|
||||
public final boolean matches(@NonNull T textToSearch, int startIndex, int endIndex) {
|
||||
return matches(textToSearch, startIndex, endIndex, null);
|
||||
}
|
||||
|
||||
public final boolean matches(@NonNull T textToSearch) {
|
||||
return matches(textToSearch, null);
|
||||
return matches(textToSearch, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ internal object TwiFucker {
|
||||
|
||||
private fun JSONObject.jsonCheckAndRemoveRecommendedUsers() {
|
||||
if (jsonHasRecommendedUsers()) {
|
||||
Log.d("revanced", "Handle recommended users: $this")
|
||||
Log.d("ReVanced", "Handle recommended users: $this")
|
||||
jsonRemoveRecommendedUsers()
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ internal object TwiFucker {
|
||||
|
||||
private fun JSONObject.jsonCheckAndRemoveThreads() {
|
||||
if (jsonHasThreads()) {
|
||||
Log.d("revabced", "Handle threads: $this")
|
||||
Log.d("ReVanced", "Handle threads: $this")
|
||||
jsonRemoveThreads()
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ internal object TwiFucker {
|
||||
val trendRemoveIndex = mutableListOf<Int>()
|
||||
forEachIndexed { trendIndex, trend ->
|
||||
if (trend.trendHasPromotedMetadata()) {
|
||||
Log.d("revanced", "Handle trends ads $trendIndex $trend")
|
||||
Log.d("ReVanced", "Handle trends ads $trendIndex $trend")
|
||||
trendRemoveIndex.add(trendIndex)
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ internal object TwiFucker {
|
||||
entry.entryGetTrends()?.trendRemoveAds()
|
||||
|
||||
if (entry.entryHasPromotedMetadata()) {
|
||||
Log.d("revanced", "Handle timeline ads $entryIndex $entry")
|
||||
Log.d("ReVanced", "Handle timeline ads $entryIndex $entry")
|
||||
removeIndex.add(entryIndex)
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ internal object TwiFucker {
|
||||
val contentItems = entry.entryGetContentItems()
|
||||
contentItems?.forEachIndexed inner@{ itemIndex, item ->
|
||||
if (item.entryHasPromotedMetadata()) {
|
||||
Log.d("revanced", "Handle timeline replies ads $entryIndex $entry")
|
||||
Log.d("ReVanced", "Handle timeline replies ads $entryIndex $entry")
|
||||
if (contentItems.length() == 1) {
|
||||
removeIndex.add(entryIndex)
|
||||
} else {
|
||||
@@ -150,7 +150,7 @@ internal object TwiFucker {
|
||||
forEachIndexed { entryIndex, entry ->
|
||||
|
||||
if (entry.entryIsTweetDetailRelatedTweets()) {
|
||||
Log.d("revanced", "Handle tweet detail related tweets $entryIndex $entry")
|
||||
Log.d("ReVanced", "Handle tweet detail related tweets $entryIndex $entry")
|
||||
removeIndex.add(entryIndex)
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ internal object TwiFucker {
|
||||
forEachIndexed { entryIndex, entry ->
|
||||
if (!entry.entryIsWhoToFollow()) return@forEachIndexed
|
||||
|
||||
Log.d("revanced", "Handle whoToFollow $entryIndex $entry")
|
||||
Log.d("ReVanced", "Handle whoToFollow $entryIndex $entry")
|
||||
entryRemoveIndex.add(entryIndex)
|
||||
|
||||
val items = entry.entryGetContentItems()
|
||||
@@ -188,7 +188,7 @@ internal object TwiFucker {
|
||||
items?.forEachIndexed { index, item ->
|
||||
item.itemContainsPromotedUser().let {
|
||||
if (it) {
|
||||
Log.d("revanced", "Handle whoToFollow promoted user $index $item")
|
||||
Log.d("ReVanced", "Handle whoToFollow promoted user $index $item")
|
||||
userRemoveIndex.add(index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.4.2")
|
||||
classpath("com.android.tools.build:gradle:8.0.2")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
|
||||
}
|
||||
}
|
||||
|
||||
12
dummy/src/main/java/org/chromium/net/UrlResponseInfo.java
Normal file
12
dummy/src/main/java/org/chromium/net/UrlResponseInfo.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package org.chromium.net;
|
||||
|
||||
//dummy class
|
||||
public abstract class UrlResponseInfo {
|
||||
|
||||
public abstract String getUrl();
|
||||
|
||||
public abstract int getHttpStatusCode();
|
||||
|
||||
// Add additional existing methods, if needed.
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
android.useAndroidX = true
|
||||
version = 0.116.0-dev.2
|
||||
version = 0.116.0-dev.7
|
||||
|
||||
Reference in New Issue
Block a user