Messages
Messages copied to clipboard
[FEATURE] Stored/known contacts ignore blocked keywords
Checklist
- [X] I made sure that there are no existing issues - open or closed - to which I could contribute my information.
- [X] I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
- [X] I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
- [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
- [X] This issue contains only one feature request.
- [X] I have read and understood the contribution guidelines.
- [ ] I optionally donated to support the Fossify mission.
Feature description
New checkbox/toggle in settings labeled "Stored contacts ignore blocked keywords" (tentative)
Behavior:
If enabled, only apply keyword blocking to not stored contacts.
If disabled, apply keyword blocking globally (this is the default behavior).
Why do you want this feature?
More fine tuned control over keyword blocking.
Additional information
⚠️ TREAT THIS AS PSEUDO-CODE ⚠️ ⚠️ THIS IS UNTESTED, I'VE NEVER CODED FOR ANDROID ⚠️
I don't have a Kotlin development environment. I just did this to increase the chances of getting accepted/implemented.
SmsReceiver.kt
// I DON'T KNOW HOW/WHERE TO PROPERLY DECLARE THIS VARIABLE
context.baseConfig.knownNumbersIgnoreKeywords = false
private fun isMessageFilteredOut(context: Context, body: String): Boolean {
val simpleContactsHelper = SimpleContactsHelper(context)
simpleContactsHelper.exists(address, privateCursor) { exists ->
// don't filter if sender is known and setting is enabled
if (exists && context.baseConfig.knownNumbersIgnoreKeywords) {
return false
}
}
// resume original function behavior
for (blockedKeyword in context.config.blockedKeywords) {
if (body.contains(blockedKeyword, ignoreCase = true)) {
return true
}
}
return false
}
Updated sample code, less confusing if-statement structure. Updated text in "Additional information" section.
the fact that messages from my contacts are blocked because they match a keyword is baffling to me. I don't want messages from contacts blocked, it makes the keyword list almost useless. In other words: +1 for this feature.
I have no idea how this will affect alphanumeric Sender IDs though. Like when you receive a message from your network provider and the sender isn't a number but it automatically has its own name even if it's not a saved in your contacts.
IDK if Android treats that as known or unknown.
Can I get some feedback on this please?