From f01bbb893e174ee733a019aea79f235aeb499ee5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Apr 2020 14:00:15 +0200 Subject: [PATCH] improve the way blocked numbers are checked --- app/build.gradle | 2 +- .../com/simplemobiletools/smsmessenger/extensions/Context.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b3b70cec..8a1f1277 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,7 +36,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.25.1' + implementation 'com.simplemobiletools:commons:5.25.2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' implementation 'org.greenrobot:eventbus:3.2.0' } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index cddae58b..b99bd52e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -474,5 +474,6 @@ fun Context.getThreadId(address: String): Long { fun Context.isNumberBlocked(number: String): Boolean { val blockedNumbers = getBlockedNumbers() - return blockedNumbers.map { it.number }.contains(number) && !blockedNumbers.map { it.normalizedNumber }.contains(number) + val numberToCompare = number.trimToComparableNumber() + return blockedNumbers.map { it.numberToCompare }.contains(numberToCompare) }