FossifyOrg / Phone

A handy phone call manager with phonebook, number blocking and multi-SIM support
https://www.fossify.org
GNU General Public License v3.0
555 stars 47 forks source link

Block contacts wildcard #251

Closed m2nis closed 2 months ago

m2nis commented 2 months ago

Checklist

Feature description

Hello,

In order to block unwanted calls, I'm a avid user of the block list. I already use the joker to block a large number of concurrent numbers, like for example : 012345* to block all the numbers beginning with 012345.

The problem is that sometimes the caller will present a number sometimes like 0123456789 (France in my case), sometimes a number like +33123456789.

At this time, I then need to enter 012345 AND +3312345 in the list of blocked contacts to be sure to block them all.

Will it be possible to have the option to enter something like (+33|0)12345* to have a single line ?

Thank you.

Why do you want this feature?

See above.

Additional information

No response

naveensingh commented 2 months ago

The implementation is simple but pattern blocking (unofficially and kind of) supports regular expressions so in your specific case, you can try ^(0|+33)12345* or its less accurate version *12345*.

~I think the app should strip the country code before checking the pattern.~ The pattern blocking needs to be more user friendly instead but that's a separate issue.

m2nis commented 2 months ago

As far as I know, the support of regular expression is very limited and ^(0|+33)12345* shouldn't work. In fact, it is impossible to even type this expression because the keyboard is limited to numeric input.

*12345* could work but will stop far too much numbers. 0123456789 will be stop, but 0212345678 as well, and it's a problem.

m2nis commented 2 months ago

NB : This ability to block thousands of numbers easily is THE feature that made me adopt this application. May be I'm the only one, but I'm not sure you should be so quick to dismiss a "little" development like this.

naveensingh commented 2 months ago

In fact, it is impossible to even type this expression because the keyboard is limited to numeric input.

It should be fixed but that's why I said it's "unofficially" supported, you can always paste anything into the text field:


the support of regular expression is very limited and ^(0|+33)12345* shouldn't work.

The provided expression should work fine. Here's the code:

https://github.com/FossifyOrg/Commons/blob/9be479f97a2a0c0f80c0464bbf83ca552dde7507/commons/src/main/kotlin/org/fossify/commons/extensions/Context.kt#L1134-L1145

I'm not dismissing your request, I'm saying it needs to be reworked so it doesn't require one to create complex patterns.

m2nis commented 2 months ago

Great ! Looks nearly perfect. ;-)

In fact, there are several difficulties. As you say, how to easily treat the country, according to the fact that people can have different countries with may be different rules (in France, it's "+33" or "0" (or "0033"), but how in the others ?).

Another point is how to save these rules easily ? Will it work if we put the expressions in a contact ?

Thank you for your reply.