From 4b57761d0274d03ecc6f22f98b0b0107281bc926 Mon Sep 17 00:00:00 2001 From: David Teresi Date: Sat, 6 Nov 2021 12:54:28 -0400 Subject: [PATCH 1/2] Remove broken room shortcut recreation --- .../notifications/NotificationFactory.kt | 3 +-- .../notifications/NotificationRenderer.kt | 4 ---- .../notifications/RoomGroupMessageCreator.kt | 16 ---------------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt index adc4e44bcc..b95bbe1bf5 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt @@ -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> @@ -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, diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt index 5afff89402..4078bb0b5c 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt @@ -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) } } diff --git a/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt b/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt index bdd7d026f9..d50ccded64 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt @@ -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 ) } From 3837f8e2e351f9bd9a82f69465213b6cc76fa322 Mon Sep 17 00:00:00 2001 From: David Teresi Date: Sat, 6 Nov 2021 13:11:38 -0400 Subject: [PATCH 2/2] Add changelog.d item --- changelog.d/4424.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4424.bugfix diff --git a/changelog.d/4424.bugfix b/changelog.d/4424.bugfix new file mode 100644 index 0000000000..679440d204 --- /dev/null +++ b/changelog.d/4424.bugfix @@ -0,0 +1 @@ +Fix incorrect cropping of conversation icons \ No newline at end of file