mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Merge pull request #4424 from dkter/fix-broken-room-icons
Fix incorrect cropping of conversation icons
This commit is contained in:
commit
892129994e
4 changed files with 2 additions and 22 deletions
1
changelog.d/4424.bugfix
Normal file
1
changelog.d/4424.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix incorrect cropping of conversation icons
|
|
@ -17,7 +17,6 @@
|
|||
package im.vector.app.features.notifications
|
||||
|
||||
import android.app.Notification
|
||||
import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import javax.inject.Inject
|
||||
|
||||
private typealias ProcessedMessageEvents = List<ProcessedEvent<NotifiableMessageEvent>>
|
||||
|
@ -104,7 +103,7 @@ class NotificationFactory @Inject constructor(
|
|||
|
||||
sealed interface RoomNotification {
|
||||
data class Removed(val roomId: String) : RoomNotification
|
||||
data class Message(val notification: Notification, val shortcutInfo: ShortcutInfoCompat?, val meta: Meta) : RoomNotification {
|
||||
data class Message(val notification: Notification, val meta: Meta) : RoomNotification {
|
||||
data class Meta(
|
||||
val summaryLine: CharSequence,
|
||||
val messageCount: Int,
|
||||
|
|
|
@ -17,7 +17,6 @@ package im.vector.app.features.notifications
|
|||
|
||||
import android.content.Context
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import im.vector.app.features.notifications.NotificationDrawerManager.Companion.ROOM_EVENT_NOTIFICATION_ID
|
||||
import im.vector.app.features.notifications.NotificationDrawerManager.Companion.ROOM_INVITATION_NOTIFICATION_ID
|
||||
import im.vector.app.features.notifications.NotificationDrawerManager.Companion.ROOM_MESSAGES_NOTIFICATION_ID
|
||||
|
@ -63,9 +62,6 @@ class NotificationRenderer @Inject constructor(private val notificationDisplayer
|
|||
}
|
||||
is RoomNotification.Message -> if (useCompleteNotificationFormat) {
|
||||
Timber.d("Updating room messages notification ${wrapper.meta.roomId}")
|
||||
wrapper.shortcutInfo?.let {
|
||||
ShortcutManagerCompat.pushDynamicShortcut(appContext, it)
|
||||
}
|
||||
notificationDisplayer.showNotificationMessage(wrapper.meta.roomId, ROOM_MESSAGES_NOTIFICATION_ID, wrapper.notification)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,10 @@ package im.vector.app.features.notifications
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Build
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.Person
|
||||
import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||
import me.gujun.android.span.Span
|
||||
import me.gujun.android.span.span
|
||||
import timber.log.Timber
|
||||
|
@ -61,17 +57,6 @@ class RoomGroupMessageCreator @Inject constructor(
|
|||
}
|
||||
|
||||
val largeBitmap = getRoomBitmap(events)
|
||||
val shortcutInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
val openRoomIntent = RoomDetailActivity.shortcutIntent(appContext, roomId)
|
||||
ShortcutInfoCompat.Builder(appContext, roomId)
|
||||
.setLongLived(true)
|
||||
.setIntent(openRoomIntent)
|
||||
.setShortLabel(roomName)
|
||||
.setIcon(largeBitmap?.let { IconCompat.createWithAdaptiveBitmap(it) } ?: iconLoader.getUserIcon(events.last().senderAvatarPath))
|
||||
.build()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val lastMessageTimestamp = events.last().timestamp
|
||||
val smartReplyErrors = events.filter { it.isSmartReplyError() }
|
||||
|
@ -96,7 +81,6 @@ class RoomGroupMessageCreator @Inject constructor(
|
|||
userDisplayName,
|
||||
tickerText
|
||||
),
|
||||
shortcutInfo,
|
||||
meta
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue