Skip to content

Commit

Permalink
fix: Revert previous release
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Aug 27, 2023
1 parent fb3b7b4 commit a178a22
Show file tree
Hide file tree
Showing 21 changed files with 173 additions and 723 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {

android {
compileSdk = 33
buildToolsVersion = "33.0.1"
namespace = "app.revanced.integrations"

defaultConfig {
Expand Down Expand Up @@ -43,7 +44,7 @@ android {
dependencies {
compileOnly(project(mapOf("path" to ":dummy")))
compileOnly("androidx.annotation:annotation:1.6.0")
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha03")
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha02")
compileOnly("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
compileOnly("com.squareup.retrofit2:retrofit:2.9.0")
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

public class OpenLinksExternallyPatch {
/**
* Return the intent to open links with. If empty, the link will be opened with the default browser.
* 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.
*
* @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.
* @param original The original custom tabs service.
* @return The new, default service to open links with or the original service.
*/
public static String getIntent(String originalIntent) {
if (SettingsEnum.EXTERNAL_BROWSER.getBoolean()) return "";

return originalIntent;
public static String enableExternalBrowser(String original) {
if (SettingsEnum.EXTERNAL_BROWSER.getBoolean()) original = "";
return original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public AdsFilter() {
"cta_shelf_card"
);

this.pathFilterGroupList.addAll(
this.pathFilterGroups.addAll(
generalAds,
buttonedAd,
merchandise,
Expand All @@ -95,16 +95,16 @@ public AdsFilter() {
webLinkPanel,
movieAds
);
this.identifierFilterGroupList.addAll(carouselAd);
this.identifierFilterGroups.addAll(carouselAd);
}

@Override
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
public boolean isFiltered(String path, @Nullable String identifier, byte[] protobufBufferArray,
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
if (exceptions.matches(path))
return false;

return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,114 +1,59 @@
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 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();
private final StringFilterGroup actionBarRule;

public ButtonsFilter() {
actionBarGroup = new StringFilterGroup(
actionBarRule = new StringFilterGroup(
null,
VIDEO_ACTION_BAR_PATH
"video_action_bar"
);
identifierFilterGroupList.addAll(actionBarGroup);


bufferFilterPathGroup = new StringFilterGroup(
null,
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
);
pathFilterGroupList.addAll(
pathFilterGroups.addAll(
new StringFilterGroup(
SettingsEnum.HIDE_LIKE_DISLIKE_BUTTON,
"|segmented_like_dislike_button"
"|like_button",
"dislike_button"
),
new StringFilterGroup(
SettingsEnum.HIDE_DOWNLOAD_BUTTON,
"|download_button.eml|"
"download_button"
),
new StringFilterGroup(
SettingsEnum.HIDE_PLAYLIST_BUTTON,
"|save_to_playlist_button"
"save_to_playlist_button"
),
new StringFilterGroup(
SettingsEnum.HIDE_CLIP_BUTTON,
"|clip_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 StringFilterGroup(
SettingsEnum.HIDE_ACTION_BUTTONS,
"ContainerType|video_action_button",
"|CellType|CollectionType|CellType|ContainerType|button.eml|"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_THANKS_BUTTON,
"yt_outline_dollar_sign_heart"
)
actionBarRule
);
}

private boolean isEveryFilterGroupEnabled() {
for (var group : pathFilterGroupList)
if (!group.isEnabled()) return false;

for (var group : bufferButtonsGroupList)
if (!group.isEnabled()) return false;
for (StringFilterGroup rule : pathFilterGroups)
if (!rule.isEnabled()) return false;

return true;
}

@Override
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
public boolean isFiltered(String path, @Nullable String identifier, 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;

// In case the group list has no match, return false.
if (!bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) return false;
if (matchedGroup == actionBarRule) {
return isEveryFilterGroupEnabled();
}

return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CommentsFilter() {
"comments_entry_point_simplebox"
);

this.pathFilterGroupList.addAll(
this.pathFilterGroups.addAll(
comments,
previewComment
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public LayoutComponentsFilter() {
"chips_shelf"
);

this.pathFilterGroupList.addAll(
this.pathFilterGroups.addAll(
channelBar,
communityPosts,
paidContent,
Expand All @@ -165,19 +165,19 @@ public LayoutComponentsFilter() {
custom
);

this.identifierFilterGroupList.addAll(
this.identifierFilterGroups.addAll(
graySeparator,
chipsShelf
);
}

@Override
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
public boolean isFiltered(String path, @Nullable String identifier, byte[] protobufBufferArray,
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
if (matchedGroup != custom && exceptions.matches(path))
return false; // Exceptions are not filtered.

return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
return super.isFiltered(path, identifier, protobufBufferArray, matchedList, matchedGroup, matchedIndex);
}


Expand Down
Loading

0 comments on commit a178a22

Please sign in to comment.