mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-03 10:47:29 +01:00
update to the latest commons version
This commit is contained in:
parent
706fcbf6ae
commit
e1078d4379
@ -62,7 +62,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:59f709a2a8'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:10c8ac2f1e'
|
||||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||||
implementation 'com.github.tibbi:android-smsmms:fe58a74d59'
|
implementation 'com.github.tibbi:android-smsmms:fe58a74d59'
|
||||||
|
@ -45,13 +45,25 @@ class SmsReceiver : BroadcastReceiver() {
|
|||||||
threadId = context.getThreadId(address)
|
threadId = context.getThreadId(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
val bitmap = getPhotoForNotification(address, context)
|
if (context.baseConfig.blockUnknownNumbers) {
|
||||||
|
|
||||||
Handler(Looper.getMainLooper()).post {
|
|
||||||
val privateCursor = context.getMyContactsCursor(false, true)
|
|
||||||
val simpleContactsHelper = SimpleContactsHelper(context)
|
val simpleContactsHelper = SimpleContactsHelper(context)
|
||||||
val isBlocked = context.baseConfig.blockUnknownNumbers && !simpleContactsHelper.exists(address)
|
simpleContactsHelper.exists(address) { exists ->
|
||||||
if (!isBlocked && !context.isNumberBlocked(address)) {
|
if (exists) {
|
||||||
|
handleMessage(context, address, subject, body, date, read, threadId, type, subscriptionId, status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
handleMessage(context, address, subject, body, date, read, threadId, type, subscriptionId, status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleMessage(context: Context, address: String, subject: String, body: String, date: Long, read: Int,
|
||||||
|
threadId: Long, type: Int, subscriptionId: Int, status: Int) {
|
||||||
|
val bitmap = getPhotoForNotification(address, context)
|
||||||
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
if (!context.isNumberBlocked(address)) {
|
||||||
|
val privateCursor = context.getMyContactsCursor(false, true)
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val newMessageId = context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
|
val newMessageId = context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
|
||||||
|
|
||||||
@ -82,7 +94,6 @@ class SmsReceiver : BroadcastReceiver() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun getPhotoForNotification(address: String, context: Context): Bitmap? {
|
private fun getPhotoForNotification(address: String, context: Context): Bitmap? {
|
||||||
val photo = SimpleContactsHelper(context).getPhotoUriFromPhoneNumber(address)
|
val photo = SimpleContactsHelper(context).getPhotoUriFromPhoneNumber(address)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user