diff --git a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift index a0b4516c4..b30e83edc 100644 --- a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift +++ b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift @@ -723,7 +723,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { func sendCallNotificationIfNeeded() async -> Result { do { - try await room.sendCallNotificationIfNeeded() + _ = try await room.sendCallNotificationIfNeeded() return .success(()) } catch { MXLog.error("Failed room call notification with error: \(error)") diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomMessageEventStringBuilder.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomMessageEventStringBuilder.swift index 680c40043..5e94213f2 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomMessageEventStringBuilder.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomMessageEventStringBuilder.swift @@ -64,6 +64,8 @@ struct RoomMessageEventStringBuilder { } else { message = AttributedString(content.body) } + case .gallery(let content): + message = AttributedString(content.body) case .other(_, let body): message = AttributedString(body) } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index 5df5c0c46..6e90b4a8c 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -96,6 +96,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { } case .location(let locationMessageContent): return buildLocationTimelineItem(for: eventItemProxy, messageLikeContent, messageContent, locationMessageContent, isOutgoing) + case .gallery(let galleryMessageContent): + return buildGalleryTimelineItem(for: eventItemProxy, messageLikeContent, messageContent, galleryMessageContent, isOutgoing) case .other: return nil } @@ -304,6 +306,29 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { encryptionAuthenticity: buildEncryptionAuthenticity(eventItemProxy.shieldState))) } + private func buildGalleryTimelineItem(for eventItemProxy: EventTimelineItemProxy, + _ messageLikeContent: MsgLikeContent, + _ messageContent: MessageContent, + _ galleryMessageContent: GalleryMessageContent, + _ isOutgoing: Bool) -> RoomTimelineItemProtocol { + TextRoomTimelineItem(id: eventItemProxy.id, + timestamp: eventItemProxy.timestamp, + isOutgoing: isOutgoing, + isEditable: eventItemProxy.isEditable, + canBeRepliedTo: eventItemProxy.canBeRepliedTo, + shouldBoost: eventItemProxy.shouldBoost, + sender: eventItemProxy.sender, + content: .init(body: galleryMessageContent.body), + properties: .init(replyDetails: buildTimelineItemReplyDetails(messageLikeContent.inReplyTo), + isThreaded: messageLikeContent.threadRoot != nil, + threadSummary: buildTimelineItemThreadSummary(messageLikeContent.threadSummary), + isEdited: messageContent.isEdited, + reactions: buildAggregatedReactions(messageLikeContent.reactions), + deliveryStatus: eventItemProxy.deliveryStatus, + orderedReadReceipts: buildOrderedReadReceipts(eventItemProxy.readReceipts), + encryptionAuthenticity: buildEncryptionAuthenticity(eventItemProxy.shieldState))) + } + private func buildStickerTimelineItem(_ eventItemProxy: EventTimelineItemProxy, _ messageLikeContent: MsgLikeContent, _ body: String, @@ -649,7 +674,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { return .notLoaded case .pending: return .loading - case .ready(let senderID, let senderProfile, let content): + case .ready(let content, let senderID, let senderProfile): let sender = buildTimelineItemSender(senderID: senderID, senderProfile: senderProfile) let latestEventContent: TimelineEventContent = switch content { @@ -858,13 +883,17 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { .video(buildVideoTimelineItemContent(content)) case .location(let content): .location(buildLocationTimelineItemContent(content)) - case .other, .none: + case .gallery(let content): + .text(.init(body: content.body)) + case .other(_, let body): + .text(.init(body: body)) + case .none: .text(.init(body: L10n.commonUnsupportedEvent)) } } } -private extension RepliedToEventDetails { +private extension EmbeddedEventDetails { var isThreaded: Bool { switch self { case .ready(let content, _, _): diff --git a/NSE/Sources/NotificationHandler.swift b/NSE/Sources/NotificationHandler.swift index 69aa4686b..0d4b754f4 100644 --- a/NSE/Sources/NotificationHandler.swift +++ b/NSE/Sources/NotificationHandler.swift @@ -104,7 +104,7 @@ class NotificationHandler { return .shouldDisplay case .roomMessage(let messageType, _): switch messageType { - case .emote, .image, .audio, .video, .file, .notice, .text, .location: + case .emote, .image, .audio, .video, .file, .notice, .text, .location, .gallery: return .shouldDisplay case .other: return .unsupportedShouldDiscard