You've already forked revanced-integrations
mirror of
https://github.com/revanced/revanced-integrations
synced 2025-11-19 03:23:27 +01:00
Compare commits
42 Commits
v0.115.0-d
...
v0.116.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a249b1648d | ||
|
|
aa9d892cde | ||
|
|
aff6e98f64 | ||
|
|
44dccb3d65 | ||
|
|
61e961a9e3 | ||
|
|
420b9263b6 | ||
|
|
fbc6855c4a | ||
|
|
ebd425b7ff | ||
|
|
13afac906a | ||
|
|
7510c0632f | ||
|
|
33e3c6b061 | ||
|
|
842f5f7616 | ||
|
|
d354356b2d | ||
|
|
95dae4896e | ||
|
|
2188607340 | ||
|
|
efa60dc64a | ||
|
|
2ba44526d5 | ||
|
|
8648434f99 | ||
|
|
97880eaf72 | ||
|
|
7ca6a080a3 | ||
|
|
8e5ca65286 | ||
|
|
c1af6e699d | ||
|
|
769a2006ce | ||
|
|
8517e8a149 | ||
|
|
9e56c40d88 | ||
|
|
3c69108caa | ||
|
|
6959808f0c | ||
|
|
e0d77a0060 | ||
|
|
2ab34fce31 | ||
|
|
cf76cbe72f | ||
|
|
c16c038396 | ||
|
|
d2a8c33109 | ||
|
|
d3f523f9dd | ||
|
|
1c2976526e | ||
|
|
18f29004b8 | ||
|
|
0207496926 | ||
|
|
b2085aeebf | ||
|
|
ac8de0a3b7 | ||
|
|
d4bc6cff68 | ||
|
|
e906c6d3a2 | ||
|
|
fdc56bf68e | ||
|
|
ea7bc57375 |
140
CHANGELOG.md
140
CHANGELOG.md
@@ -1,3 +1,143 @@
|
||||
# [0.116.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.8...v0.116.0-dev.9) (2023-08-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Support version 18.32.39 ([#464](https://github.com/ReVanced/revanced-integrations/issues/464)) ([aa9d892](https://github.com/ReVanced/revanced-integrations/commit/aa9d892cde59c39718529bc40a66b93a1cb78f82))
|
||||
|
||||
# [0.116.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.7...v0.116.0-dev.8) (2023-08-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Add `Custom player overlay opacity` patch ([#449](https://github.com/ReVanced/revanced-integrations/issues/449)) ([44dccb3](https://github.com/ReVanced/revanced-integrations/commit/44dccb3d658852e92aaf8d17e36dc205f1b3eb05))
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Hide video action buttons:** Hide individual action buttons ([#451](https://github.com/ReVanced/revanced-integrations/issues/451)) ([8e5ca65](https://github.com/ReVanced/revanced-integrations/commit/8e5ca65286b8b62eaeff3bce5fa1d2fb5a198703))
|
||||
|
||||
# [0.116.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.115.1...v0.116.0-dev.1) (2023-08-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Debug:** Logging of layout proto buffer strings ([#456](https://github.com/ReVanced/revanced-integrations/issues/456)) ([769a200](https://github.com/ReVanced/revanced-integrations/commit/769a2006ce8dc934dd5de0acc59ed6aa6985da4f))
|
||||
|
||||
## [0.115.1](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0...v0.115.1) (2023-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide Shorts components:** Hide new type of shorts in feed ([#453](https://github.com/ReVanced/revanced-integrations/issues/453)) ([6959808](https://github.com/ReVanced/revanced-integrations/commit/6959808f0c24e638a33f671728f7a9668f2de2c2))
|
||||
|
||||
## [0.115.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0...v0.115.1-dev.1) (2023-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide Shorts components:** Hide new type of shorts in feed ([#453](https://github.com/ReVanced/revanced-integrations/issues/453)) ([6959808](https://github.com/ReVanced/revanced-integrations/commit/6959808f0c24e638a33f671728f7a9668f2de2c2))
|
||||
|
||||
# [0.115.0](https://github.com/ReVanced/revanced-integrations/compare/v0.114.0...v0.115.0) (2023-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - SponsorBlock:** Fix skip highlight button showing when set to 'show in seekbar' ([ea7bc57](https://github.com/ReVanced/revanced-integrations/commit/ea7bc5737584ce967becd5b9e5d0d57f5d2fbc49))
|
||||
* **YouTube - Spoof App Version:** Remove 17.30.35 target ([e906c6d](https://github.com/ReVanced/revanced-integrations/commit/e906c6d3a2195c94c926f9903f1e4e66c3714e3e))
|
||||
* **YouTube:** fix potential litho filter thread race ([d3f523f](https://github.com/ReVanced/revanced-integrations/commit/d3f523f9dd5c3638cf9e2ba849b91e446daa99fa))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Tiktok - Feed filter:** Add more filters ([#445](https://github.com/ReVanced/revanced-integrations/issues/445)) ([c16c038](https://github.com/ReVanced/revanced-integrations/commit/c16c038396bde365ce1eec7b385eeb1f485efe99))
|
||||
* **YouTube - Hide layout components:** Hide `chips shelf` ([#448](https://github.com/ReVanced/revanced-integrations/issues/448)) ([c7d2a9b](https://github.com/ReVanced/revanced-integrations/commit/c7d2a9b3101439b241218c45d0c4b64012adab65))
|
||||
* **YouTube:** add `Player Flyout Menu` patch ([#416](https://github.com/ReVanced/revanced-integrations/issues/416)) ([b2085ae](https://github.com/ReVanced/revanced-integrations/commit/b2085aeebf4cfc21d69c0abfe545b382e2c82abe))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **YouTube:** Filter litho components using prefix tree ([#447](https://github.com/ReVanced/revanced-integrations/issues/447)) ([18f2900](https://github.com/ReVanced/revanced-integrations/commit/18f29004b8d570915a0228e292f1256785ac2cab))
|
||||
|
||||
# [0.115.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.6...v0.115.0-dev.7) (2023-08-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Tiktok - Feed filter:** Add more filters ([#445](https://github.com/ReVanced/revanced-integrations/issues/445)) ([c16c038](https://github.com/ReVanced/revanced-integrations/commit/c16c038396bde365ce1eec7b385eeb1f485efe99))
|
||||
|
||||
# [0.115.0-dev.6](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.5...v0.115.0-dev.6) (2023-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube:** fix potential litho filter thread race ([d3f523f](https://github.com/ReVanced/revanced-integrations/commit/d3f523f9dd5c3638cf9e2ba849b91e446daa99fa))
|
||||
|
||||
# [0.115.0-dev.5](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.4...v0.115.0-dev.5) (2023-08-01)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **YouTube:** Filter litho components using prefix tree ([#447](https://github.com/ReVanced/revanced-integrations/issues/447)) ([18f2900](https://github.com/ReVanced/revanced-integrations/commit/18f29004b8d570915a0228e292f1256785ac2cab))
|
||||
|
||||
# [0.115.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.3...v0.115.0-dev.4) (2023-07-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** add `Player Flyout Menu` patch ([#416](https://github.com/ReVanced/revanced-integrations/issues/416)) ([b2085ae](https://github.com/ReVanced/revanced-integrations/commit/b2085aeebf4cfc21d69c0abfe545b382e2c82abe))
|
||||
|
||||
# [0.115.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.2...v0.115.0-dev.3) (2023-07-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Spoof App Version:** Remove 17.30.35 target ([e906c6d](https://github.com/ReVanced/revanced-integrations/commit/e906c6d3a2195c94c926f9903f1e4e66c3714e3e))
|
||||
|
||||
# [0.115.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v0.115.0-dev.1...v0.115.0-dev.2) (2023-07-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - SponsorBlock:** Fix skip highlight button showing when set to 'show in seekbar' ([ea7bc57](https://github.com/ReVanced/revanced-integrations/commit/ea7bc5737584ce967becd5b9e5d0d57f5d2fbc49))
|
||||
|
||||
# [0.115.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.114.0...v0.115.0-dev.1) (2023-07-26)
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -0,0 +1,22 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
public class CustomPlayerOverlayOpacityPatch {
|
||||
private static final int DEFAULT_OPACITY = (int) SettingsEnum.PLAYER_OVERLAY_OPACITY.defaultValue;
|
||||
|
||||
public static void changeOpacity(ImageView imageView) {
|
||||
int opacity = SettingsEnum.PLAYER_OVERLAY_OPACITY.getInt();
|
||||
|
||||
if (opacity < 0 || opacity > 100) {
|
||||
ReVancedUtils.showToastLong("Player overlay opacity must be between 0-100");
|
||||
SettingsEnum.PLAYER_OVERLAY_OPACITY.saveValue(DEFAULT_OPACITY);
|
||||
opacity = DEFAULT_OPACITY;
|
||||
}
|
||||
|
||||
imageView.setImageAlpha((opacity * 255) / 100);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HidePlayerOverlayPatch {
|
||||
public static void hidePlayerOverlay(ImageView view) {
|
||||
if (!SettingsEnum.HIDE_PLAYER_OVERLAY.getBoolean()) return;
|
||||
view.setImageResource(android.R.color.transparent);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideWatchInVRPatch {
|
||||
public static boolean hideWatchInVR() {
|
||||
return SettingsEnum.HIDE_WATCH_IN_VR.getBoolean();
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,14 @@ import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class OpenLinksExternallyPatch {
|
||||
/**
|
||||
* Override 'android.support.customtabs.action.CustomTabsService',
|
||||
* in order to open links in the default browser. This is done by returning an empty string,
|
||||
* for the service that handles custom tabs in the Android support library
|
||||
* which opens links in the default service instead.
|
||||
* Return the intent to open links with. If empty, the link will be opened with the default browser.
|
||||
*
|
||||
* @param original The original custom tabs service.
|
||||
* @return The new, default service to open links with or the original service.
|
||||
* @param originalIntent The original intent to open links with.
|
||||
* @return The intent to open links with. Empty means the link will be opened with the default browser.
|
||||
*/
|
||||
public static String enableExternalBrowser(String original) {
|
||||
if (SettingsEnum.EXTERNAL_BROWSER.getBoolean()) original = "";
|
||||
return original;
|
||||
public static String getIntent(String originalIntent) {
|
||||
if (SettingsEnum.EXTERNAL_BROWSER.getBoolean()) return "";
|
||||
|
||||
return originalIntent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,25 @@ package app.revanced.integrations.patches.components;
|
||||
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.StringTrieSearch;
|
||||
|
||||
|
||||
public final class AdsFilter extends Filter {
|
||||
private final String[] exceptions;
|
||||
private final StringTrieSearch exceptions = new StringTrieSearch();
|
||||
|
||||
public AdsFilter() {
|
||||
exceptions = new String[]{
|
||||
exceptions.addPatterns(
|
||||
"home_video_with_context", // Don't filter anything in the home page video component.
|
||||
"related_video_with_context", // Don't filter anything in the related video component.
|
||||
"comment_thread", // Don't filter anything in the comments.
|
||||
"|comment.", // Don't filter anything in the comments replies.
|
||||
"library_recent_shelf",
|
||||
};
|
||||
"library_recent_shelf"
|
||||
);
|
||||
|
||||
final var buttonedAd = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_BUTTONED_ADS,
|
||||
@@ -82,7 +86,7 @@ public final class AdsFilter extends Filter {
|
||||
"cta_shelf_card"
|
||||
);
|
||||
|
||||
this.pathFilterGroups.addAll(
|
||||
this.pathFilterGroupList.addAll(
|
||||
generalAds,
|
||||
buttonedAd,
|
||||
merchandise,
|
||||
@@ -91,15 +95,16 @@ public final class AdsFilter extends Filter {
|
||||
webLinkPanel,
|
||||
movieAds
|
||||
);
|
||||
this.identifierFilterGroups.addAll(carouselAd);
|
||||
this.identifierFilterGroupList.addAll(carouselAd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFiltered(final String path, final String identifier, final byte[] _protobufBufferArray) {
|
||||
if (ReVancedUtils.containsAny(path, exceptions))
|
||||
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
if (exceptions.matches(path))
|
||||
return false;
|
||||
|
||||
return super.isFiltered(path, identifier, _protobufBufferArray);
|
||||
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,54 +1,114 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
final class ButtonsFilter extends Filter {
|
||||
private final StringFilterGroup actionBarRule;
|
||||
private static final String VIDEO_ACTION_BAR_PATH = "video_action_bar.eml";
|
||||
|
||||
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"
|
||||
VIDEO_ACTION_BAR_PATH
|
||||
);
|
||||
identifierFilterGroupList.addAll(actionBarGroup);
|
||||
|
||||
pathFilterGroups.addAll(
|
||||
|
||||
bufferFilterPathGroup = new StringFilterGroup(
|
||||
null,
|
||||
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
|
||||
);
|
||||
pathFilterGroupList.addAll(
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_LIKE_DISLIKE_BUTTON,
|
||||
"|like_button",
|
||||
"dislike_button"
|
||||
"|segmented_like_dislike_button"
|
||||
),
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_DOWNLOAD_BUTTON,
|
||||
"download_button"
|
||||
"|download_button.eml|"
|
||||
),
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_PLAYLIST_BUTTON,
|
||||
"save_to_playlist_button"
|
||||
"|save_to_playlist_button"
|
||||
),
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_CLIP_BUTTON,
|
||||
"|clip_button.eml|"
|
||||
),
|
||||
new StringFilterGroup(
|
||||
SettingsEnum.HIDE_ACTION_BUTTONS,
|
||||
"ContainerType|video_action_button",
|
||||
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
|
||||
bufferFilterPathGroup
|
||||
);
|
||||
|
||||
bufferButtonsGroupList.addAll(
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_LIVE_CHAT_BUTTON,
|
||||
"yt_outline_message_bubble_overlap"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_REPORT_BUTTON,
|
||||
"yt_outline_flag"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_SHARE_BUTTON,
|
||||
"yt_outline_share"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_REMIX_BUTTON,
|
||||
"yt_outline_youtube_shorts_plus"
|
||||
),
|
||||
// Check for clip button both here and using a path filter,
|
||||
// as there's a chance the path is a generic action button and won't contain 'clip_button'
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_CLIP_BUTTON,
|
||||
"yt_outline_scissors"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_SHOP_BUTTON,
|
||||
"yt_outline_bag"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_THANKS_BUTTON,
|
||||
"yt_outline_dollar_sign_heart"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private boolean isEveryFilterGroupEnabled() {
|
||||
for (StringFilterGroup rule : pathFilterGroups)
|
||||
if (!rule.isEnabled()) return false;
|
||||
for (var group : pathFilterGroupList)
|
||||
if (!group.isEnabled()) return false;
|
||||
|
||||
for (var group : bufferButtonsGroupList)
|
||||
if (!group.isEnabled()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFiltered(final String path, final String identifier, final byte[] _protobufBufferArray) {
|
||||
if (isEveryFilterGroupEnabled())
|
||||
if (actionBarRule.check(identifier).isFiltered()) return true;
|
||||
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
// 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 == bufferFilterPathGroup) {
|
||||
// Make sure the current path is the right one
|
||||
// to avoid false positives.
|
||||
if (!path.startsWith(VIDEO_ACTION_BAR_PATH)) return false;
|
||||
|
||||
return super.isFiltered(path, identifier, _protobufBufferArray);
|
||||
// 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
|
||||
);
|
||||
|
||||
@@ -2,15 +2,16 @@ package app.revanced.integrations.patches.components;
|
||||
|
||||
|
||||
import android.os.Build;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.StringTrieSearch;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public final class LayoutComponentsFilter extends Filter {
|
||||
private final String[] exceptions;
|
||||
|
||||
private final StringTrieSearch exceptions = new StringTrieSearch();
|
||||
private final CustomFilterGroup custom;
|
||||
|
||||
private static final ByteArrayAsStringFilterGroup mixPlaylists = new ByteArrayAsStringFilterGroup(
|
||||
@@ -20,13 +21,13 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public LayoutComponentsFilter() {
|
||||
exceptions = new String[]{
|
||||
exceptions.addPatterns(
|
||||
"home_video_with_context",
|
||||
"related_video_with_context",
|
||||
"comment_thread", // skip filtering anything in the comments
|
||||
"|comment.", // skip filtering anything in the comments replies
|
||||
"library_recent_shelf",
|
||||
};
|
||||
"library_recent_shelf"
|
||||
);
|
||||
|
||||
custom = new CustomFilterGroup(
|
||||
SettingsEnum.CUSTOM_FILTER,
|
||||
@@ -141,7 +142,7 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
"chips_shelf"
|
||||
);
|
||||
|
||||
this.pathFilterGroups.addAll(
|
||||
this.pathFilterGroupList.addAll(
|
||||
channelBar,
|
||||
communityPosts,
|
||||
paidContent,
|
||||
@@ -160,29 +161,32 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
artistCard,
|
||||
imageShelf,
|
||||
subscribersCommunityGuidelines,
|
||||
channelMemberShelf
|
||||
channelMemberShelf,
|
||||
custom
|
||||
);
|
||||
|
||||
this.identifierFilterGroups.addAll(
|
||||
this.identifierFilterGroupList.addAll(
|
||||
graySeparator,
|
||||
chipsShelf
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFiltered(final String path, final String identifier, final byte[] _protobufBufferArray) {
|
||||
if (custom.isEnabled() && custom.check(path).isFiltered())
|
||||
return true;
|
||||
|
||||
if (ReVancedUtils.containsAny(path, exceptions))
|
||||
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
if (matchedGroup != custom && exceptions.matches(path))
|
||||
return false; // Exceptions are not filtered.
|
||||
|
||||
return super.isFiltered(path, identifier, _protobufBufferArray);
|
||||
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
}
|
||||
|
||||
|
||||
// Called from a different place then the other filters.
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* Called from a different place then the other filters.
|
||||
*/
|
||||
public static boolean filterMixPlaylists(final byte[] bytes) {
|
||||
return mixPlaylists.isEnabled() && mixPlaylists.check(bytes).isFiltered();
|
||||
return mixPlaylists.check(bytes).isFiltered();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,23 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
// Abuse LithoFilter for CustomPlaybackSpeedPatch.
|
||||
public final class PlaybackSpeedMenuFilterPatch 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;
|
||||
|
||||
public PlaybackSpeedMenuFilterPatch() {
|
||||
pathFilterGroups.addAll(new StringFilterGroup(
|
||||
pathFilterGroupList.addAll(new StringFilterGroup(
|
||||
null,
|
||||
"playback_speed_sheet_content.eml-js"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isFiltered(final String path, final String identifier, final byte[] protobufBufferArray) {
|
||||
isPlaybackSpeedMenuVisible = super.isFiltered(path, identifier, protobufBufferArray);
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
isPlaybackSpeedMenuVisible = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class PlayerFlyoutMenuItemsFilter extends Filter {
|
||||
|
||||
// Search the buffer only if the flyout menu identifier 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();
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public PlayerFlyoutMenuItemsFilter() {
|
||||
identifierFilterGroupList.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_LOOP_VIDEO_MENU,
|
||||
"yt_outline_arrow_repeat_1_"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_AMBIENT_MODE_MENU,
|
||||
"yt_outline_screen_light"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_REPORT_MENU,
|
||||
"yt_outline_flag"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_HELP_MENU,
|
||||
"yt_outline_question_circle"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_MORE_INFO_MENU,
|
||||
"yt_outline_info_circle"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_SPEED_MENU,
|
||||
"yt_outline_play_arrow_half_circle"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_AUDIO_TRACK_MENU,
|
||||
"yt_outline_person_radar"
|
||||
),
|
||||
new ByteArrayAsStringFilterGroup(
|
||||
SettingsEnum.HIDE_WATCH_IN_VR_MENU,
|
||||
"yt_outline_vr"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
// 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.
|
||||
return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,76 +1,91 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import android.view.View;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import com.google.android.libraries.youtube.rendering.ui.pivotbar.PivotBar;
|
||||
|
||||
import static app.revanced.integrations.utils.ReVancedUtils.hideViewBy1dpUnderCondition;
|
||||
import static app.revanced.integrations.utils.ReVancedUtils.hideViewUnderCondition;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.libraries.youtube.rendering.ui.pivotbar.PivotBar;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public final class ShortsFilter extends Filter {
|
||||
// Set by patch.
|
||||
public static PivotBar pivotBar;
|
||||
final StringFilterGroupList shortsFilterGroup = new StringFilterGroupList();
|
||||
private final StringFilterGroup reelChannelBar = new StringFilterGroup(
|
||||
null,
|
||||
"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() {
|
||||
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 soundButton = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_SOUND_BUTTON,
|
||||
"reel_pivot_button"
|
||||
);
|
||||
|
||||
final var infoPanel = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_INFO_PANEL,
|
||||
"shorts_info_panel_overview"
|
||||
);
|
||||
|
||||
final var channelBar = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS_CHANNEL_BAR,
|
||||
"reel_channel_bar"
|
||||
);
|
||||
|
||||
final var shorts = new StringFilterGroup(
|
||||
var shorts = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_SHORTS,
|
||||
"shorts_shelf",
|
||||
"inline_shorts",
|
||||
"shorts_grid",
|
||||
"shorts_video_cell"
|
||||
"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);
|
||||
|
||||
shortsFilterGroup.addAll(soundButton, infoPanel);
|
||||
pathFilterGroups.addAll(joinButton, subscribeButton, channelBar);
|
||||
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(final String path, final String identifier,
|
||||
final byte[] protobufBufferArray) {
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
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 (reelChannelBar.check(path).isFiltered())
|
||||
if (this.pathFilterGroups.contains(path)) return true;
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (shortsFilterGroup.contains(path)) return true;
|
||||
|
||||
return this.identifierFilterGroups.contains(identifier);
|
||||
// Super class handles logging.
|
||||
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
|
||||
}
|
||||
|
||||
public static void hideShortsShelf(final View shortsShelfView) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.revanced.integrations.patches.components;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
// Abuse LithoFilter for OldVideoQualityMenuPatch.
|
||||
@@ -8,15 +10,16 @@ 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"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isFiltered(final String path, final String identifier, final byte[] protobufBufferArray) {
|
||||
isVideoQualityMenuVisible = super.isFiltered(path, identifier, protobufBufferArray);
|
||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||
isVideoQualityMenuVisible = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ public final class OldVideoQualityMenuPatch {
|
||||
// The quality menu is a RecyclerView with 3 children. The third child is the "Advanced" quality menu.
|
||||
addRecyclerListener(linearLayout, 3, 2, recyclerView -> {
|
||||
// Check if the current view is the quality menu.
|
||||
if (VideoQualityMenuFilterPatch.isVideoQualityMenuVisible) {// Hide the video quality menu.
|
||||
if (VideoQualityMenuFilterPatch.isVideoQualityMenuVisible) {
|
||||
VideoQualityMenuFilterPatch.isVideoQualityMenuVisible = false;
|
||||
linearLayout.setVisibility(View.GONE);
|
||||
|
||||
// Click the "Advanced" quality menu to show the "old" quality menu.
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package app.revanced.integrations.patches.playback.speed;
|
||||
|
||||
import static app.revanced.integrations.patches.playback.quality.OldVideoQualityMenuPatch.addRecyclerListener;
|
||||
|
||||
import android.preference.ListPreference;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.facebook.litho.ComponentHost;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import app.revanced.integrations.patches.components.PlaybackSpeedMenuFilterPatch;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import com.facebook.litho.ComponentHost;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static app.revanced.integrations.patches.playback.quality.OldVideoQualityMenuPatch.addRecyclerListener;
|
||||
|
||||
public class CustomPlaybackSpeedPatch {
|
||||
/**
|
||||
@@ -110,23 +107,24 @@ public class CustomPlaybackSpeedPatch {
|
||||
}
|
||||
|
||||
/*
|
||||
* To reduce copy paste between two similar code paths.
|
||||
* To reduce copy and paste between two similar code paths.
|
||||
*/
|
||||
public static void onFlyoutMenuCreate(final LinearLayout linearLayout) {
|
||||
// The playback rate menu is a RecyclerView with 2 children. The third child is the "Advanced" quality menu.
|
||||
addRecyclerListener(linearLayout, 2, 1, recyclerView -> {
|
||||
if (PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible &&
|
||||
recyclerView.getChildCount() == 1 &&
|
||||
recyclerView.getChildAt(0) instanceof ComponentHost
|
||||
) {
|
||||
linearLayout.setVisibility(View.GONE);
|
||||
if (PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible) {
|
||||
PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible = false;
|
||||
|
||||
// Close the new Playback speed menu and instead show the old one.
|
||||
showOldPlaybackSpeedMenu();
|
||||
if (recyclerView.getChildCount() == 1 && recyclerView.getChildAt(0) instanceof ComponentHost) {
|
||||
linearLayout.setVisibility(View.GONE);
|
||||
|
||||
// DismissView [R.id.touch_outside] is the 1st ChildView of the 3rd ParentView.
|
||||
((ViewGroup) linearLayout.getParent().getParent().getParent())
|
||||
.getChildAt(0).performClick();
|
||||
// Close the new Playback speed menu and instead show the old one.
|
||||
showOldPlaybackSpeedMenu();
|
||||
|
||||
// DismissView [R.id.touch_outside] is the 1st ChildView of the 3rd ParentView.
|
||||
((ViewGroup) linearLayout.getParent().getParent().getParent())
|
||||
.getChildAt(0).performClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
package app.revanced.integrations.settings;
|
||||
|
||||
import static java.lang.Boolean.FALSE;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.BOOLEAN;
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.FLOAT;
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.INTEGER;
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.LONG;
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.STRING;
|
||||
import static app.revanced.integrations.settings.SharedPrefCategory.RETURN_YOUTUBE_DISLIKE;
|
||||
import static app.revanced.integrations.settings.SharedPrefCategory.SPONSOR_BLOCK;
|
||||
import static app.revanced.integrations.utils.StringRef.str;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.sponsorblock.SponsorBlockSettings;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.StringRef;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -29,6 +15,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static app.revanced.integrations.settings.SettingsEnum.ReturnType.*;
|
||||
import static app.revanced.integrations.settings.SharedPrefCategory.RETURN_YOUTUBE_DISLIKE;
|
||||
import static app.revanced.integrations.settings.SharedPrefCategory.SPONSOR_BLOCK;
|
||||
import static app.revanced.integrations.utils.StringRef.str;
|
||||
import static java.lang.Boolean.FALSE;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
|
||||
|
||||
public enum SettingsEnum {
|
||||
// External downloader
|
||||
@@ -89,12 +82,18 @@ public enum SettingsEnum {
|
||||
|
||||
// Action buttons
|
||||
HIDE_LIKE_DISLIKE_BUTTON("revanced_hide_like_dislike_button", BOOLEAN, FALSE),
|
||||
HIDE_LIVE_CHAT_BUTTON("revanced_hide_live_chat_button", BOOLEAN, FALSE),
|
||||
HIDE_SHARE_BUTTON("revanced_hide_share_button", BOOLEAN, FALSE),
|
||||
HIDE_REPORT_BUTTON("revanced_hide_report_button", BOOLEAN, FALSE),
|
||||
HIDE_REMIX_BUTTON("revanced_hide_remix_button", BOOLEAN, TRUE),
|
||||
HIDE_DOWNLOAD_BUTTON("revanced_hide_download_button", BOOLEAN, FALSE),
|
||||
HIDE_THANKS_BUTTON("revanced_hide_thanks_button", BOOLEAN, TRUE),
|
||||
HIDE_CLIP_BUTTON("revanced_hide_clip_button", BOOLEAN, TRUE),
|
||||
HIDE_PLAYLIST_BUTTON("revanced_hide_playlist_button", BOOLEAN, FALSE),
|
||||
HIDE_CLIP_BUTTON("revanced_hide_clip_button", BOOLEAN, FALSE, "revanced_hide_clip_button_user_dialog_message"),
|
||||
HIDE_ACTION_BUTTONS("revanced_hide_action_buttons", BOOLEAN, FALSE),
|
||||
HIDE_SHOP_BUTTON("revanced_hide_shop_button", BOOLEAN, TRUE),
|
||||
|
||||
// Layout
|
||||
PLAYER_OVERLAY_OPACITY("revanced_player_overlay_opacity", INTEGER, 100, true),
|
||||
DISABLE_RESUMING_SHORTS_PLAYER("revanced_disable_resuming_shorts_player", BOOLEAN, FALSE),
|
||||
HIDE_ALBUM_CARDS("revanced_hide_album_cards", BOOLEAN, FALSE, true),
|
||||
HIDE_ARTIST_CARDS("revanced_hide_artist_cards", BOOLEAN, FALSE),
|
||||
@@ -115,7 +114,6 @@ public enum SettingsEnum {
|
||||
HIDE_INFO_CARDS("revanced_hide_info_cards", BOOLEAN, TRUE),
|
||||
HIDE_LOAD_MORE_BUTTON("revanced_hide_load_more_button", BOOLEAN, TRUE, true),
|
||||
HIDE_PLAYER_BUTTONS("revanced_hide_player_buttons", BOOLEAN, FALSE),
|
||||
HIDE_PLAYER_OVERLAY("revanced_hide_player_overlay", BOOLEAN, FALSE, true),
|
||||
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", BOOLEAN, FALSE, true),
|
||||
HIDE_SEEKBAR("revanced_hide_seekbar", BOOLEAN, FALSE),
|
||||
HIDE_SEEKBAR_THUMBNAIL("revanced_hide_seekbar_thumbnail", BOOLEAN, FALSE),
|
||||
@@ -124,11 +122,10 @@ public enum SettingsEnum {
|
||||
HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true),
|
||||
HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE),
|
||||
HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE),
|
||||
HIDE_WATCH_IN_VR("revanced_hide_watch_in_vr", BOOLEAN, FALSE, true),
|
||||
PLAYER_POPUP_PANELS("revanced_hide_player_popup_panels", BOOLEAN, FALSE),
|
||||
SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON("revanced_switch_create_with_notifications_button", BOOLEAN, TRUE, true),
|
||||
SPOOF_APP_VERSION("revanced_spoof_app_version", BOOLEAN, FALSE, true, "revanced_spoof_app_version_user_dialog_message"),
|
||||
SPOOF_APP_VERSION_TARGET("revanced_spoof_app_version_target", STRING, "17.30.35", true, parents(SPOOF_APP_VERSION)),
|
||||
SPOOF_APP_VERSION_TARGET("revanced_spoof_app_version_target", STRING, "17.08.35", true, parents(SPOOF_APP_VERSION)),
|
||||
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true),
|
||||
WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true),
|
||||
@Deprecated
|
||||
@@ -150,6 +147,22 @@ 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),
|
||||
HIDE_LOOP_VIDEO_MENU("revanced_hide_player_flyout_loop_video", BOOLEAN, FALSE),
|
||||
HIDE_AMBIENT_MODE_MENU("revanced_hide_player_flyout_ambient_mode", BOOLEAN, FALSE),
|
||||
HIDE_REPORT_MENU("revanced_hide_player_flyout_report", BOOLEAN, TRUE),
|
||||
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, FALSE),
|
||||
HIDE_WATCH_IN_VR_MENU("revanced_hide_player_flyout_watch_in_vr", BOOLEAN, TRUE),
|
||||
|
||||
// Misc
|
||||
AUTO_CAPTIONS("revanced_auto_captions", BOOLEAN, FALSE),
|
||||
DISABLE_ZOOM_HAPTICS("revanced_disable_zoom_haptics", BOOLEAN, TRUE),
|
||||
@@ -180,6 +193,7 @@ public enum SettingsEnum {
|
||||
// Debugging
|
||||
DEBUG("revanced_debug", BOOLEAN, FALSE),
|
||||
DEBUG_STACKTRACE("revanced_debug_stacktrace", BOOLEAN, FALSE, parents(DEBUG)),
|
||||
DEBUG_PROTOBUFFER("revanced_debug_protobuffer", BOOLEAN, FALSE, parents(DEBUG)),
|
||||
DEBUG_TOAST_ON_ERROR("revanced_debug_toast_on_error", BOOLEAN, TRUE, "revanced_debug_toast_on_error_user_dialog_message"),
|
||||
|
||||
// ReturnYoutubeDislike
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SegmentPlaybackController {
|
||||
private static SponsorSegment[] segments;
|
||||
|
||||
/**
|
||||
* Highlight segment, if one exists.
|
||||
* Highlight segment, if one exists and the skip behavior is not set to {@link CategoryBehaviour#SHOW_IN_SEEKBAR}.
|
||||
*/
|
||||
@Nullable
|
||||
private static SponsorSegment highlightSegment;
|
||||
@@ -112,10 +112,13 @@ public class SegmentPlaybackController {
|
||||
segments = videoSegments;
|
||||
calculateTimeWithoutSegments();
|
||||
|
||||
for (SponsorSegment segment : videoSegments) {
|
||||
if (segment.category == SegmentCategory.HIGHLIGHT) {
|
||||
highlightSegment = segment;
|
||||
return;
|
||||
if (SegmentCategory.HIGHLIGHT.behaviour == CategoryBehaviour.SKIP_AUTOMATICALLY
|
||||
|| SegmentCategory.HIGHLIGHT.behaviour == CategoryBehaviour.MANUAL_SKIP) {
|
||||
for (SponsorSegment segment : videoSegments) {
|
||||
if (segment.category == SegmentCategory.HIGHLIGHT) {
|
||||
highlightSegment = segment;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
highlightSegment = null;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package app.revanced.integrations.utils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class ByteTrieSearch extends TrieSearch<byte[]> {
|
||||
|
||||
private static final class ByteTrieNode extends TrieNode<byte[]> {
|
||||
TrieNode<byte[]> createNode() {
|
||||
return new ByteTrieNode();
|
||||
}
|
||||
char getCharValue(byte[] text, int index) {
|
||||
return (char) text[index];
|
||||
}
|
||||
}
|
||||
|
||||
public ByteTrieSearch() {
|
||||
super(new ByteTrieNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPattern(@NonNull byte[] pattern) {
|
||||
super.addPattern(pattern, pattern.length, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPattern(@NonNull byte[] pattern, @NonNull TriePatternMatchedCallback<byte[]> callback) {
|
||||
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 matches(textToSearch,0, textToSearch.length, callbackParameter);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package app.revanced.integrations.utils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Text pattern searching using a prefix tree (trie).
|
||||
*/
|
||||
public final class StringTrieSearch extends TrieSearch<String> {
|
||||
|
||||
private static final class StringTrieNode extends TrieNode<String> {
|
||||
TrieNode<String> createNode() {
|
||||
return new StringTrieNode();
|
||||
}
|
||||
char getCharValue(String text, int index) {
|
||||
return text.charAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public StringTrieSearch() {
|
||||
super(new StringTrieNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPattern(@NonNull String pattern) {
|
||||
super.addPattern(pattern, pattern.length(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPattern(@NonNull String pattern, @NonNull TriePatternMatchedCallback<String> callback) {
|
||||
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 matches(textToSearch, 0, textToSearch.length(), callbackParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@NonNull String textToSearch, int startIndex) {
|
||||
return matches(textToSearch, startIndex, textToSearch.length(), null);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,10 @@ import app.revanced.tiktok.settings.SettingsEnum;
|
||||
|
||||
public class DownloadsPatch {
|
||||
public static String getDownloadPath() {
|
||||
return SettingsEnum.TIK_DOWN_PATH.getString();
|
||||
return SettingsEnum.DOWNLOAD_PATH.getString();
|
||||
}
|
||||
|
||||
public static boolean shouldRemoveWatermark() {
|
||||
return SettingsEnum.TIK_DOWN_WATERMARK.getBoolean();
|
||||
return SettingsEnum.DOWNLOAD_WATERMARK.getBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
|
||||
public class AdsFilter implements IFilter {
|
||||
@Override
|
||||
public boolean getEnabled() {
|
||||
return SettingsEnum.REMOVE_ADS.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFiltered(Aweme item) {
|
||||
return item.isAd() || item.isWithPromotionalMusic();
|
||||
}
|
||||
}
|
||||
@@ -6,33 +6,28 @@ import com.ss.android.ugc.aweme.feed.model.FeedItemList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
|
||||
public class FeedItemsFilter {
|
||||
public final class FeedItemsFilter {
|
||||
private static final List<IFilter> FILTERS = List.of(
|
||||
new AdsFilter(),
|
||||
new LiveFilter(),
|
||||
new StoryFilter(),
|
||||
new ImageVideoFilter(),
|
||||
new ViewCountFilter(),
|
||||
new LikeCountFilter()
|
||||
);
|
||||
|
||||
public static void filter(FeedItemList feedItemList) {
|
||||
if (SettingsEnum.TIK_REMOVE_ADS.getBoolean()) removeAds(feedItemList);
|
||||
if (SettingsEnum.TIK_HIDE_LIVE.getBoolean()) removeLive(feedItemList);
|
||||
}
|
||||
Iterator<Aweme> feedItemListIterator = feedItemList.items.iterator();
|
||||
while (feedItemListIterator.hasNext()) {
|
||||
Aweme item = feedItemListIterator.next();
|
||||
if (item == null) continue;
|
||||
|
||||
private static void removeAds(FeedItemList feedItemList) {
|
||||
List<Aweme> items = feedItemList.items;
|
||||
Iterator<Aweme> it = items.iterator();
|
||||
while (it.hasNext()) {
|
||||
Aweme item = it.next();
|
||||
if (item != null && (item.isAd() || item.isWithPromotionalMusic())) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeLive(FeedItemList feedItemList) {
|
||||
List<Aweme> items = feedItemList.items;
|
||||
Iterator<Aweme> it = items.iterator();
|
||||
while (it.hasNext()) {
|
||||
Aweme item = it.next();
|
||||
if (item != null && (item.isLive() || item.isLiveReplay())) {
|
||||
it.remove();
|
||||
for (IFilter filter : FILTERS) {
|
||||
boolean enabled = filter.getEnabled();
|
||||
if (enabled && filter.getFiltered(item)) {
|
||||
feedItemListIterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
|
||||
public interface IFilter {
|
||||
boolean getEnabled();
|
||||
|
||||
boolean getFiltered(Aweme item);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
|
||||
public class ImageVideoFilter implements IFilter {
|
||||
@Override
|
||||
public boolean getEnabled() {
|
||||
return SettingsEnum.HIDE_IMAGE.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFiltered(Aweme item) {
|
||||
return item.isImage() || item.isPhotoMode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
import com.ss.android.ugc.aweme.feed.model.AwemeStatistics;
|
||||
|
||||
import static app.revanced.tiktok.utils.ReVancedUtils.parseMinMax;
|
||||
|
||||
public final class LikeCountFilter implements IFilter {
|
||||
final long minLike;
|
||||
final long maxLike;
|
||||
|
||||
LikeCountFilter() {
|
||||
long[] minMax = parseMinMax(SettingsEnum.MIN_MAX_LIKES);
|
||||
minLike = minMax[0];
|
||||
maxLike = minMax[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFiltered(Aweme item) {
|
||||
AwemeStatistics statistics = item.getStatistics();
|
||||
if (statistics == null) return false;
|
||||
|
||||
long likeCount = statistics.getDiggCount();
|
||||
return likeCount < minLike || likeCount > maxLike;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
|
||||
public class LiveFilter implements IFilter {
|
||||
@Override
|
||||
public boolean getEnabled() {
|
||||
return SettingsEnum.HIDE_LIVE.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFiltered(Aweme item) {
|
||||
return item.isLive() || item.isLiveReplay();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.tiktok.feedfilter;
|
||||
|
||||
import app.revanced.tiktok.settings.SettingsEnum;
|
||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||
|
||||
public class StoryFilter implements IFilter {
|
||||
@Override
|
||||
public boolean getEnabled() {
|
||||
return SettingsEnum.HIDE_STORY.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFiltered(Aweme item) {
|
||||
return item.getIsTikTokStory();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user