1
mirror of https://github.com/revanced/revanced-integrations synced 2025-11-21 18:35:37 +01:00

Compare commits

...

32 Commits

Author SHA1 Message Date
semantic-release-bot
c034d474ff chore(release): 0.117.1 [skip ci]
## [0.117.1](https://github.com/ReVanced/revanced-integrations/compare/v0.117.0...v0.117.1) (2023-09-03)

### Bug Fixes

* **YouTube - ExternalDownloads:** Trim whitespace from package name ([#469](https://github.com/ReVanced/revanced-integrations/issues/469)) ([61d997e](61d997e1db))
2023-09-03 03:44:54 +00:00
oSumAtrIX
690fec6b5a chore: merge branch dev to main (#470) 2023-09-03 05:41:02 +02:00
semantic-release-bot
20e2ecf199 chore(release): 0.117.1-dev.1 [skip ci]
## [0.117.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.117.0...v0.117.1-dev.1) (2023-08-30)

### Bug Fixes

* **YouTube - ExternalDownloads:** Trim whitespace from package name ([#469](https://github.com/ReVanced/revanced-integrations/issues/469)) ([61d997e](61d997e1db))
2023-08-30 21:11:04 +00:00
Autist69420
61d997e1db fix(YouTube - ExternalDownloads): Trim whitespace from package name (#469)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-30 23:06:47 +02:00
semantic-release-bot
04c81b39e9 chore(release): 0.117.0 [skip ci]
# [0.117.0](https://github.com/ReVanced/revanced-integrations/compare/v0.116.2...v0.117.0) (2023-08-27)

### Features

* Restore previous release ([dc955d1](dc955d1bc2))
2023-08-27 23:57:50 +00:00
oSumAtrIX
b7a176ff3e chore: merge branch dev to main (#468) 2023-08-28 01:53:07 +02:00
semantic-release-bot
1afd520c7b chore(release): 0.117.0-dev.1 [skip ci]
# [0.117.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.2...v0.117.0-dev.1) (2023-08-27)

### Features

* Restore previous release ([dc955d1](dc955d1bc2))
2023-08-27 20:30:34 +00:00
oSumAtrIX
dc955d1bc2 feat: Restore previous release 2023-08-27 21:41:23 +02:00
semantic-release-bot
f3fc0d1f7d chore(release): 0.116.2 [skip ci]
## [0.116.2](https://github.com/ReVanced/revanced-integrations/compare/v0.116.1...v0.116.2) (2023-08-27)

### Bug Fixes

* Add back missing class ([6e8d13b](6e8d13bfbb))
2023-08-27 03:21:10 +00:00
oSumAtrIX
ca4927e2a9 chore: merge branch dev to main (#467) 2023-08-27 05:17:10 +02:00
oSumAtrIX
6e8d13bfbb fix: Add back missing class 2023-08-27 05:16:07 +02:00
semantic-release-bot
90a7e604d3 chore(release): 0.116.1 [skip ci]
## [0.116.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0...v0.116.1) (2023-08-27)

### Bug Fixes

* Revert previous release ([a178a22](a178a223c2))
2023-08-27 02:51:33 +00:00
oSumAtrIX
6801ed8d28 chore: merge branch dev to main (#466) 2023-08-27 04:47:35 +02:00
semantic-release-bot
ba8f4f9b5f chore(release): 0.116.1-dev.1 [skip ci]
## [0.116.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0...v0.116.1-dev.1) (2023-08-27)

### Bug Fixes

* Revert previous release ([a178a22](a178a223c2))
2023-08-27 02:47:15 +00:00
oSumAtrIX
a178a223c2 fix: Revert previous release 2023-08-27 04:43:10 +02:00
semantic-release-bot
fb3b7b4c80 chore(release): 0.116.0 [skip ci]
# [0.116.0](https://github.com/ReVanced/revanced-integrations/compare/v0.115.1...v0.116.0) (2023-08-26)

### Bug Fixes

* use correct logging tags ([420b926](420b9263b6))
* **YouTube - Hide Shorts components:** Hide `shorts header` ([#455](https://github.com/ReVanced/revanced-integrations/issues/455)) ([13afac9](13afac906a))
* **YouTube - Litho Filter:** Don't remove the buffer until the thread stops ([#461](https://github.com/ReVanced/revanced-integrations/issues/461)) ([2188607](2188607340))
* **YouTube - Player Flyout Menu:** Change 'audio track flyout menu' to show up by default ([#458](https://github.com/ReVanced/revanced-integrations/issues/458)) ([97880ea](97880eaf72))

### Features

* **YouTube - Debug:** Logging of layout proto buffer strings ([#456](https://github.com/ReVanced/revanced-integrations/issues/456)) ([769a200](769a2006ce))
* **YouTube - Hide video action buttons:** Hide individual action buttons ([#451](https://github.com/ReVanced/revanced-integrations/issues/451)) ([8e5ca65](8e5ca65286))
* **YouTube:** Add `Alternative thumbnails` patch ([#462](https://github.com/ReVanced/revanced-integrations/issues/462)) ([d354356](d354356b2d))
* **YouTube:** Add `Custom player overlay opacity` patch ([#449](https://github.com/ReVanced/revanced-integrations/issues/449)) ([44dccb3](44dccb3d65))
* **YouTube:** Add `Enable tablet layout` patch ([d4570de](d4570de0a7))
* **YouTube:** Support version 18.32.39 ([#464](https://github.com/ReVanced/revanced-integrations/issues/464)) ([aa9d892](aa9d892cde))
2023-08-26 23:25:40 +00:00
oSumAtrIX
297d76f176 chore: merge branch dev to main (#457) 2023-08-27 01:21:37 +02:00
semantic-release-bot
acae4b1bc8 chore(release): 0.116.0-dev.10 [skip ci]
# [0.116.0-dev.10](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.9...v0.116.0-dev.10) (2023-08-26)

### Features

* **YouTube:** Add `Enable tablet layout` patch ([d4570de](d4570de0a7))
2023-08-26 15:14:13 +00:00
oSumAtrIX
d4570de0a7 feat(YouTube): Add Enable tablet layout patch 2023-08-26 17:10:35 +02:00
semantic-release-bot
a249b1648d chore(release): 0.116.0-dev.9 [skip ci]
# [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](aa9d892cde))
2023-08-26 15:05:19 +00:00
oSumAtrIX
aa9d892cde feat(YouTube): Support version 18.32.39 (#464) 2023-08-26 17:00:59 +02:00
semantic-release-bot
aff6e98f64 chore(release): 0.116.0-dev.8 [skip ci]
# [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](44dccb3d65))
2023-08-26 00:15:59 +00:00
johnconner122
44dccb3d65 feat(YouTube): Add Custom player overlay opacity patch (#449)
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-26 02:12:44 +02:00
semantic-release-bot
61e961a9e3 chore(release): 0.116.0-dev.7 [skip ci]
# [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](420b9263b6))
2023-08-24 21:07:32 +00:00
semantic-release-bot
420b9263b6 fix: use correct logging tags 2023-08-24 23:03:56 +02:00
semantic-release-bot
fbc6855c4a chore(release): 0.116.0-dev.6 [skip ci]
# [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](13afac906a))
2023-08-23 07:31:11 +00:00
LisoUseInAIKyrios
ebd425b7ff chore: fix build 2023-08-23 11:27:21 +04:00
johnconner122
13afac906a fix(YouTube - Hide Shorts components): Hide shorts header (#455)
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-23 05:35:00 +02:00
oSumAtrIX
7510c0632f refactor: fix naming inconsistency 2023-08-23 05:28:57 +02:00
oSumAtrIX
33e3c6b061 refactor: improve readability with comments 2023-08-23 05:27:54 +02:00
semantic-release-bot
842f5f7616 chore(release): 0.116.0-dev.5 [skip ci]
# [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](d354356b2d))
2023-08-21 06:32:26 +00:00
LisoUseInAIKyrios
d354356b2d feat(YouTube): Add Alternative thumbnails patch (#462) 2023-08-21 10:28:20 +04:00
24 changed files with 737 additions and 151 deletions

View File

@@ -1,3 +1,114 @@
## [0.117.1](https://github.com/ReVanced/revanced-integrations/compare/v0.117.0...v0.117.1) (2023-09-03)
### Bug Fixes
* **YouTube - ExternalDownloads:** Trim whitespace from package name ([#469](https://github.com/ReVanced/revanced-integrations/issues/469)) ([61d997e](https://github.com/ReVanced/revanced-integrations/commit/61d997e1db64730c36674445ff5b516a3acb41fb))
## [0.117.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.117.0...v0.117.1-dev.1) (2023-08-30)
### Bug Fixes
* **YouTube - ExternalDownloads:** Trim whitespace from package name ([#469](https://github.com/ReVanced/revanced-integrations/issues/469)) ([61d997e](https://github.com/ReVanced/revanced-integrations/commit/61d997e1db64730c36674445ff5b516a3acb41fb))
# [0.117.0](https://github.com/ReVanced/revanced-integrations/compare/v0.116.2...v0.117.0) (2023-08-27)
### Features
* Restore previous release ([dc955d1](https://github.com/ReVanced/revanced-integrations/commit/dc955d1bc2db63efc83d4fd5c7e076ed0867d48b))
# [0.117.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.2...v0.117.0-dev.1) (2023-08-27)
### Features
* Restore previous release ([dc955d1](https://github.com/ReVanced/revanced-integrations/commit/dc955d1bc2db63efc83d4fd5c7e076ed0867d48b))
## [0.116.2](https://github.com/ReVanced/revanced-integrations/compare/v0.116.1...v0.116.2) (2023-08-27)
### Bug Fixes
* Add back missing class ([6e8d13b](https://github.com/ReVanced/revanced-integrations/commit/6e8d13bfbbdadb8c737e7c183e9badc65fc6d719))
## [0.116.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0...v0.116.1) (2023-08-27)
### Bug Fixes
* Revert previous release ([a178a22](https://github.com/ReVanced/revanced-integrations/commit/a178a223c283abe420e197d10863d7fe64534f32))
## [0.116.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0...v0.116.1-dev.1) (2023-08-27)
### Bug Fixes
* Revert previous release ([a178a22](https://github.com/ReVanced/revanced-integrations/commit/a178a223c283abe420e197d10863d7fe64534f32))
# [0.116.0](https://github.com/ReVanced/revanced-integrations/compare/v0.115.1...v0.116.0) (2023-08-26)
### Bug Fixes
* use correct logging tags ([420b926](https://github.com/ReVanced/revanced-integrations/commit/420b9263b6e1cbb81aeb4985cf454b51912b51f8))
* **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))
* **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))
* **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))
### 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))
* **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))
* **YouTube:** Add `Alternative thumbnails` patch ([#462](https://github.com/ReVanced/revanced-integrations/issues/462)) ([d354356](https://github.com/ReVanced/revanced-integrations/commit/d354356b2d9052bc0d388633ed9eb0206f7c2058))
* **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))
* **YouTube:** Add `Enable tablet layout` patch ([d4570de](https://github.com/ReVanced/revanced-integrations/commit/d4570de0a791bd97c70ac46b84cbff75c6d0b274))
* **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.10](https://github.com/ReVanced/revanced-integrations/compare/v0.116.0-dev.9...v0.116.0-dev.10) (2023-08-26)
### Features
* **YouTube:** Add `Enable tablet layout` patch ([d4570de](https://github.com/ReVanced/revanced-integrations/commit/d4570de0a791bd97c70ac46b84cbff75c6d0b274))
# [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)

View File

@@ -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);
}
}

View File

@@ -0,0 +1,9 @@
package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum;
public final class EnableTabletLayoutPatch {
public static boolean enableTabletLayout() {
return SettingsEnum.TABLET_LAYOUT.getBoolean();
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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);

View File

@@ -18,7 +18,7 @@ final class CommentsFilter extends Filter {
"comments_entry_point_simplebox"
);
this.pathFilterGroups.addAll(
this.pathFilterGroupList.addAll(
comments,
previewComment
);

View File

@@ -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
);

View File

@@ -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: "

View File

@@ -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"
));

View File

@@ -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(

View File

@@ -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) {

View File

@@ -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"
));

View File

@@ -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
@@ -100,6 +93,7 @@ public enum SettingsEnum {
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),
@@ -120,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),
@@ -134,9 +127,8 @@ public enum SettingsEnum {
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.08.35", true, parents(SPOOF_APP_VERSION)),
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true),
TABLET_LAYOUT("revanced_tablet_layout", BOOLEAN, FALSE, true, "revanced_tablet_layout_user_dialog_message"),
WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true),
@Deprecated
DEPRECATED_SEEKBAR_COLOR("revanced_seekbar_color", STRING, "#FF0000"), // TODO: delete this
SEEKBAR_CUSTOM_COLOR("revanced_seekbar_custom_color", BOOLEAN, TRUE, true),
SEEKBAR_CUSTOM_COLOR_VALUE("revanced_seekbar_custom_color_value", STRING, "#FF0000", true, parents(SEEKBAR_CUSTOM_COLOR)),
HIDE_FILTER_BAR_FEED_IN_FEED("revanced_hide_filter_bar_feed_in_feed", BOOLEAN, FALSE, true),
@@ -154,6 +146,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),
@@ -380,14 +376,6 @@ public enum SettingsEnum {
// TODO: delete DEPRECATED_SHOW_OLD_VIDEO_QUALITY_MENU (When? anytime).
migrateOldSettingToNew(DEPRECATED_SHOW_OLD_VIDEO_QUALITY_MENU, SHOW_OLD_VIDEO_QUALITY_MENU);
// TODO: delete this seekbar color migration code
String oldSeekbarColorValue = DEPRECATED_SEEKBAR_COLOR.getString();
if (!oldSeekbarColorValue.equalsIgnoreCase((String) DEPRECATED_SEEKBAR_COLOR.defaultValue)) {
SEEKBAR_CUSTOM_COLOR_VALUE.saveValue(oldSeekbarColorValue);
SEEKBAR_CUSTOM_COLOR.saveValue(true);
DEPRECATED_SEEKBAR_COLOR.saveValue(DEPRECATED_SEEKBAR_COLOR.defaultValue);
}
// endregion
}

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -49,7 +49,8 @@ public class ExternalDownloadButton extends BottomControlButton {
LogHelper.printDebug(() -> "External download button clicked");
final var context = view.getContext();
var downloaderPackageName = SettingsEnum.EXTERNAL_DOWNLOADER_PACKAGE_NAME.getString();
// Trim string to avoid any accidental whitespace.
var downloaderPackageName = SettingsEnum.EXTERNAL_DOWNLOADER_PACKAGE_NAME.getString().trim();
boolean packageEnabled = false;
try {

View File

@@ -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)
}
}

View 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.
}

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
android.useAndroidX = true
version = 0.116.0-dev.4
version = 0.117.1