Fix breaking changes following SDK update.

This commit is contained in:
Stefan Ceriu
2025-06-10 11:38:53 +03:00
committed by Stefan Ceriu
parent 53b92ad68f
commit 2993f9b6a2
4 changed files with 36 additions and 5 deletions

View File

@@ -723,7 +723,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
func sendCallNotificationIfNeeded() async -> Result<Void, RoomProxyError> {
do {
try await room.sendCallNotificationIfNeeded()
_ = try await room.sendCallNotificationIfNeeded()
return .success(())
} catch {
MXLog.error("Failed room call notification with error: \(error)")

View File

@@ -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)
}

View File

@@ -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, _, _):

View File

@@ -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