mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 13:59:48 +01:00
DirectReplyReceiver: fetch avatar in background
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
4b46270362
commit
2b646845bf
@ -47,6 +47,7 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SYSTEM_NOTIFICATION_ID
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@ -159,6 +160,7 @@ class DirectReplyReceiver : BroadcastReceiver() {
|
||||
.extractMessagingStyleFromNotification(previousNotification)
|
||||
|
||||
// Add reply
|
||||
Single.fromCallable {
|
||||
val avatarUrl = ApiUtils.getUrlForAvatar(currentUser.baseUrl, currentUser.userId, false)
|
||||
val me = Person.Builder()
|
||||
.setName(currentUser.displayName)
|
||||
@ -170,9 +172,14 @@ class DirectReplyReceiver : BroadcastReceiver() {
|
||||
// Set the updated style
|
||||
previousBuilder.setStyle(previousStyle)
|
||||
|
||||
// Update the active notification.
|
||||
// Check if notification still exists
|
||||
if (findActiveNotification(systemNotificationId!!) != null) {
|
||||
NotificationManagerCompat.from(context).notify(systemNotificationId!!, previousBuilder.build())
|
||||
}
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "DirectReplyReceiver"
|
||||
|
@ -330,7 +330,6 @@ object NotificationUtils {
|
||||
.data(avatarUrl)
|
||||
.transformations(CircleCropTransformation())
|
||||
.placeholder(R.drawable.account_circle_96dp)
|
||||
.placeholder(R.drawable.account_circle_96dp)
|
||||
.target(
|
||||
onSuccess = { result ->
|
||||
val bitmap = (result as BitmapDrawable).bitmap
|
||||
|
Loading…
Reference in New Issue
Block a user