mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
improve the performance of recents fetching
This commit is contained in:
@ -16,7 +16,6 @@ class RecentsHelper(private val context: Context) {
|
|||||||
fun getRecentCalls(callback: (ArrayList<RecentCall>) -> Unit) {
|
fun getRecentCalls(callback: (ArrayList<RecentCall>) -> Unit) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
var recentCalls = ArrayList<RecentCall>()
|
var recentCalls = ArrayList<RecentCall>()
|
||||||
val blockedNumbers = context.getBlockedNumbers()
|
|
||||||
if (!context.hasPermission(PERMISSION_READ_CALL_LOG)) {
|
if (!context.hasPermission(PERMISSION_READ_CALL_LOG)) {
|
||||||
callback(recentCalls)
|
callback(recentCalls)
|
||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
@ -65,7 +64,8 @@ class RecentsHelper(private val context: Context) {
|
|||||||
previousRecentCallFrom = "$number$name"
|
previousRecentCallFrom = "$number$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
recentCalls = recentCalls.filter { !context.isNumberBlocked(it.phoneNumber) }.toMutableList() as ArrayList<RecentCall>
|
val blockedNumbers = context.getBlockedNumbers()
|
||||||
|
recentCalls = recentCalls.filter { !context.isNumberBlocked(it.phoneNumber, blockedNumbers) }.toMutableList() as ArrayList<RecentCall>
|
||||||
callback(recentCalls)
|
callback(recentCalls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user