Skip to content

Add basic regex filter#369

Open
Huhni wants to merge 7 commits into
jonjomckay:masterfrom
Huhni:master
Open

Add basic regex filter#369
Huhni wants to merge 7 commits into
jonjomckay:masterfrom
Huhni:master

Conversation

@Huhni
Copy link
Copy Markdown

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

Comment thread lib/generated/l10n.dart
}

/// `This tweet was filtered`
String get this_tweet_was_filtered {
Copy link
Copy Markdown
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