Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic regex filter #369

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add basic regex filter #369

wants to merge 7 commits into from

Conversation

Huhni
Copy link

@Huhni Huhni commented Mar 17, 2022

I added a filtering option as requested by #86, #148, #287
At the moment it doesn't hide the tweets completely, but instead shows a small card containing This tweet was filtered.
That is because I don't have any experience with Dart/Flutter or Android development in general. I just wanted to provide a minimal working example that can be improved by people who actually know what they're doing.

It works by adding the words you want to get filtered separated by | to the new Filters setting. It just converts the string into a regular expression so you can use expressions like \W[a-z]{2,3} and so on.

Example: bitcoin|nft|#sponsored|trump

The filter is case insensitive and removes all tweets containing the regex, so if you don't want tweets with trumpet removed you need to use trump\b instead of trump. Since the string gets evaluated as regex you need to escape characters like dots or brackets if you want to use them in the filter.

@@ -1741,6 +1741,16 @@ class L10n {
args: [],
);
}

/// `This tweet was filtered`
String get this_tweet_was_filtered {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is autogenerated. You should add this string in lib/l10n/intl_en.arb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants