Fix 'Conversation label cannot be empty' error (#6823)
This happens when building a `ShortcutInfoCompat` in `DefaultNotificationConversationService.onSendMessage` when the provided room name is not null but it's empty.
This commit is contained in:
committed by
GitHub
parent
42c141109f
commit
64d9336901
+1
-1
@@ -571,7 +571,7 @@ class MessageComposerPresenter(
|
||||
notificationConversationService.onSendMessage(
|
||||
sessionId = room.sessionId,
|
||||
roomId = roomInfo.id,
|
||||
roomName = roomInfo.name ?: roomInfo.id.value,
|
||||
roomName = roomInfo.name,
|
||||
roomIsDirect = roomInfo.isDm,
|
||||
roomAvatarUrl = roomInfo.avatarUrl ?: roomMembers.getDirectRoomMember(roomInfo = roomInfo, sessionId = room.sessionId)?.avatarUrl,
|
||||
)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ interface NotificationConversationService {
|
||||
suspend fun onSendMessage(
|
||||
sessionId: SessionId,
|
||||
roomId: RoomId,
|
||||
roomName: String,
|
||||
roomName: String?,
|
||||
roomIsDirect: Boolean,
|
||||
roomAvatarUrl: String?,
|
||||
)
|
||||
|
||||
+4
-3
@@ -76,7 +76,7 @@ class DefaultNotificationConversationService(
|
||||
override suspend fun onSendMessage(
|
||||
sessionId: SessionId,
|
||||
roomId: RoomId,
|
||||
roomName: String,
|
||||
roomName: String?,
|
||||
roomIsDirect: Boolean,
|
||||
roomAvatarUrl: String?,
|
||||
) {
|
||||
@@ -93,10 +93,11 @@ class DefaultNotificationConversationService(
|
||||
val imageLoader = imageLoaderHolder.get(client)
|
||||
|
||||
val defaultShortcutIconSize = ShortcutManagerCompat.getIconMaxWidth(context)
|
||||
val name = roomName?.takeIf { it.isNotBlank() } ?: roomId.value
|
||||
val icon = bitmapLoader.getRoomBitmap(
|
||||
avatarData = AvatarData(
|
||||
id = roomId.value,
|
||||
name = roomName,
|
||||
name = name,
|
||||
url = roomAvatarUrl,
|
||||
size = AvatarSize.RoomDetailsHeader,
|
||||
),
|
||||
@@ -105,7 +106,7 @@ class DefaultNotificationConversationService(
|
||||
)?.let(IconCompat::createWithBitmap)
|
||||
|
||||
val shortcutInfo = ShortcutInfoCompat.Builder(context, createShortcutId(sessionId, roomId))
|
||||
.setShortLabel(roomName)
|
||||
.setShortLabel(name)
|
||||
.setIcon(icon)
|
||||
.setIntent(intentProvider.getViewRoomIntent(sessionId, roomId, threadId = null, eventId = null))
|
||||
.setCategories(categories)
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class FakeNotificationConversationService : NotificationConversationService {
|
||||
override suspend fun onSendMessage(
|
||||
sessionId: SessionId,
|
||||
roomId: RoomId,
|
||||
roomName: String,
|
||||
roomName: String?,
|
||||
roomIsDirect: Boolean,
|
||||
roomAvatarUrl: String?,
|
||||
) = Unit
|
||||
|
||||
Reference in New Issue
Block a user