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

Commit

Permalink
feat(YouTube/Hide feed components): remove Hide store tab settings
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Apr 25, 2024
1 parent 266b669 commit cd511f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import app.revanced.integrations.shared.patches.components.StringFilterGroup;
import app.revanced.integrations.shared.patches.components.StringFilterGroupList;
import app.revanced.integrations.shared.utils.StringTrieSearch;
import app.revanced.integrations.youtube.patches.feed.FeedPatch;
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.youtube.shared.RootView;

Expand Down Expand Up @@ -87,7 +86,7 @@ public FeedComponentsFilter() {
);

channelProfileButtonRule = new StringFilterGroup(
null,
Settings.HIDE_BROWSE_STORE_BUTTON,
"|channel_profile_"
);

Expand Down Expand Up @@ -212,11 +211,10 @@ public boolean isFiltered(String path, @Nullable String identifier, String allVa
if (selectedNavButton != null && selectedNavButton.isLibraryOrYouTab() && !RootView.isSearchBarActive())
return false;
} else if (matchedGroup == channelProfileButtonRule) {
final boolean isBrowseStoreButtonShown = path.contains(BROWSE_STORE_BUTTON_PATH) && browseStoreButton.check(protobufBufferArray).isFiltered();
FeedPatch.hideStoreTab(isBrowseStoreButtonShown);
if (!isBrowseStoreButtonShown || !Settings.HIDE_BROWSE_STORE_BUTTON.get()) {
return false;
if (browseStoreButton.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
return false;
} else if (matchedGroup == communityPosts) {
if (!communityPostsFeedGroupSearch.matches(allValue) && Settings.HIDE_COMMUNITY_POSTS_CHANNEL.get()) {
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,6 @@ public static int hideCategoryBarInSearch(final int height) {
return Settings.HIDE_CATEGORY_BAR_IN_SEARCH.get() ? 0 : height;
}

private static WeakReference<View> channelTabViewRef = new WeakReference<>(null);
private static long lastTimeCalled = 0;

public static void setChannelTabView(View view) {
channelTabViewRef = new WeakReference<>(view);
}

public static void hideStoreTab(boolean isBrowseStoreButtonShown) {
if (!isBrowseStoreButtonShown || !Settings.HIDE_STORE_TAB.get())
return;

final long currentTime = System.currentTimeMillis();

// Ignores method reuse in less than 3 second.
if (lastTimeCalled != 0 && currentTime - lastTimeCalled < 3000)
return;
lastTimeCalled = currentTime;

// This method is called before the channel tab is created.
// Add a delay to hide after the channel tab is created.
Utils.runOnMainThreadDelayed(() -> {
final View channelTabView = channelTabViewRef.get();
if (channelTabView != null)
channelTabView.setVisibility(View.GONE);
}, 0
);
}

public static void hideBreakingNewsShelf(View view) {
hideViewBy0dpUnderCondition(
Settings.HIDE_CAROUSEL_SHELF.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_CHANNEL_MEMBER_SHELF = new BooleanSetting("revanced_hide_channel_member_shelf", TRUE);
public static final BooleanSetting HIDE_CHANNEL_PROFILE_LINKS = new BooleanSetting("revanced_hide_channel_profile_links", TRUE);
public static final BooleanSetting HIDE_FOR_YOU_SHELF = new BooleanSetting("revanced_hide_for_you_shelf", TRUE);
public static final BooleanSetting HIDE_STORE_TAB = new BooleanSetting("revanced_hide_store_tab", TRUE);

// PreferenceScreen: Feed - Community posts
public static final BooleanSetting HIDE_COMMUNITY_POSTS_CHANNEL = new BooleanSetting("revanced_hide_community_posts_channel", FALSE);
Expand Down

0 comments on commit cd511f0

Please sign in to comment.